problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Run Go script on the server : I have a hosting with a PHP file which gets the request, take a string from it and have to give to Go (gloand) script. How could I do it? | 0debug |
Linux List files dfference - "ls" vs "ls /" : <p>Never used Linux before and trying to understand the difference between </p>
<pre><code>ls
</code></pre>
<p>and </p>
<pre><code>ls /
</code></pre>
<p>"ls /" gets all my dir (and more, but not .files - hidden files) as we can see it in <a href="http://linuxcommand.org/lc3_man_pages/ls1.html" rel="nofollow noreferrer">this extensive list of commands</a>. </p>
<p>What about the <code>ls</code>?</p>
| 0debug |
i have a method and i can't call it in Android Studio : I want to create a simple calculator in Android Studio, in my way I get an error on **calling a fuction** that i have already **declared**. Any Android Expert here that can help me?
Thanks
public class CalculatorActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calculator);
}
//Start my method
public void calculator(View v) {
Button btn0 = (Button) findViewById(R.id.btn0);
Button btn1 = (Button) findViewById(R.id.btn1);
Button btn2 = (Button) findViewById(R.id.btn2);
Button btn3 = (Button) findViewById(R.id.btn3);
Button btn4 = (Button) findViewById(R.id.btn4);
Button btn5 = (Button) findViewById(R.id.btn5);
Button btn6 = (Button) findViewById(R.id.btn6);
Button btn7 = (Button) findViewById(R.id.btn7);
TextView textViewResult = (TextView) findViewById(R.id.textView);
if (btn0.isPressed() == true) {
textViewResult.setText(textViewResult + "0");
} else if (btn1.isPressed() == true) {
textViewResult.setText(textViewResult + "1");
}
}
//End my method
//I want to call that fucntion, and i get an error
calculator();
}
| 0debug |
static void malta_fpga_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
MaltaFPGAState *s = opaque;
uint32_t saddr;
saddr = (addr & 0xfffff);
switch (saddr) {
case 0x00200:
break;
case 0x00210:
break;
case 0x00408:
s->leds = val & 0xff;
malta_fpga_update_display(s);
break;
case 0x00410:
snprintf(s->display_text, 9, "%08X", (uint32_t)val);
malta_fpga_update_display(s);
break;
case 0x00418:
case 0x00420:
case 0x00428:
case 0x00430:
case 0x00438:
case 0x00440:
case 0x00448:
case 0x00450:
s->display_text[(saddr - 0x00418) >> 3] = (char) val;
malta_fpga_update_display(s);
break;
case 0x00500:
if (val == 0x42)
qemu_system_reset_request ();
break;
case 0x00508:
s->brk = val & 0xff;
break;
case 0x00a00:
s->gpout = val & 0xff;
break;
case 0x00b08:
s->i2coe = val & 0x03;
break;
case 0x00b10:
eeprom24c0x_write(val & 0x02, val & 0x01);
s->i2cout = val;
break;
case 0x00b18:
s->i2csel = val & 0x01;
break;
default:
#if 0
printf ("malta_fpga_write: Bad register offset 0x" TARGET_FMT_lx "\n",
addr);
#endif
break;
}
}
| 1threat |
why Linux VmSize VmData is lager than estimation from code? : I want to know how many memory will take when the code is running.
I sum all memory used in my code and use gcc to convert to an executable bin file.
When I the bin file, and use cat /proc/$PID/status, the VmSize VmData is much larger than expected. Even if remove all code but only sleep, the result still is the same.
VmPeak: 12816 kB
VmSize: 12816 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 964 kB
VmRSS: 964 kB
VmData: 204 kB
VmStk: 136 kB
VmExe: 56 kB
VmLib: 2100 kB
VmPTE: 48 kB
VmPMD: 12 kB
VmSwap: 0 kB
- Why the memory is so large even if no data is in my code?
- Why VmData is the same no matter I removed variables in code or not? Why not change smaller?
- how to get memory my code is using exactly? | 0debug |
Changing values of 2 textboxes with each other (VS.NET) : <p>I want to know how to change the values of 2 textboxes with each other when I click on a button. vs.net</p>
| 0debug |
static void set_options(URLContext *h, const char *uri)
{
TLSContext *c = h->priv_data;
char buf[1024], key[1024];
int has_cert, has_key;
#if CONFIG_GNUTLS
int ret;
#endif
const char *p = strchr(uri, '?');
if (!p)
return;
if (av_find_info_tag(buf, sizeof(buf), "cafile", p)) {
#if CONFIG_GNUTLS
ret = gnutls_certificate_set_x509_trust_file(c->cred, buf, GNUTLS_X509_FMT_PEM);
if (ret < 0)
av_log(h, AV_LOG_ERROR, "%s\n", gnutls_strerror(ret));
#elif CONFIG_OPENSSL
if (!SSL_CTX_load_verify_locations(c->ctx, buf, NULL))
av_log(h, AV_LOG_ERROR, "SSL_CTX_load_verify_locations %s\n", ERR_error_string(ERR_get_error(), NULL));
#endif
}
has_cert = av_find_info_tag(buf, sizeof(buf), "cert", p);
has_key = av_find_info_tag(key, sizeof(key), "key", p);
#if CONFIG_GNUTLS
if (has_cert && has_key) {
ret = gnutls_certificate_set_x509_key_file(c->cred, buf, key, GNUTLS_X509_FMT_PEM);
if (ret < 0)
av_log(h, AV_LOG_ERROR, "%s\n", gnutls_strerror(ret));
} else if (has_cert ^ has_key) {
av_log(h, AV_LOG_ERROR, "cert and key required\n");
}
#elif CONFIG_OPENSSL
if (has_cert && !SSL_CTX_use_certificate_chain_file(c->ctx, buf))
av_log(h, AV_LOG_ERROR, "SSL_CTX_use_certificate_chain_file %s\n", ERR_error_string(ERR_get_error(), NULL));
if (has_key && !SSL_CTX_use_PrivateKey_file(c->ctx, key, SSL_FILETYPE_PEM))
av_log(h, AV_LOG_ERROR, "SSL_CTX_use_PrivateKey_file %s\n", ERR_error_string(ERR_get_error(), NULL));
#endif
}
| 1threat |
404 page not found in wordpress localhost : I have a website called http://www.aarohanstudycircle.com/ running successfully on server but when i downloaded all the wp files/folder and imported the database to localhost i am getting the page not found error..[Here is the error page][1]
[1]: https://i.stack.imgur.com/rB1MS.png
http://localhost/aarohanstudycircle/public/ | 0debug |
def find_Sum(arr,n):
return sum([x for x in arr if arr.count(x) > 1]) | 0debug |
between two dates in oracle : i need to get all the employees who's age will be 64 between two dates that i insert. any help would be appreciated. | 0debug |
Python 3.3: loop crashed i think : I'm working on a series of projects for schoolwork, and this is one of the challenges set:
"'''
Factorial Finder
The Factorial of a positive integer, n, is defined as the product of the sequence n, n-1, n-2, ...1 and the factorial of zero, 0, is defined as being 1.
Solve this using both loops and recursion.
'''
num = input("Type number: ")
num1 = str(float(num) - float(1))
fnum = float(num) * float(num1)
while (num1 != 1):
num1 = str(float(num) - float(1))
fnum = float(num) * float(num1)
else:
print(fnum)"
But when it comes to running the code, you input a number and the program outputs nothing. How can i solve this? | 0debug |
Trying to style an hr tag to have end caps : <p>I'm attempting to style an hr tag to have end caps like the attached image. While I could just remove the background from that image and set that as background, that won't change width with the page. At the moment, how to get this correctly made is eluding me.</p>
<p><a href="https://gyazo.com/a89aafb7a2d6c137a9052e6f111691ae" rel="nofollow">Image of the desired hr.</a></p>
| 0debug |
Numeric date changed to String : <p>I need help creating a function that takes a user input(Numeric Date) and turns it into a string
For Example:
input: 2018-06-20
output: June 20th 2018
any hints or code would help me out. Thank you </p>
| 0debug |
void ff_framequeue_skip_samples(FFFrameQueue *fq, size_t samples, AVRational time_base)
{
FFFrameBucket *b;
size_t bytes;
int planar, planes, i;
check_consistency(fq);
av_assert1(fq->queued);
b = bucket(fq, 0);
av_assert1(samples < b->frame->nb_samples);
planar = av_sample_fmt_is_planar(b->frame->format);
planes = planar ? b->frame->channels : 1;
bytes = samples * av_get_bytes_per_sample(b->frame->format);
if (!planar)
bytes *= b->frame->channels;
if (b->frame->pts != AV_NOPTS_VALUE)
b->frame->pts += av_rescale_q(samples, av_make_q(1, b->frame->sample_rate), time_base);
b->frame->nb_samples -= samples;
b->frame->linesize[0] -= bytes;
for (i = 0; i < planes; i++)
b->frame->extended_data[i] += bytes;
for (i = 0; i < planes && i < AV_NUM_DATA_POINTERS; i++)
b->frame->data[i] = b->frame->extended_data[i];
fq->total_samples_tail += samples;
ff_framequeue_update_peeked(fq, 0);
} | 1threat |
how to fixe Listview with check box : i have a listview with check box, if scrolled up or down checkbox will unchecked how can i fix this.
i want check box not to unchecke when scrolled up or down
please i need help to fix this problem
here is my listviwadapter
String myisme = "1";
private int SELF = 100;
static final int CUSTOM_DIALOG_ID1 = 1;
public FeedHomeAdapter(Context c, ArrayList<String> id, ArrayList<String> uname,
ArrayList<String> fname, ArrayList<String> time, ArrayList<String> status,
ArrayList<String> promo, ArrayList<String> ifliked, ArrayList<String> uid, ArrayList<String> pspic,
ArrayList<String> ppic, ArrayList<String> pcolor, ArrayList<String> slike, ArrayList<String> scomment,
ArrayList<String> slink, ArrayList<String> slinktext, ArrayList<String> sother,
ArrayList<String> sid, ArrayList<String> svideo, ArrayList<String> isfollow, ArrayList<String> ischat) {
this.mContext = c;
this.id = id;
this.puName = uname;
this.pfName = fname;
this.ptime = time;
this.psatus = status;
this.ppromo = promo;
this.pifliked = ifliked;
this.puid = uid;
this.pstatuspc = pspic;
this.pprofilepc = ppic;
this.pprofilecolor = pcolor;
this.statuslike = slike;
this.statuscomment = scomment;
this.statuslink = slink;
this.statuslinktext = slinktext;
this.statusother = sother;
this.statusid = sid;
this.statusvideo = svideo;
this.isfollowing = isfollow;
this.pischat = ischat;
}
public int getCount() {
// TODO Auto-generated method stub
return id.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return position;
}
public long getItemId(int position) {
return position;
}
public ArrayList<int[]> getSpans(String body, char prefix) {
ArrayList<int[]> spans = new ArrayList<int[]>();
Pattern pattern = Pattern.compile(prefix + "\\w+");
Matcher matcher = pattern.matcher(body);
// Check all occurrences
while (matcher.find()) {
int[] currentSpan = new int[2];
currentSpan[0] = matcher.start();
currentSpan[1] = matcher.end();
spans.add(currentSpan);
}
return spans;
}
public View getView(final int pos, View child, ViewGroup parent) {
final Holder mHolder;
if (child == null) {
child = LayoutInflater.from(mContext).inflate(R.layout.chat_display_item, parent, false);
LayoutInflater layoutInflater;
layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
child = layoutInflater.inflate(R.layout.card_layout, null);
mHolder = new Holder();
mHolder.txt_uName = (TextView) child.findViewById(R.id.name);
mHolder.txt_uName1 = (TextView) child.findViewById(R.id.name1);
mHolder.txt_fName = (TextView) child.findViewById(R.id.fname);
mHolder.txt_satus = (TextView) child.findViewById(R.id.note);
mHolder.txt_time = (TextView) child.findViewById(R.id.time);
mHolder.txt_linktext = (TextView) child.findViewById(R.id.lint_title);
mHolder.cunt_like = (TextView) child.findViewById(R.id.l_count);
mHolder.like_text = (TextView) child.findViewById(R.id.like_text);
mHolder.cunt_comment = (TextView) child.findViewById(R.id.c_count);
mHolder.com_text = (TextView) child.findViewById(R.id.com_text);
mHolder.txt_promo = (TextView) child.findViewById(R.id.promoted);
mHolder.like = (ThumbUpView) child.findViewById(R.id.tpv2);
mHolder.profile_pic = (CircleImageView) child.findViewById(R.id.profilePic);
mHolder.status_pic = (ProportionalImageView) child.findViewById(R.id.status_pic);
mHolder.video_cover = (RelativeLayout) child.findViewById(R.id.video_cover);
mHolder.video_view = (FensterVideoView) child.findViewById(R.id.play_video_texture);
mHolder.download = (LinearLayout) child.findViewById(R.id.download);
mHolder.error_d = (LinearLayout) child.findViewById(R.id.error_d);
mHolder.profile_view = (RelativeLayout) child.findViewById(R.id.id_to_profile);
mHolder.comment = (ImageButton) child.findViewById(R.id.replide);
child.setTag(mHolder);
} else {
mHolder = (Holder) child.getTag();
}
mHolder.txt_satus.setHighlightColor(Color.WHITE);
mHolder.txt_satus.setHighlightColor(Color.TRANSPARENT);
if (statuslike.get(pos).toString().equals("0")) {
mHolder.like_text.setVisibility(View.GONE);
} else {
mHolder.cunt_like.setText(statuslike.get(pos));
}
if (statuscomment.get(pos).toString().equals("0")) {
mHolder.com_text.setVisibility(View.GONE);
} else {
mHolder.cunt_like.setText(statuslike.get(pos));
mHolder.cunt_comment.setText(statuscomment.get(pos));
}
mHolder.txt_linktext.setText(statuslinktext.get(pos));
mHolder.txt_time.setText(ptime.get(pos));
if (pifliked.get(pos).toString().equals("liked")) {
//set liked
mHolder.like.Like();
} else {
//set like
mHolder.like.UnLike();
}
// init Effects class
Effects.getInstance().init(mContext);
mHolder.like.checkbox(new ThumbUpView.OnThumbUp() {
@Override
public void like(boolean like) {
FeedCache controller = new FeedCache(mContext);
dataBaseall = controller.getWritableDatabase();
ContentValues values = new ContentValues();
if (like) {
String yesliked = "liked";
values.put(FeedCache.KEY_IFLIKE, yesliked);
dataBaseall.update(FeedCache.TABLE_NAME, values, FeedCache.KEY_NOTEID + "= '" + statusid.get(pos) + "'", null);
mHolder.cunt_like.setText(String.valueOf(Integer.valueOf(mHolder.cunt_like.getText().toString()) + 1));
Effects.getInstance().playSound(Effects.SOUND_1);
} else {
String yeslike = "like";
values.put(FeedCache.KEY_IFLIKE, yeslike);
dataBaseall.update(FeedCache.TABLE_NAME, values, FeedCache.KEY_NOTEID + "= '" + statusid.get(pos) + "'", null);
mHolder.cunt_like.setText(String.valueOf(Integer.valueOf(mHolder.cunt_like.getText().toString()) - 1));
Effects.getInstance().playSound(Effects.SOUND_1);
}
//close database
dataBaseall.close();
}
});
public class Holder {
TextView txt_id;
TextView txt_satus;
TextView txt_time;
TextView txt_uName;
TextView txt_uName1;
TextView txt_fName;
TextView like_text;
TextView cunt_like;
TextView cunt_comment;
TextView com_text;
TextView txt_linktext;
TextView txt_promo;
ThumbUpView checkbox;
}
}
}
| 0debug |
Unwanted space at the extreme bottom of the home page of wordpress website : <p>I am having a problem with the website i've created. Its having unwanted space at the extreme bottom of the home page. No matter what i did, it still remains there. The website is built in wordpress.
I tried removing the closing <strong>php</strong> tag from the bottom of <strong>functions.php</strong>.
Nothing's really worked.</p>
<p>The page link is <strong><a href="http://icoachgym.com/" rel="nofollow noreferrer">http://icoachgym.com/</a></strong></p>
| 0debug |
void ide_sector_write(IDEState *s)
{
int64_t sector_num;
int n;
s->status = READY_STAT | SEEK_STAT | BUSY_STAT;
sector_num = ide_get_sector(s);
#if defined(DEBUG_IDE)
printf("sector=%" PRId64 "\n", sector_num);
#endif
n = s->nsector;
if (n > s->req_nb_sectors) {
n = s->req_nb_sectors;
}
if (!ide_sect_range_ok(s, sector_num, n)) {
ide_rw_error(s);
return;
}
s->iov.iov_base = s->io_buffer;
s->iov.iov_len = n * BDRV_SECTOR_SIZE;
qemu_iovec_init_external(&s->qiov, &s->iov, 1);
block_acct_start(bdrv_get_stats(s->bs), &s->acct,
n * BDRV_SECTOR_SIZE, BLOCK_ACCT_READ);
s->pio_aiocb = bdrv_aio_writev(s->bs, sector_num, &s->qiov, n,
ide_sector_write_cb, s);
}
| 1threat |
def parabola_focus(a, b, c):
focus= (((-b / (2 * a)),(((4 * a * c) - (b * b) + 1) / (4 * a))))
return focus | 0debug |
to count the number of square integers between AA and BB (both inclusive) output shows run time error when both are 9 digits :
#include<cmath>
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int t;long long a, b;long long x; //declartion
cin>>t; //1≤T≤1001≤T≤100
if(t<1||t>100)
exit(0);
for(int i=0;i<t;i++){
long long c=0;
cin>>a>>b;
if(a>b||a<1||a>pow(10,9)||b<1) //1≤A≤B≤109
exit(0);
for(long long y=a;y<=b;y++){
x= floor(sqrt(y));
if(pow(x,2)==y){
c++;
}
}cout<<c<<endl;
}
return 0;`
}
Watson gives two integers (AA and BB) to Sherlock and asks if he can count the number of square integers between AA and BB (both inclusive).
this is my code please tell me why iam getting error time? | 0debug |
Auto generating new jPanels onto a JFrame : I'm currently working on a blog/forum portal as a school project for University.
I'm working in netbeans 8.2 using Swing as the GUI.
My question is if it's possible to auto generate an already pre-made JPanel class onto a JFrame so that it looks like the questions on the main page of stackoverflow.
So basically when a post is created it goes into the database -> I use a getter method to fill the info on the JPanel and then it auto generate itself onto the JFrame so that I don't need to create several fixed JPanels onto the Jframe.
So if there are no posts the page would be blank. When a new post is created it shows up as the first post, the next one lies over that one and so on so forth.
Is it possible to do this in Netbeans?
| 0debug |
document.getElementById('input').innerHTML = user_input; | 1threat |
static void sigp_store_adtl_status(void *arg)
{
SigpInfo *si = arg;
if (!kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS)) {
set_sigp_status(si, SIGP_STAT_INVALID_ORDER);
return;
}
if (s390_cpu_get_state(si->cpu) != CPU_STATE_STOPPED) {
set_sigp_status(si, SIGP_STAT_INCORRECT_STATE);
return;
}
if (si->param & 0x3ff) {
set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);
return;
}
cpu_synchronize_state(CPU(si->cpu));
if (kvm_s390_store_adtl_status(si->cpu, si->param)) {
set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER);
return;
}
si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
}
| 1threat |
void dsputil_init_armv4l(DSPContext* c, AVCodecContext *avctx)
{
const int idct_algo= avctx->idct_algo;
ff_put_pixels_clamped = c->put_pixels_clamped;
ff_add_pixels_clamped = c->add_pixels_clamped;
if(idct_algo==FF_IDCT_ARM){
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_ARM){
c->idct_put= j_rev_dct_ARM_put;
c->idct_add= j_rev_dct_ARM_add;
c->idct = j_rev_dct_ARM;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
} else if (idct_algo==FF_IDCT_SIMPLEARM){
c->idct_put= simple_idct_ARM_put;
c->idct_add= simple_idct_ARM_add;
c->idct = simple_idct_ARM;
}
} | 1threat |
Is there anyway to do "strikethrough" on a text file in Sublime? : <p>I like to make text files with Sublime and use them as daily-reminder lists. I would like to be able to strike a line through the things I've completed versus erase them. Is there any easy way to do this on Sublime?</p>
| 0debug |
static int truespeech_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
TSContext *c = avctx->priv_data;
int i, j;
short *samples = data;
int consumed = 0;
int16_t out_buf[240];
int iterations;
if (!buf_size)
return 0;
if (buf_size < 32) {
av_log(avctx, AV_LOG_ERROR,
"Too small input buffer (%d bytes), need at least 32 bytes\n", buf_size);
return -1;
}
iterations = FFMIN(buf_size / 32, *data_size / 480);
for(j = 0; j < iterations; j++) {
truespeech_read_frame(c, buf + consumed);
consumed += 32;
truespeech_correlate_filter(c);
truespeech_filters_merge(c);
memset(out_buf, 0, 240 * 2);
for(i = 0; i < 4; i++) {
truespeech_apply_twopoint_filter(c, i);
truespeech_place_pulses(c, out_buf + i * 60, i);
truespeech_update_filters(c, out_buf + i * 60, i);
truespeech_synth(c, out_buf + i * 60, i);
}
truespeech_save_prevvec(c);
for(i = 0; i < 240; i++)
*samples++ = out_buf[i];
}
*data_size = consumed * 15;
return consumed;
}
| 1threat |
Stop an audio file playing in html page : Im programming a very basic text adventure to show my 8 year old "old computer games". I have music playing and I want it to stop when I get to the game over routine.
I initialize it in the body:
> <audio id="music" src="sw_music.mp3" autoplay></audio>
and try to stop it here:
> case 25://You're dead
> document.getElementById("audio");
> audio.pause();
Thanks for any help I get. If any more code is needed, please advise. I tried using the audio stop in a function but it did not stop.
I also use a laser blast audio component:
> <audio id="laser" src="Laser.mp3"></audio>
| 0debug |
int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf)
{
int rc;
cmd->lba = -1;
cmd->len = scsi_cdb_length(buf);
switch (dev->type) {
case TYPE_TAPE:
rc = scsi_req_stream_xfer(cmd, dev, buf);
break;
case TYPE_MEDIUM_CHANGER:
rc = scsi_req_medium_changer_xfer(cmd, dev, buf);
break;
default:
rc = scsi_req_xfer(cmd, dev, buf);
break;
}
if (rc != 0)
return rc;
memcpy(cmd->buf, buf, cmd->len);
scsi_cmd_xfer_mode(cmd);
cmd->lba = scsi_cmd_lba(cmd);
return 0;
}
| 1threat |
mongoose query same field with different values : <p>Is there a way to user <code>mongoose.find({title:'some title'})</code> to query the same field with multiple values? For example something like this <code>mongoose.find({title:'some title', title:'some other title'})</code> sends back only documents matching <code>title:'some other title</code> is there a way to accomplish this ?</p>
| 0debug |
char *socket_address_to_string(struct SocketAddressLegacy *addr, Error **errp)
{
char *buf;
InetSocketAddress *inet;
switch (addr->type) {
case SOCKET_ADDRESS_LEGACY_KIND_INET:
inet = addr->u.inet.data;
if (strchr(inet->host, ':') == NULL) {
buf = g_strdup_printf("%s:%s", inet->host, inet->port);
} else {
buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);
}
break;
case SOCKET_ADDRESS_LEGACY_KIND_UNIX:
buf = g_strdup(addr->u.q_unix.data->path);
break;
case SOCKET_ADDRESS_LEGACY_KIND_FD:
buf = g_strdup(addr->u.fd.data->str);
break;
case SOCKET_ADDRESS_LEGACY_KIND_VSOCK:
buf = g_strdup_printf("%s:%s",
addr->u.vsock.data->cid,
addr->u.vsock.data->port);
break;
default:
abort();
}
return buf;
}
| 1threat |
GetHashCode With Generic Collection Returns : It looks like hash code issues and implementing your own equality logic have been beaten to death, but I cannot seem to find a definitive answer to this.
I have a custom object (Step) that overrides Equals, GetHashCode, ==, and != as suggested by the <a href="https://msdn.microsoft.com/ru-ru/library/ms173147(v=vs.80).aspx">MSDN documentation</a>. This object by itself works fine; When comparing a Step to a Step, the equality operators work as expected. Note that by equality I'm referring to the values of the Step's properties, not reference equality.
I have a second object (Steps) that stores the Step object in a generic list. Now I want to see if a list of Step objects is equal to another list of Step objects. In the Steps object I overrode the various methods and operators as I had done in Step. For the GetHashCode override, I iterate through the Step list and combine the hash codes:
foreach(var step in steplist.Steps)
{
hash += step.GetHashCode()
}
return hash
Simple. But it does not work. The hash codes for two separate lists with equal Step objects values return different hash codes. I'm assuming I'm not implementing the hash code override correctly.
I'm about ready to hard code the returning hash code to zero and call it a day. Any insight is appreciated. | 0debug |
'mat-toolbar' is not a known element - Angular 5 : <p>I have created a new project, and I am trying to add <code>angular-material</code>.</p>
<p>I have created <code>material.module.ts</code> in my <code>app</code> folder:</p>
<pre><code>import { NgModule } from '@angular/core';
import {
MatButtonModule,
MatMenuModule,
MatIconModule,
MatCardModule,
MatSidenavModule,
MatFormFieldModule,
MatInputModule,
MatTooltipModule,
MatToolbarModule
} from '@angular/material';
@NgModule({
imports: [
MatButtonModule,
MatMenuModule,
MatIconModule,
MatCardModule,
MatSidenavModule,
MatFormFieldModule,
MatInputModule,
MatTooltipModule,
MatToolbarModule,
],
exports: [
MatButtonModule,
MatMenuModule,
MatIconModule,
MatCardModule,
MatSidenavModule,
MatFormFieldModule,
MatInputModule,
MatTooltipModule,
MatToolbarModule
]
})
export class MaterialModule { }
</code></pre>
<p>and I have imported it into one of my components:</p>
<pre><code>import { MaterialModule } from '../material.module';
</code></pre>
<p>Furthermore, I have set up angular material in <code>index.html</code></p>
<pre><code> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</code></pre>
<p>in my <code>style.css</code> </p>
<pre><code>@import '~@angular/material/prebuilt-themes/pink-bluegrey.css';
</code></pre>
<p>I know that it is working cause I have shown a <code>material-icon</code> as a test:</p>
<pre><code><i class="material-icons">face</i>
</code></pre>
<p>but when I try to create the footer it fails and it shows this message:</p>
<blockquote>
<p>Uncaught Error: Template parse errors:
'mat-toolbar' is not a known element:
1. If 'mat-toolbar' is an Angular component, then verify that it is part of this module.
2. If 'mat-toolbar' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. </p>
</blockquote>
| 0debug |
Comparing two empty array not working in javascript : <p>In my current project I am taking a request parameter with a value of either array or a string. But if I get an array it would be an empty array. So what I did is I checked the type first and then I worked with the value. But then I did something like this</p>
<pre><code>const reqParam = []
if (reqParam === []) {
console.log('empty array')
} else {
console.log('string')
}
</code></pre>
<p>But <code>reqParam</code> despite of being an empty array is giving me false while comparing with <code>[]</code>. Why it is behaving like this? Thanks in advance.</p>
| 0debug |
static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col)
{
int c0, c1, c2, c3, a0, a1, a2, a3;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
a0 = col[8*0];
a1 = col[8*2];
a2 = col[8*4];
a3 = col[8*6];
c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1));
c1 = a1 * C1 + a3 * C2;
c3 = a1 * C2 - a3 * C1;
dest[0] = cm[(c0 + c1) >> C_SHIFT];
dest += line_size;
dest[0] = cm[(c2 + c3) >> C_SHIFT];
dest += line_size;
dest[0] = cm[(c2 - c3) >> C_SHIFT];
dest += line_size;
dest[0] = cm[(c0 - c1) >> C_SHIFT];
}
| 1threat |
MigrationState *migrate_init(const MigrationParams *params)
{
MigrationState *s = migrate_get_current();
int64_t bandwidth_limit = s->bandwidth_limit;
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
int64_t xbzrle_cache_size = s->xbzrle_cache_size;
int compress_level = s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL];
int compress_thread_count =
s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS];
int decompress_thread_count =
s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS];
int x_cpu_throttle_initial =
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL];
int x_cpu_throttle_increment =
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT];
memcpy(enabled_capabilities, s->enabled_capabilities,
sizeof(enabled_capabilities));
memset(s, 0, sizeof(*s));
s->params = *params;
memcpy(s->enabled_capabilities, enabled_capabilities,
sizeof(enabled_capabilities));
s->xbzrle_cache_size = xbzrle_cache_size;
s->parameters[MIGRATION_PARAMETER_COMPRESS_LEVEL] = compress_level;
s->parameters[MIGRATION_PARAMETER_COMPRESS_THREADS] =
compress_thread_count;
s->parameters[MIGRATION_PARAMETER_DECOMPRESS_THREADS] =
decompress_thread_count;
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL] =
x_cpu_throttle_initial;
s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT] =
x_cpu_throttle_increment;
s->bandwidth_limit = bandwidth_limit;
migrate_set_state(s, MIGRATION_STATUS_NONE, MIGRATION_STATUS_SETUP);
QSIMPLEQ_INIT(&s->src_page_requests);
s->total_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
return s;
}
| 1threat |
CoreBluetooth XPC Connection Invalid on dismiss viewcontroller : <p>After I have finished disconnecting from my bluetooth devices, seeing that they have disconnected in the didDisconnectPeripheral delegate, I attempt to dismiss my viewcontroller.</p>
<p>When this happens I see the message: "[CoreBlueooth] XPC Connection Invalid"</p>
<p>Is there something in specific that has to be cleaned up with Bluetooth before the viewcontroller is dismissed?</p>
| 0debug |
int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int *consumed, int src_size, int dst_size, int update_ctx){
int dst_index, i;
int index= c->index;
int frac= c->frac;
int dst_incr_frac= c->dst_incr % c->src_incr;
int dst_incr= c->dst_incr / c->src_incr;
int compensation_distance= c->compensation_distance;
av_assert1(c->filter_shift == FILTER_SHIFT);
av_assert1(c->felem_size == sizeof(FELEM));
if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){
int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index;
int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr;
int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr;
dst_size= FFMIN(dst_size, new_size);
for(dst_index=0; dst_index < dst_size; dst_index++){
dst[dst_index] = src[index2>>32];
index2 += incr;
}
index += dst_index * dst_incr;
index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr;
frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr;
av_assert2(index >= 0);
*consumed= index;
index = 0;
} else if (compensation_distance == 0 && index >= 0) {
int64_t end_index = (1 + src_size - c->filter_length) << c->phase_shift;
int64_t delta_frac = (end_index - index) * c->src_incr - c->frac;
int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr;
int n = FFMIN(dst_size, delta_n);
int sample_index;
if (!c->linear) {
sample_index = index >> c->phase_shift;
index &= c->phase_mask;
for (dst_index = 0; dst_index < n; dst_index++) {
FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index;
#ifdef COMMON_CORE
COMMON_CORE
#else
FELEM2 val=0;
for (i = 0; i < c->filter_length; i++) {
val += src[sample_index + i] * (FELEM2)filter[i];
}
OUT(dst[dst_index], val);
#endif
frac += dst_incr_frac;
index += dst_incr;
if (frac >= c->src_incr) {
frac -= c->src_incr;
index++;
}
sample_index += index >> c->phase_shift;
index &= c->phase_mask;
}
} else {
sample_index = index >> c->phase_shift;
index &= c->phase_mask;
for (dst_index = 0; dst_index < n; dst_index++) {
FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index;
FELEM2 val=0, v2 = 0;
#ifdef LINEAR_CORE
LINEAR_CORE
#else
for (i = 0; i < c->filter_length; i++) {
val += src[sample_index + i] * (FELEM2)filter[i];
v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc];
}
#endif
val += (v2 - val) * (FELEML) frac / c->src_incr;
OUT(dst[dst_index], val);
frac += dst_incr_frac;
index += dst_incr;
if (frac >= c->src_incr) {
frac -= c->src_incr;
index++;
}
sample_index += index >> c->phase_shift;
index &= c->phase_mask;
}
}
*consumed = sample_index;
} else {
int sample_index = 0;
for(dst_index=0; dst_index < dst_size; dst_index++){
FELEM *filter;
FELEM2 val=0;
sample_index += index >> c->phase_shift;
index &= c->phase_mask;
filter = ((FELEM*)c->filter_bank) + c->filter_alloc*index;
if(sample_index + c->filter_length > src_size || -sample_index >= src_size){
break;
}else if(sample_index < 0){
for(i=0; i<c->filter_length; i++)
val += src[FFABS(sample_index + i)] * (FELEM2)filter[i];
OUT(dst[dst_index], val);
}else if(c->linear){
FELEM2 v2=0;
#ifdef LINEAR_CORE
LINEAR_CORE
#else
for(i=0; i<c->filter_length; i++){
val += src[sample_index + i] * (FELEM2)filter[i];
v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc];
}
#endif
val+=(v2-val)*(FELEML)frac / c->src_incr;
OUT(dst[dst_index], val);
}else{
#ifdef COMMON_CORE
COMMON_CORE
#else
for(i=0; i<c->filter_length; i++){
val += src[sample_index + i] * (FELEM2)filter[i];
}
OUT(dst[dst_index], val);
#endif
}
frac += dst_incr_frac;
index += dst_incr;
if(frac >= c->src_incr){
frac -= c->src_incr;
index++;
}
if(dst_index + 1 == compensation_distance){
compensation_distance= 0;
dst_incr_frac= c->ideal_dst_incr % c->src_incr;
dst_incr= c->ideal_dst_incr / c->src_incr;
}
}
*consumed= FFMAX(sample_index, 0);
index += FFMIN(sample_index, 0) << c->phase_shift;
if(compensation_distance){
compensation_distance -= dst_index;
av_assert1(compensation_distance > 0);
}
}
if(update_ctx){
c->frac= frac;
c->index= index;
c->dst_incr= dst_incr_frac + c->src_incr*dst_incr;
c->compensation_distance= compensation_distance;
}
return dst_index;
}
| 1threat |
static void glib_select_fill(int *max_fd, fd_set *rfds, fd_set *wfds,
fd_set *xfds, struct timeval *tv)
{
GMainContext *context = g_main_context_default();
int i;
int timeout = 0, cur_timeout;
g_main_context_prepare(context, &max_priority);
n_poll_fds = g_main_context_query(context, max_priority, &timeout,
poll_fds, ARRAY_SIZE(poll_fds));
g_assert(n_poll_fds <= ARRAY_SIZE(poll_fds));
for (i = 0; i < n_poll_fds; i++) {
GPollFD *p = &poll_fds[i];
if ((p->events & G_IO_IN)) {
FD_SET(p->fd, rfds);
*max_fd = MAX(*max_fd, p->fd);
}
if ((p->events & G_IO_OUT)) {
FD_SET(p->fd, wfds);
*max_fd = MAX(*max_fd, p->fd);
}
if ((p->events & G_IO_ERR)) {
FD_SET(p->fd, xfds);
*max_fd = MAX(*max_fd, p->fd);
}
}
cur_timeout = (tv->tv_sec * 1000) + ((tv->tv_usec + 500) / 1000);
if (timeout >= 0 && timeout < cur_timeout) {
tv->tv_sec = timeout / 1000;
tv->tv_usec = (timeout % 1000) * 1000;
}
}
| 1threat |
Acces Database Symfony2 : Does anyone know how to physically access a database thats running under a symfony2 application? Like in the way you can see a database with phpmyadmin?
Might be I've been searching the wrong terms, but can't seem to find the answer. | 0debug |
Replace a column of an numpy array by the column of another numpy array : <p>I would like to replace the i-th column of an array A by the j-th column of an array B. Any help ?</p>
<p>Thanks</p>
| 0debug |
static int flic_decode_frame_8BPP(AVCodecContext *avctx,
void *data, int *got_frame,
const uint8_t *buf, int buf_size)
{
FlicDecodeContext *s = avctx->priv_data;
GetByteContext g2;
int pixel_ptr;
int palette_ptr;
unsigned char palette_idx1;
unsigned char palette_idx2;
unsigned int frame_size;
int num_chunks;
unsigned int chunk_size;
int chunk_type;
int i, j, ret;
int color_packets;
int color_changes;
int color_shift;
unsigned char r, g, b;
int lines;
int compressed_lines;
int starting_line;
signed short line_packets;
int y_ptr;
int byte_run;
int pixel_skip;
int pixel_countdown;
unsigned char *pixels;
unsigned int pixel_limit;
bytestream2_init(&g2, buf, buf_size);
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;
pixels = s->frame->data[0];
pixel_limit = s->avctx->height * s->frame->linesize[0];
if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + AV_INPUT_BUFFER_PADDING_SIZE))
frame_size = bytestream2_get_le32(&g2);
if (frame_size > buf_size)
frame_size = buf_size;
bytestream2_skip(&g2, 2);
num_chunks = bytestream2_get_le16(&g2);
bytestream2_skip(&g2, 8);
if (frame_size < 16)
frame_size -= 16;
while ((frame_size >= 6) && (num_chunks > 0) &&
bytestream2_get_bytes_left(&g2) >= 4) {
int stream_ptr_after_chunk;
chunk_size = bytestream2_get_le32(&g2);
if (chunk_size > frame_size) {
av_log(avctx, AV_LOG_WARNING,
"Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size);
chunk_size = frame_size;
}
stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 + chunk_size;
chunk_type = bytestream2_get_le16(&g2);
switch (chunk_type) {
case FLI_256_COLOR:
case FLI_COLOR:
if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE))
color_shift = 0;
else
color_shift = 2;
color_packets = bytestream2_get_le16(&g2);
palette_ptr = 0;
for (i = 0; i < color_packets; i++) {
palette_ptr += bytestream2_get_byte(&g2);
color_changes = bytestream2_get_byte(&g2);
if (color_changes == 0)
color_changes = 256;
if (bytestream2_tell(&g2) + color_changes * 3 > stream_ptr_after_chunk)
break;
for (j = 0; j < color_changes; j++) {
unsigned int entry;
if ((unsigned)palette_ptr >= 256)
palette_ptr = 0;
r = bytestream2_get_byte(&g2) << color_shift;
g = bytestream2_get_byte(&g2) << color_shift;
b = bytestream2_get_byte(&g2) << color_shift;
entry = 0xFFU << 24 | r << 16 | g << 8 | b;
if (color_shift == 2)
entry |= entry >> 6 & 0x30303;
if (s->palette[palette_ptr] != entry)
s->new_palette = 1;
s->palette[palette_ptr++] = entry;
}
}
break;
case FLI_DELTA:
y_ptr = 0;
compressed_lines = bytestream2_get_le16(&g2);
while (compressed_lines > 0) {
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
break;
if (y_ptr > pixel_limit)
line_packets = bytestream2_get_le16(&g2);
if ((line_packets & 0xC000) == 0xC000) {
line_packets = -line_packets;
if (line_packets > s->avctx->height)
y_ptr += line_packets * s->frame->linesize[0];
} else if ((line_packets & 0xC000) == 0x4000) {
av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets);
} else if ((line_packets & 0xC000) == 0x8000) {
pixel_ptr= y_ptr + s->frame->linesize[0] - 1;
CHECK_PIXEL_PTR(0);
pixels[pixel_ptr] = line_packets & 0xff;
} else {
compressed_lines--;
pixel_ptr = y_ptr;
CHECK_PIXEL_PTR(0);
pixel_countdown = s->avctx->width;
for (i = 0; i < line_packets; i++) {
if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk)
break;
pixel_skip = bytestream2_get_byte(&g2);
pixel_ptr += pixel_skip;
pixel_countdown -= pixel_skip;
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (byte_run < 0) {
byte_run = -byte_run;
palette_idx1 = bytestream2_get_byte(&g2);
palette_idx2 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run * 2);
for (j = 0; j < byte_run; j++, pixel_countdown -= 2) {
pixels[pixel_ptr++] = palette_idx1;
pixels[pixel_ptr++] = palette_idx2;
}
} else {
CHECK_PIXEL_PTR(byte_run * 2);
if (bytestream2_tell(&g2) + byte_run * 2 > stream_ptr_after_chunk)
break;
for (j = 0; j < byte_run * 2; j++, pixel_countdown--) {
pixels[pixel_ptr++] = bytestream2_get_byte(&g2);
}
}
}
y_ptr += s->frame->linesize[0];
}
}
break;
case FLI_LC:
starting_line = bytestream2_get_le16(&g2);
y_ptr = 0;
y_ptr += starting_line * s->frame->linesize[0];
compressed_lines = bytestream2_get_le16(&g2);
while (compressed_lines > 0) {
pixel_ptr = y_ptr;
CHECK_PIXEL_PTR(0);
pixel_countdown = s->avctx->width;
if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk)
break;
line_packets = bytestream2_get_byte(&g2);
if (line_packets > 0) {
for (i = 0; i < line_packets; i++) {
if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk)
break;
pixel_skip = bytestream2_get_byte(&g2);
pixel_ptr += pixel_skip;
pixel_countdown -= pixel_skip;
byte_run = sign_extend(bytestream2_get_byte(&g2),8);
if (byte_run > 0) {
CHECK_PIXEL_PTR(byte_run);
if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk)
break;
for (j = 0; j < byte_run; j++, pixel_countdown--) {
pixels[pixel_ptr++] = bytestream2_get_byte(&g2);
}
} else if (byte_run < 0) {
byte_run = -byte_run;
palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++, pixel_countdown--) {
pixels[pixel_ptr++] = palette_idx1;
}
}
}
}
y_ptr += s->frame->linesize[0];
compressed_lines--;
}
break;
case FLI_BLACK:
memset(pixels, 0,
s->frame->linesize[0] * s->avctx->height);
break;
case FLI_BRUN:
y_ptr = 0;
for (lines = 0; lines < s->avctx->height; lines++) {
pixel_ptr = y_ptr;
bytestream2_skip(&g2, 1);
pixel_countdown = s->avctx->width;
while (pixel_countdown > 0) {
if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk)
break;
byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
if (!byte_run) {
av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
}
if (byte_run > 0) {
palette_idx1 = bytestream2_get_byte(&g2);
CHECK_PIXEL_PTR(byte_run);
for (j = 0; j < byte_run; j++) {
pixels[pixel_ptr++] = palette_idx1;
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
pixel_countdown, lines);
}
} else {
byte_run = -byte_run;
CHECK_PIXEL_PTR(byte_run);
if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk)
break;
for (j = 0; j < byte_run; j++) {
pixels[pixel_ptr++] = bytestream2_get_byte(&g2);
pixel_countdown--;
if (pixel_countdown < 0)
av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n",
pixel_countdown, lines);
}
}
}
y_ptr += s->frame->linesize[0];
}
break;
case FLI_COPY:
if (chunk_size - 6 != FFALIGN(s->avctx->width, 4) * s->avctx->height) {
av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \
"has incorrect size, skipping chunk\n", chunk_size - 6);
bytestream2_skip(&g2, chunk_size - 6);
} else {
for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height;
y_ptr += s->frame->linesize[0]) {
bytestream2_get_buffer(&g2, &pixels[y_ptr],
s->avctx->width);
if (s->avctx->width & 3)
bytestream2_skip(&g2, 4 - (s->avctx->width & 3));
}
}
break;
case FLI_MINI:
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type);
break;
}
if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) {
bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2));
} else {
av_log(avctx, AV_LOG_ERROR, "Chunk overread\n");
break;
}
frame_size -= chunk_size;
num_chunks--;
}
if (bytestream2_get_bytes_left(&g2) > 2)
av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \
"and final chunk ptr = %d\n", buf_size,
buf_size - bytestream2_get_bytes_left(&g2));
memcpy(s->frame->data[1], s->palette, AVPALETTE_SIZE);
if (s->new_palette) {
s->frame->palette_has_changed = 1;
s->new_palette = 0;
}
if ((ret = av_frame_ref(data, s->frame)) < 0)
return ret;
*got_frame = 1;
return buf_size;
} | 1threat |
static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
{
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
AVStream *st = s->streams[pkt->stream_index];
int64_t pos = avio_tell(pb);
int padding = 0;
int packet_start_offset = avio_tell(pb) / 1024;
gxf_write_packet_header(pb, PKT_MEDIA);
if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO && pkt->size % 4)
padding = 4 - pkt->size % 4;
else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
padding = GXF_AUDIO_PACKET_SIZE - pkt->size;
gxf_write_media_preamble(s, pkt, pkt->size + padding);
avio_write(pb, pkt->data, pkt->size);
gxf_write_padding(pb, padding);
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (!(gxf->flt_entries_nb % 500)) {
int err;
if ((err = av_reallocp_array(&gxf->flt_entries,
gxf->flt_entries_nb + 500,
sizeof(*gxf->flt_entries))) < 0) {
gxf->flt_entries_nb = 0;
av_log(s, AV_LOG_ERROR, "could not reallocate flt entries\n");
return err;
}
}
gxf->flt_entries[gxf->flt_entries_nb++] = packet_start_offset;
gxf->nb_fields += 2;
}
updatePacketSize(pb, pos);
gxf->packet_count++;
if (gxf->packet_count == 100) {
gxf_write_map_packet(s, 0);
gxf->packet_count = 0;
}
return 0;
}
| 1threat |
string variable preventing class data from printing : Whenever I try this:
x = input()
showstat(x)
def showstat(y):
print(y.thing)
It comes back as an error, I know *why* it doesn't work; the input is a string, and therefore would be read as:
print("foo".thing)
but I don't know how to change it's data type in order to make it function properly. | 0debug |
int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
hwaddr rtas_size)
{
int ret;
int i;
ret = fdt_add_mem_rsv(fdt, rtas_addr, rtas_size);
if (ret < 0) {
fprintf(stderr, "Couldn't add RTAS reserve entry: %s\n",
fdt_strerror(ret));
return ret;
}
ret = qemu_fdt_setprop_cell(fdt, "/rtas", "linux,rtas-base",
rtas_addr);
if (ret < 0) {
fprintf(stderr, "Couldn't add linux,rtas-base property: %s\n",
fdt_strerror(ret));
return ret;
}
ret = qemu_fdt_setprop_cell(fdt, "/rtas", "linux,rtas-entry",
rtas_addr);
if (ret < 0) {
fprintf(stderr, "Couldn't add linux,rtas-entry property: %s\n",
fdt_strerror(ret));
return ret;
}
ret = qemu_fdt_setprop_cell(fdt, "/rtas", "rtas-size",
rtas_size);
if (ret < 0) {
fprintf(stderr, "Couldn't add rtas-size property: %s\n",
fdt_strerror(ret));
return ret;
}
for (i = 0; i < TOKEN_MAX; i++) {
struct rtas_call *call = &rtas_table[i];
if (!call->name) {
continue;
}
ret = qemu_fdt_setprop_cell(fdt, "/rtas", call->name,
i + TOKEN_BASE);
if (ret < 0) {
fprintf(stderr, "Couldn't add rtas token for %s: %s\n",
call->name, fdt_strerror(ret));
return ret;
}
}
return 0;
}
| 1threat |
static uint32_t cadence_ttc_read_imp(void *opaque, target_phys_addr_t offset)
{
CadenceTimerState *s = cadence_timer_from_addr(opaque, offset);
uint32_t value;
cadence_timer_sync(s);
cadence_timer_run(s);
switch (offset) {
case 0x00:
case 0x04:
case 0x08:
return s->reg_clock;
case 0x0c:
case 0x10:
case 0x14:
return s->reg_count;
case 0x18:
case 0x1c:
case 0x20:
return (uint16_t)(s->reg_value >> 16);
case 0x24:
case 0x28:
case 0x2c:
return s->reg_interval;
case 0x30:
case 0x34:
case 0x38:
return s->reg_match[0];
case 0x3c:
case 0x40:
case 0x44:
return s->reg_match[1];
case 0x48:
case 0x4c:
case 0x50:
return s->reg_match[2];
case 0x54:
case 0x58:
case 0x5c:
value = s->reg_intr;
s->reg_intr = 0;
cadence_timer_update(s);
return value;
case 0x60:
case 0x64:
case 0x68:
return s->reg_intr_en;
case 0x6c:
case 0x70:
case 0x74:
return s->reg_event_ctrl;
case 0x78:
case 0x7c:
case 0x80:
return s->reg_event;
default:
return 0;
}
}
| 1threat |
does microcontroller pull up/ pull down resistance chage with voltage 5v to 3v? : <p>Normally I would use a 10k ohm resistor for 5v circuits for pull up/down pins</p>
<p>Is it better to use a different value resistor on 3v pins?
If so what would be required?</p>
<p>ohms law and all.</p>
<p>Regards mike</p>
| 0debug |
How do I create an optional C++ template parameter for a class? : <p>I have a class right now that is defined as</p>
<pre><code>template <class A> class MyClass { };
</code></pre>
<p>I would like to add an optional template parameter B which would lead to</p>
<pre><code>template <class A, class B> class MyClass {};
</code></pre>
<p>but I want it in such a way such that if B is not specified, i.e. if I define</p>
<pre><code>MyClass<double> x;
</code></pre>
<p>then B will be the same type as A (or double in the above case) as well.</p>
<p>Is that even possible in C++?</p>
| 0debug |
def re_arrange_array(arr, n):
j=0
for i in range(0, n):
if (arr[i] < 0):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
j = j + 1
return arr | 0debug |
Custom compare function for sort() works without argument(c++) : <p>Why the custom compare function for sort() works without argument(c++)?</p>
<pre><code>void show(int a[])
{
cout<<endl;
for(int i=0;i<10;i++)
{
cout<<a[i]<<endl;
}
}
bool compare(int a,int b)
{
return a>b;
}
int main()
{
int a[10]={12,32,45,22,643,53,53,32,4,32};
sort(a,a+10,compare);
show(a);
return 0;
}
</code></pre>
<p>Thank you</p>
| 0debug |
Apollo Query with Variable : <p>Just a basic apollo query request</p>
<pre><code>this.client.query({
query: gql`
{
User(okta: $okta){
id
}
}`
}).then(result => {
this.setState({userid: result.data.User});
console.log(this.state.userid.id)
}).catch(error => {
this.setState({error: <Alert color="danger">Error</Alert>});
});
</code></pre>
<p>The question is, how/where to set the $okta variable.</p>
<p>Didn't find a solution on Stackoverflow or Google - would be great if someone could help me:)</p>
| 0debug |
Running chmod command as root with "." : <pre><code>Line#1 pwd
Line#2 /Users/jigarnaik/Documents/test
Line#3 sh-3.2# chown -R jigarnaik .
</code></pre>
<p>What will be the effect of line no 3 ?
Will it change owner of the entire device in linux OS OR
the current folder and it's sub-folders OR
all the folders and files in the path given ?</p>
<p>I ran the command as root </p>
| 0debug |
int64_t cache_resize(PageCache *cache, int64_t new_num_pages)
{
PageCache *new_cache;
int64_t i;
CacheItem *old_it, *new_it;
g_assert(cache);
if (cache->page_cache == NULL) {
return -1;
}
if (pow2floor(new_num_pages) == cache->max_num_items) {
return cache->max_num_items;
}
new_cache = cache_init(new_num_pages, cache->page_size);
if (!(new_cache)) {
DPRINTF("Error creating new cache\n");
return -1;
}
for (i = 0; i < cache->max_num_items; i++) {
old_it = &cache->page_cache[i];
if (old_it->it_addr != -1) {
new_it = cache_get_by_addr(new_cache, old_it->it_addr);
if (new_it->it_data) {
if (new_it->it_age >= old_it->it_age) {
g_free(old_it->it_data);
} else {
g_free(new_it->it_data);
new_it->it_data = old_it->it_data;
new_it->it_age = old_it->it_age;
new_it->it_addr = old_it->it_addr;
}
} else {
cache_insert(new_cache, old_it->it_addr, old_it->it_data);
}
}
}
cache->page_cache = new_cache->page_cache;
cache->max_num_items = new_cache->max_num_items;
cache->num_items = new_cache->num_items;
g_free(new_cache);
return cache->max_num_items;
} | 1threat |
Why do I get an invalid syntax error on the "i" in the for loop (python) : <p>I am learning to program with Python. Currently, I am trying to write a simple function that will check to see if a number that the user has entered is prime. The following portion of the function is throwing up an "invalid syntax" sign: </p>
<pre><code>else:
For x in range(1,b**(1/2)):
If b%x==0:
print(str(b) + " is not prime")
break
</code></pre>
<p>"b" is a variable defined elsewhere in the function. It is an integer less than 500 that the user provides. I am getting an "invalid syntax" error pointing at the "x" in the "for x in range..." part of the code. I don't understand why this is the case and would greatly appreciate some insight into this problem.</p>
<p>If it helps, so far, the entire code looks as follows:</p>
<pre><code>def check_prime():
b = input("Enter an integer less than 500: ")
if type(b)!='int':
print("Please enter an integer")
elif b > 500:
print ("Please choose a smaller number")
else:
For x in range(1,b**(1/2)):
If b%x==0:
print(str(b) + " is not prime")
break
print (str(b)+ " is prime")
</code></pre>
<p>I am aware that the function will not work exactly as I intend just yet, but I do not know how to move forward until I resolve the issue of the syntax error. Thank you, in advance, for your help.</p>
| 0debug |
static int get_physical_address_data(CPUState *env,
target_phys_addr_t *physical, int *prot,
target_ulong address, int rw, int is_user)
{
unsigned int i;
uint64_t context;
int is_nucleus;
if ((env->lsu & DMMU_E) == 0) {
*physical = ultrasparc_truncate_physical(address);
*prot = PAGE_READ | PAGE_WRITE;
return 0;
}
context = env->dmmu.mmu_primary_context & 0x1fff;
is_nucleus = env->tl > 0;
for (i = 0; i < 64; i++) {
if (ultrasparc_tag_match(&env->dtlb[i],
address, context, physical,
is_nucleus)) {
if (((env->dtlb[i].tte & 0x4) && is_user) ||
(!(env->dtlb[i].tte & 0x2) && (rw == 1))) {
uint8_t fault_type = 0;
if ((env->dtlb[i].tte & 0x4) && is_user) {
fault_type |= 1;
}
if (env->dmmu.sfsr & 1)
env->dmmu.sfsr = 2;
env->dmmu.sfsr |= (is_user << 3) | ((rw == 1) << 2) | 1;
env->dmmu.sfsr |= (fault_type << 7);
env->dmmu.sfar = address;
env->exception_index = TT_DFAULT;
#ifdef DEBUG_MMU
printf("DFAULT at 0x%" PRIx64 "\n", address);
#endif
return 1;
}
*prot = PAGE_READ;
if (env->dtlb[i].tte & 0x2)
*prot |= PAGE_WRITE;
TTE_SET_USED(env->dtlb[i].tte);
return 0;
}
}
#ifdef DEBUG_MMU
printf("DMISS at 0x%" PRIx64 "\n", address);
#endif
env->dmmu.tag_access = (address & ~0x1fffULL) | context;
env->exception_index = TT_DMISS;
return 1;
}
| 1threat |
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
int nb_jobs)
{
TransContext *s = ctx->priv;
ThreadData *td = arg;
AVFrame *out = td->out;
AVFrame *in = td->in;
int plane;
for (plane = 0; out->data[plane]; plane++) {
int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
int pixstep = s->pixsteps[plane];
int inh = AV_CEIL_RSHIFT(in->height, vsub);
int outw = AV_CEIL_RSHIFT(out->width, hsub);
int outh = AV_CEIL_RSHIFT(out->height, vsub);
int start = (outh * jobnr ) / nb_jobs;
int end = (outh * (jobnr+1)) / nb_jobs;
uint8_t *dst, *src;
int dstlinesize, srclinesize;
int x, y;
dstlinesize = out->linesize[plane];
dst = out->data[plane] + start * dstlinesize;
src = in->data[plane];
srclinesize = in->linesize[plane];
if (s->dir & 1) {
src += in->linesize[plane] * (inh - 1);
srclinesize *= -1;
}
if (s->dir & 2) {
dst = out->data[plane] + dstlinesize * (outh - start - 1);
dstlinesize *= -1;
}
for (y = start; y < end - 7; y += 8) {
for (x = 0; x < outw - 7; x += 8) {
s->transpose_8x8(src + x * srclinesize + y * pixstep,
srclinesize,
dst + (y - start) * dstlinesize + x * pixstep,
dstlinesize);
}
if (outw - x > 0 && end - y > 0)
s->transpose_block(src + x * srclinesize + y * pixstep,
srclinesize,
dst + (y - start) * dstlinesize + x * pixstep,
dstlinesize, outw - x, end - y);
}
if (end - y > 0)
s->transpose_block(src + 0 * srclinesize + y * pixstep,
srclinesize,
dst + (y - start) * dstlinesize + 0 * pixstep,
dstlinesize, outw, end - y);
}
return 0;
}
| 1threat |
Abundant Numbers/C++ : I have been trying to generate all the abundant numbers . But I am getting a blank screen as output? I am putting all the numbers that are abundant in an array and then printing the array.But its not showing anything ? Why?
` #include <iostream>
using namespace std;
int main()
{
int arr[28123];
int sum = 0,k=0;
for(int i = 1;i<28123;i++){
for(int j= 1;j<i;j++){
if(i%j==0){
sum = sum + j;
//cout<<sum<<endl;
}
}
if(sum == i){
arr[k] = i;
cout<<i<<endl;
k++;
}
}
for(int y = k;y<28123;y++){
arr[y] = 0;
}
int n = sizeof(arr)/sizeof(arr[0]);
for(int h= 0;h<k;h++){
cout <<arr[h]<< endl;
}
return 0;
}
` | 0debug |
Content Positioned in Y and X Middel : so I don't want my content positioned in middle along the X axis, I want the content in the middle of the Y axis to.
In my CSS I've used the following to prevent the page becoming any bigger
html { overflow-y: hidden; overflow-x: hidden }
and below is what I want to achieve. Just as an example, imagine a box in the middle. I believe this can be done with JavaScript, I'm just not sure how.
[![Example Image][1]][1]
So the image above shows the box in the middle on both X and Y axis. **Please don't post how to position it in the middle along X Axis like this website as that's not what I woud like.** Any help will be awesome, thanks!
[1]: http://i.stack.imgur.com/Y268i.png | 0debug |
How to give folder permissions inside a docker container Folder : <p>I am creating a folder inside my Dockerfile and I want to give it a write permission. But I am getting permission denied error when I try to do it</p>
<pre><code>FROM python:2.7
RUN pip install Flask==0.11.1
RUN useradd -ms /bin/bash admin
USER admin
COPY app /app
WORKDIR /app
RUN chmod 777 /app
CMD ["python", "app.py"]
</code></pre>
<p>My error is </p>
<pre><code>PS C:\Users\Shivanand\Documents\Notes\Praneeth's work\Flask> docker build -t
shivanand3939/test .
Sending build context to Docker daemon 209.9kB
Step 1/8 : FROM python:2.7
---> 8a90a66b719a
Step 2/8 : RUN pip install Flask==0.11.1
---> Using cache
---> 6dc114bd7cf1
Step 3/8 : RUN useradd -ms /bin/bash admin
---> Using cache
---> 1cfdb6eea7dc
Step 4/8 : USER admin
---> Using cache
---> 27c5e8b09f15
Step 5/8 : COPY app /app
---> Using cache
---> 5d628573b24f
Step 6/8 : WORKDIR /app
---> Using cache
---> 351e19a5a007
Step 7/8 : RUN chmod 777 /app
---> Running in aaad3c79e0f4
**chmod: changing permissions of ‘/app’: Operation not permitted
The command '/bin/sh -c chmod 777 /app' returned a non-zero code: 1**
</code></pre>
<p>How can I give write permissions to app folder inside my Docker container</p>
| 0debug |
digitalocean: I want to download the .env file from server where laravel application installed : I am working on laravel application on the digitalocean server. To speedup my programming I am going to clone my project to my local machine. but I did not found the .env file on hosting.
anyone please help me regarding to get .env file from digitalocean server. | 0debug |
Swift 3 - find the item with the biggest value in a dictionary : I'm implementing some logic to get the to get the closest beacon and to do that I created a dictionary where I insert some measures. My problem is that I don't know how to get the item with the biggest value. Some code below:
struct objBeacon {
var accuracy : Float
var rssi : Float
var positionInList : Float
}
var readBeacons = [String:objBeacon]()
My goal is to get the item (objBeacon) with the biggest rssi value, how can I do that without looping through the list?
Thanks for any help | 0debug |
static int vvfat_open(BlockDriverState *bs, const char* dirname, int flags)
{
BDRVVVFATState *s = bs->opaque;
int floppy = 0;
int i;
#ifdef DEBUG
vvv = s;
#endif
DLOG(if (stderr == NULL) {
stderr = fopen("vvfat.log", "a");
setbuf(stderr, NULL);
})
s->bs = bs;
s->fat_type=16;
s->sectors_per_cluster=0x10;
bs->cyls=1024; bs->heads=16; bs->secs=63;
s->current_cluster=0xffffffff;
s->first_sectors_number=0x40;
bs->read_only = 1;
s->qcow = s->write_target = NULL;
s->qcow_filename = NULL;
s->fat2 = NULL;
s->downcase_short_names = 1;
if (!strstart(dirname, "fat:", NULL))
return -1;
if (strstr(dirname, ":floppy:")) {
floppy = 1;
s->fat_type = 12;
s->first_sectors_number = 1;
s->sectors_per_cluster=2;
bs->cyls = 80; bs->heads = 2; bs->secs = 36;
}
if (strstr(dirname, ":32:")) {
fprintf(stderr, "Big fat greek warning: FAT32 has not been tested. You are welcome to do so!\n");
s->fat_type = 32;
} else if (strstr(dirname, ":16:")) {
s->fat_type = 16;
} else if (strstr(dirname, ":12:")) {
s->fat_type = 12;
bs->secs = 18;
}
s->sector_count=bs->cyls*bs->heads*bs->secs-(s->first_sectors_number-1);
if (strstr(dirname, ":rw:")) {
if (enable_write_target(s))
return -1;
bs->read_only = 0;
}
i = strrchr(dirname, ':') - dirname;
assert(i >= 3);
if (dirname[i-2] == ':' && qemu_isalpha(dirname[i-1]))
dirname += i-1;
else
dirname += i+1;
bs->total_sectors=bs->cyls*bs->heads*bs->secs;
if(init_directories(s, dirname))
return -1;
s->sector_count = s->faked_sectors + s->sectors_per_cluster*s->cluster_count;
if(s->first_sectors_number==0x40)
init_mbr(s);
if (floppy)
bs->heads = bs->cyls = bs->secs = 0;
qemu_co_mutex_init(&s->lock);
return 0;
}
| 1threat |
SQL : this is query is taking too much of time :
SQL : this is query is taking too much of time for 12 records, event indexes also created.
SELECT p.AnchorDate
,'Active' StatusDefinition
,count(1) PatientCount
,6 AS SNO
FROM (
SELECT DISTINCT pp.PatientID
,ad.AnchorDate
FROM PatientProgram pp WITH (NOLOCK)
INNER JOIN #tblMonth ad ON ad.AnchorDate = CASE
WHEN ad.AnchorDate BETWEEN DATEADD(dd, - (DAY(pp.EnrollmentStartDate) - 1), pp.EnrollmentStartDate)
AND EOMONTH (ISNULL(pp.EnrollmentEndDate, '9999-12-31'))
THEN ad.AnchorDate
ELSE NULL
END
WHERE NOT EXISTS (
SELECT 1
FROM #ManagedPopulation m
WHERE m.tKeyId = pp.ProgramID
)
AND pp.ProgramID != 4331
) p
GROUP BY p.AnchorDate; | 0debug |
void ff_slice_buffer_init(slice_buffer *buf, int line_count,
int max_allocated_lines, int line_width,
IDWTELEM *base_buffer)
{
int i;
buf->base_buffer = base_buffer;
buf->line_count = line_count;
buf->line_width = line_width;
buf->data_count = max_allocated_lines;
buf->line = av_mallocz(sizeof(IDWTELEM *) * line_count);
buf->data_stack = av_malloc(sizeof(IDWTELEM *) * max_allocated_lines);
for (i = 0; i < max_allocated_lines; i++)
buf->data_stack[i] = av_malloc(sizeof(IDWTELEM) * line_width);
buf->data_stack_top = max_allocated_lines - 1;
}
| 1threat |
How to do URL encryption in PHP : <p>I am making an application in PHP in which user names are showing in URL like
www.mysite.com/user/shahroze</p>
<p>I want to encrypt the name something like that
www.mysite.com/user/ZxtccQO58</p>
<p>how can i do that to save my sensitive data?</p>
| 0debug |
What did I do wrong in this basic python code? : <p>I'm testing out if statements and I encountered this dilemma. I don't understand what I did wrong, and why it expects a string instead of an integer. Here's my code.</p>
<pre><code># If the entered age was over 21 print "have a drink" otherwise print the other one.
age = input(int("what's your age?:\n\t"))
if age >= 21 :
print("have a drink")
else:
print("you're just a lad!")
</code></pre>
| 0debug |
void ff_celp_lp_synthesis_filterf(float *out,
const float* filter_coeffs,
const float* in,
int buffer_length,
int filter_length)
{
int i,n;
filter_length++;
for (n = 0; n < buffer_length; n++) {
out[n] = in[n];
for (i = 1; i < filter_length; i++)
out[n] -= filter_coeffs[i-1] * out[n-i];
}
}
| 1threat |
Accessing closure variables in the console : <p>Given this code</p>
<pre><code>function foo()
{
var x = 1;
function bar()
{
debugger;
return x + 1;
}
return bar();
}
</code></pre>
<p>when I open the Google Chrome's console and and <code>foo()</code> gets executed, the console stops at the <code>debugger</code> line. If I type 'x' in the console, I get <strong>Uncaught ReferenceError: x is not defined</strong>.</p>
<p>If I want to access <code>x</code> in the console, I have two options:</p>
<ul>
<li>Under <em>Source</em> go to <em>Scope</em>, open <em>Closure</em>, make a right click on <code>x</code> and click <em>Store as Global Variable</em>. This will create a global variable <code>temp1</code> with which I can access <code>x</code>.</li>
<li><p>edit <code>bar</code> to</p>
<pre><code>function var()
{
x;
debugger;
return x + 1;
}
</code></pre></li>
</ul>
<p>I noticed that when you put a <code>debugger</code> and the code accessed a scope variable at some point, then I can access it in the console.</p>
<p>I found other threads <a href="https://stackoverflow.com/questions/28388530/why-does-chrome-debugger-think-closed-local-variable-is-undefined">like this one</a> more or less aksing the same question. Is there a better way to access the closure variables?</p>
<p>Btw I use <code>Version 59.0.3071.104 (Official Build) (64-bit)</code> for Debian 8.</p>
| 0debug |
static int megasas_scsi_init(PCIDevice *dev)
{
DeviceState *d = DEVICE(dev);
MegasasState *s = MEGASAS(dev);
MegasasBaseClass *b = MEGASAS_DEVICE_GET_CLASS(s);
uint8_t *pci_conf;
int i, bar_type;
Error *err = NULL;
pci_conf = dev->config;
pci_conf[PCI_LATENCY_TIMER] = 0;
pci_conf[PCI_INTERRUPT_PIN] = 0x01;
memory_region_init_io(&s->mmio_io, OBJECT(s), &megasas_mmio_ops, s,
"megasas-mmio", 0x4000);
memory_region_init_io(&s->port_io, OBJECT(s), &megasas_port_ops, s,
"megasas-io", 256);
memory_region_init_io(&s->queue_io, OBJECT(s), &megasas_queue_ops, s,
"megasas-queue", 0x40000);
if (megasas_use_msi(s) &&
msi_init(dev, 0x50, 1, true, false)) {
s->flags &= ~MEGASAS_MASK_USE_MSI;
}
if (megasas_use_msix(s) &&
msix_init(dev, 15, &s->mmio_io, b->mmio_bar, 0x2000,
&s->mmio_io, b->mmio_bar, 0x3800, 0x68)) {
s->flags &= ~MEGASAS_MASK_USE_MSIX;
}
if (pci_is_express(dev)) {
pcie_endpoint_cap_init(dev, 0xa0);
}
bar_type = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64;
pci_register_bar(dev, b->ioport_bar,
PCI_BASE_ADDRESS_SPACE_IO, &s->port_io);
pci_register_bar(dev, b->mmio_bar, bar_type, &s->mmio_io);
pci_register_bar(dev, 3, bar_type, &s->queue_io);
if (megasas_use_msix(s)) {
msix_vector_use(dev, 0);
}
s->fw_state = MFI_FWSTATE_READY;
if (!s->sas_addr) {
s->sas_addr = ((NAA_LOCALLY_ASSIGNED_ID << 24) |
IEEE_COMPANY_LOCALLY_ASSIGNED) << 36;
s->sas_addr |= (pci_bus_num(dev->bus) << 16);
s->sas_addr |= (PCI_SLOT(dev->devfn) << 8);
s->sas_addr |= PCI_FUNC(dev->devfn);
}
if (!s->hba_serial) {
s->hba_serial = g_strdup(MEGASAS_HBA_SERIAL);
}
if (s->fw_sge >= MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE) {
s->fw_sge = MEGASAS_MAX_SGE - MFI_PASS_FRAME_SIZE;
} else if (s->fw_sge >= 128 - MFI_PASS_FRAME_SIZE) {
s->fw_sge = 128 - MFI_PASS_FRAME_SIZE;
} else {
s->fw_sge = 64 - MFI_PASS_FRAME_SIZE;
}
if (s->fw_cmds > MEGASAS_MAX_FRAMES) {
s->fw_cmds = MEGASAS_MAX_FRAMES;
}
trace_megasas_init(s->fw_sge, s->fw_cmds,
megasas_is_jbod(s) ? "jbod" : "raid");
if (megasas_is_jbod(s)) {
s->fw_luns = MFI_MAX_SYS_PDS;
} else {
s->fw_luns = MFI_MAX_LD;
}
s->producer_pa = 0;
s->consumer_pa = 0;
for (i = 0; i < s->fw_cmds; i++) {
s->frames[i].index = i;
s->frames[i].context = -1;
s->frames[i].pa = 0;
s->frames[i].state = s;
}
scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(dev),
&megasas_scsi_info, NULL);
if (!d->hotplugged) {
scsi_bus_legacy_handle_cmdline(&s->bus, &err);
if (err != NULL) {
error_free(err);
return -1;
}
}
return 0;
} | 1threat |
how to make delivery URL woocommerce for hook? : i have a problem when i want make **woocommerce hook** it say make delivery URL I do not know exactly how I was made I will be grateful if you would answer
| 0debug |
static int hevc_find_frame_end(AVCodecParserContext *s, const uint8_t *buf,
int buf_size)
{
HEVCParserContext *ctx = s->priv_data;
ParseContext *pc = &ctx->pc;
int i;
for (i = 0; i < buf_size; i++) {
int nut;
pc->state64 = (pc->state64 << 8) | buf[i];
if (((pc->state64 >> 3 * 8) & 0xFFFFFF) != START_CODE)
continue;
nut = (pc->state64 >> 2 * 8 + 1) & 0x3F;
if ((nut >= HEVC_NAL_VPS && nut <= HEVC_NAL_AUD) || nut == HEVC_NAL_SEI_PREFIX ||
(nut >= 41 && nut <= 44) || (nut >= 48 && nut <= 55)) {
if (pc->frame_start_found) {
pc->frame_start_found = 0;
return i - 5;
}
} else if (nut <= HEVC_NAL_RASL_R ||
(nut >= HEVC_NAL_BLA_W_LP && nut <= HEVC_NAL_CRA_NUT)) {
int first_slice_segment_in_pic_flag = buf[i] >> 7;
if (first_slice_segment_in_pic_flag) {
if (!pc->frame_start_found) {
pc->frame_start_found = 1;
} else {
pc->frame_start_found = 0;
return i - 5;
}
}
}
}
return END_NOT_FOUND;
}
| 1threat |
Why did python add 1 at the end? console.log(9.89+3.48) = 13.37000000000001 : <p><a href="https://i.imgur.com/YYNhvNv.png" rel="nofollow noreferrer">https://i.imgur.com/YYNhvNv.png</a></p>
<p>Its adding in 1 at the end of that console log output. Why?
Answer is suppose to be only 13.37</p>
| 0debug |
Getting selected dropdown value using plain Javascript : <p>Hi I have dojo based website which does not support Jqquery. So I need a javascript code to get the selected value text from the dropdown . Can anyone give me plain javascript code?</p>
| 0debug |
multiple if statements in SWIFT 3 : @IBAction func addtoCart(_ sender: Any) {
if UserDataSingleton.sharedDataContainer.is_guest == "guest" {
//segue, user is a guest
}
if sizebtn.isHidden == false {
if Size.selectedItem == nil {
// show alert , nothing is selected from items
}
} else {
// do API call
}
}
}
}
The code above skips api calls if the user is not a guest and has selected something from item. How can I check if :
1- user is not a guest
2- if UIButton isn't hidden and user has selected from item
| 0debug |
Chrome extension popup not showing anymore : <p>I'm creating a new Chrome extension and everything was fine. However, today I was coding a new func, then I saw that my extension icon was grayed. And when I click on the icon, the popup isn't shown. <strong>One interesting point is that the extension is working. No error logs.</strong></p>
<p>I commented all the code I wrote, but had no effect. If I open the link directly on the Chrome, it open a new tab showing the popup normally. [chrome-extension://extensionId/popup.html]</p>
<p>My manifest looks ok and the popup.html/js too. I really don't know what happened. Any ideas? Thanks!</p>
<p><strong>Manifest.json</strong></p>
<pre><code>{
"name": "Say It",
"version": "0.0.1",
"manifest_version": 2,
"description": "__MSG_appDescription__",
"icons": {
"16": "images/icon-16.png",
"128": "images/icon-128.png"
},
"default_locale": "en",
"background": {
"scripts": [
"scripts/chromereload.js",
"scripts/background.js"
]
},
"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"background",
"bookmarks",
"clipboardRead",
"clipboardWrite",
"contentSettings",
"cookies",
"*://*.google.com/",
"debugger",
"history",
"idle",
"management",
"notifications",
"pageCapture",
"topSites",
"storage",
"webNavigation",
"webRequest",
"webRequestBlocking",
"nativeMessaging"
],
"options_ui": {
"page": "options.html",
"chrome_style": true
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": [
"scripts/contentscript.js"
],
"run_at": "document_end",
"all_frames": false
}
],
"omnibox": {
"keyword": "OMNIBOX-KEYWORD"
},
"page_action": {
"default_icon": {
"19": "images/icon-19.png",
"38": "images/icon-38.png"
},
"default_title": "Say It",
"default_popup": "popup.html"
},
"web_accessible_resources": [
"images/icon-48.png"
]
}
</code></pre>
<p><strong>Popup.html</strong></p>
<pre><code><!DOCTYPE html>
<html ng-app="app">
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="styles/main.css">
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
</head>
<body ng-controller="mainController as ctrl">
<h4>Choose your Destiny!</h4>
<button class="btn btn-large btn-primary" ng-click="ctrl.kappa()">Kappa</button>
<button class="btn btn-large btn-secondary" ng-click="ctrl.pride()">Pride</button>
<button class="btn btn-large btn-success" ng-click="ctrl.fon()">Fon</button>
<script type="text/javascript" src="bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="scripts/popup.js"></script>
</body>
</html>
</code></pre>
<p>Popup.js</p>
<pre><code>(function () {
'use strict';
angular.module('app').controller('mainController', function () {
var self = this;
//Por localStorage
console.log(localStorage.getItem('kappa'));
//Por API
chrome.storage.local.get('value', function (res) {
console.log(res);
});
this.kappa = function () {
console.log('Seu Kappa!');
};
this.pride = function () {
console.log('Seu KappaPride!');
};
this.fon = function () {
console.log('Fon!');
};
});
})();
</code></pre>
| 0debug |
Excel VBA: How to combine cells in a "simple combination" fashion : I've looked for a way to do this in several foruns and websites, but found no clue...
Hope someone can help me!
Here is a sample of the data I have:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div class="cms_table"><table class="cms_table_sheet0 cms_table_gridlines"><tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student1</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student2</TD>
<TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student3</TD>
<TD class="cms_table_column3 cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student4</TD>
</tr>
<tr valign="top" class="cms_table_row0 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td"> Espindola CF</TD>
<TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td"> do Prado C</TD>
<TD class="cms_table_column3 cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td"></TD>
</tr>
<tr valign="top" class="cms_table_row1 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">Bhansali S</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">Nascimento MS</TD>
<TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td"> Dhawan V</TD>
<TD class="cms_table_column3 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td"> Amarins MB</TD>
</tr>
<tr valign="top" class="cms_table_row2 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td">Bozek T</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td"> Blazekovic A</TD>
<TD class="cms_table_column2 cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td"></TD>
<TD class="cms_table_column3 cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td"></TD>
</tr>
<tr valign="top" class="cms_table_row3 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td">Thewjitcharoen Y</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td">Nascimento MS</TD>
<TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td">do Prado C</TD>
<TD class="cms_table_column3 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td"> Nakasatien S</TD>
</tr>
<tr valign="top" class="cms_table_row4 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td">Jonas MI</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td">Bhansali S</TD>
<TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td">Amarins MB</TD>
<TD class="cms_table_column3 cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td"></TD>
</tr>
</table></div>
<!-- end snippet -->
I want an arrangement of these cells, outputting pairs that reflect how many times a particular student interacted in these groups.
In other words, it is a simple combination. For each group, there are n!/p!*(n-p)! possibilities of interaction, where "n" is the number of the students in each group (in the sample, ranging from 2 to 4) and "p" equals 2 (pairs of interaction). Note that each array of students has a different number of students.
Thus, the output would be something like this:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div class="cms_table"><table class="cms_table_sheet0 cms_table_gridlines"><tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Espindola CF</TD>
</tr>
<tr valign="top" class="cms_table_row0 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td">do Prado C</TD>
</tr>
<tr valign="top" class="cms_table_row1 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">Espindola CF</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">do Prado C</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bhansali S</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bhansali S</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Dhawan V</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bhansali S</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Amarins MB</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Dhawan V</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Amarins MB</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Dhawan V</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Amarins MB</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bozek T</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Blazekovic A</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Thewjitcharoen Y</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Thewjitcharoen Y</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">do Prado C</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Thewjitcharoen Y</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nakasatien S</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">do Prado C</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nakasatien S</TD>
</tr>
<tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">do Prado C</TD>
<TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nakasatien S</TD>
</tr>
</table></div>
<!-- end snippet -->
...and so on...
It is my first post, but I hope I made it clear enough. | 0debug |
ISO C++ forbids forward references to 'enum' types : <p>Given the program:</p>
<pre><code>enum E : int
{
A, B, C
};
</code></pre>
<p><code>g++ -c test.cpp</code> works just fine. However, <code>clang++ -c test.cpp</code> gives the following errors:</p>
<pre><code>test.cpp:1:6: error: ISO C++ forbids forward references to 'enum' types
enum E : int
^
test.cpp:1:8: error: expected unqualified-id
enum E : int
^
2 errors generated.
</code></pre>
<p>These error messages don't make any sense to me. I don't see any forward references here.</p>
| 0debug |
static av_always_inline int process_frame(WriterContext *w,
InputFile *ifile,
AVFrame *frame, AVPacket *pkt)
{
AVFormatContext *fmt_ctx = ifile->fmt_ctx;
AVCodecContext *dec_ctx = ifile->streams[pkt->stream_index].dec_ctx;
AVCodecParameters *par = ifile->streams[pkt->stream_index].st->codecpar;
AVSubtitle sub;
int ret = 0, got_frame = 0;
if (dec_ctx->codec) {
switch (par->codec_type) {
case AVMEDIA_TYPE_VIDEO:
ret = avcodec_decode_video2(dec_ctx, frame, &got_frame, pkt);
break;
case AVMEDIA_TYPE_AUDIO:
ret = avcodec_decode_audio4(dec_ctx, frame, &got_frame, pkt);
break;
case AVMEDIA_TYPE_SUBTITLE:
ret = avcodec_decode_subtitle2(dec_ctx, &sub, &got_frame, pkt);
break;
}
}
if (ret < 0)
return ret;
ret = FFMIN(ret, pkt->size);
pkt->data += ret;
pkt->size -= ret;
if (got_frame) {
int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
nb_streams_frames[pkt->stream_index]++;
if (do_show_frames)
if (is_sub)
show_subtitle(w, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
else
show_frame(w, frame, ifile->streams[pkt->stream_index].st, fmt_ctx);
if (is_sub)
avsubtitle_free(&sub);
}
return got_frame;
}
| 1threat |
Form Switching In C# : How can I lock (and make it look faded) a parent form while the child form is active? I tried to make the child form topmost but that just made it always visible and I can still edit the parent form. I want to be unable to operate on the main form while the child form is running in VS2012, C#. This is the code I used to call the second form...
private void checkButton_Click(object sender, EventArgs e)
{
Form2 newForm = new Form2(this);
newForm.Show();
} | 0debug |
MySQLClient instal error: "raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id" : <p>I am trying to install mysqlclient to my Python 3.6. Originally what i want to install is MySQLdb, however it was saying that MySQLdb does not work with Python 3 (still?). So i switch to mysqlclient.</p>
<pre><code>pip3 install mysqlclient
</code></pre>
<p>However, it was given this error:</p>
<pre><code> Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup.py", line 18, in <module>
metadata, options = get_config()
File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup_posix.py", line 60, in get_config
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup_posix.py", line 60, in <listcomp>
libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')]
File "/private/var/folders/h3/sff7td1d6pg5v5qsm5xf31q80000gn/T/pip-install-ki9z7ln9/mysqlclient/setup_posix.py", line 13, in dequote
raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?")
Exception: Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?
</code></pre>
<p>Can I know what should i do to solve this issue?</p>
| 0debug |
static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path,
const char *name, void *value, size_t size)
{
char *buffer;
ssize_t ret;
buffer = rpath(ctx, path);
ret = lgetxattr(buffer, MAP_ACL_ACCESS, value, size);
g_free(buffer);
return ret;
}
| 1threat |
static void j2k_flush(J2kDecoderContext *s)
{
if (*s->buf == 0xff)
s->buf++;
s->bit_index = 8;
s->buf++;
}
| 1threat |
Json Respone include function in php : I have one PHP code which has JSON response.
I need to separate the **['name' => $message->getName(), 'mes' => $message->getMes(), 'update_time' => $message->getUpdateTime()->format('Y-m-d H:i:s')]** into a independent function.
When I need I can call it.
But, I don't know how to do.
this is my controller
/**
* @Route("/message/board/reset/{id}", name = "message_reset", requirements = {"id" = "\d+"})
*/
public function editMeg($id)
{
$entityManager = $this->getDoctrine()->getEntityManager();
$message = $entityManager->find('MegBundle:message', $id);
$UserN = $message->getName();
$UserM = $message->getMes();
return new JsonResponse(['result' => 'ok', 'ret' => ['name' => $message->getName(), 'mes' => $message->getMes(), 'update_time' => $message->getUpdateTime()->format('Y-m-d H:i:s')]]);
}
I hope this is reasonable and has ways to do it.
I appreciate any help. | 0debug |
Docker macvlan network, unable to access internet : <p>I have a dedicated server with multiple IP addresses, some IP's have mac address associated while others(in a subnetwork) doesn't have mac addresses.
I have created docker macvlan network using:</p>
<pre><code>docker network create -d macvlan -o macvlan_mode=bridge --subnet=188.40.76.0/26 --gateway=188.40.76.1 -o parent=eth0 macvlan_bridge
</code></pre>
<p>I have ip: 88.99.102.115 with mac: 00:50:56:00:60:42. Created a container using:</p>
<pre><code>docker run --name cont1 --net=macvlan_bridge --ip=88.99.102.115 --mac-address 00:50:56:00:60:42 -itd nginx
</code></pre>
<p>This works, I can access nginx hosted at that ip address from outside.</p>
<p><strong>Case with IP which doesn't have mac address and the gateway is out of subnet.</strong></p>
<p>subnet: 88.99.114.16/28, gateway: 88.99.102.103</p>
<p>Unable to create network using:</p>
<pre><code>docker network create -d macvlan -o macvlan_mode=bridge --subnet=88.99.114.16/28 --gateway=88.99.102.103 -o parent=eth0 mynetwork
</code></pre>
<p>Throws error:</p>
<pre><code>no matching subnet for gateway 88.99.102.103
</code></pre>
<p>Tried with increasing subnet scope to include gateway:</p>
<pre><code>docker network create -d macvlan -o macvlan_mode=bridge --subnet=88.99.0.0/16 --gateway=88.99.102.103 -o parent=eth0 mynetwork
</code></pre>
<p>Network got created, then started nginx container using 'mynetwork' and well I dont have mac address for 88.99.114.18 so used some random mac address 40:1c:0f:bd:a1:d2.</p>
<pre><code>docker run --name cont1 --net=mynetwork --ip=88.99.114.18 --mac-address 40:1c:0f:bd:a1:d2 -itd nginx
</code></pre>
<p>Can't reach nginx(88.99.102.115).</p>
<ol>
<li>How do I create a macvlan docker network if my gateway is out of my subnet?</li>
<li>How do I run a container using macvlan network when I have only IP address but no mac address?</li>
</ol>
<p>I don't have much knowledge in networking, it will be really helpful if you explain in detail.</p>
<p>My /etc/network/interfaces file:</p>
<pre><code>### Hetzner Online GmbH - installimage
# Loopback device:
auto lo
iface lo inet loopback
iface lo inet6 loopback
# device: eth0
auto eth0
iface eth0 inet static
address 88.99.102.103
netmask 255.255.255.192
gateway 88.99.102.65
# default route to access subnet
up route add -net 88.99.102.64 netmask 255.255.255.192 gw 88.99.102.65 eth0
iface eth0 inet6 static
address 2a01:4f8:221:1266::2
netmask 64
gateway fe80::1
</code></pre>
| 0debug |
int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
const char *version, const char *serial)
{
int cylinders, heads, secs;
uint64_t nb_sectors;
s->bs = bs;
s->drive_kind = kind;
bdrv_get_geometry(bs, &nb_sectors);
bdrv_guess_geometry(bs, &cylinders, &heads, &secs);
if (cylinders < 1 || cylinders > 16383) {
error_report("cyls must be between 1 and 16383");
return -1;
}
if (heads < 1 || heads > 16) {
error_report("heads must be between 1 and 16");
return -1;
}
if (secs < 1 || secs > 63) {
error_report("secs must be between 1 and 63");
return -1;
}
s->cylinders = cylinders;
s->heads = heads;
s->sectors = secs;
s->nb_sectors = nb_sectors;
s->smart_enabled = 1;
s->smart_autosave = 1;
s->smart_errors = 0;
s->smart_selftest_count = 0;
if (kind == IDE_CD) {
bdrv_set_dev_ops(bs, &ide_cd_block_ops, s);
bdrv_set_buffer_alignment(bs, 2048);
} else {
if (!bdrv_is_inserted(s->bs)) {
error_report("Device needs media, but drive is empty");
return -1;
}
if (bdrv_is_read_only(bs)) {
error_report("Can't use a read-only drive");
return -1;
}
}
if (serial) {
strncpy(s->drive_serial_str, serial, sizeof(s->drive_serial_str));
} else {
snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
"QM%05d", s->drive_serial);
}
if (version) {
pstrcpy(s->version, sizeof(s->version), version);
} else {
pstrcpy(s->version, sizeof(s->version), QEMU_VERSION);
}
ide_reset(s);
bdrv_iostatus_enable(bs);
return 0;
}
| 1threat |
How to use (get and set) httpcontext.current.Session in the class library, within MVC web api application? : <p>I am getting error as "object reference not set to an instance of an object httpcontext.current.session".</p>
| 0debug |
Why constructor isn't called? : <p>Why constructor of class A isn't called when object of this class is passed as an argument to function taking the argument by value? </p>
<pre><code>class A
{
public:
A()
{
cout << "A\n";
}
};
void f_n(A val)
{
}
int main()
{
A a;
f_n(a);
return 0;
}
</code></pre>
| 0debug |
uploading React-js project to external server : I want to upload my React js project to an external server, I already have a project and I use node js local server to run it by webpack.config.js command,
I don't know what the keywords should I use it to find what I want and how to search for what I want,
if can anyone help me | 0debug |
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING_RET_CORUPT)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING_BUF_END_BEFORE_LE)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING_INVALID_FILE_SELECTED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING_FCI_FORMAT_INVALID)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING_CHANGE)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_WARNING_FILE_FILLED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_EXC_ERROR)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_EXC_ERROR_CHANGE)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_WRONG_LENGTH)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_CLA_NOT_SUPPORTED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_CHANNEL_NOT_SUPPORTED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_SECURE_NOT_SUPPORTED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_COMMAND_NOT_SUPPORTED)
VCARD_RESPONSE_NEW_STATIC_STATUS(
VCARD7816_STATUS_ERROR_COMMAND_INCOMPATIBLE_WITH_FILE)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_SECURITY_NOT_SATISFIED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_AUTHENTICATION_BLOCKED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_DATA_INVALID)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_CONDITION_NOT_SATISFIED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_DATA_NO_EF)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_SM_OBJECT_MISSING)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_SM_OBJECT_INCORRECT)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_WRONG_PARAMETERS)
VCARD_RESPONSE_NEW_STATIC_STATUS(
VCARD7816_STATUS_ERROR_WRONG_PARAMETERS_IN_DATA)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_FUNCTION_NOT_SUPPORTED)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_FILE_NOT_FOUND)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_RECORD_NOT_FOUND)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_NO_SPACE_FOR_FILE)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_LC_TLV_INCONSISTENT)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_P1_P2_INCORRECT)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_LC_P1_P2_INCONSISTENT)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_DATA_NOT_FOUND)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_WRONG_PARAMETERS_2)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_INS_CODE_INVALID)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_CLA_INVALID)
VCARD_RESPONSE_NEW_STATIC_STATUS(VCARD7816_STATUS_ERROR_GENERAL)
VCardResponse *
vcard_make_response(vcard_7816_status_t status)
{
VCardResponse *response = NULL;
switch (status) {
case VCARD7816_STATUS_SUCCESS:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_SUCCESS);
case VCARD7816_STATUS_WARNING:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING);
case VCARD7816_STATUS_WARNING_RET_CORUPT:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING_RET_CORUPT);
case VCARD7816_STATUS_WARNING_BUF_END_BEFORE_LE:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING_BUF_END_BEFORE_LE);
case VCARD7816_STATUS_WARNING_INVALID_FILE_SELECTED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING_INVALID_FILE_SELECTED);
case VCARD7816_STATUS_WARNING_FCI_FORMAT_INVALID:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING_FCI_FORMAT_INVALID);
case VCARD7816_STATUS_WARNING_CHANGE:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING_CHANGE);
case VCARD7816_STATUS_WARNING_FILE_FILLED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_WARNING_FILE_FILLED);
case VCARD7816_STATUS_EXC_ERROR:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_EXC_ERROR);
case VCARD7816_STATUS_EXC_ERROR_CHANGE:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_EXC_ERROR_CHANGE);
case VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE);
case VCARD7816_STATUS_ERROR_WRONG_LENGTH:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_WRONG_LENGTH);
case VCARD7816_STATUS_ERROR_CLA_NOT_SUPPORTED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_CLA_NOT_SUPPORTED);
case VCARD7816_STATUS_ERROR_CHANNEL_NOT_SUPPORTED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_CHANNEL_NOT_SUPPORTED);
case VCARD7816_STATUS_ERROR_SECURE_NOT_SUPPORTED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_SECURE_NOT_SUPPORTED);
case VCARD7816_STATUS_ERROR_COMMAND_NOT_SUPPORTED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_COMMAND_NOT_SUPPORTED);
case VCARD7816_STATUS_ERROR_COMMAND_INCOMPATIBLE_WITH_FILE:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_COMMAND_INCOMPATIBLE_WITH_FILE);
case VCARD7816_STATUS_ERROR_SECURITY_NOT_SATISFIED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_SECURITY_NOT_SATISFIED);
case VCARD7816_STATUS_ERROR_AUTHENTICATION_BLOCKED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_AUTHENTICATION_BLOCKED);
case VCARD7816_STATUS_ERROR_DATA_INVALID:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_DATA_INVALID);
case VCARD7816_STATUS_ERROR_CONDITION_NOT_SATISFIED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_CONDITION_NOT_SATISFIED);
case VCARD7816_STATUS_ERROR_DATA_NO_EF:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_DATA_NO_EF);
case VCARD7816_STATUS_ERROR_SM_OBJECT_MISSING:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_SM_OBJECT_MISSING);
case VCARD7816_STATUS_ERROR_SM_OBJECT_INCORRECT:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_SM_OBJECT_INCORRECT);
case VCARD7816_STATUS_ERROR_WRONG_PARAMETERS:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_WRONG_PARAMETERS);
case VCARD7816_STATUS_ERROR_WRONG_PARAMETERS_IN_DATA:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_WRONG_PARAMETERS_IN_DATA);
case VCARD7816_STATUS_ERROR_FUNCTION_NOT_SUPPORTED:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_FUNCTION_NOT_SUPPORTED);
case VCARD7816_STATUS_ERROR_FILE_NOT_FOUND:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_FILE_NOT_FOUND);
case VCARD7816_STATUS_ERROR_RECORD_NOT_FOUND:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_RECORD_NOT_FOUND);
case VCARD7816_STATUS_ERROR_NO_SPACE_FOR_FILE:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_NO_SPACE_FOR_FILE);
case VCARD7816_STATUS_ERROR_LC_TLV_INCONSISTENT:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_LC_TLV_INCONSISTENT);
case VCARD7816_STATUS_ERROR_P1_P2_INCORRECT:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_P1_P2_INCORRECT);
case VCARD7816_STATUS_ERROR_LC_P1_P2_INCONSISTENT:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_LC_P1_P2_INCONSISTENT);
case VCARD7816_STATUS_ERROR_DATA_NOT_FOUND:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_DATA_NOT_FOUND);
case VCARD7816_STATUS_ERROR_WRONG_PARAMETERS_2:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_WRONG_PARAMETERS_2);
case VCARD7816_STATUS_ERROR_INS_CODE_INVALID:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_INS_CODE_INVALID);
case VCARD7816_STATUS_ERROR_CLA_INVALID:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_CLA_INVALID);
case VCARD7816_STATUS_ERROR_GENERAL:
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_ERROR_GENERAL);
default:
response = vcard_response_new_status(status);
if (response == NULL) {
return VCARD_RESPONSE_GET_STATIC(
VCARD7816_STATUS_EXC_ERROR_MEMORY_FAILURE);
}
}
assert(response);
return response;
}
| 1threat |
static void rtas_write_pci_config(sPAPREnvironment *spapr,
uint32_t token, uint32_t nargs,
target_ulong args,
uint32_t nret, target_ulong rets)
{
uint32_t val, size, addr;
PCIDevice *dev = find_dev(spapr, 0, rtas_ld(args, 0));
if (!dev) {
rtas_st(rets, 0, -1);
return;
}
val = rtas_ld(args, 2);
size = rtas_ld(args, 1);
addr = rtas_pci_cfgaddr(rtas_ld(args, 0));
pci_default_write_config(dev, addr, val, size);
rtas_st(rets, 0, 0);
}
| 1threat |
How to tell pointer's current x-y coordinates : <p>Using JavaScript, I would like to find the x-y coordinates of cursor pointer on the screen in a HTML webpage.</p>
| 0debug |
uint64_t ldq_tce(VIOsPAPRDevice *dev, uint64_t taddr)
{
uint64_t val;
spapr_tce_dma_read(dev, taddr, &val, sizeof(val));
return tswap64(val);
}
| 1threat |
Check all type from element in list in python : <p>What is the most elegant way for me to check element type from the list. I use all, isinstance and list comprehensive. but if there is more pythonic way to do it?</p>
<pre><code>from collections import Mapping
from enum import Enum
class Company(Enum):
apple = 'Apple'
google = 'Google'
a = {'key': 'xxxx'}
a = {'key': ({'sub_dic', 'value'})}
a = [Company.apple, Company.google]
if all(isinstance(i, Mapping) for i in a):
print('dict')
elif all(isinstance(i, tuple) for i in a):
if all(isinstance(i, Mapping) for i in a):
print('tuple with dict')
else:
print('tuple')
elif all(isinstance(i, Enum) for i in a):
print('Enum')
else
print('Invalid type')
</code></pre>
| 0debug |
Computing device which is not a stored program device : <p>Can you give me one computing device that is not a stored program device?</p>
<p>Thanks!</p>
| 0debug |
static void decode_vui(HEVCContext *s, HEVCSPS *sps)
{
VUI *vui = &sps->vui;
GetBitContext *gb = &s->HEVClc->gb;
int sar_present;
av_log(s->avctx, AV_LOG_DEBUG, "Decoding VUI\n");
sar_present = get_bits1(gb);
if (sar_present) {
uint8_t sar_idx = get_bits(gb, 8);
if (sar_idx < FF_ARRAY_ELEMS(vui_sar))
vui->sar = vui_sar[sar_idx];
else if (sar_idx == 255) {
vui->sar.num = get_bits(gb, 16);
vui->sar.den = get_bits(gb, 16);
} else
av_log(s->avctx, AV_LOG_WARNING,
"Unknown SAR index: %u.\n", sar_idx);
}
vui->overscan_info_present_flag = get_bits1(gb);
if (vui->overscan_info_present_flag)
vui->overscan_appropriate_flag = get_bits1(gb);
vui->video_signal_type_present_flag = get_bits1(gb);
if (vui->video_signal_type_present_flag) {
vui->video_format = get_bits(gb, 3);
vui->video_full_range_flag = get_bits1(gb);
vui->colour_description_present_flag = get_bits1(gb);
if (vui->video_full_range_flag && sps->pix_fmt == AV_PIX_FMT_YUV420P)
sps->pix_fmt = AV_PIX_FMT_YUVJ420P;
if (vui->colour_description_present_flag) {
vui->colour_primaries = get_bits(gb, 8);
vui->transfer_characteristic = get_bits(gb, 8);
vui->matrix_coeffs = get_bits(gb, 8);
if (vui->colour_primaries >= AVCOL_PRI_NB)
vui->colour_primaries = AVCOL_PRI_UNSPECIFIED;
if (vui->transfer_characteristic >= AVCOL_TRC_NB)
vui->transfer_characteristic = AVCOL_TRC_UNSPECIFIED;
if (vui->matrix_coeffs >= AVCOL_SPC_NB)
vui->matrix_coeffs = AVCOL_SPC_UNSPECIFIED;
}
}
vui->chroma_loc_info_present_flag = get_bits1(gb);
if (vui->chroma_loc_info_present_flag) {
vui->chroma_sample_loc_type_top_field = get_ue_golomb_long(gb);
vui->chroma_sample_loc_type_bottom_field = get_ue_golomb_long(gb);
}
vui->neutra_chroma_indication_flag = get_bits1(gb);
vui->field_seq_flag = get_bits1(gb);
vui->frame_field_info_present_flag = get_bits1(gb);
vui->default_display_window_flag = get_bits1(gb);
if (vui->default_display_window_flag) {
vui->def_disp_win.left_offset = get_ue_golomb_long(gb) * 2;
vui->def_disp_win.right_offset = get_ue_golomb_long(gb) * 2;
vui->def_disp_win.top_offset = get_ue_golomb_long(gb) * 2;
vui->def_disp_win.bottom_offset = get_ue_golomb_long(gb) * 2;
if (s->apply_defdispwin &&
s->avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) {
av_log(s->avctx, AV_LOG_DEBUG,
"discarding vui default display window, "
"original values are l:%u r:%u t:%u b:%u\n",
vui->def_disp_win.left_offset,
vui->def_disp_win.right_offset,
vui->def_disp_win.top_offset,
vui->def_disp_win.bottom_offset);
vui->def_disp_win.left_offset =
vui->def_disp_win.right_offset =
vui->def_disp_win.top_offset =
vui->def_disp_win.bottom_offset = 0;
}
}
vui->vui_timing_info_present_flag = get_bits1(gb);
if (vui->vui_timing_info_present_flag) {
vui->vui_num_units_in_tick = get_bits(gb, 32);
vui->vui_time_scale = get_bits(gb, 32);
vui->vui_poc_proportional_to_timing_flag = get_bits1(gb);
if (vui->vui_poc_proportional_to_timing_flag)
vui->vui_num_ticks_poc_diff_one_minus1 = get_ue_golomb_long(gb);
vui->vui_hrd_parameters_present_flag = get_bits1(gb);
if (vui->vui_hrd_parameters_present_flag)
decode_hrd(s, 1, sps->max_sub_layers);
}
vui->bitstream_restriction_flag = get_bits1(gb);
if (vui->bitstream_restriction_flag) {
vui->tiles_fixed_structure_flag = get_bits1(gb);
vui->motion_vectors_over_pic_boundaries_flag = get_bits1(gb);
vui->restricted_ref_pic_lists_flag = get_bits1(gb);
vui->min_spatial_segmentation_idc = get_ue_golomb_long(gb);
vui->max_bytes_per_pic_denom = get_ue_golomb_long(gb);
vui->max_bits_per_min_cu_denom = get_ue_golomb_long(gb);
vui->log2_max_mv_length_horizontal = get_ue_golomb_long(gb);
vui->log2_max_mv_length_vertical = get_ue_golomb_long(gb);
}
}
| 1threat |
In Pandas, Can we create a dataframe of size 1 row and column length of 8? : I'm new to pandas concept, Is it possible to create a dataframe of size 1 row and column-length of 8.
[Data Frame][1]
[1]: https://i.stack.imgur.com/zTVmx.png | 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
static void pci_vpb_map(SysBusDevice *dev, target_phys_addr_t base)
{
PCIVPBState *s = (PCIVPBState *)dev;
memory_region_add_subregion(get_system_memory(), base + 0x01000000,
&s->mem_config);
memory_region_add_subregion(get_system_memory(), base + 0x02000000,
&s->mem_config2);
if (s->realview) {
memory_region_add_subregion(get_system_memory(), base + 0x03000000,
&s->isa);
}
}
| 1threat |
Making an Octagon in Python out of * : I am trying to write a simple code in Python to make an octagon out of *. Here is the code I have so far, but obviously isn't working properly:
oct_length = int(input("What is the length of one side? "))
for i in range(oct_length):
print(' ' * (oct_length - i-1) + '*' * (oct_length + i*2))
for i in range(oct_length-1):
print('*' * ((oct_length * 2)))
for i in range(oct_length):
print(' ' * (i+1) + '*' * ((oct_length-i)*2))
Thanks in advance | 0debug |
ImageButton wont change activity when clicked but normal buttons will : So im making a simple app that shows information for a game and decided to use the character avatars as the buttons to switch to the page that has information on them but when they are pressed they do not switch the activity
Xml for the button
http://i.imgur.com/odwTtvN.png
The on click listener
http://imgur.com/a/bNHv6 | 0debug |
Can anyone explain this? : while True:
print ("wanna exit? type a number that not between(1-11)range")
side1 = input("Type 1st side: ")
side2 = input("Type 2st side: ")
side3 = input("Type 3rd side: ")
a= [1,11]
if (side1 not in a) :
print("You exit,goodbye! ")
break
else:
a = int(side1)
b = int(side2)
c= int(side3)
perimeter = (a + b +c )
print ("The perimeter of triangle is :", perimeter )
i input a number between 1 and 10 , however it outputed "you exit...." again and again | 0debug |
void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
{
unsigned i;
for(i=0; i<num_pixels; i++)
{
dst[0]= palette[ src[i]*4+2 ];
dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+0 ];
dst+= 3;
}
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.