problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
CSS to overlay centered text on a background image : <p>I'm not an html/css guy but the guy who usually does this quit so it fell into my lap.</p>
<p>I have a page where there is a background image to fill the entire page. I found some sample css online to do this:</p>
<pre><code>html {
background: url(background.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</code></pre>
<p>What I want to do now is overlay some text on this such that it appears at the centered at the bottom of the page (not right at the bottom, maybe 50 px up from bottom). I tried a bunch of things but can't seem to get it quite right.</p>
| 0debug |
av_cold static int lavfi_read_header(AVFormatContext *avctx)
{
LavfiContext *lavfi = avctx->priv_data;
AVFilterInOut *input_links = NULL, *output_links = NULL, *inout;
AVFilter *buffersink, *abuffersink;
int *pix_fmts = create_all_formats(AV_PIX_FMT_NB);
enum AVMediaType type;
int ret = 0, i, n;
#define FAIL(ERR) { ret = ERR; goto end; }
if (!pix_fmts)
FAIL(AVERROR(ENOMEM));
avfilter_register_all();
buffersink = avfilter_get_by_name("buffersink");
abuffersink = avfilter_get_by_name("abuffersink");
if (lavfi->graph_filename && lavfi->graph_str) {
av_log(avctx, AV_LOG_ERROR,
"Only one of the graph or graph_file options must be specified\n");
FAIL(AVERROR(EINVAL));
}
if (lavfi->graph_filename) {
uint8_t *file_buf, *graph_buf;
size_t file_bufsize;
ret = av_file_map(lavfi->graph_filename,
&file_buf, &file_bufsize, 0, avctx);
if (ret < 0)
goto end;
graph_buf = av_malloc(file_bufsize + 1);
if (!graph_buf) {
av_file_unmap(file_buf, file_bufsize);
FAIL(AVERROR(ENOMEM));
}
memcpy(graph_buf, file_buf, file_bufsize);
graph_buf[file_bufsize] = 0;
av_file_unmap(file_buf, file_bufsize);
lavfi->graph_str = graph_buf;
}
if (!lavfi->graph_str)
lavfi->graph_str = av_strdup(avctx->filename);
if (!(lavfi->graph = avfilter_graph_alloc()))
FAIL(AVERROR(ENOMEM));
if ((ret = avfilter_graph_parse(lavfi->graph, lavfi->graph_str,
&input_links, &output_links, avctx)) < 0)
FAIL(ret);
if (input_links) {
av_log(avctx, AV_LOG_ERROR,
"Open inputs in the filtergraph are not acceptable\n");
FAIL(AVERROR(EINVAL));
}
for (n = 0, inout = output_links; inout; n++, inout = inout->next);
if (!(lavfi->sink_stream_map = av_malloc(sizeof(int) * n)))
FAIL(AVERROR(ENOMEM));
if (!(lavfi->sink_eof = av_mallocz(sizeof(int) * n)))
FAIL(AVERROR(ENOMEM));
if (!(lavfi->stream_sink_map = av_malloc(sizeof(int) * n)))
FAIL(AVERROR(ENOMEM));
for (i = 0; i < n; i++)
lavfi->stream_sink_map[i] = -1;
for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
int stream_idx;
if (!strcmp(inout->name, "out"))
stream_idx = 0;
else if (sscanf(inout->name, "out%d\n", &stream_idx) != 1) {
av_log(avctx, AV_LOG_ERROR,
"Invalid outpad name '%s'\n", inout->name);
FAIL(AVERROR(EINVAL));
}
if ((unsigned)stream_idx >= n) {
av_log(avctx, AV_LOG_ERROR,
"Invalid index was specified in output '%s', "
"must be a non-negative value < %d\n",
inout->name, n);
FAIL(AVERROR(EINVAL));
}
type = inout->filter_ctx->output_pads[inout->pad_idx].type;
if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) {
av_log(avctx, AV_LOG_ERROR,
"Output '%s' is not a video or audio output, not yet supported\n", inout->name);
FAIL(AVERROR(EINVAL));
}
if (lavfi->stream_sink_map[stream_idx] != -1) {
av_log(avctx, AV_LOG_ERROR,
"An output with stream index %d was already specified\n",
stream_idx);
FAIL(AVERROR(EINVAL));
}
lavfi->sink_stream_map[i] = stream_idx;
lavfi->stream_sink_map[stream_idx] = i;
}
for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
AVStream *st;
if (!(st = avformat_new_stream(avctx, NULL)))
FAIL(AVERROR(ENOMEM));
st->id = i;
}
lavfi->sinks = av_malloc(sizeof(AVFilterContext *) * avctx->nb_streams);
if (!lavfi->sinks)
FAIL(AVERROR(ENOMEM));
for (i = 0, inout = output_links; inout; i++, inout = inout->next) {
AVFilterContext *sink;
type = inout->filter_ctx->output_pads[inout->pad_idx].type;
if (type == AVMEDIA_TYPE_VIDEO && ! buffersink ||
type == AVMEDIA_TYPE_AUDIO && ! abuffersink) {
av_log(avctx, AV_LOG_ERROR, "Missing required buffersink filter, aborting.\n");
FAIL(AVERROR_FILTER_NOT_FOUND);
}
if (type == AVMEDIA_TYPE_VIDEO) {
ret = avfilter_graph_create_filter(&sink, buffersink,
inout->name, NULL,
NULL, lavfi->graph);
av_opt_set_int_list(sink, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
if (ret < 0)
goto end;
} else if (type == AVMEDIA_TYPE_AUDIO) {
enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_U8,
AV_SAMPLE_FMT_S16,
AV_SAMPLE_FMT_S32,
AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_DBL, -1 };
ret = avfilter_graph_create_filter(&sink, abuffersink,
inout->name, NULL,
NULL, lavfi->graph);
av_opt_set_int_list(sink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
if (ret < 0)
goto end;
}
lavfi->sinks[i] = sink;
if ((ret = avfilter_link(inout->filter_ctx, inout->pad_idx, sink, 0)) < 0)
FAIL(ret);
}
if ((ret = avfilter_graph_config(lavfi->graph, avctx)) < 0)
FAIL(ret);
if (lavfi->dump_graph) {
char *dump = avfilter_graph_dump(lavfi->graph, lavfi->dump_graph);
fputs(dump, stderr);
fflush(stderr);
av_free(dump);
}
for (i = 0; i < avctx->nb_streams; i++) {
AVFilterLink *link = lavfi->sinks[lavfi->stream_sink_map[i]]->inputs[0];
AVStream *st = avctx->streams[i];
st->codec->codec_type = link->type;
avpriv_set_pts_info(st, 64, link->time_base.num, link->time_base.den);
if (link->type == AVMEDIA_TYPE_VIDEO) {
st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
st->codec->pix_fmt = link->format;
st->codec->time_base = link->time_base;
st->codec->width = link->w;
st->codec->height = link->h;
st ->sample_aspect_ratio =
st->codec->sample_aspect_ratio = link->sample_aspect_ratio;
avctx->probesize = FFMAX(avctx->probesize,
link->w * link->h *
av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(link->format)) *
30);
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
st->codec->codec_id = av_get_pcm_codec(link->format, -1);
st->codec->channels = av_get_channel_layout_nb_channels(link->channel_layout);
st->codec->sample_fmt = link->format;
st->codec->sample_rate = link->sample_rate;
st->codec->time_base = link->time_base;
st->codec->channel_layout = link->channel_layout;
if (st->codec->codec_id == AV_CODEC_ID_NONE)
av_log(avctx, AV_LOG_ERROR,
"Could not find PCM codec for sample format %s.\n",
av_get_sample_fmt_name(link->format));
}
}
if (!(lavfi->decoded_frame = av_frame_alloc()))
FAIL(AVERROR(ENOMEM));
end:
av_free(pix_fmts);
avfilter_inout_free(&input_links);
avfilter_inout_free(&output_links);
if (ret < 0)
lavfi_read_close(avctx);
return ret;
}
| 1threat |
static void opt_mb_qmax(const char *arg)
{
video_mb_qmax = atoi(arg);
if (video_mb_qmax < 0 ||
video_mb_qmax > 31) {
fprintf(stderr, "qmax must be >= 1 and <= 31\n");
exit(1);
}
}
| 1threat |
def get_odd_occurence(arr, arr_size):
for i in range(0, arr_size):
count = 0
for j in range(0, arr_size):
if arr[i] == arr[j]:
count += 1
if (count % 2 != 0):
return arr[i]
return -1 | 0debug |
Firebase - How to write/read data per user after authentication : <p>I have tried to understand but not able to see how and where might be the data I am storing after login is going.</p>
<pre><code>public static final String BASE_URL = "https://xyz.firebaseio.com";
Firebase ref = new Firebase(FirebaseUtils.BASE_URL);
ref.authWithPassword("xyz@foo.com", "some_password", new Firebase.AuthResultHandler() {
@Override
public void onAuthenticated(AuthData authData) {
Toast.makeText(LoginActivity.this, "Login Successful", Toast.LENGTH_SHORT).show();
startActivity(new Intent(LoginActivity.this, MainActivity.class));
}
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
}
}
</code></pre>
<p>At this point I am successfully authenticated and landed onto <code>MainActivity</code>. Next in <code>onCreate</code> of <code>MainActivity</code>. I initialize <code>Firebase</code></p>
<pre><code>firebase = new Firebase(FirebaseUtils.BASE_URL).child("box");
// adapter below is an ArrayAdapter feeding ListView
firebase.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
if (dataSnapshot.getValue(Box.class) instanceof Box)
adapter.add(dataSnapshot.getValue(Box.class).getName());
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
adapter.remove(dataSnapshot.getValue(Box.class).getName());
}
// other callbacks
}
</code></pre>
<p>There is a add button that I used to push new records from Android to <code>Firebase</code>.</p>
<pre><code>final Button button = (Button) findViewById(R.id.addButton);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Box box = new Box("Box " + System.currentTimeMillis(), "Location " + System.currentTimeMillis());
Firebase fbBox = firebase.child("" + System.currentTimeMillis());
fbBox.setValue(box);
}
});
</code></pre>
<p>But above code doesn't add any record (evident from <code>ListView</code> that is not updated) or atleast I might not know where to look for the data. I checked opening <code>Firebase</code> in browser, but I am not sure how to check for user specific data?</p>
<p>I modified my <code>Firebase Rules</code> like </p>
<pre><code>{
"rules": {
"users": {
"$uid": {
".write": "auth != null && auth.uid == $uid",
".read": "auth != null && auth.uid == $uid"
}
}
}
}
</code></pre>
<p>I tried to open URLs such as <a href="https://xyz.firebaseio.com/xxxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxxxxx">https://xyz.firebaseio.com/xxxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxxxxx</a> but it wouldn't show any data.</p>
<p>I would like to have some information on:</p>
<ol>
<li><p>How to add user specific data after authentication. Can't it be seamless like when we don't have any restriction on read/write on user basis, because I could easily read/write data.</p></li>
<li><p>Is there any <code>Firebase</code> web view to visualize the database or see JSON data, where I can see/modify the data to/from Android device?</p></li>
</ol>
| 0debug |
Swift compare 2 array of type [int] without guaranteed order : <p>I make app for performing tests. For check for valid answer i have array of correct answers, of type [Int]. It may be, for example, [1, 5, 10].</p>
<p>Also i have array of questions id's that user entered, also [Int] type.</p>
<p>Now i have to somehow compare that arrays. But, [1,5,10] should be equal to [10,1,5] and [5,1,10], etc., because order is not guaranteed. How to achieve that?</p>
| 0debug |
Fetch multiple Images from URL : I have a one randomly selected link which have a multiple images so how can i fetch those images in my Android Studio I don't have any URL already, and display those images in RecyclerView.
| 0debug |
remove image using javascript/refresh image on change : i would like to know how I can remove an image using a red box with a white X I found this http://codepedia.info/convert-html-to-image-in-jquery-div-or-table-to-jpg-png/ I would like to know how I can make a red box on the corner everytime a new image is produced. or if its easier to just refresh the image when changes are applied | 0debug |
assembly strings - equivalent code in c++ : I've got a code in assembly:
et:
s db 'text'
s_size = $ - et
db 0Dh,0Ah,'$'
I would like to ask what does `s_size = $ - et` and `db 0Dh,0Ah,'$'`? I also wonder what would be the equivalent code of these definitions in C++? | 0debug |
static int my_log2(unsigned int i)
{
unsigned int iLog2 = 0;
while ((i >> iLog2) > 1)
iLog2++;
return iLog2;
}
| 1threat |
static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
SBRData *ch_data, const int e_a[2])
{
int e, k, m;
static const SoftFloat limgain[4] = { { 760155524, 0 }, { 0x20000000, 1 },
{ 758351638, 1 }, { 625000000, 34 } };
for (e = 0; e < ch_data->bs_num_env; e++) {
int delta = !((e == e_a[1]) || (e == e_a[0]));
for (k = 0; k < sbr->n_lim; k++) {
SoftFloat gain_boost, gain_max;
SoftFloat sum[2] = { FLOAT_0, FLOAT_0 };
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
const SoftFloat temp = av_div_sf(sbr->e_origmapped[e][m],
av_add_sf(FLOAT_1, sbr->q_mapped[e][m]));
sbr->q_m[e][m] = av_sqrt_sf(av_mul_sf(temp, sbr->q_mapped[e][m]));
sbr->s_m[e][m] = av_sqrt_sf(av_mul_sf(temp, av_int2sf(ch_data->s_indexmapped[e + 1][m], 0)));
if (!sbr->s_mapped[e][m]) {
if (delta) {
sbr->gain[e][m] = av_sqrt_sf(av_div_sf(sbr->e_origmapped[e][m],
av_mul_sf(av_add_sf(FLOAT_1, sbr->e_curr[e][m]),
av_add_sf(FLOAT_1, sbr->q_mapped[e][m]))));
} else {
sbr->gain[e][m] = av_sqrt_sf(av_div_sf(sbr->e_origmapped[e][m],
av_add_sf(FLOAT_1, sbr->e_curr[e][m])));
}
} else {
sbr->gain[e][m] = av_sqrt_sf(
av_div_sf(
av_mul_sf(sbr->e_origmapped[e][m], sbr->q_mapped[e][m]),
av_mul_sf(
av_add_sf(FLOAT_1, sbr->e_curr[e][m]),
av_add_sf(FLOAT_1, sbr->q_mapped[e][m]))));
}
}
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
sum[0] = av_add_sf(sum[0], sbr->e_origmapped[e][m]);
sum[1] = av_add_sf(sum[1], sbr->e_curr[e][m]);
}
gain_max = av_mul_sf(limgain[sbr->bs_limiter_gains],
av_sqrt_sf(
av_div_sf(
av_add_sf(FLOAT_EPSILON, sum[0]),
av_add_sf(FLOAT_EPSILON, sum[1]))));
if (av_gt_sf(gain_max, FLOAT_100000))
gain_max = FLOAT_100000;
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
SoftFloat q_m_max = av_div_sf(
av_mul_sf(sbr->q_m[e][m], gain_max),
sbr->gain[e][m]);
if (av_gt_sf(sbr->q_m[e][m], q_m_max))
sbr->q_m[e][m] = q_m_max;
if (av_gt_sf(sbr->gain[e][m], gain_max))
sbr->gain[e][m] = gain_max;
}
sum[0] = sum[1] = FLOAT_0;
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
sum[0] = av_add_sf(sum[0], sbr->e_origmapped[e][m]);
sum[1] = av_add_sf(sum[1],
av_mul_sf(
av_mul_sf(sbr->e_curr[e][m],
sbr->gain[e][m]),
sbr->gain[e][m]));
sum[1] = av_add_sf(sum[1],
av_mul_sf(sbr->s_m[e][m], sbr->s_m[e][m]));
if (delta && !sbr->s_m[e][m].mant)
sum[1] = av_add_sf(sum[1],
av_mul_sf(sbr->q_m[e][m], sbr->q_m[e][m]));
}
gain_boost = av_sqrt_sf(
av_div_sf(
av_add_sf(FLOAT_EPSILON, sum[0]),
av_add_sf(FLOAT_EPSILON, sum[1])));
if (av_gt_sf(gain_boost, FLOAT_1584893192))
gain_boost = FLOAT_1584893192;
for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) {
sbr->gain[e][m] = av_mul_sf(sbr->gain[e][m], gain_boost);
sbr->q_m[e][m] = av_mul_sf(sbr->q_m[e][m], gain_boost);
sbr->s_m[e][m] = av_mul_sf(sbr->s_m[e][m], gain_boost);
}
}
}
}
| 1threat |
hello i followed simcoder uber app and got the app in his github but whene i try to log in as a customer the app crash : 10-09 12:04:27.809 17199-17199/com.simcoder.uber E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.simcoder.uber, PID: 17199
java.lang.IllegalArgumentException: Not a valid geo location: 120.8281794, 14.8458765
at com.firebase.geofire.GeoLocation.<init>(GeoLocation.java:51)
at com.simcoder.uber.CustomerMapActivity.getDriversAround(CustomerMapActivity.java:540)
at com.simcoder.uber.CustomerMapActivity.access$2300(CustomerMapActivity.java:74)
at com.simcoder.uber.CustomerMapActivity$10.onLocationResult(CustomerMapActivity.java:483)
at com.google.android.gms.internal.zzcec.zzt(Unknown Source)
at com.google.android.gms.common.api.internal.zzcl.zzb(Unknown Source)
at com.google.android.gms.common.api.internal.zzcm.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:853)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:737)
| 0debug |
Arranging array of String from bytes : <p>I am new to java and trying to process some logic. I have file </p>
<pre><code>5049,INF
5049,INF
5049,INF
5049,INF
5049,INF
5051,INF
5051,INF
5051,BNF
5051,TNF
</code></pre>
<p>I need this file data in string concatenation like </p>
<p>pIntString value is 5049,5051 and pString value is INF,BNF,TNF.</p>
<p>My Java Code </p>
<pre><code> Path path = Paths.get(fileName);
byte[] data = Files.readAllBytes(path);
String str = new String(data);
//System.out.println(data.toString());
String[] strValue = str.split(",");
String pushidString = null;
String pIntString = strValue[0];
for (int i=0;i<strValue.length-2;i++) {
pushidString = strValue[i+2];
pIntString = pushidString + pIntString;
}
</code></pre>
<p>But this code lack basic logic. Any help would be appreciated</p>
| 0debug |
Is there a difference between floor and truncate in Haskell : <p>Does there exist a difference in functionality between <code>floor</code> and <code>truncate</code> in Haskell?</p>
<p>They seem to perform the same functionality and they have the same type signature:</p>
<ul>
<li><code>truncate :: (Integral b, RealFrac a) => a -> b</code></li>
<li><code>floor :: (Integral b, RealFrac a) => a -> b</code></li>
</ul>
| 0debug |
C - Error in Comparing Variable of Struct and String : <p>I am trying to implement a function that compares two strings. However, i am getting "expression must be a modifiable lvalue" in function strcmp even if i use char pointers instead of char array. My code is in following.</p>
<pre><code>typedef enum { false, true } boolean;
struct threeGram *threeGram_array;
struct threeGram
{
const char *value;
int occurence;
};
boolean containsValue(struct threeGram array[], const char *string){
int i;
for(i = 0; i < sizeof (array) / sizeof (struct threeGram); i++){
if(strcmp(array[i].value, string) = 0){
return true;
}
}
return false;
}
</code></pre>
| 0debug |
How to type check a single file from command line, using the setting in tsconfig.json? : <p>Normally I run <code>tsc -p ./tsconfig.json</code> which type checks all files in the <code>./src</code> folder relative to tsconfig.</p>
<p>But if I run <code>tsc -p ./tsconfig.json src/specific-file.ts</code>, it complains</p>
<blockquote>
<p>error TS5042: Option 'project' cannot be mixed with source files on a command line.</p>
</blockquote>
<p>So, if I remove the option and run <code>tsc src/specific-file.ts</code> then it checks the file, but it does not use any settings from tsconfig (because I haven't specified the tsconfig file?).</p>
<p>How can I run <code>tsc</code> on a single file and using the settings in tsconfig that would otherwise be used on the whole project?</p>
| 0debug |
push notifcation in create react app using firebase : hello guys can someone please help me in integrating push notification using firebase in my create-react-app web application i have tried to follow some article but nothing worked someone please help me with a working tutorial or a git repo.
thanks in advance.
I have followed this article but not succeded
https://dzone.com/articles/push-notification-pwa-reactjs-using-firebase
i want to add notification in my react application using firebase | 0debug |
SQL query - Getting rows for values greater by 3 numbers or letters : Am trying to come up with a query where in i can return back values which has greater letters by 2 or 3 than the chosen letter.
For Example:
I have two columns which has letters **Column A** and **Column B**. I want to get back when **column B** is greater than **Column A** by two letters.
Another Example. If a row in **Column A** is letter 'D' then it should get values only if row in **column B** 'F' because its greater by two letters.
Thanks in advance | 0debug |
static void qemu_mod_timer_ns(QEMUTimer *ts, int64_t expire_time)
{
QEMUTimer **pt, *t;
qemu_del_timer(ts);
pt = &active_timers[ts->clock->type];
for(;;) {
t = *pt;
if (!t)
break;
if (t->expire_time > expire_time)
break;
pt = &t->next;
}
ts->expire_time = expire_time;
ts->next = *pt;
*pt = ts;
if (pt == &active_timers[ts->clock->type]) {
if (!alarm_timer->pending) {
qemu_rearm_alarm_timer(alarm_timer);
}
if (use_icount)
qemu_notify_event();
}
}
| 1threat |
How to access a certain button to change the value of a certain next field (in a dynamically created controls) : #i need to use a button to make a number of textboxes with related buttons each button will add 1 to the textbox (that i want to be related to it HOW?)#
##i have a windows form with button1 and three panels##
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace AdvancedCounter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
if (panel3.Controls != null)
{
var btn = panel3.Controls.Find("_B", true).First();
btn.Click += new EventHandler(Btn_Click);
}
}
int a = 0;
int counter=0;
private void button1_Click(object sender, EventArgs e)
{
counter++;
Button btn = new Button();
btn.Location = new Point(0, 100);
btn.Text = "ADD";
btn.Name ="_B";
btn.Dock = DockStyle.Left;
TextBox txt = new TextBox();
txt.Name = "_T";
txt.Location = new Point(500, 100);
txt.Dock = DockStyle.Left;
txt.Text = a.ToString();
panel3.Controls.Add(txt);
panel3.Controls.Add(btn);
foreach (var item in panel3.Controls.Find("_B", true))
{
item.Text = "ass";
}
}
// btn.Click += new EventHandler(Btn_Click);
private void Btn_Click(object sender, EventArgs e)
{
// MessageBox.Show(sender.ToString());
// throw new NotImplementedException();
var txtbx= panel3.Controls.Find("_T", true).First();
var btnbx = panel3.Controls.Find("_B", true).First();
a++;
// find[1].Dispose();
txtbx.Text = a.ToString();
}
}
}
| 0debug |
Is it possible to start the for loop from backwards : <p>I'm pretty sure that my logic is right but it doesn't print anything. Can anyone please take a look at my code. It supposes to print the string backward. But it doesn't print anything. It doesn't give me an error either. Thanks</p>
<pre><code>String x = input.nextLine();
for(int i = x.length()-1; i<=0;i--)
{
System.out.println(x.charAt(i));
}
</code></pre>
| 0debug |
Trying to find numbers in my String then store those values in a variable for use in math : Basically ive had a easy time at this so far because ive been just useing userInput.includes() then the word then what happens if the word is typed. I want to make it so the user can put like add 2 numbers together. So then my program would store that 2 make 2 variables then make a adding function. My big issue is finding the integer in a string and storing it in a variable.
function hasNumbers(t)
{
var regex = /\d/g;
return regex.test(t);
}
something like this would be good but id prefer it not to be a function. ether like var amountOfVariables = or if(userInput.includes,isinteger,typeof, etc there has to be a combination of methods that allows you to find a integer in a string. then stores it in a variable
was trying to use
document.write(amountOfVariables);
to test if it was being stored but no luck. I know i need to convert the String part into a int.
Example of a user input might be " make a C++ program that adds 2 numbers together" the 2 should be stored in whatever variable .
I want a method or a way to store integers in a users input in variables for later use in functions. But at the moment I cant get this to work.
| 0debug |
Why does the default shell in OS X 10 look differently than that in Linux (Mint, Lubuntu...)? : <p>To clarify, when entering the default shell in OS X it appears as:</p>
<p><strong>pcname:~ username$</strong></p>
<p>and changing directories appears as:</p>
<p><strong>pcname:myFolder~ username$</strong></p>
<hr>
<p>however, in my experience with linux distros, the shell appears as:</p>
<p><strong>username@pcname:~$</strong></p>
<p>what is the purpose for the differences in syntax?</p>
| 0debug |
static void set_mem_path(Object *o, const char *str, Error **errp)
{
HostMemoryBackend *backend = MEMORY_BACKEND(o);
HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(o);
if (memory_region_size(&backend->mr)) {
error_setg(errp, "cannot change property value");
return;
}
if (fb->mem_path) {
g_free(fb->mem_path);
}
fb->mem_path = g_strdup(str);
}
| 1threat |
int slirp_remove_hostfwd(int is_udp, struct in_addr host_addr, int host_port)
{
struct socket *so;
struct socket *head = (is_udp ? &udb : &tcb);
struct sockaddr_in addr;
int port = htons(host_port);
socklen_t addr_len;
int n = 0;
loop_again:
for (so = head->so_next; so != head; so = so->so_next) {
addr_len = sizeof(addr);
if (getsockname(so->s, (struct sockaddr *)&addr, &addr_len) == 0 &&
addr.sin_addr.s_addr == host_addr.s_addr &&
addr.sin_port == port) {
close(so->s);
sofree(so);
n++;
goto loop_again;
}
}
return n;
}
| 1threat |
Create files / folders on docker-compose build or docker-compose up : <p>I'm trying my first steps into Docker, so I tried making a Dockerfile that creates a simple index.html and a directory images (See code below)</p>
<p>Then I run docker-compose build to create the image, and docker-compose-up to run the server. But I get no file index.html or folder images.</p>
<p>This is my Dockerfile:</p>
<pre><code>FROM php:apache
MAINTAINER brent@dropsolid.com
WORKDIR /var/www/html
RUN touch index.html \
&& mkdir images
</code></pre>
<p>And this is my docker-compose.yml</p>
<pre><code>version: '2'
services:
web:
build: .docker/web
ports:
- "80:80"
volumes:
- ./docroot:/var/www/html
</code></pre>
<p>I would expect that this would create a docroot folder with an image directory and an index.html, but I only get the docroot.</p>
| 0debug |
static void end_frame(AVFilterLink *link)
{
DeshakeContext *deshake = link->dst->priv;
AVFilterBufferRef *in = link->cur_buf;
AVFilterBufferRef *out = link->dst->outputs[0]->out_buf;
Transform t;
float matrix[9];
float alpha = 2.0 / deshake->refcount;
char tmp[256];
Transform orig;
if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) {
find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t);
} else {
uint8_t *src1 = (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0];
uint8_t *src2 = in->data[0];
deshake->cx = FFMIN(deshake->cx, link->w);
deshake->cy = FFMIN(deshake->cy, link->h);
if ((unsigned)deshake->cx + (unsigned)deshake->cw > link->w) deshake->cw = link->w - deshake->cx;
if ((unsigned)deshake->cy + (unsigned)deshake->ch > link->h) deshake->ch = link->h - deshake->cy;
deshake->cw &= ~15;
src1 += deshake->cy * in->linesize[0] + deshake->cx;
src2 += deshake->cy * in->linesize[0] + deshake->cx;
find_motion(deshake, src1, src2, deshake->cw, deshake->ch, in->linesize[0], &t);
}
orig.vector.x = t.vector.x;
orig.vector.y = t.vector.y;
orig.angle = t.angle;
orig.zoom = t.zoom;
deshake->avg.vector.x = alpha * t.vector.x + (1.0 - alpha) * deshake->avg.vector.x;
deshake->avg.vector.y = alpha * t.vector.y + (1.0 - alpha) * deshake->avg.vector.y;
deshake->avg.angle = alpha * t.angle + (1.0 - alpha) * deshake->avg.angle;
deshake->avg.zoom = alpha * t.zoom + (1.0 - alpha) * deshake->avg.zoom;
t.vector.x -= deshake->avg.vector.x;
t.vector.y -= deshake->avg.vector.y;
t.angle -= deshake->avg.angle;
t.zoom -= deshake->avg.zoom;
t.vector.x *= -1;
t.vector.y *= -1;
t.angle *= -1;
if (deshake->fp) {
snprintf(tmp, 256, "%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f\n", orig.vector.x, deshake->avg.vector.x, t.vector.x, orig.vector.y, deshake->avg.vector.y, t.vector.y, orig.angle, deshake->avg.angle, t.angle, orig.zoom, deshake->avg.zoom, t.zoom);
fwrite(tmp, sizeof(char), strlen(tmp), deshake->fp);
}
t.vector.x += deshake->last.vector.x;
t.vector.y += deshake->last.vector.y;
t.angle += deshake->last.angle;
t.zoom += deshake->last.zoom;
t.vector.x *= 0.9;
t.vector.y *= 0.9;
t.angle *= 0.9;
deshake->last.vector.x = t.vector.x;
deshake->last.vector.y = t.vector.y;
deshake->last.angle = t.angle;
deshake->last.zoom = t.zoom;
avfilter_get_matrix(t.vector.x, t.vector.y, t.angle, 1.0 + t.zoom / 100.0, matrix);
avfilter_transform(in->data[0], out->data[0], in->linesize[0], out->linesize[0], link->w, link->h, matrix, INTERPOLATE_BILINEAR, deshake->edge);
avfilter_get_matrix(t.vector.x / (link->w / CHROMA_WIDTH(link)), t.vector.y / (link->h / CHROMA_HEIGHT(link)), t.angle, 1.0 + t.zoom / 100.0, matrix);
avfilter_transform(in->data[1], out->data[1], in->linesize[1], out->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge);
avfilter_transform(in->data[2], out->data[2], in->linesize[2], out->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), matrix, INTERPOLATE_BILINEAR, deshake->edge);
if (deshake->ref != NULL)
avfilter_unref_buffer(deshake->ref);
deshake->ref = in;
avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1);
avfilter_end_frame(link->dst->outputs[0]);
avfilter_unref_buffer(out);
}
| 1threat |
How to edit PHP.ini file to enable bigger files upload? : <p>I want to code a php file uploader, but for bigger files. What do I have to modify?</p>
| 0debug |
How to do 'lateral view explode()' in pandas : <p>I want to do this :</p>
<pre><code># input:
A B
0 [1, 2] 10
1 [5, 6] -20
# output:
A B
0 1 10
1 2 10
2 5 -20
3 6 -20
</code></pre>
<p>Every column A's value is a list</p>
<pre><code>df = pd.DataFrame({'A':[[1,2],[5,6]],'B':[10,-20]})
df = pd.DataFrame([[item]+list(df.loc[line,'B':]) for line in df.index for item in df.loc[line,'A']],
columns=df.columns)
</code></pre>
<p>The above code can work but it's very slow</p>
<p>is there any clever method?</p>
<p>Thank you</p>
| 0debug |
How to change the icon which used as a nav link ? while link is active ,icon must be changed to another icon with help of jquery : I used icon as a nav link.Icon must be changed to another icon while it is active.then again it must be converted into first icon while moved into another link with help of jQuery and css image sprites. | 0debug |
How can I get Style="Display:None" value by using POST methord in PHP : This is my php code.
if (isset($_POST['submit'])) {
$uname = $_POST['uname'];
$pass= md5($_POST['pass']);
$level = $_POST['ulevel'];
$role = $_POST['urole'];}
This is HTML code
<div id="alevel" style="display: none">
<select id="select" name="urole">
<option value="">Select Role</option>
<option value="admin">Admin</option>
<option value="editr">Editor</option>
</select>
</div>
I want after submit select role in urole value POST to $role | 0debug |
static int xan_huffman_decode(uint8_t *dest, int dest_len,
const uint8_t *src, int src_len)
{
uint8_t byte = *src++;
uint8_t ival = byte + 0x16;
const uint8_t * ptr = src + byte*2;
int ptr_len = src_len - 1 - byte*2;
uint8_t val = ival;
uint8_t *dest_end = dest + dest_len;
uint8_t *dest_start = dest;
int ret;
GetBitContext gb;
if ((ret = init_get_bits8(&gb, ptr, ptr_len)) < 0)
return ret;
while (val != 0x16) {
unsigned idx = val - 0x17 + get_bits1(&gb) * byte;
if (idx >= 2 * byte)
return AVERROR_INVALIDDATA;
val = src[idx];
if (val < 0x16) {
if (dest >= dest_end)
return dest_len;
*dest++ = val;
val = ival;
}
}
return dest - dest_start;
}
| 1threat |
Axios handling errors : <p>I'm trying to understand javascript promises better with Axios. What I pretend is to handle all errors in Request.js and only call the request function from anywhere without having to use <code>catch()</code>.</p>
<p>In this example, the response to the request will be 400 with an error message in JSON.</p>
<p>This is the error I'm getting:</p>
<p><code>Uncaught (in promise) Error: Request failed with status code 400</code></p>
<p>The only solution I find is to add <code>.catch(() => {})</code> in Somewhere.js but I'm trying to avoid having to do that. Is it possible?</p>
<p>Here's the code:</p>
<blockquote>
<p>Request.js</p>
</blockquote>
<pre><code>export function request(method, uri, body, headers) {
let config = {
method: method.toLowerCase(),
url: uri,
baseURL: API_URL,
headers: { 'Authorization': 'Bearer ' + getToken() },
validateStatus: function (status) {
return status >= 200 && status < 400
}
}
...
return axios(config).then(
function (response) {
return response.data
}
).catch(
function (error) {
console.log('Show error notification!')
return Promise.reject(error)
}
)
}
</code></pre>
<blockquote>
<p>Somewhere.js</p>
</blockquote>
<pre><code>export default class Somewhere extends React.Component {
...
callSomeRequest() {
request('DELETE', '/some/request').then(
() => {
console.log('Request successful!')
}
)
}
...
}
</code></pre>
| 0debug |
Spark: Could not find CoarseGrainedScheduler : <p>Am not sure what's causing this exception running my Spark job after running for some few hours.</p>
<p>Am running Spark 2.0.2</p>
<p>Any debugging tip ?</p>
<pre><code>2016-12-27 03:11:22,199 [shuffle-server-3] ERROR org.apache.spark.network.server.TransportRequestHandler - Error while invoking RpcHandler#receive() for one-way message.
org.apache.spark.SparkException: Could not find CoarseGrainedScheduler.
at org.apache.spark.rpc.netty.Dispatcher.postMessage(Dispatcher.scala:154)
at org.apache.spark.rpc.netty.Dispatcher.postOneWayMessage(Dispatcher.scala:134)
at org.apache.spark.rpc.netty.NettyRpcHandler.receive(NettyRpcEnv.scala:571)
at org.apache.spark.network.server.TransportRequestHandler.processOneWayMessage(TransportRequestHandler.java:180)
at org.apache.spark.network.server.TransportRequestHandler.handle(TransportRequestHandler.java:109)
at org.apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.java:119)
at org.apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.java:51)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at org.apache.spark.network.util.TransportFrameDecoder.channelRead(TransportFrameDecoder.java:85)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEve
</code></pre>
| 0debug |
TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32') : <p>I am new to coding but I am trying to create a really simple program that will basically plot a line. The user will input values for v and a then v and a and x will determine y. I attempted to do this with this:</p>
<pre><code>x = np.linspace(0., 9., 10)
a = raw_input('Acceleration =')
v = raw_input('Velocity = ')
y=v*x-0.5*a*x**2.
</code></pre>
<p>basically this will represent a parabola where v is velocity, a is acceleration and x is time. But, I keep getting this error:</p>
<pre><code>TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32'
) dtype('S32') dtype('S32')
</code></pre>
| 0debug |
can a image url contain a written virus : <p>i was trying to insert image urls into my database but I was wondering can image urls contain virus written in the url itself. I've looked around for the answer but can't find the answer.
like this. I've seen real huge urls about a page long. Like this url below could that be a virus.
<a href="http://vignette4.wikia.nocookie.net/disney/images/8/8b/AoU_Hulk_03.png/revision/latest?cb=20150310161344" rel="nofollow">http://vignette4.wikia.nocookie.net/disney/images/8/8b/AoU_Hulk_03.png/revision/latest?cb=20150310161344</a></p>
<p>data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMTEhUTExMWFhUXGBgXGBgYGBgaHRodGBcYFxcXGhcYHSggGBolHRUVITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGxAQGi0lICUtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIALEBHAMBIgACEQEDEQH/xAAbAAACAgMBAAAAAAAAAAAAAAAEBQMGAAECB//EAEUQAAEDAgMFBQYDBQYEBwAAAAEAAhEDIQQSMQUGQVFhEyJxgZEyQqGxwfAUUuEjYnKS0QcVM4LC8SQ0Q6JEU2Oys8PS/8QAGQEAAwEBAQAAAAAAAAAAAAAAAQIDBAAF/8QALhEAAgICAQMCBAUFAQAAAAAAAAECEQMhEgQxQRNRIjJxgWGRocHwIzOx0eEU/9oADAMBAAIRAxEAPwC9vaoi1TPC4Wi2ZaNsYFIAFHnW2OXWztHZKExARRKhqBFAkDCkEFUObM3jEhTbUqGMomdUKxpBY/yKexKMxlIHDlw1aqLWxTS7vEhWza2JOHbVDrtIt9FzsZ1Knh6LxSp9q5udz3Ma53eJIguBi0aLN1HVrBFNq7YeCq34M3UoOqd5rXOYOMGD56IffGs/LALA+7sgcHOytLQSS2QIzNsTOvIpni9ouqCHPLvE29FTts18pD4nszmgcRBbUb4uY548SFjxdfLJkWqR3NaQZh6TqmENRzpymAEpaJupnvcGGk13dmbaEatd5gyoqLTB5BeqiiRHnAIPIq+Y7aLRhKdYkSLAeGn31Xn1cyV06s97Q1x7jdAg1Z1DLeqmagp12j2tUtwNJ7XB2kQVLi67jSDZ9nRQtxndaI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BbWI+EKYdV2VpYuXcJ//9k=</p>
| 0debug |
def modular_inverse(arr, N, P):
current_element = 0
for i in range(0, N):
if ((arr[i] * arr[i]) % P == 1):
current_element = current_element + 1
return current_element | 0debug |
static int videotoolbox_buffer_create(AVCodecContext *avctx, AVFrame *frame)
{
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
CVPixelBufferRef pixbuf = (CVPixelBufferRef)vtctx->frame;
OSType pixel_format = CVPixelBufferGetPixelFormatType(pixbuf);
enum AVPixelFormat sw_format = av_map_videotoolbox_format_to_pixfmt(pixel_format);
int width = CVPixelBufferGetWidth(pixbuf);
int height = CVPixelBufferGetHeight(pixbuf);
AVHWFramesContext *cached_frames;
int ret;
ret = ff_videotoolbox_buffer_create(vtctx, frame);
if (ret < 0)
return ret;
if (!vtctx->cached_hw_frames_ctx)
return 0;
cached_frames = (AVHWFramesContext*)vtctx->cached_hw_frames_ctx->data;
if (cached_frames->sw_format != sw_format ||
cached_frames->width != width ||
cached_frames->height != height) {
AVBufferRef *hw_frames_ctx = av_hwframe_ctx_alloc(cached_frames->device_ref);
AVHWFramesContext *hw_frames;
if (!hw_frames_ctx)
return AVERROR(ENOMEM);
hw_frames = (AVHWFramesContext*)hw_frames_ctx->data;
hw_frames->format = cached_frames->format;
hw_frames->sw_format = sw_format;
hw_frames->width = width;
hw_frames->height = height;
ret = av_hwframe_ctx_init(hw_frames_ctx);
if (ret < 0) {
av_buffer_unref(&hw_frames_ctx);
return ret;
}
av_buffer_unref(&vtctx->cached_hw_frames_ctx);
vtctx->cached_hw_frames_ctx = hw_frames_ctx;
}
av_assert0(!frame->hw_frames_ctx);
frame->hw_frames_ctx = av_buffer_ref(vtctx->cached_hw_frames_ctx);
if (!frame->hw_frames_ctx)
return AVERROR(ENOMEM);
return 0;
}
| 1threat |
static void gen_slbie(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
gen_helper_slbie(cpu_env, cpu_gpr[rB(ctx->opcode)]);
#endif
}
| 1threat |
How do I add different classes to <td> in javascript : Hey I have two td elements in a table. I want the have separate style classes for them. How do I do this?
This is my code:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
table += "<tr>";
for(var i = 0; i < data.list.length; i++){
table += "<td>" + "<table>" + "<td>" + value1 "</td>" + "<td>" + value2 + "</td>" + "</table>";
}
table += "</tr>";
<!-- end snippet -->
I have tried to simply add class in td element but that does not work. Any ideas? I use Javascript to create the table.
So this does not work:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
table += "<tr>";
for(var i = 0; i < data.list.length; i++){
table += "<td>" + "<table>" + "<td class="one">" + value1 "</td>" + "<td class="two">" + value2 + "</td>" + "</table>";
}
table += "</tr>";
<!-- end snippet -->
| 0debug |
sql is the column value is null get column from another table : I have two tables.
If percentage in table A is null then I want to look for it in table B
SELECT t.id,
CASE
WHEN t.percentage IS NULL
THEN (SELECT percentage FROM test2 AS s WHERE s.id=t.id )
ELSE t.percentage
END AS percentage
FROM [project_percentage] t
| 0debug |
Using css class in php script : <p>I used <a href="http://enjoycss.com" rel="nofollow noreferrer">enjoycss</a> to create some css components and then get the codes. For a button, I got</p>
<pre><code>.mybutton-css {
display: inline-block;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
cursor: pointer;
padding: 10px 20px;
border: 1px solid #018dc4;
-webkit-border-radius: 3px;
border-radius: 3px;
font: normal 16px/normal Tahoma, Geneva, sans-serif;
color: rgba(255,255,255,0.9);
-o-text-overflow: clip;
text-overflow: clip;
background: #0199d9;
-webkit-box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) ;
box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) ;
text-shadow: -1px -1px 0 rgba(15,73,168,0.66) ;
-webkit-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1);
-moz-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1);
-o-transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1);
transition: all 300ms cubic-bezier(0.42, 0, 0.58, 1);
}
</code></pre>
<p>However, it differs from what I see in the tutorials as they use <code>.button</code> but I don't see that. I also don't know how to call that! should I create a file named <code>mybutton-css.txt</code>? In <code>test.php</code>, I have</p>
<pre><code><html>
<head>
<title> Hello </title>
</head>
<body>
<?php
print( "hello world" );
<input type="button" class="mybutton-css" value="Load File" />
?>
</body>
</html>
</code></pre>
| 0debug |
static int announce_self_create(uint8_t *buf,
uint8_t *mac_addr)
{
uint32_t magic = EXPERIMENTAL_MAGIC;
uint16_t proto = htons(ETH_P_EXPERIMENTAL);
memset(buf, 0, 64);
memset(buf, 0xff, 6);
memcpy(buf + 6, mac_addr, 6);
memcpy(buf + 12, &proto, 2);
memcpy(buf + 14, &magic, 4);
return 64;
}
| 1threat |
Spring boot + batch, 2 JNDI configuration steps : Can anyone suggest how to configure 2 JNDI names in spring boot configuration. | 0debug |
How to share data between components in VueJS : <p>I have a fairly simple VueJS app, 3 components (Login, SelectSomething, DoStuff)</p>
<p>Login component is just a form for user and pass input while the second component needs to display some data obtained in the login progress.</p>
<p>How can I share data from one component to the others? So that when I route to second component I still have the data obtained in the Login one?</p>
| 0debug |
static void gic_cpu_write(gic_state *s, int cpu, int offset, uint32_t value)
{
switch (offset) {
case 0x00:
s->cpu_enabled[cpu] = (value & 1);
DPRINTF("CPU %d %sabled\n", cpu, s->cpu_enabled ? "En" : "Dis");
break;
case 0x04:
s->priority_mask[cpu] = (value & 0xff);
break;
case 0x08:
break;
case 0x10:
return gic_complete_irq(s, cpu, value & 0x3ff);
default:
hw_error("gic_cpu_write: Bad offset %x\n", (int)offset);
return;
}
gic_update(s);
}
| 1threat |
How to delete elements of a pointer in c++ : <p>If I have a pointer <code>float *p;</code> And I want to delete one element of its elements or all of its elements .. Is there any operator can do this??</p>
<p>And <code>delete [] p;</code> operator will delete only the address of the pointer or the elements too?</p>
<p>Thanks in advance.</p>
| 0debug |
unsigned s390_del_running_cpu(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
if (cs->halted == 0) {
assert(s390_running_cpus >= 1);
s390_running_cpus--;
cs->halted = 1;
cs->exception_index = EXCP_HLT;
}
return s390_running_cpus;
}
| 1threat |
How to compare two Streams in Java 8 : <p>What would be a good way to compare two <code>Stream</code> instances in Java 8 and find out whether they have the same elements, specifically for purposes of unit testing?</p>
<p>What I've got now is:</p>
<pre><code>@Test
void testSomething() {
Stream<Integer> expected;
Stream<Integer> thingUnderTest;
// (...)
Assert.assertArrayEquals(expected.toArray(), thingUnderTest.toArray());
}
</code></pre>
<p>or alternatively:</p>
<pre><code>Assert.assertEquals(
expected.collect(Collectors.toList()),
thingUnderTest.collect(Collectors.toList()));
</code></pre>
<p>But that means I'm constructing two collections and discarding them. It's not a performance issue, given the size of my test streams, but I'm wondering whether there's a canonical way to compare two streams.</p>
| 0debug |
void blockdev_auto_del(BlockDriverState *bs)
{
DriveInfo *dinfo = drive_get_by_blockdev(bs);
if (dinfo->auto_del) {
drive_uninit(dinfo);
}
}
| 1threat |
xml2js in Angular 6: Can't resolve 'stream' and 'timers' : <p>I would like to parse xml data, retrieved from the server. Unfortunately <code>HttpClient</code> does not support xml, only json, therefore I installed the package <code>xml2js</code>:</p>
<pre><code>npm install xml2js --save
npm install @types/xml2js --save-dev
</code></pre>
<p>Then I try to use it like this:</p>
<pre><code>import {Parser} from 'xml2js';
Parser.parseString(xml_str, function (err, result) {
console.dir(result);
});
</code></pre>
<p>I get these two errors if I run it:</p>
<pre><code>WARNING in ./node_modules/xml2js/node_modules/sax/lib/sax.js
Module not found: Error: Can't resolve 'stream' in 'C:\projects\app\node_modules\xml2js\node_modules\sax\lib'
ERROR in ./node_modules/xml2js/lib/parser.js
Module not found: Error: Can't resolve 'timers' in 'C:\projects\app\node_modules\xml2js\lib'
</code></pre>
<p>I haven't found any solutions to this problem, maybe it is an Angular6 issue only. Is there any way, to parse xml in Angular6?</p>
| 0debug |
static BlockAIOCB *blkverify_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockCompletionFunc *cb, void *opaque)
{
BDRVBlkverifyState *s = bs->opaque;
BlkverifyAIOCB *acb = blkverify_aio_get(bs, true, sector_num, qiov,
nb_sectors, cb, opaque);
bdrv_aio_writev(s->test_file, sector_num, qiov, nb_sectors,
blkverify_aio_cb, acb);
bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors,
blkverify_aio_cb, acb);
return &acb->common;
}
| 1threat |
static int pred(float *in, float *tgt, int n)
{
int x, y;
float *p1, *p2;
double f0, f1, f2;
float temp;
if (in[n] == 0)
return 0;
if ((f0 = *in) <= 0)
return 0;
for (x=1 ; ; x++) {
if (n < x)
return 1;
p1 = in + x;
p2 = tgt;
f1 = *(p1--);
for (y=x; --y; f1 += (*(p1--))*(*(p2++)));
p1 = tgt + x - 1;
p2 = tgt;
*(p1--) = f2 = -f1/f0;
for (y=x >> 1; y--;) {
temp = *p2 + *p1 * f2;
*(p1--) += *p2 * f2;
*(p2++) = temp;
}
if ((f0 += f1*f2) < 0)
return 0;
}
}
| 1threat |
static uint32_t arm_timer_read(void *opaque, target_phys_addr_t offset)
{
arm_timer_state *s = (arm_timer_state *)opaque;
switch (offset >> 2) {
case 0:
case 6:
return s->limit;
case 1:
return ptimer_get_count(s->timer);
case 2:
return s->control;
case 4:
return s->int_level;
case 5:
if ((s->control & TIMER_CTRL_IE) == 0)
return 0;
return s->int_level;
default:
hw_error("%s: Bad offset %x\n", __func__, (int)offset);
return 0;
}
}
| 1threat |
static int ipvideo_decode_block_opcode_0x3(IpvideoContext *s)
{
unsigned char B;
int x, y;
CHECK_STREAM_PTR(1);
B = *s->stream_ptr++;
if (B < 56) {
x = -(8 + (B % 7));
y = -(B / 7);
} else {
x = -(-14 + ((B - 56) % 29));
y = -( 8 + ((B - 56) / 29));
}
debug_interplay (" motion byte = %d, (x, y) = (%d, %d)\n", B, x, y);
return copy_from(s, &s->current_frame, x, y);
}
| 1threat |
static void machine_initfn(Object *obj)
{
MachineState *ms = MACHINE(obj);
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
object_property_set_description(obj, "accel",
"Accelerator list",
NULL);
object_property_add_bool(obj, "kernel-irqchip",
machine_get_kernel_irqchip,
machine_set_kernel_irqchip,
NULL);
object_property_set_description(obj, "kernel-irqchip",
"Use KVM in-kernel irqchip",
NULL);
object_property_add(obj, "kvm-shadow-mem", "int",
machine_get_kvm_shadow_mem,
machine_set_kvm_shadow_mem,
NULL, NULL, NULL);
object_property_set_description(obj, "kvm-shadow-mem",
"KVM shadow MMU size",
NULL);
object_property_add_str(obj, "kernel",
machine_get_kernel, machine_set_kernel, NULL);
object_property_set_description(obj, "kernel",
"Linux kernel image file",
NULL);
object_property_add_str(obj, "initrd",
machine_get_initrd, machine_set_initrd, NULL);
object_property_set_description(obj, "initrd",
"Linux initial ramdisk file",
NULL);
object_property_add_str(obj, "append",
machine_get_append, machine_set_append, NULL);
object_property_set_description(obj, "append",
"Linux kernel command line",
NULL);
object_property_add_str(obj, "dtb",
machine_get_dtb, machine_set_dtb, NULL);
object_property_set_description(obj, "dtb",
"Linux kernel device tree file",
NULL);
object_property_add_str(obj, "dumpdtb",
machine_get_dumpdtb, machine_set_dumpdtb, NULL);
object_property_set_description(obj, "dumpdtb",
"Dump current dtb to a file and quit",
NULL);
object_property_add(obj, "phandle-start", "int",
machine_get_phandle_start,
machine_set_phandle_start,
NULL, NULL, NULL);
object_property_set_description(obj, "phandle-start",
"The first phandle ID we may generate dynamically",
NULL);
object_property_add_str(obj, "dt-compatible",
machine_get_dt_compatible,
machine_set_dt_compatible,
NULL);
object_property_set_description(obj, "dt-compatible",
"Overrides the \"compatible\" property of the dt root node",
NULL);
object_property_add_bool(obj, "dump-guest-core",
machine_get_dump_guest_core,
machine_set_dump_guest_core,
NULL);
object_property_set_description(obj, "dump-guest-core",
"Include guest memory in a core dump",
NULL);
object_property_add_bool(obj, "mem-merge",
machine_get_mem_merge,
machine_set_mem_merge, NULL);
object_property_set_description(obj, "mem-merge",
"Enable/disable memory merge support",
NULL);
object_property_add_bool(obj, "usb",
machine_get_usb,
machine_set_usb, NULL);
object_property_set_description(obj, "usb",
"Set on/off to enable/disable usb",
NULL);
object_property_add_str(obj, "firmware",
machine_get_firmware,
machine_set_firmware, NULL);
object_property_set_description(obj, "firmware",
"Firmware image",
NULL);
object_property_add_bool(obj, "iommu",
machine_get_iommu,
machine_set_iommu, NULL);
object_property_set_description(obj, "iommu",
"Set on/off to enable/disable Intel IOMMU (VT-d)",
NULL);
ms->sysbus_notifier.notify = machine_init_notify;
qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
}
| 1threat |
How to register a global state for actix_web? : I am a new user of `Rust` and `actix_web` crate. I am trying to set up a global state for my HttpServer, and it seems like `register_data` is the proper API. (I could be wrong about this API).
But from the [doc][1], it is not clear to me how to create a single instance of Application Data shared by all HttpServer threads. Here is my code piece:
```
HttpServer::new(|| {
App::new()
.register_data(web::Data::new(Mutex::new(MyServer::new())))
.service(web::resource("/myservice").route(web::post().to(my_service)))
.service(web::resource("/list").to(list_service))
})
```
In the POST handler `my_service`, I update the state of `MyServer` and in the GET handler `list_service`, it will print out the state.
While `my_service` is successful in storing the state, the `list_service` only prints empty output. My question is:
How do I know if `actix` `HttpServer` created a single instance of `MyServer` or not? If not, how can I ensure it creates a single instance?
Thanks.
[1]: https://docs.rs/actix-web/1.0.9/actix_web/web/struct.Data.html | 0debug |
IPv6 - county detection : I have a CSV file downloaded from Maxmind which contains IPv6 data. I need to upload it to MySql table and then use this table to detect a country by IPv6.
So the first question is what the MySql type should be LONGSTART and LONGEND fields in my MySQL table as max INTEGER length can be of 20 while I have 42540488558116655331872044393019998208 number?
And the other question is how to build a MySql query in order to find an IP address between LONGSTART and LONGEND? I use a function( ipv6_numeric($ip) ) which converts '2001::11ff:ffff:f' IPv6 address into a long number like 2540488558116655331872044393019998208.
Thanks for advance! | 0debug |
static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear,
double cutoff0, enum AVSampleFormat format, enum SwrFilterType filter_type, int kaiser_beta,
double precision, int cheby){
double cutoff = cutoff0? cutoff0 : 0.97;
double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
int phase_count= 1<<phase_shift;
if (!c || c->phase_shift != phase_shift || c->linear!=linear || c->factor != factor
|| c->filter_length != FFMAX((int)ceil(filter_size/factor), 1) || c->format != format
|| c->filter_type != filter_type || c->kaiser_beta != kaiser_beta) {
c = av_mallocz(sizeof(*c));
if (!c)
return NULL;
c->format= format;
c->felem_size= av_get_bytes_per_sample(c->format);
switch(c->format){
case AV_SAMPLE_FMT_S16P:
c->filter_shift = 15;
break;
case AV_SAMPLE_FMT_S32P:
c->filter_shift = 30;
break;
case AV_SAMPLE_FMT_FLTP:
case AV_SAMPLE_FMT_DBLP:
c->filter_shift = 0;
break;
default:
av_log(NULL, AV_LOG_ERROR, "Unsupported sample format\n");
av_assert0(0);
}
c->phase_shift = phase_shift;
c->phase_mask = phase_count - 1;
c->linear = linear;
c->factor = factor;
c->filter_length = FFMAX((int)ceil(filter_size/factor), 1);
c->filter_alloc = FFALIGN(c->filter_length, 8);
c->filter_bank = av_mallocz(c->filter_alloc*(phase_count+1)*c->felem_size);
c->filter_type = filter_type;
c->kaiser_beta = kaiser_beta;
if (!c->filter_bank)
goto error;
if (build_filter(c, (void*)c->filter_bank, factor, c->filter_length, c->filter_alloc, phase_count, 1<<c->filter_shift, filter_type, kaiser_beta))
goto error;
memcpy(c->filter_bank + (c->filter_alloc*phase_count+1)*c->felem_size, c->filter_bank, (c->filter_alloc-1)*c->felem_size);
memcpy(c->filter_bank + (c->filter_alloc*phase_count )*c->felem_size, c->filter_bank + (c->filter_alloc - 1)*c->felem_size, c->felem_size);
}
c->compensation_distance= 0;
if(!av_reduce(&c->src_incr, &c->dst_incr, out_rate, in_rate * (int64_t)phase_count, INT32_MAX/2))
goto error;
c->ideal_dst_incr= c->dst_incr;
c->index= -phase_count*((c->filter_length-1)/2);
c->frac= 0;
return c;
error:
av_free(c->filter_bank);
av_free(c);
return NULL;
}
| 1threat |
Why TextView not show all content when change screen rotation : please see below code and say me why text view show half of text when device change its rotation.
<LinearLayout
android:id="@+id/box1"
android:layout_marginTop="30dp"
android:background="#e4eaefec"
android:layout_width="wrap_content"
android:padding="26dp"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent2"
android:textSize="22sp"
android:padding="2dp"
android:textStyle="bold"
android:gravity="center_horizontal"
android:text=" text text text text text"/>
<TableLayout .../>
...
</LinearLayout>
in portrait its ok, but in landscape all content of text view not showen. only many words showen. | 0debug |
void qcrypto_cipher_free(QCryptoCipher *cipher)
{
QCryptoCipherBuiltin *ctxt = cipher->opaque;
if (!cipher) {
return;
}
ctxt->free(cipher);
g_free(cipher);
}
| 1threat |
static inline int qemu_gluster_zerofill(struct glfs_fd *fd, int64_t offset,
int64_t size)
{
return glfs_zerofill(fd, offset, size);
}
| 1threat |
Is it safe to use a method's nested procedure as a winapi callback? : <p>This is the simplified scenario, in Delphi 7:</p>
<pre><code>procedure TMyClass.InternalGetData;
var
pRequest: HINTERNET;
/// nested Callback
procedure HTTPOpenRequestCallback(hInet: HINTERNET; Context: PDWORD; Status: DWORD; pInformation: Pointer; InfoLength: DWORD); stdcall;
begin
// [...] make something with pRequest
end;
begin
pRequest := HTTPOpenRequest(...);
// [...]
if (InternetSetStatusCallback(pRequest, @HTTPOpenRequestCallback) = PFNInternetStatusCallback(INTERNET_INVALID_STATUS_CALLBACK)) then
raise Exception.Create('InternetSetStatusCallback failed');
// [...]
end;
</code></pre>
<p>The whole thing <strong>seems to work fine</strong>, but is it really correct and safe?
I'd like to have it encapsulated this way because it's more readable and clean. My doubt is whether the nested procedure is a simple, normal procedure or not, so that it can have its own calling convention (<code>stdcall</code>) and safely reference outer method's local variables (<code>pRequest</code>).</p>
<p>Thank you.</p>
| 0debug |
Determine if command is successful/exists c : <p>How can I determine if a command is successful or exists in C? This will need to be compatible with multiple architectures and routers (don't ask haha)</p>
<p>I was thinking of using popen or system or exec(v)(l). But the command I want to check for is sendmail. Since sendmail is a command that runs forever with no output this will be a little hard to do. Any ideas?</p>
<p>Thanks in advance.</p>
| 0debug |
What is happening in binary IO in C? : <p>I imagine this applies to a lot of other languages as well.</p>
<p>I have this code here, and I am wondering what is actually happening and how I can interpret what is written to the file...</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main ()
{
//Initialize a variable and load it with input using scanf
char write[100] = "Write this.";
FILE *fp = fopen("./binFile.txt", "w+");
fwrite(write, sizeof(write[0]), sizeof(write)/sizeof(write[0]), fp);
fclose(fp);
}
</code></pre>
<p>and then when I open the text file I see this...</p>
<pre><code>5772 6974 6520 7468 6973 2e00 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000
</code></pre>
<p>But I am having some trouble seeing exactly what is going on here. How does this text break down to binary?</p>
| 0debug |
React 16: Warning: Expected server HTML to contain a matching <div> in <body> : <p>Since upgrading to React 16 I get this error message:</p>
<p><code>warning.js:33 Warning: Expected server HTML to contain a matching <div> in <body>.</code></p>
<p>What is generally causing this error message and how can it be fixed?</p>
| 0debug |
Repeated Popup: Xcode wants to access key "com.apple.dt.XcodeDeviceMonitor" in your keychain : <p>Starting in MacOS Sierra, I've started to get this popup periodically from XCode, even after pressing 'Always Allow'. </p>
<p><a href="https://i.stack.imgur.com/fWurq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fWurq.png" alt="Popup"></a></p>
<p>I've tried deleting the "com.apple.dt.XcodeDeviceMonitor" item in Keychain. This regenerates the key, but doesn't fix the issue.</p>
<p>It's an open discussion topic on the Apple <a href="https://forums.developer.apple.com/thread/64863" rel="noreferrer">forums</a>, but no one seems to have a solution.</p>
| 0debug |
Visual Studio keeps adding IIS Express back into my launchsettings.json : <p>I am trying to remove the IIS Express profile from my .NET Core launch settings but every time i repoen the solution, Visual Studio adds it back in again. For example, in a new project my launch settings looks like this</p>
<pre><code>{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55735/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MyProject": {
"commandName": "Project",
"launchUrl": "http://localhost:5010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
</code></pre>
<p>I remove the IIS sections</p>
<pre><code>{
"profiles": {
"MyProject": {
"commandName": "Project",
"launchUrl": "http://localhost:5010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
</code></pre>
<p>The solution runs fine. But as soon as I close and reopen the solution the IIS sections reappear.</p>
<p>Any ideas?</p>
| 0debug |
static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
unsigned int i, entries;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
avio_r8(pb);
avio_rb24(pb);
entries = avio_rb32(pb);
if (!entries)
return 0;
if (entries >= UINT_MAX/sizeof(int64_t))
return AVERROR_INVALIDDATA;
sc->chunk_offsets = av_malloc(entries * sizeof(int64_t));
if (!sc->chunk_offsets)
return AVERROR(ENOMEM);
sc->chunk_count = entries;
if (atom.type == MKTAG('s','t','c','o'))
for (i=0; i<entries; i++)
sc->chunk_offsets[i] = avio_rb32(pb);
else if (atom.type == MKTAG('c','o','6','4'))
for (i=0; i<entries; i++)
sc->chunk_offsets[i] = avio_rb64(pb);
else
return AVERROR_INVALIDDATA;
return 0;
}
| 1threat |
static inline int pic_is_unused(MpegEncContext *s, Picture *pic)
{
if (pic->f.buf[0] == NULL)
return 1;
if (pic->needs_realloc && !(pic->reference & DELAYED_PIC_REF))
return 1;
return 0;
}
| 1threat |
Python: find most common element : How can i print the most common element of a list without importing a library?
>>> l=[1,2,3,4,4,4]
So i want the output to be 4.
| 0debug |
hello I just UPLOADE FILE IN LARAVL5 : please help
>
> I'm going to upload a file but it does not work
>
I will send the field with the meta name
> view
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tab1success">
<form method="post" name="type" action="songs">
{{ csrf_field() }}
<div class="form-group">
<div class="row">
<label class="col-md-3 control-label" for="Name">نام موزیک</label>
<div class="col-md-7">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-music">
</i>
</div>
<input id="Name" name="title" type="text"
placeholder="نام موزیک" class="form-control input-md">
</div>
</div>
</div>
<br>
<div class="row">
<label class="col-md-3 control-label" for="Name (Full name)">دسته
بندی</label>
<div class="col-md-7">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-list">
</i>
</div>
<select id="Name" name="category" type="دسته بندی"
placeholder="دسته بندی" class="form-control input-md">
<option>fun</option>
<option>love</option>
<option>birth</option>
<option>wedding</option>
</select>
</div>
</div>
</div>
<br>
<div class="row">
<label class="col-md-3 control-label" for="Name (Full name)">توضیحات</label>
<div class="col-md-7">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-file-text-o">
</i>
</div>
<textarea id="Name" name="text" placeholder="توضیحات"
class="form-control input-md"></textarea>
</div>
</div>
</div>
<br>
<div class="row">
<label class="col-md-3 control-label" for="Name (Full name)">انتخاب
فایل</label>
<div class="col-md-7">
<div class="input-group">
<div class="input-group-addon">
<i class="fa fa-folder-o">
</i>
</div>
<input id="meta" name="meta" type="file" placeholder="انتخاب فایل"
class="form-control input-md">
</div>
</div>
</div>
<br>
<div class="row" style="text-align: center">
<div class="col-md-10 " style="text-align: center">
<button id="Name" name="submit" type="submit" placeholder="انتخاب فایل"
class="form-control input-md" style="text-align: center">اضافه
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
Controller
public function create(Request $req, $type) {
$this->authorize('is_admin');
$req->file('meta')->store('app');
// $path = Storage::putFile('app', $req->file('meta'))
}
**error**
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to a member function store() on null
[https://i.stack.imgur.com/5EMNy.png][1]
Does anybody know what i should do about this? | 0debug |
Instance of variable : <p>I have a c code</p>
<pre><code>int foo( int *p, int n){
int a[81];
int i,v;
for( i = 0; i < n ; i++){
a[i]=p[i]
if( n == 1 ) return a[0];
v=foo ( a, n-1);
if( v > a[n-1] )
return v;
else
return a[n-1];
}
int main ( void ){
int b[81], i;
for( i = 0; i < 81; i++){
b[i]=rand();
foo(b,81);
return 0;
}
</code></pre>
<p>And i need to find out how many instances of variable a will exist( max number) my answer was 81 , but it was wrong and i cant find out what number it should be. How could i determine it?</p>
| 0debug |
how to make a custom input range slider : hi i want create a custom slider like shown in image how can i do it please see the fiddle which i have tried.!
[![enter image description here][1]][1]
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.slider-info {
display: inline-block;
width: 120px;
margin-right: 10px;
vertical-align: inherit;
}
<!-- language: lang-html -->
<h2>working slider input range</h2>
<input class="slider-info" name="gdskill[1]" id="gdskill1" type="range" min="0" value="0" max="10" step="1" list="ticks" oninput="Output1.value = gdskill1.value" />
<output id="Output1">0</output>
<input name="gdskill[2]" id="gdskill2" type="range" min="0" value="0" max="10" step="1" list="ticks" oninput="Output2.value = gdskill2.value" />
<output id="Output2">0</output>
<datalist id="ticks">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</datalist>
<h2>i want design this like shown in image is it possible..? can anyone helpme with it im little new to css.</h2>
<!-- end snippet -->
[1]: https://i.stack.imgur.com/0fQ8T.png
Fillde LINK: https://jsfiddle.net/9qgx71kd/2/ | 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
Jest typescript tests runs twice, one for ts files, and one for js files : <p>I'm starting to write some tests using Jest and typescript, however I'm getting some errors and the problem seems to be that the tests are run twice, one for ts files, and a second time for js files.</p>
<p>The typescript test passes, but the compiled javascript tests don't.</p>
<pre><code>yarn run v1.5.1
$ jest
PASS src/__tests__/some.test.ts (7.955s)
● Console
console.log src/lib/google-analytics/ga-api.ts:75
Succsess!!
console.log src/__tests__/some.test.ts:42
{ reports: { batchGet: [Function: batchGet] } }
FAIL dist/__tests__/some.test.js
● Console
console.log dist/lib/google-analytics/ga-api.js:64
Reject
● it gets a full google analytics report
No key or keyFile set.
68 |
69 | return new Promise((resolve, reject) => {
> 70 | jwtClient.authorize((err: any) => {
71 | if (err) {
72 | console.log("Reject");
73 | reject(err);
at GoogleToken.<anonymous> (node_modules/googleapis/node_modules/gtoken/src/index.ts:102:13)
at step (node_modules/googleapis/node_modules/gtoken/build/src/index.js:42:23)
at Object.next (node_modules/googleapis/node_modules/gtoken/build/src/index.js:23:53)
at node_modules/googleapis/node_modules/gtoken/build/src/index.js:17:71
at Object.<anonymous>.__awaiter (node_modules/googleapis/node_modules/gtoken/build/src/index.js:13:12)
at GoogleToken.Object.<anonymous>.GoogleToken.getTokenAsync (node_modules/googleapis/node_modules/gtoken/build/src/index.js:102:16)
at GoogleToken.Object.<anonymous>.GoogleToken.getToken (node_modules/googleapis/node_modules/gtoken/src/index.ts:93:17)
at JWT.<anonymous> (node_modules/googleapis/node_modules/google-auth-library/src/auth/jwtclient.ts:181:37)
at step (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:57:23)
at Object.next (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:38:53)
at node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:32:71
at Object.<anonymous>.__awaiter (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:28:12)
at JWT.Object.<anonymous>.JWT.refreshToken (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:181:16)
at JWT.<anonymous> (node_modules/googleapis/node_modules/google-auth-library/src/auth/jwtclient.ts:154:31)
at step (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:57:23)
at Object.next (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:38:53)
at node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:32:71
at Object.<anonymous>.__awaiter (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:28:12)
at JWT.Object.<anonymous>.JWT.authorizeAsync (node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:156:16)
at JWT.Object.<anonymous>.JWT.authorize (node_modules/googleapis/node_modules/google-auth-library/src/auth/jwtclient.ts:147:12)
at Promise (src/lib/google-analytics/ga-api.ts:70:23)
at GoogleAnalyticsApiClient.getGCPAuthToken (src/lib/google-analytics/ga-api.ts:69:16)
at GoogleAnalyticsApiClient.<anonymous> (src/lib/google-analytics/ga-api.ts:52:42)
at dist/lib/google-analytics/ga-api.js:7:71
at Object.<anonymous>.__awaiter (dist/lib/google-analytics/ga-api.js:3:12)
at GoogleAnalyticsApiClient.getGaApiClient (dist/lib/google-analytics/ga-api.js:50:16)
at Object.<anonymous>.test (src/__tests__/some.test.ts:41:14)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 9.516s
Ran all test suites.
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c jest
Directory: /Users/carlosbernal/Documents/Grability/DataScience/ga-downloader
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/Users/carlosbernal/Documents/Grability/DataScience/ga-downloader/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
</code></pre>
<p>Is this normal in ts-jest or am I missing some extra configuration?</p>
| 0debug |
Load a large Jquery file at once? : I have a question regarding the loading of Jquery files. From what I've read so far the general consensus appears to be: less script files is better, but I could not find an answer to my next question:
Say you have a script file of 4000 lines of code. Some 500 lines are only used on one specific page. Would it make sense (performance-wise) to only load this part of the script when that specific page is opened (using something like if URL == X then load {})? Or wouldn't it matter if you load the entire script just once.
Thank you all in advance for your advice | 0debug |
void s390_add_running_cpu(S390CPU *cpu)
{
CPUState *cs = CPU(cpu);
if (cs->halted) {
s390_running_cpus++;
cs->halted = 0;
cs->exception_index = -1;
}
}
| 1threat |
Dependency Structure of a Go application : **What's the best way to model a model (user) and a database without running into circular dependencies?**
I have a golang application that I'm trying to setup. The structure of imports is confusing because it doesn't cleanly appear to divide along separation of concerns. I would like to have a database store that requires access to the names of models to migrate them. It seems odd to have models migrate themselves and that seems like a unrelated concern to the models. At the same time, I would like to have validations per model that require the importing of the database store. It seems even more odd to have the store validate individual models. This creates a circular dependency however.
structure:
models
- user.go
config
- store.go
`store.go`
...
// CreateDb - creates table
func (i *Store) CreateDb() {
...
i.DB.AutoMigrate(&models.User{})
...
}
...
`user.go`
package models
type User struct {
Email string
}
func (u *User) ValidateUser() (err []error) {
messages := make([]error, 0)
// Uniqueness Validations
email := ""
email = config.Database.DB.Where("email LIKE ?", u.Email).First(&User)
if email != "" {
messages = append(messages, errors.New("Email has to be unique"))
}
return messages
}
I've tried putting them into a third package but that fails because they both require the same dependency - store. I've also tried putting them all into the same package which I suppose works but that seems to breakdown all structure and sep of concerns.
Advice?
| 0debug |
static void decode_micromips32_opc (CPUMIPSState *env, DisasContext *ctx,
uint16_t insn_hw1)
{
int32_t offset;
uint16_t insn;
int rt, rs, rd, rr;
int16_t imm;
uint32_t op, minor, mips32_op;
uint32_t cond, fmt, cc;
insn = cpu_lduw_code(env, ctx->pc + 2);
ctx->opcode = (ctx->opcode << 16) | insn;
rt = (ctx->opcode >> 21) & 0x1f;
rs = (ctx->opcode >> 16) & 0x1f;
rd = (ctx->opcode >> 11) & 0x1f;
rr = (ctx->opcode >> 6) & 0x1f;
imm = (int16_t) ctx->opcode;
op = (ctx->opcode >> 26) & 0x3f;
switch (op) {
case POOL32A:
minor = ctx->opcode & 0x3f;
switch (minor) {
case 0x00:
minor = (ctx->opcode >> 6) & 0xf;
switch (minor) {
case SLL32:
mips32_op = OPC_SLL;
goto do_shifti;
case SRA:
mips32_op = OPC_SRA;
goto do_shifti;
case SRL32:
mips32_op = OPC_SRL;
goto do_shifti;
case ROTR:
mips32_op = OPC_ROTR;
do_shifti:
gen_shift_imm(ctx, mips32_op, rt, rs, rd);
break;
default:
goto pool32a_invalid;
}
break;
case 0x10:
minor = (ctx->opcode >> 6) & 0xf;
switch (minor) {
case ADD:
mips32_op = OPC_ADD;
goto do_arith;
case ADDU32:
mips32_op = OPC_ADDU;
goto do_arith;
case SUB:
mips32_op = OPC_SUB;
goto do_arith;
case SUBU32:
mips32_op = OPC_SUBU;
goto do_arith;
case MUL:
mips32_op = OPC_MUL;
do_arith:
gen_arith(ctx, mips32_op, rd, rs, rt);
break;
case SLLV:
mips32_op = OPC_SLLV;
goto do_shift;
case SRLV:
mips32_op = OPC_SRLV;
goto do_shift;
case SRAV:
mips32_op = OPC_SRAV;
goto do_shift;
case ROTRV:
mips32_op = OPC_ROTRV;
do_shift:
gen_shift(ctx, mips32_op, rd, rs, rt);
break;
case AND:
mips32_op = OPC_AND;
goto do_logic;
case OR32:
mips32_op = OPC_OR;
goto do_logic;
case NOR:
mips32_op = OPC_NOR;
goto do_logic;
case XOR32:
mips32_op = OPC_XOR;
do_logic:
gen_logic(ctx, mips32_op, rd, rs, rt);
break;
case SLT:
mips32_op = OPC_SLT;
goto do_slt;
case SLTU:
mips32_op = OPC_SLTU;
do_slt:
gen_slt(ctx, mips32_op, rd, rs, rt);
break;
default:
goto pool32a_invalid;
}
break;
case 0x18:
minor = (ctx->opcode >> 6) & 0xf;
switch (minor) {
case MOVN:
mips32_op = OPC_MOVN;
goto do_cmov;
case MOVZ:
mips32_op = OPC_MOVZ;
do_cmov:
gen_cond_move(ctx, mips32_op, rd, rs, rt);
break;
case LWXS:
gen_ldxs(ctx, rs, rt, rd);
break;
default:
goto pool32a_invalid;
}
break;
case INS:
gen_bitops(ctx, OPC_INS, rt, rs, rr, rd);
return;
case EXT:
gen_bitops(ctx, OPC_EXT, rt, rs, rr, rd);
return;
case POOL32AXF:
gen_pool32axf(env, ctx, rt, rs);
break;
case 0x07:
generate_exception(ctx, EXCP_BREAK);
break;
default:
pool32a_invalid:
MIPS_INVAL("pool32a");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case POOL32B:
minor = (ctx->opcode >> 12) & 0xf;
switch (minor) {
case CACHE:
check_cp0_enabled(ctx);
break;
case LWC2:
case SWC2:
generate_exception_err(ctx, EXCP_CpU, 2);
break;
case LWP:
case SWP:
#ifdef TARGET_MIPS64
case LDP:
case SDP:
#endif
gen_ldst_pair(ctx, minor, rt, rs, SIMM(ctx->opcode, 0, 12));
break;
case LWM32:
case SWM32:
#ifdef TARGET_MIPS64
case LDM:
case SDM:
#endif
gen_ldst_multiple(ctx, minor, rt, rs, SIMM(ctx->opcode, 0, 12));
break;
default:
MIPS_INVAL("pool32b");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case POOL32F:
if (env->CP0_Config1 & (1 << CP0C1_FP)) {
minor = ctx->opcode & 0x3f;
check_cp1_enabled(ctx);
switch (minor) {
case ALNV_PS:
mips32_op = OPC_ALNV_PS;
goto do_madd;
case MADD_S:
mips32_op = OPC_MADD_S;
goto do_madd;
case MADD_D:
mips32_op = OPC_MADD_D;
goto do_madd;
case MADD_PS:
mips32_op = OPC_MADD_PS;
goto do_madd;
case MSUB_S:
mips32_op = OPC_MSUB_S;
goto do_madd;
case MSUB_D:
mips32_op = OPC_MSUB_D;
goto do_madd;
case MSUB_PS:
mips32_op = OPC_MSUB_PS;
goto do_madd;
case NMADD_S:
mips32_op = OPC_NMADD_S;
goto do_madd;
case NMADD_D:
mips32_op = OPC_NMADD_D;
goto do_madd;
case NMADD_PS:
mips32_op = OPC_NMADD_PS;
goto do_madd;
case NMSUB_S:
mips32_op = OPC_NMSUB_S;
goto do_madd;
case NMSUB_D:
mips32_op = OPC_NMSUB_D;
goto do_madd;
case NMSUB_PS:
mips32_op = OPC_NMSUB_PS;
do_madd:
gen_flt3_arith(ctx, mips32_op, rd, rr, rs, rt);
break;
case CABS_COND_FMT:
cond = (ctx->opcode >> 6) & 0xf;
cc = (ctx->opcode >> 13) & 0x7;
fmt = (ctx->opcode >> 10) & 0x3;
switch (fmt) {
case 0x0:
gen_cmpabs_s(ctx, cond, rt, rs, cc);
break;
case 0x1:
gen_cmpabs_d(ctx, cond, rt, rs, cc);
break;
case 0x2:
gen_cmpabs_ps(ctx, cond, rt, rs, cc);
break;
default:
goto pool32f_invalid;
}
break;
case C_COND_FMT:
cond = (ctx->opcode >> 6) & 0xf;
cc = (ctx->opcode >> 13) & 0x7;
fmt = (ctx->opcode >> 10) & 0x3;
switch (fmt) {
case 0x0:
gen_cmp_s(ctx, cond, rt, rs, cc);
break;
case 0x1:
gen_cmp_d(ctx, cond, rt, rs, cc);
break;
case 0x2:
gen_cmp_ps(ctx, cond, rt, rs, cc);
break;
default:
goto pool32f_invalid;
}
break;
case POOL32FXF:
gen_pool32fxf(ctx, rt, rs);
break;
case 0x00:
switch ((ctx->opcode >> 6) & 0x7) {
case PLL_PS:
mips32_op = OPC_PLL_PS;
goto do_ps;
case PLU_PS:
mips32_op = OPC_PLU_PS;
goto do_ps;
case PUL_PS:
mips32_op = OPC_PUL_PS;
goto do_ps;
case PUU_PS:
mips32_op = OPC_PUU_PS;
goto do_ps;
case CVT_PS_S:
mips32_op = OPC_CVT_PS_S;
do_ps:
gen_farith(ctx, mips32_op, rt, rs, rd, 0);
break;
default:
goto pool32f_invalid;
}
break;
case 0x08:
switch ((ctx->opcode >> 6) & 0x7) {
case LWXC1:
mips32_op = OPC_LWXC1;
goto do_ldst_cp1;
case SWXC1:
mips32_op = OPC_SWXC1;
goto do_ldst_cp1;
case LDXC1:
mips32_op = OPC_LDXC1;
goto do_ldst_cp1;
case SDXC1:
mips32_op = OPC_SDXC1;
goto do_ldst_cp1;
case LUXC1:
mips32_op = OPC_LUXC1;
goto do_ldst_cp1;
case SUXC1:
mips32_op = OPC_SUXC1;
do_ldst_cp1:
gen_flt3_ldst(ctx, mips32_op, rd, rd, rt, rs);
break;
default:
goto pool32f_invalid;
}
break;
case 0x18:
fmt = (ctx->opcode >> 9) & 0x3;
switch ((ctx->opcode >> 6) & 0x7) {
case RSQRT2_FMT:
switch (fmt) {
case FMT_SDPS_S:
mips32_op = OPC_RSQRT2_S;
goto do_3d;
case FMT_SDPS_D:
mips32_op = OPC_RSQRT2_D;
goto do_3d;
case FMT_SDPS_PS:
mips32_op = OPC_RSQRT2_PS;
goto do_3d;
default:
goto pool32f_invalid;
}
break;
case RECIP2_FMT:
switch (fmt) {
case FMT_SDPS_S:
mips32_op = OPC_RECIP2_S;
goto do_3d;
case FMT_SDPS_D:
mips32_op = OPC_RECIP2_D;
goto do_3d;
case FMT_SDPS_PS:
mips32_op = OPC_RECIP2_PS;
goto do_3d;
default:
goto pool32f_invalid;
}
break;
case ADDR_PS:
mips32_op = OPC_ADDR_PS;
goto do_3d;
case MULR_PS:
mips32_op = OPC_MULR_PS;
do_3d:
gen_farith(ctx, mips32_op, rt, rs, rd, 0);
break;
default:
goto pool32f_invalid;
}
break;
case 0x20:
cc = (ctx->opcode >> 13) & 0x7;
fmt = (ctx->opcode >> 9) & 0x3;
switch ((ctx->opcode >> 6) & 0x7) {
case MOVF_FMT:
switch (fmt) {
case FMT_SDPS_S:
gen_movcf_s(rs, rt, cc, 0);
break;
case FMT_SDPS_D:
gen_movcf_d(ctx, rs, rt, cc, 0);
break;
case FMT_SDPS_PS:
gen_movcf_ps(rs, rt, cc, 0);
break;
default:
goto pool32f_invalid;
}
break;
case MOVT_FMT:
switch (fmt) {
case FMT_SDPS_S:
gen_movcf_s(rs, rt, cc, 1);
break;
case FMT_SDPS_D:
gen_movcf_d(ctx, rs, rt, cc, 1);
break;
case FMT_SDPS_PS:
gen_movcf_ps(rs, rt, cc, 1);
break;
default:
goto pool32f_invalid;
}
break;
case PREFX:
break;
default:
goto pool32f_invalid;
}
break;
#define FINSN_3ARG_SDPS(prfx) \
switch ((ctx->opcode >> 8) & 0x3) { \
case FMT_SDPS_S: \
mips32_op = OPC_##prfx##_S; \
goto do_fpop; \
case FMT_SDPS_D: \
mips32_op = OPC_##prfx##_D; \
goto do_fpop; \
case FMT_SDPS_PS: \
mips32_op = OPC_##prfx##_PS; \
goto do_fpop; \
default: \
goto pool32f_invalid; \
}
case 0x30:
switch ((ctx->opcode >> 6) & 0x3) {
case ADD_FMT:
FINSN_3ARG_SDPS(ADD);
break;
case SUB_FMT:
FINSN_3ARG_SDPS(SUB);
break;
case MUL_FMT:
FINSN_3ARG_SDPS(MUL);
break;
case DIV_FMT:
fmt = (ctx->opcode >> 8) & 0x3;
if (fmt == 1) {
mips32_op = OPC_DIV_D;
} else if (fmt == 0) {
mips32_op = OPC_DIV_S;
} else {
goto pool32f_invalid;
}
goto do_fpop;
default:
goto pool32f_invalid;
}
break;
case 0x38:
switch ((ctx->opcode >> 6) & 0x3) {
case MOVN_FMT:
FINSN_3ARG_SDPS(MOVN);
break;
case MOVZ_FMT:
FINSN_3ARG_SDPS(MOVZ);
break;
default:
goto pool32f_invalid;
}
break;
do_fpop:
gen_farith(ctx, mips32_op, rt, rs, rd, 0);
break;
default:
pool32f_invalid:
MIPS_INVAL("pool32f");
generate_exception(ctx, EXCP_RI);
break;
}
} else {
generate_exception_err(ctx, EXCP_CpU, 1);
}
break;
case POOL32I:
minor = (ctx->opcode >> 21) & 0x1f;
switch (minor) {
case BLTZ:
mips32_op = OPC_BLTZ;
goto do_branch;
case BLTZAL:
mips32_op = OPC_BLTZAL;
goto do_branch;
case BLTZALS:
mips32_op = OPC_BLTZALS;
goto do_branch;
case BGEZ:
mips32_op = OPC_BGEZ;
goto do_branch;
case BGEZAL:
mips32_op = OPC_BGEZAL;
goto do_branch;
case BGEZALS:
mips32_op = OPC_BGEZALS;
goto do_branch;
case BLEZ:
mips32_op = OPC_BLEZ;
goto do_branch;
case BGTZ:
mips32_op = OPC_BGTZ;
do_branch:
gen_compute_branch(ctx, mips32_op, 4, rs, -1, imm << 1);
break;
case TLTI:
mips32_op = OPC_TLTI;
goto do_trapi;
case TGEI:
mips32_op = OPC_TGEI;
goto do_trapi;
case TLTIU:
mips32_op = OPC_TLTIU;
goto do_trapi;
case TGEIU:
mips32_op = OPC_TGEIU;
goto do_trapi;
case TNEI:
mips32_op = OPC_TNEI;
goto do_trapi;
case TEQI:
mips32_op = OPC_TEQI;
do_trapi:
gen_trap(ctx, mips32_op, rs, -1, imm);
break;
case BNEZC:
case BEQZC:
gen_compute_branch(ctx, minor == BNEZC ? OPC_BNE : OPC_BEQ,
4, rs, 0, imm << 1);
break;
case LUI:
gen_logic_imm(ctx, OPC_LUI, rs, -1, imm);
break;
case SYNCI:
break;
case BC2F:
case BC2T:
generate_exception_err(ctx, EXCP_CpU, 2);
break;
case BC1F:
mips32_op = (ctx->opcode & (1 << 16)) ? OPC_BC1FANY2 : OPC_BC1F;
goto do_cp1branch;
case BC1T:
mips32_op = (ctx->opcode & (1 << 16)) ? OPC_BC1TANY2 : OPC_BC1T;
goto do_cp1branch;
case BC1ANY4F:
mips32_op = OPC_BC1FANY4;
goto do_cp1mips3d;
case BC1ANY4T:
mips32_op = OPC_BC1TANY4;
do_cp1mips3d:
check_cop1x(ctx);
check_insn(ctx, ASE_MIPS3D);
do_cp1branch:
gen_compute_branch1(ctx, mips32_op,
(ctx->opcode >> 18) & 0x7, imm << 1);
break;
case BPOSGE64:
case BPOSGE32:
default:
MIPS_INVAL("pool32i");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case POOL32C:
minor = (ctx->opcode >> 12) & 0xf;
switch (minor) {
case LWL:
mips32_op = OPC_LWL;
goto do_ld_lr;
case SWL:
mips32_op = OPC_SWL;
goto do_st_lr;
case LWR:
mips32_op = OPC_LWR;
goto do_ld_lr;
case SWR:
mips32_op = OPC_SWR;
goto do_st_lr;
#if defined(TARGET_MIPS64)
case LDL:
mips32_op = OPC_LDL;
goto do_ld_lr;
case SDL:
mips32_op = OPC_SDL;
goto do_st_lr;
case LDR:
mips32_op = OPC_LDR;
goto do_ld_lr;
case SDR:
mips32_op = OPC_SDR;
goto do_st_lr;
case LWU:
mips32_op = OPC_LWU;
goto do_ld_lr;
case LLD:
mips32_op = OPC_LLD;
goto do_ld_lr;
#endif
case LL:
mips32_op = OPC_LL;
goto do_ld_lr;
do_ld_lr:
gen_ld(ctx, mips32_op, rt, rs, SIMM(ctx->opcode, 0, 12));
break;
do_st_lr:
gen_st(ctx, mips32_op, rt, rs, SIMM(ctx->opcode, 0, 12));
break;
case SC:
gen_st_cond(ctx, OPC_SC, rt, rs, SIMM(ctx->opcode, 0, 12));
break;
#if defined(TARGET_MIPS64)
case SCD:
gen_st_cond(ctx, OPC_SCD, rt, rs, SIMM(ctx->opcode, 0, 12));
break;
#endif
case PREF:
break;
default:
MIPS_INVAL("pool32c");
generate_exception(ctx, EXCP_RI);
break;
}
break;
case ADDI32:
mips32_op = OPC_ADDI;
goto do_addi;
case ADDIU32:
mips32_op = OPC_ADDIU;
do_addi:
gen_arith_imm(ctx, mips32_op, rt, rs, imm);
break;
case ORI32:
mips32_op = OPC_ORI;
goto do_logici;
case XORI32:
mips32_op = OPC_XORI;
goto do_logici;
case ANDI32:
mips32_op = OPC_ANDI;
do_logici:
gen_logic_imm(ctx, mips32_op, rt, rs, imm);
break;
case SLTI32:
mips32_op = OPC_SLTI;
goto do_slti;
case SLTIU32:
mips32_op = OPC_SLTIU;
do_slti:
gen_slt_imm(ctx, mips32_op, rt, rs, imm);
break;
case JALX32:
offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 2;
gen_compute_branch(ctx, OPC_JALX, 4, rt, rs, offset);
break;
case JALS32:
offset = (int32_t)(ctx->opcode & 0x3FFFFFF) << 1;
gen_compute_branch(ctx, OPC_JALS, 4, rt, rs, offset);
break;
case BEQ32:
gen_compute_branch(ctx, OPC_BEQ, 4, rt, rs, imm << 1);
break;
case BNE32:
gen_compute_branch(ctx, OPC_BNE, 4, rt, rs, imm << 1);
break;
case J32:
gen_compute_branch(ctx, OPC_J, 4, rt, rs,
(int32_t)(ctx->opcode & 0x3FFFFFF) << 1);
break;
case JAL32:
gen_compute_branch(ctx, OPC_JAL, 4, rt, rs,
(int32_t)(ctx->opcode & 0x3FFFFFF) << 1);
break;
case LWC132:
mips32_op = OPC_LWC1;
goto do_cop1;
case LDC132:
mips32_op = OPC_LDC1;
goto do_cop1;
case SWC132:
mips32_op = OPC_SWC1;
goto do_cop1;
case SDC132:
mips32_op = OPC_SDC1;
do_cop1:
gen_cop1_ldst(env, ctx, mips32_op, rt, rs, imm);
break;
case ADDIUPC:
{
int reg = mmreg(ZIMM(ctx->opcode, 23, 3));
int offset = SIMM(ctx->opcode, 0, 23) << 2;
gen_addiupc(ctx, reg, offset, 0, 0);
}
break;
case LB32:
mips32_op = OPC_LB;
goto do_ld;
case LBU32:
mips32_op = OPC_LBU;
goto do_ld;
case LH32:
mips32_op = OPC_LH;
goto do_ld;
case LHU32:
mips32_op = OPC_LHU;
goto do_ld;
case LW32:
mips32_op = OPC_LW;
goto do_ld;
#ifdef TARGET_MIPS64
case LD32:
mips32_op = OPC_LD;
goto do_ld;
case SD32:
mips32_op = OPC_SD;
goto do_st;
#endif
case SB32:
mips32_op = OPC_SB;
goto do_st;
case SH32:
mips32_op = OPC_SH;
goto do_st;
case SW32:
mips32_op = OPC_SW;
goto do_st;
do_ld:
gen_ld(ctx, mips32_op, rt, rs, imm);
break;
do_st:
gen_st(ctx, mips32_op, rt, rs, imm);
break;
default:
generate_exception(ctx, EXCP_RI);
break;
}
}
| 1threat |
static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
{
VirtIOGPU *g = opaque;
if (idx > g->conf.max_outputs) {
return -1;
}
g->req_state[idx].x = info->xoff;
g->req_state[idx].y = info->yoff;
g->req_state[idx].width = info->width;
g->req_state[idx].height = info->height;
if (info->width && info->height) {
g->enabled_output_bitmask |= (1 << idx);
} else {
g->enabled_output_bitmask &= ~(1 << idx);
}
virtio_gpu_notify_event(g, VIRTIO_GPU_EVENT_DISPLAY);
return 0;
}
| 1threat |
Use multiple var files in ansible role : <p>One of my roles has two different variable types. One is public (things like package versions and other benign information). These can be committed to SCM without a worry. It also requires some private information (such as API keys and other secret information). I'm using <code>ansible-vault</code> to encrypt secret information. My solution was to have <code>vars/main.yaml</code> for pulic, and <code>vars/vault.yml</code> for the encrypted private information.</p>
<p>I came across a problem and am uncertain what's the best practice or actual solution here. It seems that ansible only loads the <code>vars/main.yml</code> file. Naturally I do not want to encrypt the public information so I looked for solution. So far the only solution I came up with (suggested on IRC) is to create <code>group_vars/all/vault.yml</code> and prefix all variables with the role name. This works because ansible seems to recursively load everything under <code>group_vars</code>. This does work but seems organizationally incorrect because the variables are for a <em>specific</em> role and not "globally universally true". I also tried to put <code>include: vars/vault.yml</code> into <code>vars/main.yml</code> but that did not work.</p>
<p>Is there a proper way to do this?</p>
| 0debug |
How to find a character using index in PHP string? : <p>I have a string in PHP code like this:</p>
<pre><code>$string = "This is a PHP code";
</code></pre>
<p>I want to find a character at index 3 in above string. And output must be:</p>
<pre><code>s
</code></pre>
<p>Is there any idea to achieve this goal ?</p>
| 0debug |
Clear Cache in iOS: Deleting Application Data of Other Apps : <p>Recently, I have came across many apps which "Clear Cache" on iPhone. They also specify that you may lose some saved data and temp files.</p>
<p>What I know is that Apple doesn't allows you to access data of other Apps neither directory. So, how they are cleaning cache data? Can anyone put some light on it?</p>
<p>Reference: <a href="https://itunes.apple.com/ph/app/magic-phone-cleaner/id1176756975?mt=8" rel="noreferrer">Magic Phone Cleaner</a></p>
<p><a href="https://itunes.apple.com/ph/app/power-clean-delete-duplicate-photos-scan-network/id1115097063?mt=8" rel="noreferrer">Power Clean</a></p>
| 0debug |
Is HTML.Partial case sensitive? : <p>Is HTML.Partial case sensitive? If it is, how do I call a partial when I donn't have the correct capitalization?</p>
| 0debug |
int av_opencl_init(AVDictionary *options, AVOpenCLExternalEnv *ext_opencl_env)
{
int ret = 0;
AVDictionaryEntry *opt_build_entry;
AVDictionaryEntry *opt_platform_entry;
AVDictionaryEntry *opt_device_entry;
LOCK_OPENCL
if (!gpu_env.init_count) {
opt_platform_entry = av_dict_get(options, "platform_idx", NULL, 0);
opt_device_entry = av_dict_get(options, "device_idx", NULL, 0);
gpu_env.usr_spec_dev_info.platform_idx = -1;
gpu_env.usr_spec_dev_info.dev_idx = -1;
if (opt_platform_entry) {
gpu_env.usr_spec_dev_info.platform_idx = strtol(opt_platform_entry->value, NULL, 10);
}
if (opt_device_entry) {
gpu_env.usr_spec_dev_info.dev_idx = strtol(opt_device_entry->value, NULL, 10);
}
ret = init_opencl_env(&gpu_env, ext_opencl_env);
if (ret < 0)
goto end;
}
opt_build_entry = av_dict_get(options, "build_options", NULL, 0);
if (opt_build_entry)
ret = compile_kernel_file(&gpu_env, opt_build_entry->value);
else
ret = compile_kernel_file(&gpu_env, NULL);
if (ret < 0)
goto end;
av_assert1(gpu_env.kernel_code_count > 0);
gpu_env.init_count++;
end:
UNLOCK_OPENCL
return ret;
}
| 1threat |
How a function is given a name? : <p>Which name is given a function that is separated by undescore.
function_name.</p>
<p>And to a function like FunctionName? and what would be the right one for python and ANSI C.??</p>
| 0debug |
How can I remove these white spaces in my HTML table without affecting the other rows placement? : I am fairly new to HTML and CSS, I've been working on creating a clickable banner by using a table, but Im having trouble getting rid of white spaces between my rows and spliced images. This is what the table looks like in a browser [Browser view of table][1]
And below is my code for the table
[Image of Code][2]
I've tried inline styling using padding and margin but both seems to affect the placement of the other banners, specifically the third banner. Im quite new and not too sure what else to try, does anyone have any advice or resources I can use to figure this out?
Thanks!
[1]: https://i.stack.imgur.com/t1H9g.jpg
[2]: https://i.stack.imgur.com/8n6lt.png | 0debug |
how can we use superscript and subscript text in flutter Text or RichText : <p>i want to show a superscript text but not found any example or can anyone help me with this.</p>
<p>I have tried Text and RichText also, but not found any method or fields.</p>
| 0debug |
How to use session variable with NodeJs? : <p>I have the following NodeJS code:</p>
<pre><code> let sql = `SELECT box_id, cubby_id, occupied, comport
FROM box
WHERE longestDimension = ?
AND LOWER(box_id) = LOWER(?)`;
connection.query(sql, [boxSelectedDimension, boxSelectedValue] , function(err, rows, fields) {
if (!err) {
for(var i=0; i< rows.length; i++) {
// Make the comparaison case insensitive
if (rows[i].occupied == `unoccupied`) {
console.log("free");
var comport = rows[i].comport;
var command = "open" + rows[i].cubby_id;
</code></pre>
<p>Essentially i would like to store the value of the <code>comport</code> and <code>command</code> variable in a session variable so that the value of these variable could be used in another router page in nodejs. </p>
<p>I am not sure how to store and retrieve the session variable.</p>
| 0debug |
Limit request size to Web applications (c cgi versus .net vesus Go) : This is a question regarding basic understanding of a web application.
Although c is poor choice for web application, It is easier for me to ask this question as it relates to c cgi. The same issue might exist with other technologies like .NET/ Go.
I c cgi, when a request comes in, what prevents a malicious user from sending a huge input size for one of the parameter? Is it possibel to drop such a request even before evaluating the size inside of a program?
Does this happen at the web server level where we can say drop certain request if it is beyond a certain size? If the size of the request parameter is determined using the argv, where does the space get allocated?
In other words, How can we prevent a web application from processing malicious request of big size so the web application does not even allocate space or spend processing. Does this ocur at the application level or the hosting server level.
Thanks,
Kg
----
How can we drop such an request using Go?
How is it handled in .net? | 0debug |
need to create preview of json in html : I have json looks like
data:[{test:{innertest:"2345", outertest:"abcd"},
trans:{sig:"sou",trip:[{one:"2"},{two:"3"}],otherac:"iii"},
{test:{innertest:"uuu", outertest:"rrr"},trans:{sig:"e",trip:[{one:"9"},{two:"8"}],otherac:"eee"}}]
I need to crate preview(in google chrome network) for this json in html. can any one give me any idea how to do.
| 0debug |
How to change gravatar picture programmatically? : I'm using gravatar to display my user contact in wordpress but I want to allow them to change their picture. I don't see any way to set it with the API..
Is it possible ?
Thank | 0debug |
void ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in)
{
char *param, buffer[128], tmp[128];
int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0;
SrtStack stack[16];
stack[0].tag[0] = 0;
strcpy(stack[0].param[PARAM_SIZE], "{\\fs}");
strcpy(stack[0].param[PARAM_COLOR], "{\\c}");
strcpy(stack[0].param[PARAM_FACE], "{\\fn}");
for (; !end && *in; in++) {
switch (*in) {
case '\r':
break;
case '\n':
if (line_start) {
end = 1;
break;
}
rstrip_spaces_buf(dst);
av_bprintf(dst, "\\N");
line_start = 1;
break;
case ' ':
if (!line_start)
av_bprint_chars(dst, *in, 1);
break;
case '{':
len = 0;
an += sscanf(in, "{\\an%*1u}%n", &len) >= 0 && len > 0;
if ((an != 1 && (len = 0, sscanf(in, "{\\%*[^}]}%n", &len) >= 0 && len > 0)) ||
(len = 0, sscanf(in, "{%*1[CcFfoPSsYy]:%*[^}]}%n", &len) >= 0 && len > 0)) {
in += len - 1;
} else
av_bprint_chars(dst, *in, 1);
break;
case '<':
tag_close = in[1] == '/';
len = 0;
if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) {
const char *tagname = buffer;
while (*tagname == ' ')
tagname++;
if ((param = strchr(tagname, ' ')))
*param++ = 0;
if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) ||
( tag_close && sptr > 0 && !strcmp(stack[sptr-1].tag, tagname))) {
int i, j, unknown = 0;
in += len + tag_close;
if (!tag_close)
memset(stack+sptr, 0, sizeof(*stack));
if (!strcmp(tagname, "font")) {
if (tag_close) {
for (i=PARAM_NUMBER-1; i>=0; i--)
if (stack[sptr-1].param[i][0])
for (j=sptr-2; j>=0; j--)
if (stack[j].param[i][0]) {
av_bprintf(dst, "%s", stack[j].param[i]);
break;
}
} else {
while (param) {
if (!strncmp(param, "size=", 5)) {
unsigned font_size;
param += 5 + (param[5] == '"');
if (sscanf(param, "%u", &font_size) == 1) {
snprintf(stack[sptr].param[PARAM_SIZE],
sizeof(stack[0].param[PARAM_SIZE]),
"{\\fs%u}", font_size);
}
} else if (!strncmp(param, "color=", 6)) {
param += 6 + (param[6] == '"');
snprintf(stack[sptr].param[PARAM_COLOR],
sizeof(stack[0].param[PARAM_COLOR]),
"{\\c&H%X&}",
html_color_parse(log_ctx, param));
} else if (!strncmp(param, "face=", 5)) {
param += 5 + (param[5] == '"');
len = strcspn(param,
param[-1] == '"' ? "\"" :" ");
av_strlcpy(tmp, param,
FFMIN(sizeof(tmp), len+1));
param += len;
snprintf(stack[sptr].param[PARAM_FACE],
sizeof(stack[0].param[PARAM_FACE]),
"{\\fn%s}", tmp);
}
if ((param = strchr(param, ' ')))
param++;
}
for (i=0; i<PARAM_NUMBER; i++)
if (stack[sptr].param[i][0])
av_bprintf(dst, "%s", stack[sptr].param[i]);
}
} else if (tagname[0] && !tagname[1] && strspn(tagname, "bisu") == 1) {
av_bprintf(dst, "{\\%c%d}", tagname[0], !tag_close);
} else {
unknown = 1;
snprintf(tmp, sizeof(tmp), "</%s>", tagname);
}
if (tag_close) {
sptr--;
} else if (unknown && !strstr(in, tmp)) {
in -= len + tag_close;
av_bprint_chars(dst, *in, 1);
} else
av_strlcpy(stack[sptr++].tag, tagname,
sizeof(stack[0].tag));
break;
}
}
default:
av_bprint_chars(dst, *in, 1);
break;
}
if (*in != ' ' && *in != '\r' && *in != '\n')
line_start = 0;
}
while (dst->len >= 2 && !strncmp(&dst->str[dst->len - 2], "\\N", 2))
dst->len -= 2;
dst->str[dst->len] = 0;
rstrip_spaces_buf(dst);
}
| 1threat |
Searching array for strings in array VBA : <p>I have declared an array containing 59 items as a string. Does anyone know how I could write a bit of code that would search another range (A:F), and highlight any cell that contained one of the items in my array yellow.</p>
<p>I think this might be a loop inside of another loop, but I am not sure how to construct it. Apologies for the lack of code, I hope the explanation is clear.</p>
<p>Thanks!</p>
| 0debug |
int nbd_client_session_co_discard(NbdClientSession *client, int64_t sector_num,
int nb_sectors)
{
struct nbd_request request;
struct nbd_reply reply;
ssize_t ret;
if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) {
return 0;
}
request.type = NBD_CMD_TRIM;
request.from = sector_num * 512;
request.len = nb_sectors * 512;
nbd_coroutine_start(client, &request);
ret = nbd_co_send_request(client, &request, NULL, 0);
if (ret < 0) {
reply.error = -ret;
} else {
nbd_co_receive_reply(client, &request, &reply, NULL, 0);
}
nbd_coroutine_end(client, &request);
return -reply.error;
}
| 1threat |
Python can't implement timeit module : <p>This is a basic exercise. I just don't know hot to implement the timeit module correctly. I keep recieving syntax errors</p>
<pre><code>import timeit
import random
def bubblesort(LAux):
for i in range(len(LAux)):
exchange = False
for j in range(len(LAux)-1):
if LAux[j] > LAux[j+1]:
tmp = LAux[j+1]
LAux[j+1] = LAux[j]
LAux[j] = tmp
exchange = True
if not exchange:
break
return(LAux)
a=int(input("Size of list: "))
lst = [0]*a
for i in range(a):
lst[i] = random.randint(1,100)
print(bubblesort(lst))
print(timeit.timeit()
</code></pre>
| 0debug |
void ff_put_h264_qpel8_mc20_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hz_8w_msa(src - 2, stride, dst, stride, 8);
}
| 1threat |
Difference between Function pointer and passing pointers : <h1>I have these codes...</h1>
<pre><code>#include <iostream>
using namespace std;
int * Function (int a, int b);
int main()
{
int a = 2;
int b = 7;
int * x = &a;
int * y = &b;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
Function (a , b);
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
Function (a , b);
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
system ("PAUSE");
return 0;
}
int * Function (int a, int b)
{
int pom;
pom = a;
a = b;
b = pom;
}
</code></pre>
<h3>This one is Function pointer and do not change variables. I dont know why, and what exactly means Fucntion pointer. Why is this kind of pointers useful ?</h3>
<h2>Versus</h2>
<pre><code> #include <iostream>
using namespace std;
int Function (int * a, int * b);
int main()
{
int a = 2;
int b = 7;
int * x = &a;
int * y = &b;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
Function (&a , &b);
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
Function (&a , & b);
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
cout << endl << endl;
cout << a << " " << *x << endl;
cout << b << " " << *y << endl;
system ("PAUSE");
return 0;
}
int Function (int * a, int * b)
{
int pom;
pom = *a;
*a = *b;
*b = pom;
}
</code></pre>
<h3>This is ordinary passing by pointers, this change a variables like books learn. I am interested how to use passing by pointer for expamle arrays.</h3>
| 0debug |
Make array of objects from one array (keys) the other array of arrays (values) : <p>Maybe this was asked before, and I have no clue how to look for it, so I applogize in advance for my total lack of wording skills. So, here it goes. I am programming in ECMA5 (so no fancy array/object methods available). I have one array, which contains the keys, lets say:</p>
<pre><code>var keys = ["name", "age", "school"];
</code></pre>
<p>Then, an array of arrays containing the values:</p>
<pre><code>var values = [["John John", 16, "Saints Hills High School"], ["Miranda Knobs", 12, "St Mary Junior High"], ["Patricia Lee", 13, "Milwakee High School"]];
</code></pre>
<p>I want to create an array of objects. Each object having the keys from the first array and the values from the second array, like so:</p>
<pre><code>var result = [{name: "John John", age: 16, school: "Saints Hills High School"}, {name: "Miranda Knobs", age: 12, school: "St Mary Junior High"}, {name: "Patricia Lee", age: 13, school: "Milwakee High School"}];
</code></pre>
<p>I saw some questions/solutions with 2 arrays, one containing the keys and one the values, but I have no idea how to repeat the first array multiple times for each object.</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.