problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
In C#, how do I compare the characters in two strings : <p>In C#, how do I compare the characters in two strings. For example, let's say I have these two strings "admin12@3" and "adminb12@3. ",How do I programically return the different letter from these two string?</p>
| 0debug
|
R - manually adding legend to ggplot : Consider the graph below that I created with the code further below. I would like to add a legend that might say something like "median" and "90% confidence interval." I've seen lots of examples of how one can create complex datasets and then use scale properties, but in this case, I'd really hope to just be able to specify the legend directly somehow if possible.
[![enter image description here][1]][1]
library(ggplot2)
middle = data.frame(t=c(0,1,2,3),value=c(0,2,4,6))
ribbon = data.frame(t=c(0,1,2,3),min=c(0,0,0,0),max=c(0,4,8,12))
g = ggplot()
g = g + geom_line (data=middle,aes(x=t,y=value),color='blue',size=2)
g = g + geom_ribbon(data=ribbon,aes(x=t,ymin=min,ymax=max),alpha=.3,fill='lightblue')
print(g)
[1]: http://i.stack.imgur.com/2KAV6.png
| 0debug
|
fetch() POST request to Express.js generates empty body {} : <p><strong>Goal:</strong> send some defined string data from <strong>HTML</strong> in a <code>fetch()</code> function e.g. "MY DATA"</p>
<hr>
<p>My code:</p>
<p><strong>HTML</strong></p>
<pre><code><!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
function fetcher() {
fetch('/compute',
{
method: "POST",
body: "MY DATA",
headers: {
"Content-Type": "application/json"
}
}
)
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(myJson);
});
}
</script>
</body>
</html>
</code></pre>
<p><strong>Server.js</strong></p>
<pre><code>var express = require("express");
var app = express();
var compute = require("./compute");
var bodyParser = require("body-parser");
//not sure what "extended: false" is for
app.use(bodyParser.urlencoded({ extended: false }));
app.post('/compute', (req, res, next) => {
console.log(req.body);
var result = compute.myfunction(req.body);
res.status(200).json(result);
});
</code></pre>
<p><strong>Currently:</strong> <code>console.log(req.body)</code> logs <code>{}</code></p>
<p><strong>Desired:</strong> <code>console.log(req.body)</code> logs <code>"MY DATA"</code></p>
<p><strong>NOTES:</strong></p>
<ol>
<li>I also tried sending body in fetch() as <code>body: JSON.stringify({"Data": "MY DATA"})</code> but get the same empty {}</li>
<li>I either my fetch() request, or my bodyParser(), is not setup correctly.</li>
</ol>
| 0debug
|
How to set up Airflow Send Email? : <p>I followed online tutorial to set up Email SMTP server in airflow.cfg as below:</p>
<pre><code>[email]
email_backend = airflow.utils.email.send_email_smtp
[smtp]
# If you want airflow to send emails on retries, failure, and you want to use
# the airflow.utils.email.send_email_smtp function, you have to configure an
# smtp server here
smtp_host = smtp.gmail.com
smtp_starttls = True
smtp_ssl = False
# Uncomment and set the user/pass settings if you want to use SMTP AUTH
# smtp_user =
# smtp_password =
smtp_port = 587
smtp_mail_from = myemail@gmail.com
</code></pre>
<p>And my DAG is as below:</p>
<pre><code>from datetime import datetime
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.email_operator import EmailOperator
def print_hello():
return 'Hello world!'
default_args = {
'owner': 'peter',
'start_date':datetime(2018,8,11),
}
dag = DAG('hello_world', description='Simple tutorial DAG',
schedule_interval='* * * * *',
default_args = default_args, catchup=False)
dummy_operator = DummyOperator(task_id='dummy_task', retries=3, dag=dag)
hello_operator = PythonOperator(task_id='hello_task', python_callable=print_hello, dag=dag)
email = EmailOperator(
task_id='send_email',
to='to@gmail.com',
subject='Airflow Alert',
html_content=""" <h3>Email Test</h3> """,
dag=dag
)
email >> dummy_operator >> hello_operator
</code></pre>
<p>I assumed the email operator will run after the other two operators and then send me an email.
But email was not sent to me.
I really appreciate your help. Thank you very much.</p>
<p>Best</p>
| 0debug
|
Is it possible to force pandas not to convert data type when using DataFrame.replace : <p>Here's a working example:</p>
<pre><code>df = pd.DataFrame({'A': [-39882300000000000000]}, dtype='object')
</code></pre>
<p><code>df.replace({',': '.'})</code> raises an <code>OverflowError</code> because somewhere in the code the <code>convert</code> flag is set to True. I am not sure but it is probably because pandas is inferring that it only contain numbers.</p>
<p>I read the data from an Excel workbook and I want to prevent this conversion when using <code>df.replace</code>. Is there a way to do so?</p>
| 0debug
|
int ff_h264_check_intra4x4_pred_mode(H264Context *h){
MpegEncContext * const s = &h->s;
static const int8_t top [12]= {-1, 0,LEFT_DC_PRED,-1,-1,-1,-1,-1, 0};
static const int8_t left[12]= { 0,-1, TOP_DC_PRED, 0,-1,-1,-1, 0,-1,DC_128_PRED};
int i;
if(!(h->top_samples_available&0x8000)){
for(i=0; i<4; i++){
int status= top[ h->intra4x4_pred_mode_cache[scan8[0] + i] ];
if(status<0){
av_log(h->s.avctx, AV_LOG_ERROR, "top block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
return -1;
} else if(status){
h->intra4x4_pred_mode_cache[scan8[0] + i]= status;
}
}
}
if((h->left_samples_available&0x8888)!=0x8888){
static const int mask[4]={0x8000,0x2000,0x80,0x20};
for(i=0; i<4; i++){
if(!(h->left_samples_available&mask[i])){
int status= left[ h->intra4x4_pred_mode_cache[scan8[0] + 8*i] ];
if(status<0){
av_log(h->s.avctx, AV_LOG_ERROR, "left block unavailable for requested intra4x4 mode %d at %d %d\n", status, s->mb_x, s->mb_y);
return -1;
} else if(status){
h->intra4x4_pred_mode_cache[scan8[0] + 8*i]= status;
}
}
}
}
return 0;
}
| 1threat
|
android studio firebase search find my value in under verious childs : hi gys i am trying to retrive my data in firebase but problem is my value is under the 3 childs normally iam able to to search value under the 1 child but can't search under the 2nd and 3rd one
here is example plz help thank you
i am try this one but not get result
`enter code here` FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference mUserDatabase = database.getReference();
enter code here//and query
Query
firebaseSearchQuery=mUserDatabase.orderByChild("Time").startAt(searchText).endAt(searchText + "\uf8ff");
| 0debug
|
pandas read excel values not formulas : <p>Is there a way to have pandas read in only the values from excel and not the formulas? It reads the formulas in as NaN unless I go in and manually save the excel file before running the code. I am just working with the basic read excel function of pandas,</p>
<pre><code>import pandas as pd
df = pd.read_excel(filename, sheetname="Sheet1")
</code></pre>
<p>This will read the values if I have gone in and saved the file prior to running the code. But after running the code to update a new sheet, if I don't go in and save the file after doing that and try to run this again, it will read the formulas as NaN instead of just the values. Is there a work around that anyone knows of that will just read values from excel with pandas?</p>
| 0debug
|
Go: Check for Network Connection : how can I check if I am able to connect to a server via ssh before running a program on it?
This is how I am connecting to a server:
`cli := ssh.NewSSHClient(conf.User, randomServer)`
and I would like to either use switch or an if statement
P.S.: I am super new to Go.
| 0debug
|
static inline void gen_outs(DisasContext *s, int ot)
{
gen_string_movl_A0_ESI(s);
gen_op_ld_T0_A0(ot + s->mem_index);
gen_op_mov_TN_reg(OT_WORD, 1, R_EDX);
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[1]);
tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff);
tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T[0]);
tcg_gen_helper_0_2(helper_out_func[ot], cpu_tmp2_i32, cpu_tmp3_i32);
gen_op_movl_T0_Dshift[ot]();
#ifdef TARGET_X86_64
if (s->aflag == 2) {
gen_op_addq_ESI_T0();
} else
#endif
if (s->aflag) {
gen_op_addl_ESI_T0();
} else {
gen_op_addw_ESI_T0();
}
}
| 1threat
|
SFINAE on assembly? : <p>Is it possible to use metaprogramming tricks to allow SFINAE on assembly blocks? For example to detect if an instruction like "CPUID" is available on a processor: (this is not valid code, but illustrates what I would like to achieve)</p>
<pre><code>// This should work if `CPUID` is a valid instruction on the target architecture
template <
class... T,
class = decltype(sizeof...(T), asm volatile("CPUID":::)
>
bool f(T...) {
return true;
}
// This should fail because `BLAH` is not an instruction
template <
class... T,
class = decltype(sizeof...(T), asm volatile("BLAH":::)
>
bool f(T...) {
return true;
}
</code></pre>
| 0debug
|
Send multiple Excel Workbooks to relevant recipients : I have around 40 individual reports saved as Excel workbooks, which need to be sent to 40 different groups of recipients. Is there a VBA macro or similar that could be used to send the emails to the necessary recipients without having to enter each email address for each workbook?
| 0debug
|
Convert list of tuples w/ lenght 5 to dictionary in Python : <p>what if I have a tuple list like this:</p>
<pre><code>list = [('Ana', 'Lisbon', 42195, '10-18', 2224),
('Eva', 'New York', 42195, '06-13', 2319),
('Ana', 'Tokyo', 42195, '02-22', 2403),
('Eva', 'Sao Paulo', 21098, '04-12', 1182),
('Ana', 'Sao Paulo', 21098, '04-12', 1096),
('Dulce', 'Tokyo', 42195, '02-22', 2449),
('Ana', 'Boston', 42195, '04-20', 2187)]
</code></pre>
<p>How can I convert this to a dictionary like this one?</p>
<pre><code>dict = {'Ana': [('Ana', 'Lisboa', 42195, '10-18', 2224),('Ana', 'Toquio',42195, '02-22', 2403),
('Ana', 'Sao Paulo', 21098, '04-12', 1096),('Ana', 'Boston', 42195, '04-20', 2187)],
'Dulce': [('Dulce', 'Toquio', 42195, '02-22', 2449)],
'Eva': [('Eva', 'Nova Iorque', 42195, '06-13', 2319),
('Eva', 'Sao Paulo', 21098, '04-12', 1182)]}
</code></pre>
| 0debug
|
When to use NullBooleanField in Django : <p>I have a button that, when clicked, should save in the database that the user has drunk water. I just wanted to check whether NullBooleanField would be the correct way to define this.</p>
<p>A broader question that if answered would be useful to the community is a list of optimal circumstances under which to use NullBooleanField. But I'm not asking that here. Just in case you wanted a better challenge. </p>
<p>Thank you in advance. </p>
| 0debug
|
static int decode_i_frame(FourXContext *f, AVFrame *frame, const uint8_t *buf, int length)
{
int x, y, ret;
const int width = f->avctx->width;
const int height = f->avctx->height;
const unsigned int bitstream_size = AV_RL32(buf);
int token_count av_unused;
unsigned int prestream_size;
const uint8_t *prestream;
if (length < bitstream_size + 12) {
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
return AVERROR_INVALIDDATA;
}
token_count = AV_RL32(buf + bitstream_size + 8);
prestream_size = 4 * AV_RL32(buf + bitstream_size + 4);
prestream = buf + bitstream_size + 12;
if (prestream_size + bitstream_size + 12 != length
|| bitstream_size > (1 << 26)
|| prestream_size > (1 << 26)) {
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n",
prestream_size, bitstream_size, length);
return AVERROR_INVALIDDATA;
}
prestream = read_huffman_tables(f, prestream, prestream_size);
if (!prestream) {
av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n");
return AVERROR_INVALIDDATA;
}
init_get_bits(&f->gb, buf + 4, 8 * bitstream_size);
prestream_size = length + buf - prestream;
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size,
prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer)
return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream,
prestream_size / 4);
memset((uint8_t*)f->bitstream_buffer + prestream_size,
0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size);
f->last_dc = 0 * 128 * 8 * 8;
for (y = 0; y < height; y += 16) {
for (x = 0; x < width; x += 16) {
if ((ret = decode_i_mb(f)) < 0)
return ret;
idct_put(f, frame, x, y);
}
}
if (get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3) != 256)
av_log(f->avctx, AV_LOG_ERROR, "end mismatch\n");
return 0;
}
| 1threat
|
Multiple NSPredicates for NSFetchRequest in Swift? : <p>Currently, I have a simple NSFetchRequest with an associated NSPredicate. However, Im hoping there is a way you can append multiple predicates. I've seen examples in Objective C, but none for Swift.</p>
<p>Can you define a list of NSPredicate's or append multiple NSPredicate objects to a single NSFetchRequest somehow?</p>
<p>Thanks!</p>
| 0debug
|
static void common_unbind(struct common *c)
{
xen_be_unbind_evtchn(&c->xendev);
if (c->page) {
munmap(c->page, XC_PAGE_SIZE);
c->page = NULL;
}
}
| 1threat
|
How to get the progress of WebView while loading the data, Xamarin.Forms : <p>I am developing an App using Xamarin.Forms for listing the news from different sources. I use a webView to open the link corresponding to the news. But I want to show the progress while loading the webpage into web view, like the progress bar on Safari App. For this I have used the ProgressBar element like this:</p>
<pre><code><StackLayout>
<!-- WebView needs to be given height and width request within layouts to render. -->
<ProgressBar Progress ="" HorizontalOptions="FillAndExpand" x:Name="progress"/>
<WebView x:Name="webView"
HeightRequest="1000"
WidthRequest="1000"
VerticalOptions= "FillAndExpand"
Navigating="webOnNavigating"
Navigated="webOnEndNavigating"/>
</StackLayout>
</code></pre>
<p>and in the code I have used</p>
<pre><code>void webOnNavigating (object sender, WebNavigatingEventArgs e)
{
progress.IsVisible = true;
}
void webOnEndNavigating (object sender, WebNavigatedEventArgs e)
{
progress.IsVisible = false;
}
</code></pre>
<p>But I want to show also the progress of loading the data, not just an indication that is loading and load. I want the user to know that the data are loading. Is there a way to achieve this.</p>
| 0debug
|
While installing hadoop, When I run start-dfs.sh command it shows me no such file or directory found : [enter image description here][1]
[1]: https://i.stack.imgur.com/AG86h.png
[root@nn1 hadoop-2.9.0]# ./sbin/start-dfs.sh
Starting namenodes on [nn1]
nn1: namenode running as process 2707. Stop it first.
nn1: datanode running as process 2859. Stop it first.
dn1: bash: line 0: cd: /home/user1/hadoop-2.9.0: No such file or directory
dn1: bash: /home/user1/hadoop-2.9.0/sbin/hadoop-daemon.sh: No such file or directory
dn2: bash: line 0: cd: /home/user1/hadoop-2.9.0: No such file or directory
dn2: bash: /home/user1/hadoop-2.9.0/sbin/hadoop-daemon.sh: No such file or directory
Starting secondary namenodes [0.0.0.0]
0.0.0.0: secondarynamenode running as process 3052. Stop it first.
[root@nn1 hadoop-2.9.0]#
For reference :
Master:
Hostname= nn1
Username= user1
Slave1:
Hostname=dn1
username=slave1
slave2:
Hostname=dn2
username=slave2
| 0debug
|
static void test_keyval_visit_any(void)
{
Visitor *v;
QDict *qdict;
QObject *any;
QList *qlist;
QString *qstr;
qdict = keyval_parse("a.0=null,a.1=1", NULL, &error_abort);
v = qobject_input_visitor_new_keyval(QOBJECT(qdict));
QDECREF(qdict);
visit_start_struct(v, NULL, NULL, 0, &error_abort);
visit_type_any(v, "a", &any, &error_abort);
qlist = qobject_to_qlist(any);
g_assert(qlist);
qstr = qobject_to_qstring(qlist_pop(qlist));
g_assert_cmpstr(qstring_get_str(qstr), ==, "null");
qstr = qobject_to_qstring(qlist_pop(qlist));
g_assert_cmpstr(qstring_get_str(qstr), ==, "1");
g_assert(qlist_empty(qlist));
visit_check_struct(v, &error_abort);
visit_end_struct(v, NULL);
visit_free(v);
}
| 1threat
|
static void lsi_execute_script(LSIState *s)
{
uint32_t insn;
uint32_t addr;
int opcode;
s->istat1 |= LSI_ISTAT1_SRUN;
again:
insn = read_dword(s, s->dsp);
addr = read_dword(s, s->dsp + 4);
DPRINTF("SCRIPTS dsp=%08x opcode %08x arg %08x\n", s->dsp, insn, addr);
s->dsps = addr;
s->dcmd = insn >> 24;
s->dsp += 8;
switch (insn >> 30) {
case 0:
if (s->sist1 & LSI_SIST1_STO) {
DPRINTF("Delayed select timeout\n");
lsi_stop_script(s);
break;
}
s->dbc = insn & 0xffffff;
s->rbc = s->dbc;
if (insn & (1 << 29)) {
addr = read_dword(s, addr);
} else if (insn & (1 << 28)) {
uint32_t buf[2];
int32_t offset;
offset = sxt24(addr);
cpu_physical_memory_read(s->dsa + offset, (uint8_t *)buf, 8);
s->dbc = cpu_to_le32(buf[0]);
s->rbc = s->dbc;
addr = cpu_to_le32(buf[1]);
}
if ((s->sstat1 & PHASE_MASK) != ((insn >> 24) & 7)) {
DPRINTF("Wrong phase got %d expected %d\n",
s->sstat1 & PHASE_MASK, (insn >> 24) & 7);
lsi_script_scsi_interrupt(s, LSI_SIST0_MA, 0);
break;
}
s->dnad = addr;
s->ia = s->dsp - 8;
switch (s->sstat1 & 0x7) {
case PHASE_DO:
s->waiting = 2;
lsi_do_dma(s, 1);
if (s->waiting)
s->waiting = 3;
break;
case PHASE_DI:
s->waiting = 2;
lsi_do_dma(s, 0);
if (s->waiting)
s->waiting = 3;
break;
case PHASE_CMD:
lsi_do_command(s);
break;
case PHASE_ST:
lsi_do_status(s);
break;
case PHASE_MO:
lsi_do_msgout(s);
break;
case PHASE_MI:
lsi_do_msgin(s);
break;
default:
BADF("Unimplemented phase %d\n", s->sstat1 & PHASE_MASK);
exit(1);
}
s->dfifo = s->dbc & 0xff;
s->ctest5 = (s->ctest5 & 0xfc) | ((s->dbc >> 8) & 3);
s->sbc = s->dbc;
s->rbc -= s->dbc;
s->ua = addr + s->dbc;
break;
case 1:
opcode = (insn >> 27) & 7;
if (opcode < 5) {
uint32_t id;
if (insn & (1 << 25)) {
id = read_dword(s, s->dsa + sxt24(insn));
} else {
id = addr;
}
id = (id >> 16) & 0xf;
if (insn & (1 << 26)) {
addr = s->dsp + sxt24(addr);
}
s->dnad = addr;
switch (opcode) {
case 0:
s->sdid = id;
if (s->current_dma_len && (s->ssid & 0xf) == id) {
DPRINTF("Already reselected by target %d\n", id);
break;
}
s->sstat0 |= LSI_SSTAT0_WOA;
s->scntl1 &= ~LSI_SCNTL1_IARB;
if (id >= LSI_MAX_DEVS || !s->scsi_dev[id]) {
DPRINTF("Selected absent target %d\n", id);
lsi_script_scsi_interrupt(s, 0, LSI_SIST1_STO);
lsi_disconnect(s);
break;
}
DPRINTF("Selected target %d%s\n",
id, insn & (1 << 3) ? " ATN" : "");
s->current_dev = s->scsi_dev[id];
s->current_tag = id << 8;
s->scntl1 |= LSI_SCNTL1_CON;
if (insn & (1 << 3)) {
s->socl |= LSI_SOCL_ATN;
}
lsi_set_phase(s, PHASE_MO);
break;
case 1:
DPRINTF("Wait Disconect\n");
s->scntl1 &= ~LSI_SCNTL1_CON;
break;
case 2:
lsi_wait_reselect(s);
break;
case 3:
DPRINTF("Set%s%s%s%s\n",
insn & (1 << 3) ? " ATN" : "",
insn & (1 << 6) ? " ACK" : "",
insn & (1 << 9) ? " TM" : "",
insn & (1 << 10) ? " CC" : "");
if (insn & (1 << 3)) {
s->socl |= LSI_SOCL_ATN;
lsi_set_phase(s, PHASE_MO);
}
if (insn & (1 << 9)) {
BADF("Target mode not implemented\n");
exit(1);
}
if (insn & (1 << 10))
s->carry = 1;
break;
case 4:
DPRINTF("Clear%s%s%s%s\n",
insn & (1 << 3) ? " ATN" : "",
insn & (1 << 6) ? " ACK" : "",
insn & (1 << 9) ? " TM" : "",
insn & (1 << 10) ? " CC" : "");
if (insn & (1 << 3)) {
s->socl &= ~LSI_SOCL_ATN;
}
if (insn & (1 << 10))
s->carry = 0;
break;
}
} else {
uint8_t op0;
uint8_t op1;
uint8_t data8;
int reg;
int operator;
#ifdef DEBUG_LSI
static const char *opcode_names[3] =
{"Write", "Read", "Read-Modify-Write"};
static const char *operator_names[8] =
{"MOV", "SHL", "OR", "XOR", "AND", "SHR", "ADD", "ADC"};
#endif
reg = ((insn >> 16) & 0x7f) | (insn & 0x80);
data8 = (insn >> 8) & 0xff;
opcode = (insn >> 27) & 7;
operator = (insn >> 24) & 7;
DPRINTF("%s reg 0x%x %s data8=0x%02x sfbr=0x%02x%s\n",
opcode_names[opcode - 5], reg,
operator_names[operator], data8, s->sfbr,
(insn & (1 << 23)) ? " SFBR" : "");
op0 = op1 = 0;
switch (opcode) {
case 5:
op0 = s->sfbr;
op1 = data8;
break;
case 6:
if (operator)
op0 = lsi_reg_readb(s, reg);
op1 = data8;
break;
case 7:
if (operator)
op0 = lsi_reg_readb(s, reg);
if (insn & (1 << 23)) {
op1 = s->sfbr;
} else {
op1 = data8;
}
break;
}
switch (operator) {
case 0:
op0 = op1;
break;
case 1:
op1 = op0 >> 7;
op0 = (op0 << 1) | s->carry;
s->carry = op1;
break;
case 2:
op0 |= op1;
break;
case 3:
op0 ^= op1;
break;
case 4:
op0 &= op1;
break;
case 5:
op1 = op0 & 1;
op0 = (op0 >> 1) | (s->carry << 7);
s->carry = op1;
break;
case 6:
op0 += op1;
s->carry = op0 < op1;
break;
case 7:
op0 += op1 + s->carry;
if (s->carry)
s->carry = op0 <= op1;
else
s->carry = op0 < op1;
break;
}
switch (opcode) {
case 5:
case 7:
lsi_reg_writeb(s, reg, op0);
break;
case 6:
s->sfbr = op0;
break;
}
}
break;
case 2:
{
int cond;
int jmp;
if ((insn & 0x002e0000) == 0) {
DPRINTF("NOP\n");
break;
}
if (s->sist1 & LSI_SIST1_STO) {
DPRINTF("Delayed select timeout\n");
lsi_stop_script(s);
break;
}
cond = jmp = (insn & (1 << 19)) != 0;
if (cond == jmp && (insn & (1 << 21))) {
DPRINTF("Compare carry %d\n", s->carry == jmp);
cond = s->carry != 0;
}
if (cond == jmp && (insn & (1 << 17))) {
DPRINTF("Compare phase %d %c= %d\n",
(s->sstat1 & PHASE_MASK),
jmp ? '=' : '!',
((insn >> 24) & 7));
cond = (s->sstat1 & PHASE_MASK) == ((insn >> 24) & 7);
}
if (cond == jmp && (insn & (1 << 18))) {
uint8_t mask;
mask = (~insn >> 8) & 0xff;
DPRINTF("Compare data 0x%x & 0x%x %c= 0x%x\n",
s->sfbr, mask, jmp ? '=' : '!', insn & mask);
cond = (s->sfbr & mask) == (insn & mask);
}
if (cond == jmp) {
if (insn & (1 << 23)) {
addr = s->dsp + sxt24(addr);
}
switch ((insn >> 27) & 7) {
case 0:
DPRINTF("Jump to 0x%08x\n", addr);
s->dsp = addr;
break;
case 1:
DPRINTF("Call 0x%08x\n", addr);
s->temp = s->dsp;
s->dsp = addr;
break;
case 2:
DPRINTF("Return to 0x%08x\n", s->temp);
s->dsp = s->temp;
break;
case 3:
DPRINTF("Interrupt 0x%08x\n", s->dsps);
if ((insn & (1 << 20)) != 0) {
s->istat0 |= LSI_ISTAT0_INTF;
lsi_update_irq(s);
} else {
lsi_script_dma_interrupt(s, LSI_DSTAT_SIR);
}
break;
default:
DPRINTF("Illegal transfer control\n");
lsi_script_dma_interrupt(s, LSI_DSTAT_IID);
break;
}
} else {
DPRINTF("Control condition failed\n");
}
}
break;
case 3:
if ((insn & (1 << 29)) == 0) {
uint32_t dest;
dest = read_dword(s, s->dsp);
s->dsp += 4;
lsi_memcpy(s, dest, addr, insn & 0xffffff);
} else {
uint8_t data[7];
int reg;
int n;
int i;
if (insn & (1 << 28)) {
addr = s->dsa + sxt24(addr);
}
n = (insn & 7);
reg = (insn >> 16) & 0xff;
if (insn & (1 << 24)) {
cpu_physical_memory_read(addr, data, n);
DPRINTF("Load reg 0x%x size %d addr 0x%08x = %08x\n", reg, n,
addr, *(int *)data);
for (i = 0; i < n; i++) {
lsi_reg_writeb(s, reg + i, data[i]);
}
} else {
DPRINTF("Store reg 0x%x size %d addr 0x%08x\n", reg, n, addr);
for (i = 0; i < n; i++) {
data[i] = lsi_reg_readb(s, reg + i);
}
cpu_physical_memory_write(addr, data, n);
}
}
}
if (s->istat1 & LSI_ISTAT1_SRUN && !s->waiting) {
if (s->dcntl & LSI_DCNTL_SSM) {
lsi_script_dma_interrupt(s, LSI_DSTAT_SSI);
} else {
goto again;
}
}
DPRINTF("SCRIPTS execution stopped\n");
}
| 1threat
|
apache server in linux error forbiden access : first sory for my english<br>
im beginer in web development
when i run apache server give me this error in web page :<br>
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.20 (Unix) mod_wsgi/4.4.22 Python/2.7.11
im develop django 1.9.1 web app and use mode_wsgi with apache vresion 2 <br>
and my wsgi.py file :
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "newSite.settings")
application = get_wsgi_application()
and my httpd.conf :<br>
WSGIScriptAlias /newsite "/home/hello/django/newSite/newSite/wsgi.py"
WSGIPythonPath "/home/hello/django/newSite"
<Directory "/home/hello/django/newSite/newSite/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
please help me <br>
thanks .
| 0debug
|
static inline int compress_coef(int *coefs, int num)
{
int i, res = 0;
for (i = 0; i < num; i++)
res += coef_test_compression(coefs[i]);
return res == num ? 1 : 0;
}
| 1threat
|
SQL group_by query : <p>I have a table name users. Assume in the table I have the following fields :</p>
<p>User id , UUID1 , UUID2</p>
<p>I am trying to build the following SQL query the will return :
.number of rows including both the same UUID1 and UUID2. not that UUID1 equal UUID2 but just number of row including both (GROUP BY) and in addition the number of rows contains UUID1 or UUID2 (Separately, no grouping).</p>
<p>So I would like to have a table output as followed :
UUID1 , UUID2, Number_of_Rows_Contain_both, Number_Of_Rows_Contains_Only_Only_One</p>
<p>Any idea how can I generate such a query ?</p>
| 0debug
|
Xcode playground gets stuck on 'Running playground' or 'Launching simulator' and won't run the code, what to do? : <p>Every time I create a new playground in order to test some code, Xcode gets stuck and won't run the code. It simply presents 'Running playground' or 'Launching simulator' statement at the top of the screen with the loading icon promisingly spinning next to it but nothing happens. Sometimes this continues indefinitely and sometimes Xcode halts and prints this to console :</p>
<pre><code>Playground execution failed: error: Couldn't lookup symbols:
__swift_FORCE_LOAD_$_swiftCoreImage
__swift_FORCE_LOAD_$_swiftFoundation
_playground_log_hidden
_playground_logger_initialize
_playground_log_postprint
thread #1: tid = 0xc0cd0, 0x000000010ea7c3c0 MyPlayground`executePlayground, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
frame #0: 0x000000010ea7c3c0 MyPlayground`executePlayground
frame #1: 0x000000010ea7b9c0 MyPlayground`__37-[XCPAppDelegate enqueueRunLoopBlock]_block_invoke + 32
frame #2: 0x000000010f59625c CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #3: 0x000000010f57b304 CoreFoundation`__CFRunLoopDoBlocks + 356
frame #4: 0x000000010f57aa75 CoreFoundation`__CFRunLoopRun + 901
frame #5: 0x000000010f57a494 CoreFoundation`CFRunLoopRunSpecific + 420
frame #6: 0x0000000114985a6f GraphicsServices`GSEventRunModal + 161
frame #7: 0x0000000110124f34 UIKit`UIApplicationMain + 159
frame #8: 0x000000010ea7b6e9 MyPlayground`main + 201
frame #9: 0x0000000112ad268d libdyld.dylib`start + 1
frame #10: 0x0000000112ad268d libdyld.dylib`start + 1
</code></pre>
<p>I am running Xcode 8.0 (8A218a) on macOS Sierra 10.12. <br></p>
<p><strong>Hardware</strong>: <br>
MacBook Pro (13" Mid-2012) <br>
2,5 GHz Intel Core i5 <br>
4 GB 1600 MHz Ram DDR3</p>
<p>I have looked around but at least neither of these threads have provided an answer: <br>
<a href="https://forums.developer.apple.com/thread/5902" rel="noreferrer">https://forums.developer.apple.com/thread/5902</a> <br>
<a href="https://github.com/jas/playground/issues/9" rel="noreferrer">https://github.com/jas/playground/issues/9</a></p>
<p>Things I have already tried with zero success:</p>
<ul>
<li>Restarting Xcode</li>
<li>Reinstalling Xcode (downgraded to 7.3 but since that didn't help I
upgraded back to 8.0)</li>
<li>Restarting the machine</li>
<li>Creating a new playground</li>
</ul>
<p>Do you have any ideas on how to solve this problem? I am new to programming and eagerly trying to learn Swift but Xcode is making it practically impossible...</p>
<p>Thank you in advance, cheers.</p>
| 0debug
|
alert('Hello ' + user_input);
| 1threat
|
VueJS + Django Channels : <p>I just finished reading the introductions for <a href="https://vuejs.org/v2/guide/#Getting-Started" rel="noreferrer">VueJS</a> and <a href="https://channels.readthedocs.io/en/stable/getting-started.html" rel="noreferrer">Django Channels</a> and would like to use them together to provide real-time updates to several components on a webpage. This illustrates the basic idea:</p>
<p><a href="https://i.stack.imgur.com/fC6S1.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/fC6S1.jpg" alt="enter image description here"></a></p>
<p>Being new to VueJS, it seems the diagram above requires some type of "middle man", between the VueJS components and the websocket, that makes sure each component gets the correct data.</p>
<p>So, my questions are:</p>
<ol>
<li>Architecturally, is this a good design?</li>
<li>If so, can VueJS act as that "middle man" to manage which component connects to which channel?</li>
</ol>
<p>Thanks for your help :)</p>
| 0debug
|
av_cold void ff_mlpdsp_init(MLPDSPContext *c)
{
c->mlp_filter_channel = mlp_filter_channel;
if (ARCH_X86)
ff_mlpdsp_init_x86(c);
}
| 1threat
|
why do i have a Getactivity context error? : Sorry i am a beginner and i am not sure why there is this error which is at the get activity context line,this is the code please help me out here,i am trying to activate a ringtone from the broadcast receiver program(alarm)
public class OnAlarmReceiver extends BroadcastReceiver {
private static final int NOTIFY_ME_ID = 1337;
Ringtone ringTone;
Uri uriRingtone;
@Override
public void onReceive(Context ctxt, Intent intent) {
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(ctxt);
boolean useNotification = prefs.getBoolean("use_notification", true);
uriRingtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
ringTone = RingtoneManager.getRingtone(getactivityContext(), uriRingtone);
ringTone.play();
if (useNotification) {
NotificationManager mgr = (NotificationManager)
ctxt.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent i = PendingIntent.getActivity(ctxt, 0, new Intent(ctxt, AlarmActivity.class), 0);
Notification note = new Notification.Builder(ctxt)
.setContentTitle("Restaurant List")
.setContentText("It's time for lunch!")
.setSmallIcon(android.R.drawable.stat_notify_chat)
.setContentIntent(i)
.setAutoCancel(true).build();
note.flags |= Notification.FLAG_AUTO_CANCEL;
mgr.notify(NOTIFY_ME_ID, note);
}
else {
Intent i = new Intent(ctxt, AlarmActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctxt.startActivity(i);
}
}
,}
| 0debug
|
static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size)
{
uint8_t *buf1;
RMContext *rm = s->priv_data;
ByteIOContext *pb = &s->pb;
StreamInfo *stream = rm->audio_stream;
int i;
buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
write_packet_header(s, stream, size, stream->enc->coded_frame->key_frame);
for(i=0;i<size;i+=2) {
buf1[i] = buf[i+1];
buf1[i+1] = buf[i];
}
put_buffer(pb, buf1, size);
put_flush_packet(pb);
stream->nb_frames++;
av_free(buf1);
return 0;
}
| 1threat
|
PHP Parse error: syntax error, unexpected 'DB_USER' (T_STRING), expecting ',' or ')' in /var/www/wordpress/wp-config.php on line 26 : <p>I have this error that i find in /var/www/wordpress/wp-config.php,</p>
<p>but i cant find the error</p>
<pre><code><?php
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress_db);
/** MySQL database username */
define('DB_USER', 'username_here');
/** MySQL database password */
define('DB_PASSWORD', 'wp_password');
/** MySQL hostname */
define('DB_HOST', '99.99.99.99');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
</code></pre>
<p>everything seems to be correct from my point of view, what i am missing?</p>
<p>Victor</p>
| 0debug
|
Features difference between Laravel and Lumen : <p>My php skill is intermediate, I have to create one custom application and it is in mid level range. I like to use any framework since I don't have much time. I heard about Laravel & lumen both have less learning curve. I tried to read both documentation, But I can't determine exact feature difference between them. Can anyone please tabular those features. Thanks in advance.</p>
| 0debug
|
static void GLZWDecodeInit(GifState * s, int csize)
{
s->eob_reached = 0;
s->pbuf = s->buf;
s->ebuf = s->buf;
s->bbuf = 0;
s->bbits = 0;
s->codesize = csize;
s->cursize = s->codesize + 1;
s->curmask = mask[s->cursize];
s->top_slot = 1 << s->cursize;
s->clear_code = 1 << s->codesize;
s->end_code = s->clear_code + 1;
s->slot = s->newcodes = s->clear_code + 2;
s->oc = s->fc = 0;
s->sp = s->stack;
}
| 1threat
|
Failed to query database : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><?php
//Get Value
$username = $_POST['user'];
$password = $_POST['pass'];
//Connet To The Server And Select Database
mysqli_connect("192.168.xxx.xxx", "xxx", "xxxxxxxxxxxxx");
mysqli_select_db("xxxxx");
//Query The Database For User
$result = mysqli_query("select * from user where username = '$username' and password = '$password'")
or die("Failed to query database ".mysqli_connect_error());
$row = mysqli_fetch_array($result);
if (empty($username)) {
header('Location: fa.html');
} elseif (empty($password)) {
header('Location: fa.html');
} elseif ($row['username'] == $username && $row['password'] == $password){
header('Location: su.html');
} else{
header('Location: fa.html');
}
?></code></pre>
</div>
</div>
I have no experience to code PHP so i have no idea what's wrong is my code.
I have replace "mysql" into "mysqli" but it is still not working correctly.
It's work fine when running "mysql_*" and using my local Window web server.
But when i put it into Linux server it occur error message "Failed to query database ".</p>
| 0debug
|
static void qemu_tcg_init_cpu_signals(void)
{
#ifdef CONFIG_IOTHREAD
sigset_t set;
struct sigaction sigact;
memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = cpu_signal;
sigaction(SIG_IPI, &sigact, NULL);
sigemptyset(&set);
sigaddset(&set, SIG_IPI);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
#endif
}
| 1threat
|
How to get Android phone display prnt screen? : How to get Android OS Phone display screenshot every one minute and send with email?Thanks in advance.
Android
| 0debug
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
static void qapi_clone_type_str(Visitor *v, const char *name, char **obj,
Error **errp)
{
QapiCloneVisitor *qcv = to_qcv(v);
assert(qcv->depth);
*obj = g_strdup(*obj ?: "");
}
| 1threat
|
void qdist_init(struct qdist *dist)
{
dist->entries = g_malloc(sizeof(*dist->entries));
dist->size = 1;
dist->n = 0;
}
| 1threat
|
Set secomp to unconfined in docker-compose : <p>I need to be able fork a process. As i understand it i need to set the security-opt. I have tried doing this with docker command and it works fine. However when i do this in a docker-compose file it seem to do nothing, maybe I'm not using compose right.</p>
<h1>Docker</h1>
<pre><code>docker run --security-opt=seccomp:unconfined <id> dlv debug --listen=:2345 --headless --log ./cmd/main.go
</code></pre>
<h1>Docker-compose</h1>
<h2>Setup</h2>
<p>docker-compose.yml</p>
<pre><code>networks:
backend:
services:
example:
build: .
security_opt:
- seccomp:unconfined
networks:
- backend
ports:
- "5002:5002"
</code></pre>
<p>Dockerfile</p>
<pre><code>FROM golang:1.8
RUN go get -u github.com/derekparker/delve/cmd/dlv
RUN dlv debug --listen=:2345 --headless --log ./cmd/main.go
</code></pre>
<p>command</p>
<pre><code>docker-compose -f docker-compose.yml up --build --abort-on-container-exit
</code></pre>
<h1>Result</h1>
<blockquote>
<p>2017/09/04 15:58:33 server.go:73: Using API v1 2017/09/04 15:58:33
debugger.go:97: launching process with args: [/go/src/debug] could not
launch process: fork/exec /go/src/debug: operation not permitted</p>
</blockquote>
| 0debug
|
Use .gdsl file in a Java project in IntelliJ : <p>I have a file <code>pipeline.gdsl</code> that contains the Syntax for my Jenkins Pipeline DSL. Following <a href="http://st-g.de/2016/08/jenkins-pipeline-autocompletion-in-intellij" rel="noreferrer">this blog post</a> I put the file into the <code>/src</code> folder of my Java project. When I now edit my <code>Jenkinsfile</code> (residing in the root folder of my project), I don't get any code completion / syntax explanation as I would expect.</p>
<p>My project is a Java / Gradle project and I cannot make a Groovy project out of it. Is there some other way to make IntelliJ aware of the <code>.gdsl</code> file and provide code completion?</p>
| 0debug
|
How do I send a variable from a javascript to a php file? : <p>For example i have a variable</p>
<pre><code>var test = "done";
</code></pre>
<p>how can I send it to php? and then post it</p>
| 0debug
|
Several error's in Swift 3 Project, : The four error's I get are
1: // Use of undeclared type 'MemeImage'
Line 46
2: // Binary Operator '*' cannot be applied to operands of type '()' and 'Int'
Line 85
3: // Unexpected non-void return value in void function
Line 113
4: // Use of local variable 'makeMemedImage' before its declaration
Line 169
import UIKit
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UITextFieldDelegate {
// Top of the storyboard
@IBOutlet weak var topBar: UIToolbar!
@IBOutlet weak var shareBtn: UIBarButtonItem!
@IBOutlet weak var cancelBtn: UIBarButtonItem!
// Middle of the storyboard
@IBOutlet weak var topTextField: UITextField!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var bottomTextField: UITextField!
// Bottom of the storyboard
@IBOutlet weak var bottomBar: UIToolbar!
@IBOutlet weak var cameraBtn: UIBarButtonItem!
@IBOutlet weak var albumBtn: UIBarButtonItem!
// text attributes
let topTextDefault = "TOP TEXT"
let bottomTextDefault = "BOTTOM TEXT"
let noText = ""
let topTextDelegate = TopTextDelegate()
let bottomTextDelegate = BottomTextDelegate()
// meme attributes
let memeTextAttributes:[String: Any] = [NSStrokeColorAttributeName: UIColor.black, NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont( name: "HelveticaNeue-CondensedBlack", size: 40 )!, NSStrokeWidthAttributeName: NSNumber( value: -4.0 )]
var isKeyboardVisible = false
// Use of undeclared type 'MemeImage'
var meme: MemeImage!
override func viewDidLoad() {
super.viewDidLoad()
imageView.contentMode = UIViewContentMode.scaleAspectFit
}
override func viewDidAppear(_ animated: Bool) {
cameraBtn.isEnabled = UIImagePickerController.isSourceTypeAvailable(.camera)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.subscribeToKeyboardNotifications()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
unsubscribeFromKeyboardNotifications()
}
func initTextFields(textField: UITextField, initialText: String, delegate: UITextFieldDelegate) {
textField.defaultTextAttributes = memeTextAttributes
textField.textAlignment = NSTextAlignment.center
textField.text = initialText
textField.delegate = delegate
}
func keyboardWillShow(_ notification:Notification) {
if bottomTextField.isFirstResponder {
// Binary Operator '*' cannot be applied to operands of ttype '()' and 'Int' -----------
view.frame.origin.y = getKeyboardHeight(notification) * -1
}
}
func keyboardWillHide(_ notification:Notification) {
if bottomTextField.isFirstResponder {
view.frame.origin.y = 0.0
}
}
func subscribeToKeyboardNotifications() {
NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillShow(_:)), name: .UIKeyboardWillShow, object: nil )
NotificationCenter.default.addObserver( self, selector: #selector(keyboardWillHide(_:)), name: .UIKeyboardWillHide, object: nil )
}
func unsubscribeFromKeyboardNotifications() {
NotificationCenter.default.removeObserver( self, name: .UIKeyboardWillShow, object: nil )
NotificationCenter.default.removeObserver( self, name: .UIKeyboardWillHide, object: nil )
}
func getKeyboardHeight(_ notification:Notification) {
let userInfo = notification.userInfo
let keyboardSize = userInfo![UIKeyboardFrameEndUserInfoKey] as! NSValue
// Unexpected non-void return value in void function---------
return keyboardSize.cgRectValue.height
}
func imagePickCancel(_ picker: UIImagePickerController) {
dismiss(animated: true, completion: nil)
}
func imageWasPicked(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
imageView.contentMode = .scaleAspectFit
imageView.image = image
shareBtn.isEnabled = true
cancelBtn.isEnabled = true
} else {
dismiss(animated: true, completion: nil)
}
}
func pickImageType(sourceType: UIImagePickerControllerSourceType) {
let pickerController = UIImagePickerController()
pickerController.delegate = self
pickerController.sourceType = sourceType
self.present( pickerController, animated: true, completion: nil)
}
@IBAction func getImageFromCamera(_ sender: Any) {
pickImageType(sourceType: UIImagePickerControllerSourceType.camera)
}
@IBAction func getImageFromAlbum(_ sender: Any) {
pickImageType(sourceType: UIImagePickerControllerSourceType.photoLibrary)
}
@IBAction func cancel(_ sender: Any) {
shareBtn.isEnabled = false
imageView.image = nil
topTextField.text = topTextDefault
bottomTextField.text = bottomTextDefault
meme = nil
}
@IBAction func share(_ sender: Any) {
// Use of local variable 'makeMemedImage' before its declaration ------------
let memedImage = makeMemedImage()
let socialController = UIActivityViewController( activityItems: [memedImage], applicationActivities: nil )
socialController.completionWithItemsHandler = {
UIActivityType, completion, items, error in
if completion {
self.saveMemedImage(memedImage: memedImage) {
}
} else {
self.dismiss( animated: true, completion: nil )
}
self.present(socialController, animated: true, completion: nil)
}
func makeMemedImage() -> UIImage {
topBar.isHidden = true
bottomBar.isHidden = true
UIGraphicsBeginImageContext(self.view.frame.size)
view.drawHierarchy( in: self.view.frame, afterScreenUpdates: true )
let memedImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
topBar.isHidden = false
bottomBar.isHidden = false
return memedImage
}
func save() {
self.meme = memedImage.init(topText: self.txtTop.text!, bottomText: self.txtBottom.text!, origImage: self.imgView.image!, memedImage: memedImage)
}
}
}
| 0debug
|
cannot resolve the symbol R : Not a duplicate of http://stackoverflow.com/questions/31071568/cannot-resolve-the-symbol-r-in-android-studio and related questions to above.
i am trying to use the location services in my app. I am following the tutorials http://www.androidwarriors.com/2015/10/fused-location-provider-in-android.html and also the google android developer guide on how to setup google apis.
after changing gradle and manifest, i encounter the error that the symbol R can not be resolved.
i added the following line to gradle app file
compile 'com.google.android.gms:play-services:9.4.0'
and this line to manifest
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
i tried
cleaning project
restarting android studio
sync project with gradle
re importing the packages
among others to be tried
i am not sure why is this apeparing and how to fix it.
| 0debug
|
I have created a button but cant find which command to use : i have already created a button using this code; btnLuxury=Button(f1,padx=16,pady=8,bd=16, fg="black",font=('arial', 16,'bold'),width=10,
text="Luxury", bg="powder blue", command = Luxury).grid(row=8,column=3)
but when i click on it, it does nothing. now i want it to display the amount 8000 in the text box of total amount. what do i type after def, now
| 0debug
|
How to use "HTML form target self" ? : I am new to HTML and need to complete a simple task.
I have a database with some numbers assigned to a fake account (PHP).
I try to contact the database (with success) and get the right result from the form.
My issue is that the form result open a new page and display there...
I would really like the result to be displayed IN the module I use to send the form OR anywhere else on the same page I used to send the form.
Here is my code:
<!DOCTYPE html>
<html>
<body>
<form
method="post"
action="http://ggdbase.dx.am/impulseGetInfo.php"
target="_self">
Account name:<br>
<input type="text" name="name" value="derps">
<br>
<input type="submit" value="Click To Load Account Info">
</form>
</body>
</html>
[This is what the module look like (on Enjin.com)][1]
[This is what I get when clicking the button][2]
I did try replacing '_self' with '_blank' or parent and all the other options I could find but none of them gave me a different result :S
**Also , could it be caused by the Enjin system itself ?
If anyone have a clue how I can fix this, I cant wait to get your feedback !
[1]: https://i.stack.imgur.com/8pxKl.jpg
[2]: https://i.stack.imgur.com/jJpM0.jpg
| 0debug
|
static int add_file(AVFormatContext *avf, char *filename, ConcatFile **rfile,
unsigned *nb_files_alloc)
{
ConcatContext *cat = avf->priv_data;
ConcatFile *file;
char *url;
size_t url_len;
if (cat->safe > 0 && !safe_filename(filename)) {
av_log(avf, AV_LOG_ERROR, "Unsafe file name '%s'\n", filename);
return AVERROR(EPERM);
}
url_len = strlen(avf->filename) + strlen(filename) + 16;
if (!(url = av_malloc(url_len)))
return AVERROR(ENOMEM);
ff_make_absolute_url(url, url_len, avf->filename, filename);
av_free(filename);
if (cat->nb_files >= *nb_files_alloc) {
size_t n = FFMAX(*nb_files_alloc * 2, 16);
ConcatFile *new_files;
if (n <= cat->nb_files || n > SIZE_MAX / sizeof(*cat->files) ||
!(new_files = av_realloc(cat->files, n * sizeof(*cat->files))))
return AVERROR(ENOMEM);
cat->files = new_files;
*nb_files_alloc = n;
}
file = &cat->files[cat->nb_files++];
memset(file, 0, sizeof(*file));
*rfile = file;
file->url = url;
file->start_time = AV_NOPTS_VALUE;
file->duration = AV_NOPTS_VALUE;
return 0;
}
| 1threat
|
Angular 8 - Stop ng serve if build fail : <p>I need the way to stop the "ng serve" when the build failed. At the moment, app start anyway.</p>
<p>Thanks.</p>
| 0debug
|
static int get_phys_addr_lpae(CPUARMState *env, target_ulong address,
int access_type, int is_user,
hwaddr *phys_ptr, int *prot,
target_ulong *page_size_ptr)
{
CPUState *cs = CPU(arm_env_get_cpu(env));
MMUFaultType fault_type = translation_fault;
uint32_t level = 1;
uint32_t epd;
int32_t tsz;
uint32_t tg;
uint64_t ttbr;
int ttbr_select;
hwaddr descaddr, descmask;
uint32_t tableattrs;
target_ulong page_size;
uint32_t attrs;
int32_t granule_sz = 9;
int32_t va_size = 32;
int32_t tbi = 0;
if (arm_el_is_aa64(env, 1)) {
va_size = 64;
if (extract64(address, 55, 1))
tbi = extract64(env->cp15.c2_control, 38, 1);
else
tbi = extract64(env->cp15.c2_control, 37, 1);
tbi *= 8;
}
uint32_t t0sz = extract32(env->cp15.c2_control, 0, 6);
if (arm_el_is_aa64(env, 1)) {
t0sz = MIN(t0sz, 39);
t0sz = MAX(t0sz, 16);
}
uint32_t t1sz = extract32(env->cp15.c2_control, 16, 6);
if (arm_el_is_aa64(env, 1)) {
t1sz = MIN(t1sz, 39);
t1sz = MAX(t1sz, 16);
}
if (t0sz && !extract64(address, va_size - t0sz, t0sz - tbi)) {
ttbr_select = 0;
} else if (t1sz && !extract64(~address, va_size - t1sz, t1sz - tbi)) {
ttbr_select = 1;
} else if (!t0sz) {
ttbr_select = 0;
} else if (!t1sz) {
ttbr_select = 1;
} else {
fault_type = translation_fault;
goto do_fault;
}
if (ttbr_select == 0) {
ttbr = env->cp15.ttbr0_el1;
epd = extract32(env->cp15.c2_control, 7, 1);
tsz = t0sz;
tg = extract32(env->cp15.c2_control, 14, 2);
if (tg == 1) {
granule_sz = 13;
}
if (tg == 2) {
granule_sz = 11;
}
} else {
ttbr = env->cp15.ttbr1_el1;
epd = extract32(env->cp15.c2_control, 23, 1);
tsz = t1sz;
tg = extract32(env->cp15.c2_control, 30, 2);
if (tg == 3) {
granule_sz = 13;
}
if (tg == 1) {
granule_sz = 11;
}
}
if (epd) {
goto do_fault;
}
if ((va_size - tsz) > (granule_sz * 4 + 3)) {
level = 0;
} else if ((va_size - tsz) > (granule_sz * 3 + 3)) {
level = 1;
} else {
level = 2;
}
if (tsz) {
address &= (1ULL << (va_size - tsz)) - 1;
}
descmask = (1ULL << (granule_sz + 3)) - 1;
descaddr = extract64(ttbr, 0, 48);
descaddr &= ~((1ULL << (va_size - tsz - (granule_sz * (4 - level)))) - 1);
tableattrs = 0;
for (;;) {
uint64_t descriptor;
descaddr |= (address >> (granule_sz * (4 - level))) & descmask;
descaddr &= ~7ULL;
descriptor = ldq_phys(cs->as, descaddr);
if (!(descriptor & 1) ||
(!(descriptor & 2) && (level == 3))) {
goto do_fault;
}
descaddr = descriptor & 0xfffffff000ULL;
if ((descriptor & 2) && (level < 3)) {
tableattrs |= extract64(descriptor, 59, 5);
level++;
continue;
}
page_size = (1 << ((granule_sz * (4 - level)) + 3));
descaddr |= (address & (page_size - 1));
if (arm_feature(env, ARM_FEATURE_V8)) {
attrs = extract64(descriptor, 2, 10)
| (extract64(descriptor, 53, 11) << 10);
} else {
attrs = extract64(descriptor, 2, 10)
| (extract64(descriptor, 52, 12) << 10);
}
attrs |= extract32(tableattrs, 0, 2) << 11;
attrs |= extract32(tableattrs, 3, 1) << 5;
if (extract32(tableattrs, 2, 1)) {
attrs &= ~(1 << 4);
}
break;
}
fault_type = access_fault;
if ((attrs & (1 << 8)) == 0) {
goto do_fault;
}
fault_type = permission_fault;
if (is_user && !(attrs & (1 << 4))) {
goto do_fault;
}
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
if (attrs & (1 << 12) || (!is_user && (attrs & (1 << 11)))) {
if (access_type == 2) {
goto do_fault;
}
*prot &= ~PAGE_EXEC;
}
if (attrs & (1 << 5)) {
if (access_type == 1) {
goto do_fault;
}
*prot &= ~PAGE_WRITE;
}
*phys_ptr = descaddr;
*page_size_ptr = page_size;
return 0;
do_fault:
return (1 << 9) | (fault_type << 2) | level;
}
| 1threat
|
guint qemu_chr_fe_add_watch(CharDriverState *s, GIOCondition cond,
GIOFunc func, void *user_data)
{
GSource *src;
guint tag;
if (s->chr_add_watch == NULL) {
return -ENOSYS;
}
src = s->chr_add_watch(s, cond);
g_source_set_callback(src, (GSourceFunc)func, user_data, NULL);
tag = g_source_attach(src, NULL);
g_source_unref(src);
return tag;
}
| 1threat
|
static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n)
{
if(avctx->slice_count) return avctx->slice_offset[n];
else return AV_RL32(buf + n*8 - 4) == 1 ? AV_RL32(buf + n*8) : AV_RB32(buf + n*8);
}
| 1threat
|
Skip type check on unused parameters : <p>When I compile my typescript project, I'm using the <code>noImplicitAny</code> option so that I won't forget to specify the types on my variables and arguments.</p>
<p>However sometimes you have arguments that you don't use. For example:</p>
<pre><code>jQuery.ajaxTransport("+*", function (options: JQueryAjaxSettings) {
return {
abort: function (_, callback: JQueryCallback) {
</code></pre>
<p>I am not interested in the first argument of the abort function, so I ignore it by naming it _.</p>
<p>Is that the proper way to do that in TypeScript? I couldn't find it in the guide. I suspect that it isn't the proper way, because I can only name one argument _.</p>
<p>Typescript raises the following error: </p>
<blockquote>
<p>error TS7006: Parameter '_' implicitly has an 'any' type.</p>
</blockquote>
<p>I could just type <code>_:any</code> but that seems a bit overkill for an argument that I don't use.</p>
| 0debug
|
static void cabac_reinit(HEVCLocalContext *lc)
{
skip_bytes(&lc->cc, 0);
}
| 1threat
|
C++ quiz game exercise - ugly and bad functionality : The code is very ugly and it's supposed to form a simple test, but there are some problems..the point is to create a quiz game with ten quetions and the idea is to choose and pick answers with the arrows and enter. I would love some suggestions or improvements.
How may I recontstruct it in order to proceed to the next question after clicking the Enter button..so far is available only one question and it checks for correct/incorrect and adds a point +1 to the variable "d".
**Knowledge Level: High School**
#include <iostream>
#include <stdlib.h>
#include <conio.h>
using namespace std;
int main()
{ char k;
int m = 0, d = 0 ;
const int Up = 72;
const int Down = 80;
const int Enter = 13;
cout<<" 1.Which is the closest planet to the Sun?\n"
"> A) Mercury\n"
" B) Mars\n"
" C) Earth\n"
" D) Neptune\n";
do {
k = getch();
if(k == Down) {
m++;
}
else if(k == Up) {
m--;
}
if(m>3) {
m = 0;
}
else if(m < 0) {
m = 3;
}
system("CLS");;
if (m == 0) {
cout << " 1.What is the closest planet to the Sun?\n"
"> A) Mercury\n";
}
else {
cout<<" 1.What is the closest planet to the Sun?\n"
" A) Mercury\n";
}
if (m == 1) {
cout << "> B) Mars\n";
}
else {
cout<< " B) Mars\n";
}
if (m == 2) {
cout << "> C) Earth\n";
}
else {
cout<< " C) Earth\n";
}
if (m == 3) {
cout << "> D) Neptune\n\n";
}
else {
cout<< " D) Neptune\n\n";
}
} while (k != Enter);
if (m==0) {
d++;
}
}
Thanks in advance,
Regards,
Dimitur.
| 0debug
|
Does OkHttpClient have a max retry count : <p>I am setting the retry on connection failure option for OkHttpClient. </p>
<pre><code>client = new OkHttpClient();
client.setRetryOnConnectionFailure(true);
</code></pre>
<p>I will like to know how many times it will keep trying. Looking at the <a href="https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/internal/http/HttpEngine.java#L362" rel="noreferrer">source code</a> I did not see any maximum limit. How do I configure the client to stop trying after a few attempts?</p>
| 0debug
|
How to fix ElasticSearch conflicts on the same key when two process writing at the same time : <p>I have multiple processes to write data to ES at the same time, also two processes may write the same key with different values at the same time, it caused the exception as following:</p>
<pre><code>"error" : "VersionConflictEngineException[[website][2] [blog][1]:
version conflict, current [2], provided [1]]",
"status" : 409
</code></pre>
<p>How could I fix the above problem please, since I have to keep multiple processes.</p>
| 0debug
|
Python: No Module named Zlib, Mac OS X El Capitan 10.11.6 : <p>I'm trying to convert my python command line application to an app with py2app.
Everytime I try to import zlib or try to install setuptools , I get an error : no module named zlib.</p>
<p>Python was installed with brew.
I searched every corner of the internet and stack overflow, I have reinstalled python with brew , I have installed all Xcode CLI related stuff with :</p>
<pre><code>xcode-select --install
</code></pre>
<p>I also ran :</p>
<pre><code>ls /usr/include/zlib.h
</code></pre>
<p>and I can see that zlib is there where it is supposed to be.</p>
<p>Reinstalled with:</p>
<pre><code>brew reinstall python
</code></pre>
<p>Unfortunately that didn't work for me. I can't get what is wrong.</p>
<p>Any ideas?</p>
| 0debug
|
static int sys_utimensat(int dirfd, const char *pathname,
const struct timespec times[2], int flags)
{
return (utimensat(dirfd, pathname, times, flags));
}
| 1threat
|
Is it possible to copy code from one AWS Lambda function to another without downloading it first? : <p>So I'm currently working on building the deployer for our AWS Lambda functions. </p>
<p>Since AWS versions all share a configuration, this requires having multiple functions (foo_prod, foo_staging, foo_whatever) that are the various versions of our code instead of using aliases like I <em>want</em> to do. </p>
<p>So my question is: </p>
<p>1) Whether or not there's a sane way to re-deploy code. (IE: Staging to Prod) without downloading it to my desktop first and then re-uploading.</p>
<p>2) Whether or not I'm wrong about that shared configuration bit or whether it's possible to tell under which alias the function is running in the actual Lambda such that I can create multiple environment variables for each environment. </p>
| 0debug
|
How to use maven to unpack resource folder when .jar is ran : <p>I have a project that was written entirely independent of Maven, and now that we need to build a distributable .jar, we can't get the resource files packed in the .jar correctly.</p>
<p>The resource files are basically a bunch of .csv files that the user needs to have already setup, but can modify in the future.</p>
<p>I want the program to run like so:</p>
<ol>
<li><p>Launch program.jar</p></li>
<li><p>Reads the resource files in the resource folder, but if it doesn't exist, make the files/folder.</p></li>
<li><p>Program runs, calls resource files</p></li>
<li><p>Program ends, users are free to modify .csv files.</p></li>
</ol>
<p>We've tried including the resource files (in another directory) in the list of dependencies when the program is built, but it doesn't work when an outside user runs it. The code references the filepath multiple times (C:\commonfolder\resources\alltheCSVfiles)</p>
<p>I'm using java JDK 10.0.01, and intelliJ</p>
| 0debug
|
fail in creating a dictionary : I am trying to create a dictionnary in a function but I don't know for which reason I got this:
MONdic = {"mama"}
print MONdic
what I get as a result is :
> set(['mama'])
any help ?
| 0debug
|
How can I extract price of mobile phone from different ecommerce websites in php : <p>How can I extract price of <strong>mobile</strong> phone from different ecommerce websites in php tell me code</p>
| 0debug
|
static void *circular_buffer_task( void *_URLContext)
{
URLContext *h = _URLContext;
UDPContext *s = h->priv_data;
fd_set rfds;
struct timeval tv;
while(!s->exit_thread) {
int left;
int ret;
int len;
if (ff_check_interrupt(&h->interrupt_callback)) {
s->circular_buffer_error = AVERROR(EINTR);
goto end;
}
FD_ZERO(&rfds);
FD_SET(s->udp_fd, &rfds);
tv.tv_sec = 1;
tv.tv_usec = 0;
ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv);
if (ret < 0) {
if (ff_neterrno() == AVERROR(EINTR))
continue;
s->circular_buffer_error = AVERROR(EIO);
goto end;
}
if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
continue;
left = av_fifo_space(s->fifo);
if(left < UDP_MAX_PKT_SIZE + 4) {
av_log(h, AV_LOG_ERROR, "circular_buffer: OVERRUN\n");
s->circular_buffer_error = AVERROR(EIO);
goto end;
}
len = recv(s->udp_fd, s->tmp+4, sizeof(s->tmp)-4, 0);
if (len < 0) {
if (ff_neterrno() != AVERROR(EAGAIN) && ff_neterrno() != AVERROR(EINTR)) {
s->circular_buffer_error = AVERROR(EIO);
goto end;
}
continue;
}
AV_WL32(s->tmp, len);
pthread_mutex_lock(&s->mutex);
av_fifo_generic_write(s->fifo, s->tmp, len+4, NULL);
pthread_cond_signal(&s->cond);
pthread_mutex_unlock(&s->mutex);
}
end:
pthread_mutex_lock(&s->mutex);
pthread_cond_signal(&s->cond);
pthread_mutex_unlock(&s->mutex);
return NULL;
}
| 1threat
|
Angular 2 final - change route parameter on the URL programmatically : <p>Assume I'm actually the page "results"...</p>
<p><a href="http://server/results;dateFrom=03-11-2016;page=1" rel="noreferrer">http://server/results;dateFrom=03-11-2016;page=1</a></p>
<p>Me as the results page, I'd like to load the page 2, but I need to set the URL string on the browser to <a href="http://server/results;dateFrom=03-11-2016;page=2" rel="noreferrer">http://server/results;dateFrom=03-11-2016;page=2</a> just in case if someone decide to bookmark it.</p>
<p>so, how to programmatically change the URL parameter on the Web Browser Address Bar ?</p>
<p>ty !</p>
| 0debug
|
How can I convert required string in Java? : <p>convert given string as per requirement. abc123 need to be convert 012onetwothree</p>
<p>What is the best way to implement such kind of program, i used the enum for this to implement </p>
| 0debug
|
Vuetify: colors are not showing up : <p>I'm trying to integrate Vuetify to my existing Vue project, but the colors are not showing up correctly. I'm following the guide at <a href="https://vuetifyjs.com/en/getting-started/quick-start" rel="noreferrer">https://vuetifyjs.com/en/getting-started/quick-start</a> -> existing applications.</p>
<p>The css file seems to be somehow loaded correctly as buttons seems to be highlighted with shadows and there are some click effects. However the colors and the text are not showing up correctly:</p>
<p><a href="https://i.stack.imgur.com/Q6omr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Q6omr.png" alt="enter image description here"></a></p>
<p>My main.js</p>
<pre><code>import Vue from "vue";
import App from "./App";
import Vuetify from "vuetify";
import router from "./router";
import "../node_modules/vuetify/dist/vuetify.min.css";
Vue.config.productionTip = false;
Vue.use(Vuetify);
/* eslint-disable no-new */
new Vue({
el: "#app",
router,
components: { App },
template: "<App/>"
});
</code></pre>
<p>My component.vue</p>
<pre><code><template>
<div class="hello">
<v-btn color="success">Success</v-btn>
<v-btn color="error">Error</v-btn>
<v-btn color="warning">Warning</v-btn>
<v-btn color="info">Info</v-btn>
</div>
</template>
<script>
... // Removed for simplicity
</script>
<style lang="stylus" scoped>
@import '../../node_modules/vuetify/src/stylus/main' // Ensure you are using stylus-loader
</style>
</code></pre>
| 0debug
|
Call back on new App install : <p>I want to perform some action in my app when a new other application is installed in the device.</p>
<p>Is there any way I can do that? TIA</p>
| 0debug
|
static void vexpress_common_init(MachineState *machine)
{
VexpressMachineState *vms = VEXPRESS_MACHINE(machine);
VexpressMachineClass *vmc = VEXPRESS_MACHINE_GET_CLASS(machine);
VEDBoardInfo *daughterboard = vmc->daughterboard;
DeviceState *dev, *sysctl, *pl041;
qemu_irq pic[64];
uint32_t sys_id;
DriveInfo *dinfo;
pflash_t *pflash0;
ram_addr_t vram_size, sram_size;
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *vram = g_new(MemoryRegion, 1);
MemoryRegion *sram = g_new(MemoryRegion, 1);
MemoryRegion *flashalias = g_new(MemoryRegion, 1);
MemoryRegion *flash0mem;
const hwaddr *map = daughterboard->motherboard_map;
int i;
daughterboard->init(vms, machine->ram_size, machine->cpu_model, pic);
if (bios_name) {
char *fn;
int image_size;
if (drive_get(IF_PFLASH, 0, 0)) {
error_report("The contents of the first flash device may be "
"specified with -bios or with -drive if=pflash... "
"but you cannot use both options at once");
exit(1);
}
fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (!fn) {
error_report("Could not find ROM image '%s'", bios_name);
exit(1);
}
image_size = load_image_targphys(fn, map[VE_NORFLASH0],
VEXPRESS_FLASH_SIZE);
g_free(fn);
if (image_size < 0) {
error_report("Could not load ROM image '%s'", bios_name);
exit(1);
}
}
sys_id = 0x1190f500;
sysctl = qdev_create(NULL, "realview_sysctl");
qdev_prop_set_uint32(sysctl, "sys_id", sys_id);
qdev_prop_set_uint32(sysctl, "proc_id", daughterboard->proc_id);
qdev_prop_set_uint32(sysctl, "len-db-voltage",
daughterboard->num_voltage_sensors);
for (i = 0; i < daughterboard->num_voltage_sensors; i++) {
char *propname = g_strdup_printf("db-voltage[%d]", i);
qdev_prop_set_uint32(sysctl, propname, daughterboard->voltages[i]);
g_free(propname);
}
qdev_prop_set_uint32(sysctl, "len-db-clock",
daughterboard->num_clocks);
for (i = 0; i < daughterboard->num_clocks; i++) {
char *propname = g_strdup_printf("db-clock[%d]", i);
qdev_prop_set_uint32(sysctl, propname, daughterboard->clocks[i]);
g_free(propname);
}
qdev_init_nofail(sysctl);
sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, map[VE_SYSREGS]);
pl041 = qdev_create(NULL, "pl041");
qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512);
qdev_init_nofail(pl041);
sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, map[VE_PL041]);
sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]);
dev = sysbus_create_varargs("pl181", map[VE_MMCI], pic[9], pic[10], NULL);
qdev_connect_gpio_out(dev, 0,
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT));
qdev_connect_gpio_out(dev, 1,
qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN));
sysbus_create_simple("pl050_keyboard", map[VE_KMI0], pic[12]);
sysbus_create_simple("pl050_mouse", map[VE_KMI1], pic[13]);
sysbus_create_simple("pl011", map[VE_UART0], pic[5]);
sysbus_create_simple("pl011", map[VE_UART1], pic[6]);
sysbus_create_simple("pl011", map[VE_UART2], pic[7]);
sysbus_create_simple("pl011", map[VE_UART3], pic[8]);
sysbus_create_simple("sp804", map[VE_TIMER01], pic[2]);
sysbus_create_simple("sp804", map[VE_TIMER23], pic[3]);
sysbus_create_simple("pl031", map[VE_RTC], pic[4]);
sysbus_create_simple("pl111", map[VE_CLCD], pic[14]);
dinfo = drive_get_next(IF_PFLASH);
pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0",
dinfo);
if (!pflash0) {
fprintf(stderr, "vexpress: error registering flash 0.\n");
exit(1);
}
if (map[VE_NORFLASHALIAS] != -1) {
flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0);
memory_region_init_alias(flashalias, NULL, "vexpress.flashalias",
flash0mem, 0, VEXPRESS_FLASH_SIZE);
memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias);
}
dinfo = drive_get_next(IF_PFLASH);
if (!ve_pflash_cfi01_register(map[VE_NORFLASH1], "vexpress.flash1",
dinfo)) {
fprintf(stderr, "vexpress: error registering flash 1.\n");
exit(1);
}
sram_size = 0x2000000;
memory_region_init_ram(sram, NULL, "vexpress.sram", sram_size,
&error_abort);
vmstate_register_ram_global(sram);
memory_region_add_subregion(sysmem, map[VE_SRAM], sram);
vram_size = 0x800000;
memory_region_init_ram(vram, NULL, "vexpress.vram", vram_size,
&error_abort);
vmstate_register_ram_global(vram);
memory_region_add_subregion(sysmem, map[VE_VIDEORAM], vram);
if (nd_table[0].used) {
lan9118_init(&nd_table[0], map[VE_ETHERNET], pic[15]);
}
for (i = 0; i < NUM_VIRTIO_TRANSPORTS; i++) {
sysbus_create_simple("virtio-mmio", map[VE_VIRTIO] + 0x200 * i,
pic[40 + i]);
}
daughterboard->bootinfo.ram_size = machine->ram_size;
daughterboard->bootinfo.kernel_filename = machine->kernel_filename;
daughterboard->bootinfo.kernel_cmdline = machine->kernel_cmdline;
daughterboard->bootinfo.initrd_filename = machine->initrd_filename;
daughterboard->bootinfo.nb_cpus = smp_cpus;
daughterboard->bootinfo.board_id = VEXPRESS_BOARD_ID;
daughterboard->bootinfo.loader_start = daughterboard->loader_start;
daughterboard->bootinfo.smp_loader_start = map[VE_SRAM];
daughterboard->bootinfo.smp_bootreg_addr = map[VE_SYSREGS] + 0x30;
daughterboard->bootinfo.gic_cpu_if_addr = daughterboard->gic_cpu_if_addr;
daughterboard->bootinfo.modify_dtb = vexpress_modify_dtb;
daughterboard->bootinfo.secure_boot = true;
arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);
}
| 1threat
|
How to add a primary key to all tables in SQL server? : While migrating from access to SQL server and then using entity framework on it, I got this issue. The good thing is that it if it fails for some table, it doesn't fail for all.
| 0debug
|
using object as parameters in java : class Test {
int a, b;
Test (int i,int j)
{
a=i;
b=j;
System.out.println("a is " + a);
}
boolean equalto(Test o)
{
if (o.a == a && o.b == b )
return true;
else return false;
}
}
class PassObj {
public static void main(String[] args) {
Test ob2 = new Test(100,22);
Test ob3 = new Test(-1 ,-1);
Test ob1 = new Test(100 ,22) ;
System.out.println(ob1.equalto(ob2));
System.out.println(ob1.equalto(ob3));
}
}
In the above code may I know how if condition is working.
say for 1st print statement in if statement ob2.a is compared with "a" i.e 100==a
my doubt is what is the value of "a" it is taking to compare and how ? I have tried to print that "a" value before print statement is executed and I understood that when object is created and initiated those 3 values of "a" is getting printed as 100, -1 and 100.
Does ob1.equalto(ob2) calls constructor again ? if so then in my output shouldn't "a" get printed again. I am new to OOP and not clear with this concept.
My doubt is which "a" it will take when it is comparing for print statement 1 and 2 and how can I print only those 2 "a"
output I am getting now:
a is 100
a is -1
a is 100
true
false
| 0debug
|
Multi-line user input in iOS: UITextField vs UITextView : <p>I need to show users a multi-line text input "box" with a height greater than the standard height of a <code>UITextField</code>. What the best or most correct approach should be?:</p>
<ol>
<li>Using a <code>UITextField</code> and change its height in code or by applying a certain height constraint.</li>
<li>Using an editable <code>UITextView</code>. This is multi-line but it has no placeholder by default, I guess I should implement that feature in code.</li>
</ol>
| 0debug
|
Go http clent not follow redirects : I have a function for check url like that:
func Checkurl(url string) {
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
resp, err := client.Get(url)
In error var: unexpected EOF
In tcpdump i see redirect and Connection close:
15:53:41.510722 IP (tos 0x0, ttl 248, id 18315, offset 0, flags [none], proto TCP (6), length 123)
XXX.XXX.XXX.XXX.80 > XXX.XXX.XXX.XXX.53618: Flags [F.], cksum 0xb96f (correct), seq 85:168, ack 1, win 5840, length 83: HTTP, length: 83
HTTP/1.1 302 Moved Temporarily
Location: http://XXX.XXX.XXX.XXX
Connection: close
How i can get Location?
| 0debug
|
how to set header background color in ionic 4 : <p>I am trying in different way which I followed link(<a href="https://stackoverflow.com/questions/53531819/how-to-set-background-color-ionic-4">How to set background color IONIC 4</a>) for header background color and tried as per ionic 2 and ionic 3 as well:</p>
<p>I am able to make background color for ion-content, but background color is not coming for header.</p>
<p>Code:</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-html lang-html prettyprint-override"><code><ion-header>
<ion-toolbar style="background-color: red">
<ion-title>Login</ion-title>
</ion-toolbar>
</ion-header></code></pre>
</div>
</div>
</p>
<p>Please need your support.</p>
| 0debug
|
How to convert column to row in sql server : I would like to convert following data
CLAIMID CODENUMBER
2 465.9
2 238.8
2 461.9
2 786.2
Would like to see as
CLAIMID ICD1 ICD2 ICD3 ICD4
2 465.9 238.8 461.9 786.2
Your help will be appreciated..
| 0debug
|
Do Progressive Web Apps Have The Following Ability : <p>Before I spend time learning PWA can it do something like this?</p>
<p>When online, call an API that returns some JSON data and store that data locally e.g. a few customers (say 50) and a few products (say 100)</p>
<p>Then when offline (because I am in the middle of nowhere with no phone or wifi signal) have a screen to select a customer (from the stored data), then select a product (from the stored data) - save the order for later.</p>
<p>Repeat the entry of orders.</p>
<p>Then later when back on-line send the saved orders to an API</p>
<p>Of course the above is simplified but can it do the above?</p>
| 0debug
|
The name tf.Session is deprecated. Please use tf.compat.v1.Session instead : <p>I got the following deprecation warning in my tensorflow code: </p>
<blockquote>
<p>The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.</p>
</blockquote>
<ul>
<li>Why I got this warning</li>
<li>What will happen in tensorflow 2.0. instead of <code>tf.session</code></li>
<li>Is it okay to use <code>tf.compat.v1.Session</code></li>
</ul>
| 0debug
|
static void tcg_out_reloc(TCGContext *s, tcg_insn_unit *code_ptr, int type,
int label_index, intptr_t addend)
{
TCGLabel *l;
TCGRelocation *r;
l = &s->labels[label_index];
if (l->has_value) {
patch_reloc(code_ptr, type, l->u.value, addend);
} else {
r = tcg_malloc(sizeof(TCGRelocation));
r->type = type;
r->ptr = code_ptr;
r->addend = addend;
r->next = l->u.first_reloc;
l->u.first_reloc = r;
}
}
| 1threat
|
C - array aloccation : I have following code and i need to allocate memory for char data[]. I tryed many things, but it still doesnt work. Can someone help me ? I know my malloc wont allocate anything for data, but how to repair this.
//img->data = malloc(sizeof(char)*(img->xsize * img->ysize * 3)); need data allocate like this
```
struct ppm {
unsigned xsize;
unsigned ysize;
char data[];
};
struct ppm *img = malloc(sizeof(struct ppm));
if (!img)
fprintf(stderr, "Chyba alokace pameti.\n");
exit(1);
}
if (fscanf(fp, "%x %x", &img->xsize, &img->ysize) != 2) {
fprintf(stderr, "Spatna velikost obrazku '%s'\n", filename);
exit(1);
}
if (fread(img->data, 3 * img->xsize, img->ysize, fp))
fprintf(stderr, "Nepodarilo se nacist pixely z '%s'\n", filename);
exit(1);
}
```
| 0debug
|
Wierd behaviour of getline in C++ ? : <p>Well I know using cin we can't read multiple strings . But the behaviour of getline here in this program is hard to understand . I am not able to figure out what is issue in it . Is it I can't use cin and getline in tandem ?</p>
<pre><code>#include <iostream>
#include <string>
int main()
{
std::string name;
std::cout << "What is your name? ";
std::cin>>name;
std::cout << "Hello, " << name << "!"<<std::endl;
getline (std::cin, name);
std::cout << "Hello, " << name << "!\n";
}
Input :
Jai Simha Verma
Jai Simha Verma
OUTPUT:
What is your name? Hello, Jai!
Hello, Simha Verma !
</code></pre>
| 0debug
|
static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
SpectralBandReplication *sbr, SBRData *ch_data)
{
int e, i, m;
if (sbr->bs_interpol_freq) {
for (e = 0; e < ch_data->bs_num_env; e++) {
const float recip_env_size = 0.5f / (ch_data->t_env[e + 1] - ch_data->t_env[e]);
int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
for (m = 0; m < sbr->m[1]; m++) {
float sum = 0.0f;
for (i = ilb; i < iub; i++) {
sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] +
X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1];
}
e_curr[e][m] = sum * recip_env_size;
}
}
} else {
int k, p;
for (e = 0; e < ch_data->bs_num_env; e++) {
const int env_size = 2 * (ch_data->t_env[e + 1] - ch_data->t_env[e]);
int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
const uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
for (p = 0; p < sbr->n[ch_data->bs_freq_res[e + 1]]; p++) {
float sum = 0.0f;
const int den = env_size * (table[p + 1] - table[p]);
for (k = table[p]; k < table[p + 1]; k++) {
for (i = ilb; i < iub; i++) {
sum += X_high[k][i][0] * X_high[k][i][0] +
X_high[k][i][1] * X_high[k][i][1];
}
}
sum /= den;
for (k = table[p]; k < table[p + 1]; k++) {
e_curr[e][k - sbr->kx[1]] = sum;
}
}
}
}
}
| 1threat
|
XCode9: code signing blocked mmap() while running on device : <p>I encountered the following issue after upgrading to XCode9 (Well I could not completely isolate the cause because I re-generated the certificate right after upgrading for enabling Push Service) :</p>
<pre><code>dyld: Library not loaded: @rpath/apowo.framework/apowo
Referenced from: /var/containers/Bundle/Application/2CD5CA32-1DAF-423B-B921-024DCBEE2AF0/picatown.app/picatown
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/2CD5CA32-1DAF-423B-B921-024DCBEE2AF0/XXXX.app/Frameworks/apowo.framework/apowo: code signing blocked mmap() of '/private/var/containers/Bundle/Application/2CD5CA32-1DAF-423B-B921-024DCBEE2AF0/XXXX.app/Frameworks/apowo.framework/apowo'
</code></pre>
<p>There are several similar posts over SO but I believe it might be caused by something new. In fact the original issue was not on XXX.framework but libswiftcore, and after I have done all the suggestions on SO the error came from my own libraries. And here is what I have tried:</p>
<ul>
<li>clean</li>
<li>delete the derived data</li>
<li>restart XCode, Mac, and my phone</li>
<li>delete all the certificates and recreate again</li>
<li>delete the framework references (and the binaries as well) from the project and re-add</li>
</ul>
<p>None of them works.</p>
<p>Some additional data is I am using jenkins and fastlane to manage the build. The XCode project is re-created every time when the job runs. The same job runs well on another machine which is on XCode 8 and nothing breaks (runs after re-creation of the certs so it is with the new certs).</p>
<p>I thought it was about the libraries and I rebuilt them on XCode 9. The newly built libs were also in the XCode 8 built app and worked well but not on XCode 9.</p>
<p>Any help will be appreciated.</p>
| 0debug
|
uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t *out_size)
{
uint8_t *ret = NULL;
JNIEnv *env = NULL;
jobject buffer = NULL;
JNI_GET_ENV_OR_RETURN(env, codec, NULL);
if (codec->has_get_i_o_buffer) {
buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffer_id, idx);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
} else {
if (!codec->input_buffers) {
codec->input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
codec->input_buffers = (*env)->NewGlobalRef(env, codec->input_buffers);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
}
buffer = (*env)->GetObjectArrayElement(env, codec->input_buffers, idx);
if (ff_jni_exception_check(env, 1, codec) < 0) {
goto fail;
}
}
ret = (*env)->GetDirectBufferAddress(env, buffer);
*out_size = (*env)->GetDirectBufferCapacity(env, buffer);
fail:
if (buffer) {
(*env)->DeleteLocalRef(env, buffer);
}
return ret;
}
| 1threat
|
AutoMapper 4.2 and Ninject 3.2 : <p>I'm updating a project of mine to use AutoMapper 4.2, and I'm running into breaking changes. While I <em>seem</em> to have resolved said changes, I'm not entirely convinced I've done so in the most appropriate way.</p>
<p>In the old code, I have a <code>NinjectConfiguration</code>, and an <code>AutoMapperConfiguration</code> class that are each loaded by WebActivator. In the new version the <code>AutoMapperConfiguration</code> drops out and I instead instance a <code>MapperConfiguration</code> directly in the <code>NinjectConfiguration</code> class where the bindings are happening, like so:</p>
<pre><code>private static void RegisterServices(
IKernel kernel) {
var profiles = AssemblyHelper.GetTypesInheriting<Profile>(Assembly.Load("???.Mappings")).Select(Activator.CreateInstance).Cast<Profile>();
var config = new MapperConfiguration(
c => {
foreach (var profile in profiles) {
c.AddProfile(profile);
}
});
kernel.Bind<MapperConfiguration>().ToMethod(
c =>
config).InSingletonScope();
kernel.Bind<IMapper>().ToMethod(
c =>
config.CreateMapper()).InRequestScope();
RegisterModules(kernel);
}
</code></pre>
<p>So, is this the appropriate way of binding AutoMapper 4.2 using Ninject? It seems to be working so far, but I just want to make sure.</p>
| 0debug
|
static int default_fdset_dup_fd_find(int dup_fd)
{
return -1;
}
| 1threat
|
where should i install CMake? : <p>I am trying to pip install dlib for a project I am working on, but when I try I get this error:
RuntimeError: CMake must be installed to build the following extensions: dlib
I tried to install CMake, but couldn't understand where should I locate the extracted files?
Thanks in advance!</p>
| 0debug
|
onClick functon not working for a selected option field : I got a Paypal button on my webpage includes this generated code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" class="center-align" id="paypal">
<input type="hidden" name="cmd" value="_s-xclick" >
<input type="hidden" name="hosted_button_id" value="XMMPHFAWFLLRG">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal." ">
<img alt=""
By clicking on the "buy now" logo, JS should check, if an option is selected. I am using the Materialize Framework, and that's the select field:
<select>
<option value="0" disabled selected>Kategorie</option>
<option value="1">Beauty</option>
<option value="2">Technik</option>
<option value="3">Deko</option>
</select>
So no ID or class names, it's the only select on the page.
My Javascript, which I tried looks like that:
function isSelected() {
if (getElementsByTagName("select").value == '0') {
alert("Bitte eine Kategorie auswählen!");
};
}
}
How do you guys think, I could solve the problem? I checked similiar questions, but didn't get it solved.
| 0debug
|
static int xan_decode_frame_type0(AVCodecContext *avctx, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
XanContext *s = avctx->priv_data;
uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;
unsigned chroma_off, corr_off;
int cur, last, size;
int i, j;
int ret;
corr_off = AV_RL32(buf + 8);
chroma_off = AV_RL32(buf + 4);
if ((ret = xan_decode_chroma(avctx, avpkt)) != 0)
return ret;
size = avpkt->size - 4;
if (corr_off >= avpkt->size) {
av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n");
corr_off = 0;
}
if (corr_off)
size = corr_off;
if (chroma_off)
size = FFMIN(size, chroma_off);
ret = xan_unpack_luma(buf + 12, size, src, s->buffer_size >> 1);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
return ret;
}
ybuf = s->y_buffer;
last = *src++;
ybuf[0] = last << 1;
for (j = 1; j < avctx->width - 1; j += 2) {
cur = (last + *src++) & 0x1F;
ybuf[j] = last + cur;
ybuf[j+1] = cur << 1;
last = cur;
}
ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
for (i = 1; i < avctx->height; i++) {
last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
ybuf[0] = last << 1;
for (j = 1; j < avctx->width - 1; j += 2) {
cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
ybuf[j] = last + cur;
ybuf[j+1] = cur << 1;
last = cur;
}
ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
}
if (corr_off) {
int corr_end, dec_size;
corr_end = avpkt->size;
if (chroma_off > corr_off)
corr_end = chroma_off;
dec_size = xan_unpack(s->scratch_buffer, s->buffer_size,
avpkt->data + 8 + corr_off,
corr_end - corr_off);
if (dec_size < 0)
dec_size = 0;
for (i = 0; i < dec_size; i++)
s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F;
}
src = s->y_buffer;
ybuf = s->pic.data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
ybuf[i] = (src[i] << 2) | (src[i] >> 3);
src += avctx->width;
ybuf += s->pic.linesize[0];
}
return 0;
}
| 1threat
|
Code not working : <?php
require_once('connect.php');
if(isset ($_POST['register_btn'])){
extract($_POST);
//if($password == $password2){
//create user
$password = md5($password2);
$sql = "INSERT INTO `users`(`name`, `username`, `email`, `password`, `contact`) VALUES ('$name','$username','$email','$password','$contact')";
//var_dump($sql);
echo "LOGIN SUCCESSFUL";
echo $username;
//header("location: process.php");
// } else {
// echo "The two passwords do not match";
// }
}
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Sign Up</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1> Sign Up</h1>
<form method="post" action="register.php">
<table>
<tr>
<td>Name :</td>
<td><input type="text" name="name" class="textinput"></td>
</tr>
<tr>
<td>Username :</td>
<td><input type="text" name="username" class="textinput"></td>
</tr>
<tr>
<td>Email :</td>
<td><input type="email" name="email" class="textinput"></td>
</tr>
<tr>
<td>Password :</td>
<td><input type="password" name="password" class="textinput"></td>
</tr>
<tr>
<td>Confirm Password :</td>
<td><input type="password" name="password2" class="textinput"></td>
</tr>
<tr>
<td>Contact :</td>
<td><input type="number" name="contact" class="textinput"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="register_btn" value="Register"></td>
</tr>
<tr>
<td></td>
<td>Already a member <a href="login.php">SIGN IN</a></td>
</tr>
</table>
</form>
</body>
</html>
Whenever i register using this page the code doesent do anything
what should i do so that it works properly? I want that when it submits it adds the details of the form in the database which is apparantly the biggest problem
need to sort it out asap
| 0debug
|
In TypeScript, why is it not an error to access (get) property that only has a setter? : <p>Why does this compile? (TS v2.0.3)</p>
<pre><code>class SetterOnly {
set prop(v) {
let x = this.prop;
}
}
</code></pre>
<p>I would expect <code>this.prop</code> to generate a compile-time error ...</p>
| 0debug
|
I need to remove multiple occurrence of char and leave only one : I need the code in C to replace multiple occurrences of individual characters with a single char
For Example:
char = {A,a,B,b,b}
output:
A,B
| 0debug
|
static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, unsigned src_size)
{
const uint8_t *s = src;
const uint8_t *end;
#ifdef HAVE_MMX
const uint8_t *mm_end;
#endif
uint16_t *d = (uint16_t *)dst;
end = s + src_size;
#ifdef HAVE_MMX
__asm __volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm __volatile(
"movq %0, %%mm7\n\t"
"movq %1, %%mm6\n\t"
::"m"(red_15mask),"m"(green_15mask));
mm_end = end - 15;
while(s < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movd %1, %%mm0\n\t"
"movd 4%1, %%mm3\n\t"
"punpckldq 8%1, %%mm0\n\t"
"punpckldq 12%1, %%mm3\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm3, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"psllq $7, %%mm0\n\t"
"psllq $7, %%mm3\n\t"
"pand %%mm7, %%mm0\n\t"
"pand %%mm7, %%mm3\n\t"
"psrlq $6, %%mm1\n\t"
"psrlq $6, %%mm4\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm4\n\t"
"psrlq $19, %%mm2\n\t"
"psrlq $19, %%mm5\n\t"
"pand %2, %%mm2\n\t"
"pand %2, %%mm5\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm5, %%mm3\n\t"
"psllq $16, %%mm3\n\t"
"por %%mm3, %%mm0\n\t"
MOVNTQ" %%mm0, %0\n\t"
:"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
d += 4;
s += 16;
}
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
const int src= *((uint32_t*)s)++;
*d++ = ((src&0xF8)<<7) + ((src&0xF800)>>6) + ((src&0xF80000)>>19);
}
}
| 1threat
|
C string input without spaces or tabs : I am trying to find the best way of getting an input of string without the spaces and tabs. And from it to get dynamic number of the individual strings that the main one contian.
For example:
For the string str = " abc \t tt 6 \t 4 7"
The out put will be str1 = "abc" str2 = "tt" str3 = "6" str4 = "4" str5 = "7"
I thought maybe for the dynamic creation of string to use malloc to creat an array of strings. But I could not make it work, and ignore the spaces and tabs (\t)
Thanks for the helpers.
| 0debug
|
ngrx: how to pass parameters to selector inside createSelector method : <p>I have a very simple state in my store:</p>
<pre><code>const state = {
records: [1,2,3],
};
</code></pre>
<p>I have a selector for records:</p>
<pre><code>export const getRecords = createSelector(getState, (state: State) => state.records));
</code></pre>
<p>And what I want now is to have separate selectors for fetching each record by index.
For this purpose I want to create one generic selector with props in this way:</p>
<pre><code>export const getRecordByIndex = createSelector(
getRecords,
(state: State, { index }) => state.records[index]),
);
</code></pre>
<p>And after that create a couple of specific selectors e. g.:</p>
<pre><code>export const getFirstRecord = createSelector(
getRecordByIndex(/* somehow pass index = 0 to this selector */),
(firstRecord) => firstRecord),
);
</code></pre>
<p>But I didn't find any mention how to pass parameters to selectors with props when we use them inside createSelector method. Is it possible?</p>
| 0debug
|
Why are numpy calculations not affected by the global interpreter lock? : <p>I'm trying to decide if I should use multiprocessing or threading, and I've learned some interesting bits about the <a href="https://wiki.python.org/moin/GlobalInterpreterLock" rel="noreferrer">Global Interpreter Lock</a>. In this nice <a href="http://nathangrigg.net/2015/04/python-threading-vs-processes/" rel="noreferrer">blog post</a>, it seems multithreading isn't suitable for busy tasks. However, I also learned that some functionality, such as I/O or numpy, is unaffected by the GIL.</p>
<p>Can anyone explain why, and how I can find out if my (probably quite numpy-heavy) code is going to be suitable for multithreading?</p>
| 0debug
|
Android Studio 3 - It is possible to take a screenshot or record screen? : <p>In latest version of Android Studio android monitor was changed to android profiler. Android profiler it's great but I don't see any option to take a screenshots or record device screen. So my question is where are now capturing options? </p>
| 0debug
|
Python mathematical function to an array : I am working on a project involving a data file that will contain an XYZ coordinates for several atoms. I need to have the molecule oriented such that the two sulfur atoms are resting on the x axis. I know the math behind what I need to do, I am just unsure how to apply this to an array in python. It has been years since i have done any programming and any pointers would be greatly appreciated.
| 0debug
|
Why do I get dir: command not found on Mac when there is some files in that directory? : <p>I try to see the files that are in my Desktop. So I move into the directory of my desktop. Then I write: dir in Terminal and it says:
-bash: dir: command not found
What could possibly be the problem? Because obviously there are many files there.</p>
| 0debug
|
how to use a a scanner to Ask the user to guess the number until = to random number : so heres my code
public class JavaAsig8 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int number;
System.out.print("Enter a whole number: ");
number = stdIn.nextInt();
Random r = new Random();
for (int i = 0; i < number; i++) {
Random rn = new Random();
int answer = rn.nextInt(10) + 1;
System.out.println(answer);
}
}
}
but i need to be able to Ask the user to guess the number until = to random number
| 0debug
|
How add button in Action : I want to add new button in action
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/ZzOtd.jpg
| 0debug
|
Memory map of what happens when we use command line arguments? : <p>What I understand is argc holds total number of arguments. Suppose my program takes 1 argument apart from program name. Now what does argv hold? Two pointer eg: 123,130 or ./hello\0 and 5. If it holds 123 how does it know it has read one argument? Does it know because of \0.</p>
<p>If all the above is wrong, can someone help me understand using memory map.</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.