problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static av_cold int qdm2_decode_init(AVCodecContext *avctx)
{
QDM2Context *s = avctx->priv_data;
uint8_t *extradata;
int extradata_size;
int tmp_val, tmp, size;
if (!avctx->extradata || (avctx->extradata_size < 48)) {
av_log(avctx, AV_LOG_ERROR, "extradata missing or truncated\n");
return -1;
}
extradata = avctx->extradata;
extradata_size = avctx->extradata_size;
while (extradata_size > 7) {
if (!memcmp(extradata, "frmaQDM", 7))
break;
extradata++;
extradata_size--;
}
if (extradata_size < 12) {
av_log(avctx, AV_LOG_ERROR, "not enough extradata (%i)\n",
extradata_size);
return -1;
}
if (memcmp(extradata, "frmaQDM", 7)) {
av_log(avctx, AV_LOG_ERROR, "invalid headers, QDM? not found\n");
return -1;
}
if (extradata[7] == 'C') {
av_log(avctx, AV_LOG_ERROR, "stream is QDMC version 1, which is not supported\n");
return -1;
}
extradata += 8;
extradata_size -= 8;
size = AV_RB32(extradata);
if(size > extradata_size){
av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n",
extradata_size, size);
return -1;
}
extradata += 4;
av_log(avctx, AV_LOG_DEBUG, "size: %d\n", size);
if (AV_RB32(extradata) != MKBETAG('Q','D','C','A')) {
av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n");
return -1;
}
extradata += 8;
avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
extradata += 4;
if (s->channels > MPA_MAX_CHANNELS)
return AVERROR_INVALIDDATA;
avctx->sample_rate = AV_RB32(extradata);
extradata += 4;
avctx->bit_rate = AV_RB32(extradata);
extradata += 4;
s->group_size = AV_RB32(extradata);
extradata += 4;
s->fft_size = AV_RB32(extradata);
extradata += 4;
s->checksum_size = AV_RB32(extradata);
if (s->checksum_size >= 1U << 28) {
av_log(avctx, AV_LOG_ERROR, "data block size too large (%u)\n", s->checksum_size);
return AVERROR_INVALIDDATA;
}
s->fft_order = av_log2(s->fft_size) + 1;
s->fft_frame_size = 2 * s->fft_size;
s->group_order = av_log2(s->group_size) + 1;
s->frame_size = s->group_size / 16;
if (s->frame_size > QDM2_MAX_FRAME_SIZE)
return AVERROR_INVALIDDATA;
s->sub_sampling = s->fft_order - 7;
s->frequency_range = 255 / (1 << (2 - s->sub_sampling));
switch ((s->sub_sampling * 2 + s->channels - 1)) {
case 0: tmp = 40; break;
case 1: tmp = 48; break;
case 2: tmp = 56; break;
case 3: tmp = 72; break;
case 4: tmp = 80; break;
case 5: tmp = 100;break;
default: tmp=s->sub_sampling; break;
}
tmp_val = 0;
if ((tmp * 1000) < avctx->bit_rate) tmp_val = 1;
if ((tmp * 1440) < avctx->bit_rate) tmp_val = 2;
if ((tmp * 1760) < avctx->bit_rate) tmp_val = 3;
if ((tmp * 2240) < avctx->bit_rate) tmp_val = 4;
s->cm_table_select = tmp_val;
if (s->sub_sampling == 0)
tmp = 7999;
else
tmp = ((-(s->sub_sampling -1)) & 8000) + 20000;
if (tmp < 8000)
s->coeff_per_sb_select = 0;
else if (tmp <= 16000)
s->coeff_per_sb_select = 1;
else
s->coeff_per_sb_select = 2;
if ((s->fft_order < 7) || (s->fft_order > 9)) {
av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order);
return -1;
}
ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R);
ff_mpadsp_init(&s->mpadsp);
qdm2_init(s);
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
avcodec_get_frame_defaults(&s->frame);
avctx->coded_frame = &s->frame;
return 0;
}
| 1threat |
Convert from Flux to Mono : <p>How can I convert from a Flux with 1 element to a Mono?</p>
<pre><code>Flux.fromArray(arrayOf(1,2,1,1,1,2))
.distinct()
.take(1)
</code></pre>
<p>How do I make this a Mono(1)?</p>
| 0debug |
MySql.Data.EntityFrameworkCore vs Pomelo.EntityFrameworkCore.MySql : <p>Which database connector should I use in <strong>.Net Core 2</strong> enterprise level web app which is going to handle large amount of data.</p>
<p>I have two choices:</p>
<ol>
<li>Pomelo.EntityFrameworkCore.MySql</li>
<li>MySql.Data.EntityFrameworkCore</li>
</ol>
<p>But still confuse which one to choose for the development.</p>
<p>I started with <strong>MySql.Data.EntityFrameworkCore</strong>, which is MySQL official provider but after facing several issues while code first migration I had to google again for some better alternative.</p>
<p>After some research I found <strong>Pomelo.EntityFrameworkCore.MySql</strong> bit more helpful for my application and it also covered the issues I was facing before.</p>
<p>But it still left me a bit confuse about which one to choose for long term.</p>
<p><strong>Pomelo</strong> is workign fine currently but I am not sure if they (pomelo team) will keep always keep it updating and will keep it in sync with the latest .Net Core version available in the market??</p>
<p><strong>MySql</strong> is not working as expected but the only plus point with this is : It is provided by MySQl itself.</p>
<p>Please help me to decide</p>
| 0debug |
static void xilinx_spips_flush_txfifo(XilinxSPIPS *s)
{
for (;;) {
int i;
uint8_t rx;
uint8_t tx = 0;
for (i = 0; i < num_effective_busses(s); ++i) {
if (!i || s->snoop_state == SNOOP_STRIPING) {
if (fifo8_is_empty(&s->tx_fifo)) {
s->regs[R_INTR_STATUS] |= IXR_TX_FIFO_UNDERFLOW;
xilinx_spips_update_ixr(s);
return;
} else {
tx = fifo8_pop(&s->tx_fifo);
}
}
rx = ssi_transfer(s->spi[i], (uint32_t)tx);
DB_PRINT("tx = %02x rx = %02x\n", tx, rx);
if (!i || s->snoop_state == SNOOP_STRIPING) {
if (fifo8_is_full(&s->rx_fifo)) {
s->regs[R_INTR_STATUS] |= IXR_RX_FIFO_OVERFLOW;
DB_PRINT("rx FIFO overflow");
} else {
fifo8_push(&s->rx_fifo, (uint8_t)rx);
}
}
}
switch (s->snoop_state) {
case (SNOOP_CHECKING):
switch (tx) {
case 0x0b:
case 0x6b:
s->snoop_state = 4;
break;
case 0xbb:
s->snoop_state = 4;
break;
case 0xeb:
s->snoop_state = 6;
break;
default:
s->snoop_state = SNOOP_NONE;
}
break;
case (SNOOP_STRIPING):
case (SNOOP_NONE):
break;
default:
s->snoop_state--;
}
}
}
| 1threat |
void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs)
{
bdrv_ref(bs);
blk->root = bdrv_root_attach_child(bs, "root", &child_root, blk);
notifier_list_notify(&blk->insert_bs_notifiers, blk);
if (blk->public.throttle_state) {
throttle_timers_attach_aio_context(
&blk->public.throttle_timers, bdrv_get_aio_context(bs));
}
}
| 1threat |
static float pvq_band_cost(CeltPVQ *pvq, CeltFrame *f, OpusRangeCoder *rc, int band,
float *bits, float lambda)
{
int i, b = 0;
uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 };
const int band_size = ff_celt_freq_range[band] << f->size;
float buf[176 * 2], lowband_scratch[176], norm1[176], norm2[176];
float dist, cost, err_x = 0.0f, err_y = 0.0f;
float *X = buf;
float *X_orig = f->block[0].coeffs + (ff_celt_freq_bands[band] << f->size);
float *Y = (f->channels == 2) ? &buf[176] : NULL;
float *Y_orig = f->block[1].coeffs + (ff_celt_freq_bands[band] << f->size);
OPUS_RC_CHECKPOINT_SPAWN(rc);
memcpy(X, X_orig, band_size*sizeof(float));
if (Y)
memcpy(Y, Y_orig, band_size*sizeof(float));
f->remaining2 = ((f->framebits << 3) - f->anticollapse_needed) - opus_rc_tell_frac(rc) - 1;
if (band <= f->coded_bands - 1) {
int curr_balance = f->remaining / FFMIN(3, f->coded_bands - band);
b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[band] + curr_balance), 14);
}
if (f->dual_stereo) {
pvq->quant_band(pvq, f, rc, band, X, NULL, band_size, b / 2, f->blocks, NULL,
f->size, norm1, 0, 1.0f, lowband_scratch, cm[0]);
pvq->quant_band(pvq, f, rc, band, Y, NULL, band_size, b / 2, f->blocks, NULL,
f->size, norm2, 0, 1.0f, lowband_scratch, cm[1]);
} else {
pvq->quant_band(pvq, f, rc, band, X, Y, band_size, b, f->blocks, NULL, f->size,
norm1, 0, 1.0f, lowband_scratch, cm[0] | cm[1]);
}
for (i = 0; i < band_size; i++) {
err_x += (X[i] - X_orig[i])*(X[i] - X_orig[i]);
if (Y)
err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
}
dist = sqrtf(err_x) + sqrtf(err_y);
cost = OPUS_RC_CHECKPOINT_BITS(rc)/8.0f;
*bits += cost;
OPUS_RC_CHECKPOINT_ROLLBACK(rc);
return lambda*dist*cost;
}
| 1threat |
static int estimate_sid_gain(G723_1_Context *p)
{
int i, shift, seg, seg2, t, val, val_add, x, y;
shift = 16 - p->cur_gain * 2;
if (shift > 0)
t = p->sid_gain << shift;
else
t = p->sid_gain >> -shift;
x = av_clipl_int32(t * (int64_t)cng_filt[0] >> 16);
if (x >= cng_bseg[2])
return 0x3F;
if (x >= cng_bseg[1]) {
shift = 4;
seg = 3;
} else {
shift = 3;
seg = (x >= cng_bseg[0]);
}
seg2 = FFMIN(seg, 3);
val = 1 << shift;
val_add = val >> 1;
for (i = 0; i < shift; i++) {
t = seg * 32 + (val << seg2);
t *= t;
if (x >= t)
val += val_add;
else
val -= val_add;
val_add >>= 1;
}
t = seg * 32 + (val << seg2);
y = t * t - x;
if (y <= 0) {
t = seg * 32 + (val + 1 << seg2);
t = t * t - x;
val = (seg2 - 1 << 4) + val;
if (t >= y)
val++;
} else {
t = seg * 32 + (val - 1 << seg2);
t = t * t - x;
val = (seg2 - 1 << 4) + val;
if (t >= y)
val--;
}
return val;
}
| 1threat |
Arrow Right Type Sidebar : <p>I've been banging this problem for hours and still can't figure out how to achieve this arrow right type sidebar. I want the look of my sidebar like this.
<a href="https://i.stack.imgur.com/cPjKJ.png" rel="nofollow noreferrer">Sidebar UI I want to achieve</a></p>
<p>How can I achieve that arrow right sidebar? Is there similar code that I can used as basis? </p>
| 0debug |
How to get data from JSON after decode : <p>From API i get following JSON string</p>
<pre><code>{
"cost":1000.00,
"cost_ua":25900.44,
"pay_date":"29-07-2017",
"payments":{
"1":{
"tar":"90965",
"name":"Ввозная ( импортная ) пошлина",
"basis_value":25900.44,
"sum_type":"грн.",
"pay_description":{
"name":"Льготная/полная",
"value":"5.00 %",
"comments":"ЗУ N 584-VII",
"document":{
"num":"584-VII",
"date":"19-09-2013"
}
}
},
"2":{ "name":"Налог на добавленную стоимость ( НДС )" }
},
"payments_sum":6734.11,
"payments_ua_sum":260.00,
"payments_persent":26.00
}
</code></pre>
<p>After json_decode how can i get "basis_value" and "comments" ?
I tried this, but it not work</p>
<pre><code>$result_parse = json_decode($response);
echo $result_parse->payments->basis_value;
echo $result_parse->payments->1->basis_value;
</code></pre>
| 0debug |
java.util.ConcurrentModificationException in Android : <p>I am writing a piece of code which displays in an expandable list using information from an AsyncTask and a pre defined HashMap. But it is throwing <strong>java.util.ConcurrentModificationException</strong>. My code is as follows:</p>
<p>AsnycTask</p>
<pre><code>private class BackTask extends AsyncTask<Void, Void, Void> {
ProgressDialog pd;
ArrayList<String> name;
ArrayList<Integer> quantity;
Map<String, Map<String, Integer>> cart_names1 = new HashMap<String, Map<String, Integer>>();
public BackTask(ArrayList<String> name, ArrayList<Integer> quantity) {
this.name = name;
this.quantity = quantity;
}
protected void onPreExecute() {
super.onPreExecute();
pd = new ProgressDialog(ha);
pd.setTitle("Retrieving data");
pd.setMessage("Please wait.");
pd.setCancelable(true);
pd.setIndeterminate(true);
pd.show();
}
protected Void doInBackground(Void... arg0) {
InputStream is = null;
String result = "";
try {
String link = "http://chutte.co.nf/get_item_prices.php?";
for (int b = 0; b < name.size(); b++) {
link += "names[]" + "=" + name.get(b) + "&";
}
for (int a = 0; a < quantity.size(); a++) {
link += "quantities[]" + "=" + quantity.get(a);
if (a != quantity.size() - 1) {
link += "&";
}
}
Log.e("ERROR", link);
URL url = new URL(link);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
is = urlConnection.getInputStream();
} catch (Exception e) {
if (pd != null) pd.dismiss();
Log.e("ERROR", e.getMessage());
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder builder = new StringBuilder();
String line = null;
while ((line = reader.readLine()) != null) {
builder.append(line + "\n");
}
is.close();
result = builder.toString();
} catch (Exception e) {
Log.e("ERROR", "Error converting result " + e.toString());
}
try {
result = result.substring(result.indexOf("["));
JSONArray jsonArray = new JSONArray(result);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
Map<String, Integer> temmap = new HashMap<>();
String temname = jsonObject.getString("Name");
temmap.put("First", jsonObject.getInt("First"));
temmap.put("Second", jsonObject.getInt("Second"));
temmap.put("Third", jsonObject.getInt("Third"));
Log.e("ERROR", temmap.get("First").toString());
cart_names1.put(temname, temmap);
}
strhold2.clear();
strhold2.add("First");
strhold2.add("Second");
strhold2.add("Third");
String[] strhold1 = new String[strhold2.size()];
for (int i56 = 0; i56 < strhold2.size(); i56++) {
strhold1[i56] = strhold2.get(i56);
}
System.out.println(cart_names1);
Log.e("ERROR", Integer.toString(cart_names1.size()) + "IN LATEST");
if (cart_names1.size() > 1) {
System.out.println(cart_names1.size());
System.out.println(strhold2.size());
Combination.printCombination(cart_names1, strhold1, strhold2.size(), cart_names1.size(), 2);
ArrayList<String> wrong = Permutation.getlist();
System.out.println(wrong + "this is final");
setalldata(wrong);
System.out.println(wrong);
couldthis.clear();
couldthis.addAll(wrong);
} else {
Single_Permutation.getpermute(cart_names1);
System.out.println(Single_Permutation.singlelist);
couldthis.clear();
couldthis.addAll(Single_Permutation.singlelist);
setalldata(Single_Permutation.singlelist);
Log.e("ERROR", "thisis the list 1" + getdataformap());
}
} catch (Exception e) {
Log.e("ERROR", "Error pasting data " + e.toString());
}
return null;
}
@Override
protected void onPostExecute(Void result) {
/*SetMap setMap = new SetMap(getdataformap());
setMap.execute();*/
if (pd != null){ pd.dismiss();}
ListFragment.addtolist(getdataformap());
Log.e("ERROR", "This is putmap i" + getdataformap());
SetMap setMap =new SetMap(getdataformap());
setMap.execute();
}
}
}
</code></pre>
<p>Fragment(with expandable list)</p>
<pre><code>public static class ListFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
public static ExpandableListView expandablelistview;
public static CustomExpandableListAdapter expandableadapter;
public static HashMap<Fitems, List<Fnitems>> datapforput = new HashMap<>();
public static List<Fitems> mainforput = new ArrayList<>();
public static View view;
public static Context getha;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
view = inflater.inflate(R.layout.activity_listfragment, container, false);
//doddata();
expandablelistview = (ExpandableListView) view.findViewById(R.id.expandableListView);
expandableadapter = new CustomExpandableListAdapter(((Result) getActivity()).getha(), mainforput, datapforput);
expandablelistview.setAdapter(expandableadapter);
getha = ((Result) getActivity()).getha();
return view;
}
@Override
public void onStart() {
super.onStart();
Permutation.finallist = new ArrayList<>();
Single_Permutation.singlelist = new ArrayList<>();
/* doddata();
expandablelistview = (ExpandableListView) view.findViewById(R.id.expandableListView);
expandableadapter = new CustomExpandableListAdapter(((Result)getActivity()).getha(),mainforput,datapforput);
expandablelistview.setAdapter(expandableadapter);*/
}
/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static void doddata() {
Fitems fitems1 = new Fitems();
Fitems fitems2 = new Fitems();
Fnitems fnitems1 = new Fnitems();
Fnitems fnitems2 = new Fnitems();
Fnitems fnitems3 = new Fnitems();
Fnitems fnitems4 = new Fnitems();
fitems1.setName("AAA");
fitems2.setName("BBB");
fnitems1.setName("AAAa");
fnitems2.setName("AAAb");
fnitems3.setName("BBBa");
fnitems4.setName("BBBb");
List<Fnitems> listfnitem1 = new ArrayList<>();
List<Fnitems> listfnitem2 = new ArrayList<>();
listfnitem1.add(fnitems1);
listfnitem1.add(fnitems2);
listfnitem2.add(fnitems3);
listfnitem2.add(fnitems4);
datapforput.put(fitems1, listfnitem1);
datapforput.put(fitems2, listfnitem2);
mainforput.add(fitems1);
mainforput.add(fitems2);
//Log.e("ERROR", "thisis the list for god's sake " + Result.couldthis+datapforput.toString());
if (Result.couldthis.size() > 0) {
for (int i = 0; i < (Result.couldthis).size(); i++) {
for (Map.Entry<Fitems, List<Fnitems>> entry : datapforput.entrySet()) {
if (Result.couldthis.get(i).equals(entry.getKey().getName())){
Fnitems fnitems5 = new Fnitems();
fnitems5.setName(Search_multiple.cart_records.get(i).getName());
entry.getValue().add(fnitems5);
}else {
Fitems fitems3 = new Fitems();
fitems3.setName(Result.couldthis.get(i));
Fnitems fnitems5 = new Fnitems();
fnitems5.setName(Search_multiple.cart_records.get(i).getName());
List<Fnitems> listfnitem3 = new ArrayList<>();
listfnitem3.add(fnitems5);
datapforput.put(fitems3, listfnitem3);
mainforput.add(fitems3);
}
}
}
}
}
public static ListFragment newInstance() {
ListFragment fragment = new ListFragment();
Log.e("ERROR", "man .... " + fragment.getTag());
return fragment;
}
public static void addtolist(ArrayList<String> dataforputting) {
// Log.e("ERROR", "thisis the list 3" + (dataforputting));
//if (expandableadapter != null){
expandableadapter.clear();//}
//Log.e("INFO", "This is mainforput" + mainforput + "This is dataforput" + datapforput);
doddata();
//Log.e("INFO", "This is mainforput" + mainforput + "This is dataforput" + datapforput);
expandableadapter = new CustomExpandableListAdapter(getha, mainforput, datapforput);
expandablelistview.setAdapter(expandableadapter);
}
}
</code></pre>
<p>Stack</p>
<pre><code>07-13 18:16:11.955 17339-17339/nf.co.riaah.chutte E/ERROR: Inside populate Second
07-13 18:16:11.986 17339-17339/nf.co.riaah.chutte E/AndroidRuntime: FATAL EXCEPTION: main
Process: nf.co.riaah.chutte, PID: 17339
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
at java.util.HashMap$EntryIterator.next(HashMap.java:824)
at java.util.HashMap$EntryIterator.next(HashMap.java:822)
at nf.co.riaah.chutte.Result$ListFragment.doddata(Result.java:199)
at nf.co.riaah.chutte.Result$ListFragment.addtolist(Result.java:230)
at nf.co.riaah.chutte.Result$SetMap.onPostExecute(Result.java:1049)
at nf.co.riaah.chutte.Result$SetMap.onPostExecute(Result.java:967)
at android.os.AsyncTask.finish(AsyncTask.java:636)
at android.os.AsyncTask.access$500(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:139)
at android.app.ActivityThread.main(ActivityThread.java:5298)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
</code></pre>
| 0debug |
int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture,
int *got_picture_ptr,
UINT8 *buf, int buf_size)
{
int ret;
ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
buf, buf_size);
avctx->frame_number++;
return ret;
}
| 1threat |
How can I calculate the dates between two dates in a specific year? : <p>I have a </p>
<p>Start_Date = 1988-04-01
End_Date = 2017-04-30</p>
<p>how can I calcuate the difference between two days in a specific year?
such as 2000 will have 365 days, 2017 will have 120 days.</p>
<p>how can I do that?</p>
| 0debug |
what does this line of python code means : am using paramiko in python to sftp files to remote machine, rest of code makes sense to me but this specific line am not understanding what it does
transport = paramiko.Transport((hostname, 22))
what is transport?
this is the whole code
transport = paramiko.Transport((hostname, 22))
transport.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(transport)
sftp.put(localPath, remotePath)
sftp.close()
transport.close()
what i understand is that it makes the socket, i might be wrong, please someone clarify this to me in most simple terms | 0debug |
Count number of times a character appears in string : <p>So basically I need a script that summarizes which characters and the number of times they appear in a random string. Caps have to be ignored, for example:</p>
<pre><code>var myString = promt ("Type anything: "); //"hello Hello";
</code></pre>
<p>The end result has to be something like this: <code>h = 2, e = 2, l = 4, o = 2</code> printed in the HTML document.</p>
<p>I've tried using <code>myString.match().length</code> without much success. My main problem is defining which characters to check and not checking characters twice (for example: if there are two "h" in the string not checking them twice). </p>
| 0debug |
How to display only numbers in a coulmn if it has strings and numbers. if only string is present then the column should left as empty : Please help me to find a Sql query/ procedure for below request.
I am having column A which is having below values in each row
COLUMN A
My toy is in ('111000','1112220')
My toy is this
My toy is in ('111000')
My toy is this
My toy is in ('111002')
Now i need a query to display the column A with value containing only numbers, If the row is not having any number then it should be left as empty like below
COLUMN A
111000|1112220
111000
111002
if it is a store procedure/ a query any thing is fine for me. Please help me on this | 0debug |
How do get "value + id " as a value? : <p>I want to get value name + id.But how ?</p>
<pre><code>var samin1 = "Cat";
var samin2 = "Dog";
var samin3 = "Elephant";
var samin4 = "Wolf";
var choosenvalue = 2;
var outputvalue = "samin"+"choosenvalue";
</code></pre>
<p>So I need to see "Dog".But I see as text "samin2";
Note: I dont use array.</p>
| 0debug |
What is com.google.android.gm? : <p>One of my logs is returning the following message:</p>
<p><code>12-07 10:42:45.201 6622-17013/? D/DownloadManager: 23 Starting {Apk-apks_1.1.017-812_releaseVersion.apk} by {10112:com.google.android.gm}</code></p>
<p>I believe <code>com.google.android.gm</code> represents my gmail account but not sure. Need more insights.</p>
| 0debug |
How to use regexp to identify the number of hydrogens in a chemical formula? : <p>Which expression should I use to identify the number of hydrogen atoms in a chemical formula?</p>
<p>For example:</p>
<p>C40H51N11O19 - 51 hydrogens</p>
<p>C2HO - 1 hydrogen</p>
<p>CO2 - no hydrogens (empty)</p>
<p>Any suggestions?</p>
<p>Thanks!</p>
<p>Cheers!</p>
| 0debug |
Can't convert Int in String : <p>I have a textbox where i write a int.
I want to use this textbox to construct my object.</p>
<p>Main.cs :</p>
<pre><code>private void SauvegarderMoto_Click(object sender, EventArgs e)
{
try
{
Moto maMoto = new Moto(
maMarque.Text = lesMarques.SelectedItem.ToString(),
monModele.Text = lesModeles.SelectedItem.ToString(),
monMoteur.Text = lesMoteurs.SelectedItem.ToString(),
maCylindree.Text = lesCylindrees.SelectedItem.ToString(),
monAnnee.Text = Convert.ToInt32(lesAnnees.Text)
);
MessageBox.Show("Moto enregistrée avec succès !", "Information");
tabControl1.SelectTab(MaMoto);
}
catch(Exception)
{
MessageBox.Show("Il manque des informations !", "Information");
}
}
</code></pre>
<p>Thanks for help </p>
| 0debug |
static void spr_read_sdr1 (void *opaque, int gprn, int sprn)
{
tcg_gen_ld_tl(cpu_gpr[gprn], cpu_env, offsetof(CPUState, sdr1));
}
| 1threat |
void HELPER(stby_e)(CPUHPPAState *env, target_ulong addr, target_ulong val)
{
uintptr_t ra = GETPC();
switch (addr & 3) {
case 3:
if (parallel_cpus) {
atomic_store_3(env, addr - 3, val, 0xffffff00u, ra);
} else {
cpu_stw_data_ra(env, addr - 3, val >> 16, ra);
cpu_stb_data_ra(env, addr - 1, val >> 8, ra);
}
break;
case 2:
cpu_stw_data_ra(env, addr - 2, val >> 16, ra);
break;
case 1:
cpu_stb_data_ra(env, addr - 1, val >> 24, ra);
break;
default:
#ifndef CONFIG_USER_ONLY
probe_write(env, addr, cpu_mmu_index(env, 0), ra);
#endif
break;
}
}
| 1threat |
static inline int16_t mipsdsp_sat_add_i16(int16_t a, int16_t b,
CPUMIPSState *env)
{
int16_t tempS;
tempS = a + b;
if (MIPSDSP_OVERFLOW(a, b, tempS, 0x8000)) {
if (a > 0) {
tempS = 0x7FFF;
} else {
tempS = 0x8000;
}
set_DSPControl_overflow_flag(1, 20, env);
}
return tempS;
}
| 1threat |
Web applications with javascript : <p>Now I program all my web apps with Flask or Django. (blogs, social networks...). I need templates, db access, controllers, routing...</p>
<p>Now I want to do same web applications, but with javascript.</p>
<p>People tell me : You need NodeJs for server-side, Angular for the front, and for example firebase or mongodb. Or also you can use Express JS.</p>
<p>But can I just use Angular JS and Firebase for start a big web app ? Need I Node if Angular can Access/Update/Delete in my db ? </p>
| 0debug |
How do I recursivly replace a word in file and directory names in terminal : from with the OSX terminal, I want to recursively replace a word with the name of both a directory and a file name. For instance, I have an angular app and the module name is article, all of the file names, and directory names contain the word article. I've already done a find and replace to replace articles with apples in the code. Now I want to do the same with the file structure so both the file names and the directories share the same convention. | 0debug |
void cpu_tlb_update_dirty(CPUState *env)
{
int i;
for(i = 0; i < CPU_TLB_SIZE; i++)
tlb_update_dirty(&env->tlb_table[0][i]);
for(i = 0; i < CPU_TLB_SIZE; i++)
tlb_update_dirty(&env->tlb_table[1][i]);
#if (NB_MMU_MODES >= 3)
for(i = 0; i < CPU_TLB_SIZE; i++)
tlb_update_dirty(&env->tlb_table[2][i]);
#endif
#if (NB_MMU_MODES >= 4)
for(i = 0; i < CPU_TLB_SIZE; i++)
tlb_update_dirty(&env->tlb_table[3][i]);
#endif
#if (NB_MMU_MODES >= 5)
for(i = 0; i < CPU_TLB_SIZE; i++)
tlb_update_dirty(&env->tlb_table[4][i]);
#endif
}
| 1threat |
How to use PHP and Mysql to display different items with only one webpage : <p>My e-business website is actually a search engine.</p>
<p>Step 1 :
users can search the item they like by key words or other attributes. </p>
<p>Step 2:
After that, user may find the items they like, and click on the title of a specific item (or picture,etc) to activate a hyperlink.</p>
<p>Step 3:
Then a webpage that describes the detail of the item will appear.</p>
<p>I was stuck in Step 3.</p>
<p>I found that there are more than 10 thousand items in MySQL database. I wondered if I need to create more than 10 thousand webpages to describe the details for each items ?(Of course it is impractical, but I don't know how to build only one webpage to solve this problem). </p>
<p>p.s. An idea has once come into my mind that I can build a share webpage for describing the detail of items, and find a way to detect which hyperlink or item user have clicked on, but I haven't learn this skill. Is it possible, or there is a better way?</p>
| 0debug |
How to execute this Go binary? : <p>I am told to build a go binary and execute it like this.</p>
<pre><code>go build hello-world.go
$ ls
hello-world hello-world.go
./hello-world
hello world
</code></pre>
<p>So <code>go build hello-world.go</code> takes the human-readable <code>hello-world.go</code> file and creates a binary file.</p>
<p>My two questions are:</p>
<ol>
<li><p>Typically, what are the advantages of compiled code and a file that is directly executable? Is it that it's NOT dependent on your OSX or any other dependencies? How come?</p></li>
<li><p>Why does <code>./hello-world</code> execute the created binary.</p></li>
</ol>
| 0debug |
Validate user input using seperate function : <p>How do I get this to not return 'brea outside loop'. I've read multiple other answers on stackoverflow but cannot grasp the concept as it's inside a seperate function.</p>
<pre><code> def dayEntry(book,cmd):
for x,type in zip(list, gettype):
entry = input('?: ')
validate(entry,type)
results.append(entry)
print (results)
def validate(inval, intyp):
if intyp == "date":
try:
datetime.datetime.strptime(inval, '%d-%m-%Y')
except ValueError:
print("Format not valid, use DD-MM-YYYY")
break
</code></pre>
| 0debug |
MD5 digest of String in go is different from java : I am creating md5 digest in java which is needed to calculate 4 byte hex hash of the input string. Following is the code in Java
> public static String hashString(String s) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
byte[] digest = md.digest(s.getBytes("US-ASCII"));
byte[] output = new byte[digest.length / 4];
for (int i = 0; i < output.length; i++) {
for (int j = 0; j < digest.length; j += 4) {
System.out.print(digest[j]);
output[i] ^= digest[i + j];
}
}
return getHexString(output);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
return null;
}
}
I wanted to use the same code in Golang, however, the md5 output is different than what I am getting in java. Below is the code in go:
func hashString(s string) string {
md := md5.New()
md.Write([]byte(s))
data := md.Sum(nil)
fmt.Println(data)
output := make([]byte, len(data)/4)
for i:=0; i < len(output); i++{
for j:=0 ;j < len(data); j++ {
output[i] ^= data[i + j];
fmt.Print(output[i])
}
}
return getHexString(md.Sum(nil))
}
I have added print statements in both the code samples. As I am new in Go, I am not aware if there are any other libraries or way available to do so. I just followed what I found on internet. It would be really great if someone can help with this. | 0debug |
how to disable red pop up in home screen iphone? : <p>when i am start video calling and press home button in red pop up is display on home screen.how to hide this red pop up in home screen.I have search but not getting and solution.</p>
<p><a href="https://i.stack.imgur.com/tB93i.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tB93i.jpg" alt="enter image description here"></a></p>
| 0debug |
Jquery: Uncaught SyntaxError: missing ) after argument list : <p>I am not sure what causes this problem (thought I covered it correctly). What happens is that on click, it should apply the grow class (which is 0.8 seconds) and after that flip over. Else it reverses this proces.</p>
<pre><code>$('.click').toggle(function(){
var self = this;
$(this).removeClass('normal');
$(this).addClass('grow');
setTimeout(function(){
$(self).addClass('flip')
}800); <-- getting my error here
},
function(){
$(this).removeClass('flip');
setTimeout(function(){
$(this).addClass('normal');
$(this).removeClass('grow');
}800);
});
</code></pre>
<p>Yet I get an error <code>Uncaught SyntaxError: missing ) after argument list</code> on the first setTimeout (and probably ont he second one) but I dont see why i missed a <code>)</code></p>
| 0debug |
static inline int vmsvga_fifo_length(struct vmsvga_state_s *s)
{
int num;
if (!s->config || !s->enable) {
return 0;
}
if ((CMD(min) | CMD(max) | CMD(next_cmd) | CMD(stop)) & 3) {
return 0;
}
if (CMD(min) < (uint8_t *) s->cmd->fifo - (uint8_t *) s->fifo) {
return 0;
}
if (CMD(max) > SVGA_FIFO_SIZE ||
CMD(min) >= SVGA_FIFO_SIZE ||
CMD(stop) >= SVGA_FIFO_SIZE ||
CMD(next_cmd) >= SVGA_FIFO_SIZE) {
return 0;
}
if (CMD(max) < CMD(min) + 10 * 1024) {
return 0;
}
num = CMD(next_cmd) - CMD(stop);
if (num < 0) {
num += CMD(max) - CMD(min);
}
return num >> 2;
}
| 1threat |
Regex for Non-negative numbers with two decimals OR Non-negative Integers. No leading 0 : <p>As-salāmu ʿalaykum,</p>
<pre><code>Allowed:
0
0.00
0.01
0.10
0.11
1
1.00
1.10
1.01
1.11
99999999
99999999.00
99999999.01
99999999.10
99999999.11
NOT ALLOWED:
.
.00
00
00.
00.00
00.01
00.10
00.11
01
010
01.
01.00
01.000
</code></pre>
<p>I could go on but i think you get the gist of what I want. The Regex will be used to validate currency, with a maximum of two optional decimals. No upper limit for the left hand side of the decimal, as long as it isn't a leading 0. </p>
<p>It will be used in a Java-application.</p>
<p>Thanks in advance</p>
| 0debug |
XCode Swift 3 UITableViewController Cell doesn't show..PLEASE HELPPP : I am exporting json file from itunes api>converted that to a json file>send that to firebase> brought that in to a dictionary file here and now I am trying to put that into a tableview but it does not seem to work and I have no clue why. I checked that:
1. The file that I imported was successfully converted into a dictionary.
2. Datasource and delegate is connected to this UITableViewController file.
3. Put other arrays to check if my connections were right(and it worked but it does not work at all if I use the data that I brought in with Firebase)
4. I put cell style as subtitle and type as dynamic.
Below is the UITableViewController code:
import UIKit
import Firebase
class TableViewController1: UITableViewController {
var ref: FIRDatabaseReference!
var rank = [String]()
var song = [[String]]()
var artist = [[String]]()
var tna = [String]()
override func viewDidLoad() {
super.viewDidLoad()
self.ref = FIRDatabase.database().reference()
let userID = FIRAuth.auth()?.currentUser?.uid
self.ref.child("top100itunes").observeSingleEvent(of: .value, with: { (snapshot) in
let jsonfile = snapshot.value! as! String
//print(jsonfile)
let jsondict:[String:Any] = self.convertToDictionary(text: jsonfile)!
for (key, value) in jsondict {
if key != nil {
self.rank.append(key)
if value != nil{
self.tna.append(value as! String)
}
}
}
for x in self.tna{
if x != nil {
for (key,value) in self.convertToDictionary(text: x)!{
self.song.append([key])
self.artist.append([value as! String])
}
}
}
}, withCancel: nil)
}
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
func convertToDictionary(text: String) -> [String: Any]? {
if let data = text.data(using: .utf8) {
do {
return try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
} catch {
print(error.localizedDescription)
}
}
return nil
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return self.song.count
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return self.song[section].count
}
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return self.rank[section]
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell2", for: indexPath)
cell.textLabel?.text = self.song[indexPath.section][indexPath.row]
cell.detailTextLabel?.text = self.artist[indexPath.section][indexPath.row]
return cell
}
}
The json file that I imported is in the structure like:
{ 1 :
{ Title : Artist },
2 :
{ Title : Artist },
.....
}
PLEASE HELP:(
| 0debug |
2017-01-01 00:08:57.231 format equals yyyy-MM-dd.HH:mm:ss? : <p>I'm a bit baffled what format these timestamps are in. I was told the format to use is <code>yyyy-MM-dd.HH:mm:ss</code> but all of the timestamps appear like this <code>2017-01-01 00:08:57.231</code>, <code>2017-01-01 07:43:36.348</code>, or <code>2017-01-01 13:25:55.683</code>. I'm not understanding why there are <strong>four</strong> sections to the time <code>?:Hour:Minute:Second</code> in the actual data I have when the format I'm supposed to be using only has <strong>three</strong> time sections. Are these datetime timestamps not actually in the format of <code>yyyy-MM-dd.HH:mm:ss</code>?</p>
| 0debug |
Expected a name but was STRING at line 1 column 99 path $[0].apkInfo.versionName : <p>I upgraded to gradle to 3.1.1 but now i want to change again to 3.0.1 but after changing to 3.0.1 i am getting this error</p>
<blockquote>
<p>Expected a name but was STRING at line 1 column 99 path $[0].apkInfo.versionName</p>
</blockquote>
<p>I was using 3.0.1 before and it was working perfectly but i changed after android studio update.</p>
<p>The error is only coming when generating signed apk.</p>
<p><strong>Project Gradle</strong></p>
<pre><code>buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
</code></pre>
<p><strong>App gradle</strong></p>
<pre><code>apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.smiles.smartstuddy"
minSdkVersion 16
targetSdkVersion 27
versionCode 4
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
compile 'com.github.lzyzsd:circleprogress:1.2.1'
compile 'dev.dworks.libs:volleyplus:+'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'commons-io:commons-io:2.4'
compile 'com.github.bumptech.glide:glide:4.6.1'
compile 'es.voghdev.pdfviewpager:library:1.0.3'
}
</code></pre>
| 0debug |
How to make a random number between -1 and 1 in Java : <p>Trying to figure this out for a while, need a random number that is either -1, 0 or 1. Any help would be great.</p>
| 0debug |
mongodb 3.4.3 Permission denied wiredtiger_kv_engine.cpp 267 error with ubuntu 16 : <p>I'm having problems lauching mongod as a service:
How is it possible that it works when I do sudo mongod -f /etc/mongod.conf but when launching it with sudo service mongod start I get an error in the log </p>
<p><code>Assertion: 28595:13: Permission denied src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267</code></p>
<p>I'm running mongodb on ubuntu 16</p>
<p>I followed exactly the instructions in the mongodb documentation for installation of that version, so is this a bug? Any suggestions how to solve this are appreciated. </p>
<p>Additional information:</p>
<p>The mongodb service startup script looks like this and runs it as user mongodb, could this be connected to the error?
lib/systemd/system/mongodb.service:</p>
<pre><code>[Unit]
Description=MongoDB Database Service
Wants=network.target
After=network.target
[Service]
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
User=mongodb
Group=mongodb
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target
</code></pre>
| 0debug |
Why attribute app:endIconMode is not found in TextInputLayout? : <p>Hello I am creating an app with the androidx libraries but when I am trying to add a toggle to show or hide the password in an TextInputEditText with the app:endIconMode attribute I am getting the error error: attribute endIconMode not found.</p>
<p>This is my TextInputLayout and TextInputEditText</p>
<pre><code><com.google.android.material.textfield.TextInputLayout
android:id="@+id/password_text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="password"
app:endIconMode="password_toggle"
app:layout_constraintTop_toBottomOf="@+id/user_text_input_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_text_input_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"/>
</com.google.android.material.textfield.TextInputLayout>
</code></pre>
<p>Also these are my dependencies in gradle</p>
<pre><code>implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.0.0'
</code></pre>
<p>I am not sure what i am missing, maybe a dependency? As far as i read in the documentation no extra dependency besides the material one is required.</p>
<p>Thanks</p>
| 0debug |
How do I distinguish between a scanner input and keyboard input in Javascript? : <p>I have gone through answers and came across two ways which can help in distinguishing between scanner and keyboard inputs. It can be done through:</p>
<ul>
<li><p><b>Time Based:</b> Scanner inputs are faster than manual keyboard inputs.</p></li>
<li><p><b>Prefix Based:</b> Append a prefix to barcodes or scanners (inbuilt in scanner devices) and use it to identify the scanner inputs. </p></li>
</ul>
<p>Here are the links: <a href="https://stackoverflow.com/questions/11290898/detect-when-input-box-filled-by-keyboard-and-when-by-barcode-scanner">link 1</a>, <a href="https://stackoverflow.com/questions/21633537/javascript-how-to-read-a-hand-held-barcode-scanner-best?noredirect=1&lq=1">link 2</a> which I have used for the references.</p>
<p>The problem which I have run into is that whenever the user manually types some keyboard keys while the scanning event is being fired it gets added to scanner input and leads to inconsistent results. </p>
<p>Here is the code which I am using: </p>
<pre><code>var BarcodeScannerEvents = function(){
this.initialize.apply(this, arguments);
};
BarcodeScannerEvents.prototype = {
initialize: function() {
$(document).on({
keypress: $.proxy(this._keypress, this)
});
},
_timeoutHandler: 0,
_inputString: '',
_keypress: function (e){
if(this._timeoutHandler){
clearTimeout(this._timeoutHandler);
}
this._inputString += String.fromCharCode(e.which);
//CHECKS FOR VALID CHARACTERS WHILE SCANNING
this._timeoutHandler = setTimeout($.proxy(function(){
if(this._inputString.length <= 10){
this._inputString = '';
return;
}
$(document).trigger('barcodescanned', this._inputString);
this._inputString = '';
}, this), 20);
}
};
new BarcodeScannerEvents();
</code></pre>
<p>The format for my barcode is: ~xxx-xxx-xxxxxx where x can be any number between 0-9. If a character which is a number is appended to the barcode it leads to wrong inserts in the database.</p>
<p>I have tried comparing the events from keyboard inputs and scanner inputs but to no avail. I have given a thought of appending extra characters before each digit and then invalidate the scanned barcode if consecutive numbers appear. But I don't feel this is best way to approach this problem. Can someone help me out here? </p>
| 0debug |
static int multiwrite_req_compare(const void *a, const void *b)
{
return (((BlockRequest*) a)->sector - ((BlockRequest*) b)->sector);
}
| 1threat |
void visit_type_number(Visitor *v, double *obj, const char *name, Error **errp)
{
if (!error_is_set(errp)) {
v->type_number(v, obj, name, errp);
}
}
| 1threat |
Kubernetes - Why does selector field fail to validate for Deployment? : <p>Using Kubernetes 1.2.4, why does my below <a href="http://kubernetes.io/docs/user-guide/deployments/" rel="noreferrer">Deployment</a> definition (redis.yaml) cause the following error?</p>
<pre><code>$ kubectl apply -f redis.yaml
error validating "redis.yaml": error validating data: found invalid field name for v1beta1.LabelSelector; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>
<p><strong>redis.yaml:</strong></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redis
spec:
replicas: 3
selector:
name: redis
template:
metadata:
labels:
name: redis
spec:
containers:
- name: redis
image: kubernetes/redis:v1
ports:
- containerPort: 6379
resources:
limits:
cpu: "0.1"
volumeMounts:
- mountPath: /redis-master-data
name: data
volumes:
- name: data
emptyDir: {}
</code></pre>
| 0debug |
Manipulating a list with dynamically created controls : <p>Let's say, I have a <code>List<Person> people</code>, where <code>Person</code> is a class containing three strings: a <code>Name</code>, <code>Surname</code> and <code>Age</code>. I also have six dynamically created <code>TextBox</code> controls, that are placed on a <code>Panel</code> control, and have a name assigned to them using a <code>for</code> loop. As well as, dynamically created <code>TextChanged</code> event for said <code>TextBox</code> controls. Currently the <code>List</code> consists of two entries <code>people.Add(new Person { Name = John, Surname = Johnson, Age = 25 });</code> and <code>people.Add(new Person { Name = Jack, Surname = Jackson, Age = 30 });</code>. I need the user to be able to change those <code>List<Person></code> entries, by inputting text in the corresponding <code>Textbox</code>. So, the first <code>TextBox</code> changes the <code>people[0].Name</code>, second - <code>people[0].Surname</code>, third - <code>people[0].Age</code>, fourth - <code>people[1].Name</code>, and so on...</p>
| 0debug |
How to permanently draw a for loop inside an if statement? - Processing : I have a if statement which checks for collision as such:
if (BallY == y && BallX == x) // check for collision
{
x = 80; // reset x to initial
y = 240; // reset y to initial
z = 100; //reset z to initial
}
I need a for loop inside this if statement as such:
if (BallY == y && BallX == x) // check for collision
{
x = 80; // reset x to initial
y = 240; // reset y to initial
z = 100; //reset z to initial
for (int i=50; i<width; i+=80)
{
fill(250,0,0);
ellipse(i, 50, 70, 70);
}
}
So the point is to draw a line of circle's on the top of the screen once the collision occurs. This code however, only draws them for a split second then they disappear. How would i make them stay given that a collision has occurred? | 0debug |
IPFS: How to add a file to an existing folder? : <p>Given a rather large folder, that has already been pushed to the network, and deleted locally. How would a file be added to that folder, without re-downloading the entire folder it?</p>
| 0debug |
static void mpegvideo_extract_headers(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
ParseContext1 *pc = s->priv_data;
const uint8_t *buf_end;
const uint8_t *buf_start= buf;
uint32_t start_code;
int frame_rate_index, ext_type, bytes_left;
int frame_rate_ext_n, frame_rate_ext_d;
int picture_structure, top_field_first, repeat_first_field, progressive_frame;
int horiz_size_ext, vert_size_ext, bit_rate_ext;
s->repeat_pict = 0;
buf_end = buf + buf_size;
while (buf < buf_end) {
start_code= -1;
buf= ff_find_start_code(buf, buf_end, &start_code);
bytes_left = buf_end - buf;
switch(start_code) {
case PICTURE_START_CODE:
if (bytes_left >= 2) {
s->pict_type = (buf[1] >> 3) & 7;
}
break;
case SEQ_START_CODE:
if (bytes_left >= 7) {
pc->width = (buf[0] << 4) | (buf[1] >> 4);
pc->height = ((buf[1] & 0x0f) << 8) | buf[2];
avcodec_set_dimensions(avctx, pc->width, pc->height);
frame_rate_index = buf[3] & 0xf;
pc->frame_rate.den = avctx->time_base.den = ff_frame_rate_tab[frame_rate_index].num;
pc->frame_rate.num = avctx->time_base.num = ff_frame_rate_tab[frame_rate_index].den;
avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400;
avctx->codec_id = CODEC_ID_MPEG1VIDEO;
avctx->sub_id = 1;
}
break;
case EXT_START_CODE:
if (bytes_left >= 1) {
ext_type = (buf[0] >> 4);
switch(ext_type) {
case 0x1:
if (bytes_left >= 6) {
horiz_size_ext = ((buf[1] & 1) << 1) | (buf[2] >> 7);
vert_size_ext = (buf[2] >> 5) & 3;
bit_rate_ext = ((buf[2] & 0x1F)<<7) | (buf[3]>>1);
frame_rate_ext_n = (buf[5] >> 5) & 3;
frame_rate_ext_d = (buf[5] & 0x1f);
pc->progressive_sequence = buf[1] & (1 << 3);
avctx->has_b_frames= !(buf[5] >> 7);
pc->width |=(horiz_size_ext << 12);
pc->height |=( vert_size_ext << 12);
avctx->bit_rate += (bit_rate_ext << 18) * 400;
avcodec_set_dimensions(avctx, pc->width, pc->height);
avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1);
avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1);
avctx->codec_id = CODEC_ID_MPEG2VIDEO;
avctx->sub_id = 2;
}
break;
case 0x8:
if (bytes_left >= 5) {
picture_structure = buf[2]&3;
top_field_first = buf[3] & (1 << 7);
repeat_first_field = buf[3] & (1 << 1);
progressive_frame = buf[4] & (1 << 7);
if (repeat_first_field) {
if (pc->progressive_sequence) {
if (top_field_first)
s->repeat_pict = 4;
else
s->repeat_pict = 2;
} else if (progressive_frame) {
s->repeat_pict = 1;
}
}
}
break;
}
}
break;
case -1:
goto the_end;
default:
if (start_code >= SLICE_MIN_START_CODE &&
start_code <= SLICE_MAX_START_CODE)
goto the_end;
break;
}
}
the_end: ;
} | 1threat |
Received remark as comparison between signed and unsigned operands : <p>I have a "C"code snippet as below </p>
<pre><code>int32_t A = 5;
uint32_t B = 8;
if ( A >= B )
{
printf("Test");
}
</code></pre>
<p>When i build this i received an remark/warning as "comparison between signed and unsigned operands.Can any one address this issue?</p>
| 0debug |
How can be use node js api in meteor : I want to use node API in my meteor project.But i enable to find the way, it take my whole day but i can't get succeed.
so how can I expose node API and how to use it in meteor?
| 0debug |
static void nvic_recompute_state(NVICState *s)
{
int i;
int pend_prio = NVIC_NOEXC_PRIO;
int active_prio = NVIC_NOEXC_PRIO;
int pend_irq = 0;
for (i = 1; i < s->num_irq; i++) {
VecInfo *vec = &s->vectors[i];
if (vec->enabled && vec->pending && vec->prio < pend_prio) {
pend_prio = vec->prio;
pend_irq = i;
}
if (vec->active && vec->prio < active_prio) {
active_prio = vec->prio;
}
}
if (active_prio > 0) {
active_prio &= nvic_gprio_mask(s);
}
s->vectpending = pend_irq;
s->exception_prio = active_prio;
trace_nvic_recompute_state(s->vectpending, s->exception_prio);
}
| 1threat |
static size_t curl_size_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
{
CURLState *s = ((CURLState*)opaque);
size_t realsize = size * nmemb;
size_t fsize;
if(sscanf(ptr, "Content-Length: %zd", &fsize) == 1) {
s->s->len = fsize;
}
return realsize;
}
| 1threat |
Difference between Tesseract 3 and Tesseract 4? : <p>What are the major differences between Tesseract 3 and Tesseract 4 ? And why should I choose one over the other ?</p>
| 0debug |
static void *aio_thread(void *unused)
{
sigset_t set;
sigfillset(&set);
sigprocmask(SIG_BLOCK, &set, NULL);
while (1) {
struct qemu_paiocb *aiocb;
size_t offset;
int ret = 0;
pthread_mutex_lock(&lock);
while (TAILQ_EMPTY(&request_list) &&
!(ret == ETIMEDOUT)) {
struct timespec ts = { 0 };
qemu_timeval tv;
qemu_gettimeofday(&tv);
ts.tv_sec = tv.tv_sec + 10;
ret = pthread_cond_timedwait(&cond, &lock, &ts);
}
if (ret == ETIMEDOUT)
break;
aiocb = TAILQ_FIRST(&request_list);
TAILQ_REMOVE(&request_list, aiocb, node);
offset = 0;
aiocb->active = 1;
idle_threads--;
pthread_mutex_unlock(&lock);
while (offset < aiocb->aio_nbytes) {
ssize_t len;
if (aiocb->is_write)
len = pwrite(aiocb->aio_fildes,
(const char *)aiocb->aio_buf + offset,
aiocb->aio_nbytes - offset,
aiocb->aio_offset + offset);
else
len = pread(aiocb->aio_fildes,
(char *)aiocb->aio_buf + offset,
aiocb->aio_nbytes - offset,
aiocb->aio_offset + offset);
if (len == -1 && errno == EINTR)
continue;
else if (len == -1) {
pthread_mutex_lock(&lock);
aiocb->ret = -errno;
pthread_mutex_unlock(&lock);
break;
} else if (len == 0)
break;
offset += len;
pthread_mutex_lock(&lock);
aiocb->ret = offset;
pthread_mutex_unlock(&lock);
}
pthread_mutex_lock(&lock);
idle_threads++;
pthread_mutex_unlock(&lock);
sigqueue(getpid(),
aiocb->aio_sigevent.sigev_signo,
aiocb->aio_sigevent.sigev_value);
}
idle_threads--;
cur_threads--;
pthread_mutex_unlock(&lock);
return NULL;
}
| 1threat |
Select random item in cardview : Cardview you see in the image view with the touch of a downward items are displayed one at a time Now I would like to touch scroll down and one randomly selected items.
[Image][1]
Project link:
[CardView][2]
[1]: http://i.stack.imgur.com/XvOm5.png
[2]: https://github.com/chiemy/CardView | 0debug |
Fastest way to grep list 1000 reocrds in another million of records in a file in linux : Fastest way to grep list 1000 reocrds in another million of records in a file in linux .
Let's say these are my sample records :
1,,EE1,1000,WAT,EEE,20160222T02:00:15+0400,20181231T23:59:59+0400,,vEEE,,47126469f184fee9a80664d952d7fea7,50278774602,95223904,140495221530736,21001,,,,,,,,,,,,,,,C
0,,EE1,1000,WAT,EEE,20160222T02:00:15+0400,20181231T23:59:59+0400,20160222T02:00:15+0400,,vEEE,47126469f184fee9a80664d952d7fea7,50278774602,,,21001,,,,,,,,,,,,,,,H
1,,EE1,1000,WAT,EEE,20160222T02:00:15+0400,20181231T23:59:59+0400,20160521T11:07:25+0400,,vEEE,47126469f184fee9a80664d952d7fea7,50278774602,0095223904,140495221530736,21001,,,,,,,,,,,,,,,H
If i grep 50278774602 the values will come in three rows. I have developed one script using for loop on the same , i have a list to such numbers in a file and i am searching the value in the big file (millions of row) and i need only the last occurrence of such row containing my grep pattern , it works perfectly with for loop but my concern is its taking huge time .
My script :
for i in `cat /home/admin/pnd_tmp`; do grep $i /test/done/TEST_RT* | tail -1 > /home/admin/pnd_fin | awk -F "," '{if ( $1 == "4" ) print $13 }' > /home/admin/pnd_tmp_fin; done
Can anyone write me a simple script to find in a quickest time . | 0debug |
Golang map internal implementation - how does it search the map for a key? : <p>I've read in "The Go Programming Language" that a "given key can be retrieved ... using a constant number of key comparisons on average, no matter how large the hash table." I'm not sure what that means in terms of its implementation internally though. Does that mean it searches through every key until it finds a match or is some type of binary (or other) search algorithm used internally?</p>
<p>For example, if I have a map with 2,000 keys, does it "on average" need to look at 1,000 to find a match or does it look at only 11 (log2 n) as it would with binary search?</p>
<p>Thanks,
Ben</p>
| 0debug |
LiveData vs. ObservableField for data binding : <p>There are multiple questions on Stackoverflow related to difference between LiveData and ObservableField. Also, I have found multiple articles on the internet about this topic. All of them explain that LiveData is lifecycle-aware unlike ObservableField. Most of them also mention that it is advantageous to use LiveData instead of ObservableField if component such as Activity or Fragment observe the attribute, so we don't need to unsubscribe.</p>
<p>However, even after reading all of that, what is still not clear to me is if there is or isn't some advantage of using LiveData over ObservableField for data binding. For example:</p>
<p>ViewModel:</p>
<pre><code>class UserViewModel(user: User) : ViewModel {
val userName = ObservableField<String>(user.name) // Option 1
val userName = MutableLiveData<String>(user.name) // Option 2
}
</code></pre>
<p>Layout:</p>
<pre><code><layout>
<data>
<variable name="viewModel" type="com.example.UserViewModel" />
</data>
...
</layout>
</code></pre>
<p>For option 2, I will also have to use <code>binding.setLifecycleOwner(activity)</code>, of course. Let's assume that nothing else than the layout observes <code>userName</code>.</p>
<p>My questions is:</p>
<p>Is there any advantage of using option 2 over option 1 or it doesn't matter in this case since the view (layout) will simply observe until it exists ?</p>
<p>What confuses me even more is this article:
<a href="https://android.jlelse.eu/android-architecture-components-livedata-with-data-binding-7bf85871bbd8" rel="noreferrer">https://android.jlelse.eu/android-architecture-components-livedata-with-data-binding-7bf85871bbd8</a>
which says:
<em>"In the previous approach (without LiveData) if we wanted to show the data on the UI, we should previously check if it still exists. With LiveData we don’t need to worry about it because data will be posted only if Activity is at least started (so in started or resumed state)."</em></p>
<p>I don't understand this quoted part. What is meant by checking if UI still exists in case of "previous approach" which uses <code>ObservableField</code>? How would you apply this check for my example in option 1 ?</p>
| 0debug |
Fastest way to check if array is equal to? : <p>I am writing a game simulation that tests if any piece is on the board. If a piece is not I would like the AI to place a piece on the board, for this I created a bool function to test if all the pieces are set to 0 which means they are yet to enter the board. The current function boots, but I feel there is a much simpler way to do this:</p>
<pre><code>bool checkPiece(int a[])
{
int n = 0;
bool e = true;
while (e == true && n < 4)
{
if (a[n] == 0 )
{
n++;
}
else
{
return false;
}
}
return true;
}
</code></pre>
| 0debug |
In Chrome Network Tab, under the size column, what do the 2 numbers represent? : <p><a href="https://i.stack.imgur.com/PWj9b.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PWj9b.png" alt="enter image description here"></a></p>
<p>See above: For the first requestwhat does 82.0kb represent and what does 187kb represent?</p>
<p>Also, while we are at it, what do the 2 different numbers under time column represent? (the top number is usually larger but they are very similar)</p>
| 0debug |
static int kvm_put_msrs(CPUState *env, int level)
{
struct {
struct kvm_msrs info;
struct kvm_msr_entry entries[100];
} msr_data;
struct kvm_msr_entry *msrs = msr_data.entries;
int n = 0;
kvm_msr_entry_set(&msrs[n++], MSR_IA32_SYSENTER_CS, env->sysenter_cs);
kvm_msr_entry_set(&msrs[n++], MSR_IA32_SYSENTER_ESP, env->sysenter_esp);
kvm_msr_entry_set(&msrs[n++], MSR_IA32_SYSENTER_EIP, env->sysenter_eip);
if (kvm_has_msr_star(env))
kvm_msr_entry_set(&msrs[n++], MSR_STAR, env->star);
if (kvm_has_msr_hsave_pa(env))
kvm_msr_entry_set(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
#ifdef TARGET_X86_64
if (lm_capable_kernel) {
kvm_msr_entry_set(&msrs[n++], MSR_CSTAR, env->cstar);
kvm_msr_entry_set(&msrs[n++], MSR_KERNELGSBASE, env->kernelgsbase);
kvm_msr_entry_set(&msrs[n++], MSR_FMASK, env->fmask);
kvm_msr_entry_set(&msrs[n++], MSR_LSTAR, env->lstar);
}
#endif
if (level == KVM_PUT_FULL_STATE) {
if (smp_cpus == 1 || env->tsc != 0) {
kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSC, env->tsc);
}
kvm_msr_entry_set(&msrs[n++], MSR_KVM_SYSTEM_TIME,
env->system_time_msr);
kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr);
#ifdef KVM_CAP_ASYNC_PF
kvm_msr_entry_set(&msrs[n++], MSR_KVM_ASYNC_PF_EN, env->async_pf_en_msr);
#endif
}
#ifdef KVM_CAP_MCE
if (env->mcg_cap) {
int i;
if (level == KVM_PUT_RESET_STATE)
kvm_msr_entry_set(&msrs[n++], MSR_MCG_STATUS, env->mcg_status);
else if (level == KVM_PUT_FULL_STATE) {
kvm_msr_entry_set(&msrs[n++], MSR_MCG_STATUS, env->mcg_status);
kvm_msr_entry_set(&msrs[n++], MSR_MCG_CTL, env->mcg_ctl);
for (i = 0; i < (env->mcg_cap & 0xff) * 4; i++)
kvm_msr_entry_set(&msrs[n++], MSR_MC0_CTL + i, env->mce_banks[i]);
}
}
#endif
msr_data.info.nmsrs = n;
return kvm_vcpu_ioctl(env, KVM_SET_MSRS, &msr_data);
}
| 1threat |
static void gen_rlwnm(DisasContext *ctx)
{
uint32_t mb, me;
mb = MB(ctx->opcode);
me = ME(ctx->opcode);
if (likely(mb == 0 && me == 31)) {
TCGv_i32 t0, t1;
t0 = tcg_temp_new_i32();
t1 = tcg_temp_new_i32();
tcg_gen_trunc_tl_i32(t0, cpu_gpr[rB(ctx->opcode)]);
tcg_gen_trunc_tl_i32(t1, cpu_gpr[rS(ctx->opcode)]);
tcg_gen_andi_i32(t0, t0, 0x1f);
tcg_gen_rotl_i32(t1, t1, t0);
tcg_gen_extu_i32_tl(cpu_gpr[rA(ctx->opcode)], t1);
tcg_temp_free_i32(t0);
tcg_temp_free_i32(t1);
} else {
TCGv t0;
#if defined(TARGET_PPC64)
TCGv t1;
#endif
t0 = tcg_temp_new();
tcg_gen_andi_tl(t0, cpu_gpr[rB(ctx->opcode)], 0x1f);
#if defined(TARGET_PPC64)
t1 = tcg_temp_new_i64();
tcg_gen_deposit_i64(t1, cpu_gpr[rS(ctx->opcode)],
cpu_gpr[rS(ctx->opcode)], 32, 32);
tcg_gen_rotl_i64(t0, t1, t0);
tcg_temp_free_i64(t1);
#else
tcg_gen_rotl_i32(t0, cpu_gpr[rS(ctx->opcode)], t0);
#endif
if (unlikely(mb != 0 || me != 31)) {
#if defined(TARGET_PPC64)
mb += 32;
me += 32;
#endif
tcg_gen_andi_tl(cpu_gpr[rA(ctx->opcode)], t0, MASK(mb, me));
} else {
tcg_gen_andi_tl(t0, t0, MASK(32, 63));
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], t0);
}
tcg_temp_free(t0);
}
if (unlikely(Rc(ctx->opcode) != 0))
gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]);
}
| 1threat |
static void usb_host_auto_check(void *unused)
{
struct USBHostDevice *s;
struct USBAutoFilter *f;
libusb_device **devs;
struct libusb_device_descriptor ddesc;
int unconnected = 0;
int i, n;
if (usb_host_init() != 0) {
return;
}
if (runstate_is_running()) {
n = libusb_get_device_list(ctx, &devs);
for (i = 0; i < n; i++) {
if (libusb_get_device_descriptor(devs[i], &ddesc) != 0) {
continue;
}
if (ddesc.bDeviceClass == LIBUSB_CLASS_HUB) {
continue;
}
QTAILQ_FOREACH(s, &hostdevs, next) {
f = &s->match;
if (f->bus_num > 0 &&
f->bus_num != libusb_get_bus_number(devs[i])) {
continue;
}
if (f->addr > 0 &&
f->addr != libusb_get_device_address(devs[i])) {
continue;
}
if (f->port != NULL) {
char port[16] = "-";
usb_host_get_port(devs[i], port, sizeof(port));
if (strcmp(f->port, port) != 0) {
continue;
}
}
if (f->vendor_id > 0 &&
f->vendor_id != ddesc.idVendor) {
continue;
}
if (f->product_id > 0 &&
f->product_id != ddesc.idProduct) {
continue;
}
s->seen++;
if (s->errcount >= 3) {
continue;
}
if (s->dh != NULL) {
continue;
}
if (usb_host_open(s, devs[i]) < 0) {
s->errcount++;
continue;
}
break;
}
}
libusb_free_device_list(devs, 1);
QTAILQ_FOREACH(s, &hostdevs, next) {
if (s->dh == NULL) {
unconnected++;
}
if (s->seen == 0) {
if (s->dh) {
usb_host_close(s);
}
s->errcount = 0;
}
s->seen = 0;
}
#if 0
if (unconnected == 0) {
if (usb_auto_timer) {
timer_del(usb_auto_timer);
trace_usb_host_auto_scan_disabled();
}
return;
}
#endif
}
if (!usb_vmstate) {
usb_vmstate = qemu_add_vm_change_state_handler(usb_host_vm_state, NULL);
}
if (!usb_auto_timer) {
usb_auto_timer = timer_new_ms(QEMU_CLOCK_REALTIME, usb_host_auto_check, NULL);
if (!usb_auto_timer) {
return;
}
trace_usb_host_auto_scan_enabled();
}
timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 2000);
}
| 1threat |
how to display in desc order by date not time : <p>[how to display in desc order by date not time]</p>
<p>I am using the SELECT * from alarms ORDER BY time_date DESC. it will display the output according to time in descending order but we display the descending order by date not time.</p>
<p>My sql structure is for time_date fields:</p>
<p>1) 23:48:17 05-04-2016
2) 23:20:42 31-03-2016
3) 22:06:29 03-04-2016
4) 21:48:31 28-03-2016</p>
| 0debug |
C++: Semi-Colon placed before opening bracket in a while loop : while(condition);{
statement;
}
The semi-colon before the opening bracket of the while loop shouldn't be there. The question I'm having is why the program gets stuck at the while loop during run time. As far as I'm aware the semi colon is a terminating punctuator that lets the compiler know that it has come to the end of the statement. Since it doesn't read the opening bracket of the while loop shouldn't it then move on to the next line and perform the action? If you run the debugger and move step by step, it stops moving at the while statement and will not go further. I'm just looking for some insight as to why this is the case. If it is the case that the while has to be followed by a condition and then the opening bracket why does it compile when the semi-colon is placed in between? Shouldn't some sort of error be thrown?
The IDE being used is Dev c++. I'm not sure if this is a IDE specific issue as I've not tested this in other IDEs.
| 0debug |
What sort of hardware is required to support a network deployment that can support 25,000 transactions per day : <p>I am trying to analyse what sort of hardware is required to support a network deployment as below diagram that can support 25,000 transactions per day.
<a href="https://i.stack.imgur.com/VIR9V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VIR9V.png" alt="enter image description here"></a></p>
| 0debug |
How to display background image using PHP/CSS : <p>I'm looking for the clean simple solution for linking background images using PHP and CSS Any help is much appreciated! </p>
<p>I've read around for over an hour and can't seem to find the answer.
<a href="https://i.stack.imgur.com/Ia0qv.png" rel="nofollow noreferrer">Here is what I have</a></p>
<p>I'm expecting the image to be displayed but it is not.</p>
| 0debug |
float64 HELPER(ucf64_addd)(float64 a, float64 b, CPUUniCore32State *env)
{
return float64_add(a, b, &env->ucf64.fp_status);
}
| 1threat |
static PCIDevice *nic_init(PCIBus * bus, NICInfo * nd, uint32_t device)
{
PCIEEPRO100State *d;
EEPRO100State *s;
logout("\n");
d = (PCIEEPRO100State *) pci_register_device(bus, nd->model,
sizeof(PCIEEPRO100State), -1,
NULL, NULL);
s = &d->eepro100;
s->device = device;
s->pci_dev = &d->dev;
pci_reset(s);
s->eeprom = eeprom93xx_new(EEPROM_SIZE);
d->eepro100.mmio_index =
cpu_register_io_memory(0, pci_mmio_read, pci_mmio_write, s);
pci_register_io_region(&d->dev, 0, PCI_MEM_SIZE,
PCI_ADDRESS_SPACE_MEM |
PCI_ADDRESS_SPACE_MEM_PREFETCH, pci_mmio_map);
pci_register_io_region(&d->dev, 1, PCI_IO_SIZE, PCI_ADDRESS_SPACE_IO,
pci_map);
pci_register_io_region(&d->dev, 2, PCI_FLASH_SIZE, PCI_ADDRESS_SPACE_MEM,
pci_mmio_map);
memcpy(s->macaddr, nd->macaddr, 6);
logout("macaddr: %s\n", nic_dump(&s->macaddr[0], 6));
assert(s->region[1] == 0);
nic_reset(s);
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
nic_receive, nic_can_receive, s);
qemu_format_nic_info_str(s->vc, s->macaddr);
qemu_register_reset(nic_reset, s);
register_savevm(s->vc->model, -1, 3, nic_save, nic_load, s);
return (PCIDevice *)d;
}
| 1threat |
Xcode Can't Recognize my ViewController : <p><code>SignUpViewController2</code> - I have already identified this in Xcode. Xcode says "use of undeclared type <code>SignUpViewController2</code>". I don't know why Xcode doesn't know what SignUpViewController2 is.</p>
<p><a href="https://i.stack.imgur.com/5RiG2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5RiG2.png" alt="https://i.gyazo.com/b9bd7091467e71bb8ad5a73e840a1f9b.png"></a>
<a href="https://i.stack.imgur.com/h163a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h163a.png" alt="enter image description here"></a></p>
| 0debug |
Split one file into multiple based on keyword : <p>I want to split my single file into two file when a particular keyword comes in the file.. Consider that I have whole content in single line. So it is not possible to count line number and then split it.</p>
<p>Thanks in advance for help </p>
| 0debug |
static av_cold int pnm_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
| 1threat |
import heapq
def cheap_items(items,n):
cheap_items = heapq.nsmallest(n, items, key=lambda s: s['price'])
return cheap_items | 0debug |
how to change 'return' button in keyboard? : <p>How can I change the return button to some other native buttons ios has? </p>
<p>Now it shows the grey <code>return</code> button and instead I want it to be blue with some other text like the example below: </p>
<p>EXAMPLE:</p>
<p><a href="https://i.stack.imgur.com/V2rqc.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/V2rqc.jpg" alt="enter image description here"></a> </p>
| 0debug |
Where is the Evaluate on console in Chrome Developer Tools : <p>After I update my chrome, I cannot see the <code>Evaluate on console</code> in Chrome Developer Tools, Here is the screenshot</p>
<p><a href="https://i.stack.imgur.com/gaOE1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gaOE1.png" alt="enter image description here"></a></p>
<p>the chrome version is <code>Version 65.0.3325.162 (Official Build) (64-bit)</code></p>
<p>What happened? thanks for your help.</p>
| 0debug |
Warning: #1292 Truncated incorrect DOUBLE value: 'xxx' : <p>I'm trying to create a MySQL query to select two teams</p>
<p>Using the query below I keep getting this error and its not something I've come across before, google seems to offer a variety of answers but I'm unable to relate the fix to my query.</p>
<pre><code>SELECT
m.idm,
m.buteq1,
m.buteq2,
tf.eq_name,
ts.eq_name
FROM wpap_match m
INNER JOIN wpap_equipes tf
on tf.eq_name = tf.id
INNER JOIN wpap_equipes ts
on ts.eq_name = ts.id
</code></pre>
<p>Result:</p>
<pre><code> Warning: #1292 Truncated incorrect DOUBLE value: 'ESS'
</code></pre>
<p>Can any one help to fix this ?</p>
| 0debug |
static void rng_egd_opened(RngBackend *b, Error **errp)
{
RngEgd *s = RNG_EGD(b);
if (s->chr_name == NULL) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
"chardev", "a valid character device");
s->chr = qemu_chr_find(s->chr_name);
if (s->chr == NULL) {
error_set(errp, QERR_DEVICE_NOT_FOUND, s->chr_name);
qemu_chr_add_handlers(s->chr, rng_egd_chr_can_read, rng_egd_chr_read,
NULL, s); | 1threat |
Prevent view controller from stacking IOS 13 (swift) : <p>I am working on an app and recently updated to my Xcode. With this update the way view controllers are presented is changed and I want to revert it back to its old ways. They used to display over the other ones but now they "stack". </p>
<p>I would like the iPhone on the left, while what I currently have is the iPhone on the right.
<a href="https://i.stack.imgur.com/BPuWH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BPuWH.png" alt="enter image description here"></a>Thanks. </p>
| 0debug |
static void do_interrupt64(CPUX86State *env, int intno, int is_int,
int error_code, target_ulong next_eip, int is_hw)
{
SegmentCache *dt;
target_ulong ptr;
int type, dpl, selector, cpl, ist;
int has_error_code, new_stack;
uint32_t e1, e2, e3, ss;
target_ulong old_eip, esp, offset;
has_error_code = 0;
if (!is_int && !is_hw) {
has_error_code = exception_has_error_code(intno);
}
if (is_int) {
old_eip = next_eip;
} else {
old_eip = env->eip;
}
dt = &env->idt;
if (intno * 16 + 15 > dt->limit) {
raise_exception_err(env, EXCP0D_GPF, intno * 16 + 2);
}
ptr = dt->base + intno * 16;
e1 = cpu_ldl_kernel(env, ptr);
e2 = cpu_ldl_kernel(env, ptr + 4);
e3 = cpu_ldl_kernel(env, ptr + 8);
type = (e2 >> DESC_TYPE_SHIFT) & 0x1f;
switch (type) {
case 14:
case 15:
break;
default:
raise_exception_err(env, EXCP0D_GPF, intno * 16 + 2);
break;
}
dpl = (e2 >> DESC_DPL_SHIFT) & 3;
cpl = env->hflags & HF_CPL_MASK;
if (is_int && dpl < cpl) {
raise_exception_err(env, EXCP0D_GPF, intno * 16 + 2);
}
if (!(e2 & DESC_P_MASK)) {
raise_exception_err(env, EXCP0B_NOSEG, intno * 16 + 2);
}
selector = e1 >> 16;
offset = ((target_ulong)e3 << 32) | (e2 & 0xffff0000) | (e1 & 0x0000ffff);
ist = e2 & 7;
if ((selector & 0xfffc) == 0) {
raise_exception_err(env, EXCP0D_GPF, 0);
}
if (load_segment(env, &e1, &e2, selector) != 0) {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
}
if (!(e2 & DESC_S_MASK) || !(e2 & (DESC_CS_MASK))) {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
}
dpl = (e2 >> DESC_DPL_SHIFT) & 3;
if (dpl > cpl) {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
}
if (!(e2 & DESC_P_MASK)) {
raise_exception_err(env, EXCP0B_NOSEG, selector & 0xfffc);
}
if (!(e2 & DESC_L_MASK) || (e2 & DESC_B_MASK)) {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
}
if ((!(e2 & DESC_C_MASK) && dpl < cpl) || ist != 0) {
if (ist != 0) {
esp = get_rsp_from_tss(env, ist + 3);
} else {
esp = get_rsp_from_tss(env, dpl);
}
esp &= ~0xfLL;
ss = 0;
new_stack = 1;
} else if ((e2 & DESC_C_MASK) || dpl == cpl) {
if (env->eflags & VM_MASK) {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
}
new_stack = 0;
if (ist != 0) {
esp = get_rsp_from_tss(env, ist + 3);
} else {
esp = env->regs[R_ESP];
}
esp &= ~0xfLL;
dpl = cpl;
} else {
raise_exception_err(env, EXCP0D_GPF, selector & 0xfffc);
new_stack = 0;
esp = 0;
}
PUSHQ(esp, env->segs[R_SS].selector);
PUSHQ(esp, env->regs[R_ESP]);
PUSHQ(esp, cpu_compute_eflags(env));
PUSHQ(esp, env->segs[R_CS].selector);
PUSHQ(esp, old_eip);
if (has_error_code) {
PUSHQ(esp, error_code);
}
if ((type & 1) == 0) {
env->eflags &= ~IF_MASK;
}
env->eflags &= ~(TF_MASK | VM_MASK | RF_MASK | NT_MASK);
if (new_stack) {
ss = 0 | dpl;
cpu_x86_load_seg_cache(env, R_SS, ss, 0, 0, 0);
}
env->regs[R_ESP] = esp;
selector = (selector & ~3) | dpl;
cpu_x86_load_seg_cache(env, R_CS, selector,
get_seg_base(e1, e2),
get_seg_limit(e1, e2),
e2);
env->eip = offset;
}
| 1threat |
Loading not responding in Android. Help me to fix this please : Anyone Can help me to fix the Loading harmful and not responding in Android App?
I'm the newbie in Android and i have to do my project and which have bug with Android OS 6. The app show the group persons on the map and when click on Contact icon, then show the group person lists. For now, on other OS below OS 6 are working fine and in OS 6 When change to group which have friends or Members, then click on Contact, the loading was stuck and Not responding alert show up. I don't know Why. But on the group which have no members or friends have working fine. I'll show you with the screenshot below.
> The Image One is no Members and Friends in the Group (Group Name was
> Test1).
>
> Image One -
> https://drive.google.com/file/d/0BwG4MW1kR1WMSGNHYXNENzVGVUE/view
> The Image Two is Choose the Non Member Group and Click on Contact
> Icon, the list was only me show up.(Work fine with no member in
> group).
>
> Image Two -
> https://drive.google.com/file/d/0BwG4MW1kR1WMcXc5NDc0c09nRXc/view
>
> The Image Three was chosen the Group which have Members or
> Friends.(The Group name was tt.) The Location pointer was show up in
> Map.
>
> Image Three -
> https://drive.google.com/file/d/0BwG4MW1kR1WMbEdHZUs2NGZPYW8/view
>
> The Image Four is Choose the group which have Members and Click on the
> Contact Icon, Then the bug was show up. (The loading icon was stuck
> and after a few seconds or minutes then no responding alert will show
> up).
>
> Image Four -
> https://drive.google.com/file/d/0BwG4MW1kR1WMbF94cjQySkJhSDA/view | 0debug |
Akka Streams: What does Mat represents in Source[out, Mat] : <p>In Akka streams what does Mat in Source[Out, Mat] or Sink[In, Mat] represent. When will it actually be used?</p>
| 0debug |
whats wrong in my code? plz help me findidng error on input 5033 : given below is my code plz help me in finding error on input 5033. quesion is as follows:
Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a "Double Cola" drink vending machine; there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! The resulting two Sheldons go to the end of the queue. Then the next in the queue (Leonard) buys a can, drinks it and gets to the end of the queue as two Leonards, and so on. This process continues ad infinitum.
For example, Penny drinks the third can of cola and the queue will look like this: Rajesh, Howard, Sheldon, Sheldon, Leonard, Leonard, Penny, Penny.
Write a program that will print the name of a man who will drink the n-th can.
Note that in the very beginning the queue looks like that: Sheldon, Leonard, Penny, Rajesh, Howard. The first person is Sheldon.
Input
The input data consist of a single integer n (1 ≤ n ≤ 109).
It is guaranteed that the pretests check the spelling of all the five names, that is, that they contain all the five possible answers.
Output
Print the single line — the name of the person who drinks the n-th can of cola. The cans are numbered starting from 1. Please note that you should spell the names like this: "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" (without the quotes). In that order precisely the friends are in the queue initially.
import java.util.*;
public class sheldon {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();int i=0,rem=0,q=0;
if(n<6) {
if(n==1)
System.out.print("Sheldon");
else if(n==2)
System.out.print("Leonard");
else if(n==3)
System.out.print("Penny");
else if (n==4)
System.out.print("Rajesh");
else
System.out.print("Howard");
}
else {
n=n-5;
while(n!=0) {
i++;
rem=n;
if((10*i)<=n) {
n=n-(10*i);}
else break;
}System.out.println(i);System.out.println(rem);
q=(rem/(2*i));
if(q==0)
System.out.print("Sheldon");
else if(q==1)
System.out.println("Leonard");
else if(q==2)
System.out.print("Penny");
else if (q==3)
System.out.print("Rajesh");
else
System.out.print("Howard");
}
sc.close();
}
}
| 0debug |
static int vfio_set_trigger_eventfd(VFIOINTp *intp,
eventfd_user_side_handler_t handler)
{
VFIODevice *vbasedev = &intp->vdev->vbasedev;
struct vfio_irq_set *irq_set;
int argsz, ret;
int32_t *pfd;
argsz = sizeof(*irq_set) + sizeof(*pfd);
irq_set = g_malloc0(argsz);
irq_set->argsz = argsz;
irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER;
irq_set->index = intp->pin;
irq_set->start = 0;
irq_set->count = 1;
pfd = (int32_t *)&irq_set->data;
*pfd = event_notifier_get_fd(&intp->interrupt);
qemu_set_fd_handler(*pfd, (IOHandler *)handler, NULL, intp);
ret = ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set);
g_free(irq_set);
if (ret < 0) {
error_report("vfio: Failed to set trigger eventfd: %m");
qemu_set_fd_handler(*pfd, NULL, NULL, NULL);
}
return ret;
}
| 1threat |
Spring Data vs Couchbase SDK : <p>What is the difference between Spring Data Library and Couchbase Java SDK? Is one preferred over the other in specific scenarios? If I am working on Spring project , is Spring Data preferred over Couchbase Java SDK?</p>
| 0debug |
static int mov_write_mdia_tag(AVIOContext *pb, MOVMuxContext *mov,
MOVTrack *track)
{
int64_t pos = avio_tell(pb);
avio_wb32(pb, 0);
ffio_wfourcc(pb, "mdia");
mov_write_mdhd_tag(pb, mov, track);
mov_write_hdlr_tag(pb, track);
mov_write_minf_tag(pb, track);
return update_size(pb, pos);
}
| 1threat |
How to print array of numbers given i and j? Such that some of all elements of i is equal to j : Given number i and j.
Print an array of length i such that the sum of all the elements in array is equal j.
input:
i = 5 ;
j = 27;
Output:
6
6
5
5
5 | 0debug |
static void draw_char(AVCodecContext *avctx, int c, int a)
{
XbinContext *s = avctx->priv_data;
if (s->y > avctx->height - s->font_height)
return;
ff_draw_pc_font(s->frame.data[0] + s->y * s->frame.linesize[0] + s->x,
s->frame.linesize[0], s->font, s->font_height, c,
a & 0x0F, a >> 4);
s->x += FONT_WIDTH;
if (s->x >= avctx->width) {
s->x = 0;
s->y += s->font_height;
}
}
| 1threat |
static void mpcore_priv_map_setup(mpcore_priv_state *s)
{
int i;
SysBusDevice *gicbusdev = sysbus_from_qdev(s->gic);
SysBusDevice *busdev = sysbus_from_qdev(s->mptimer);
memory_region_init(&s->container, "mpcode-priv-container", 0x2000);
memory_region_init_io(&s->iomem, &mpcore_scu_ops, s, "mpcore-scu", 0x100);
memory_region_add_subregion(&s->container, 0, &s->iomem);
for (i = 0; i < (s->num_cpu + 1); i++) {
target_phys_addr_t offset = 0x100 + (i * 0x100);
memory_region_add_subregion(&s->container, offset,
sysbus_mmio_get_region(gicbusdev, i + 1));
}
for (i = 0; i < (s->num_cpu + 1) * 2; i++) {
target_phys_addr_t offset = 0x600 + (i >> 1) * 0x100 + (i & 1) * 0x20;
memory_region_add_subregion(&s->container, offset,
sysbus_mmio_get_region(busdev, i));
}
memory_region_add_subregion(&s->container, 0x1000,
sysbus_mmio_get_region(gicbusdev, 0));
for (i = 0; i < s->num_cpu; i++) {
int ppibase = (s->num_irq - 32) + i * 32;
sysbus_connect_irq(busdev, i * 2,
qdev_get_gpio_in(s->gic, ppibase + 29));
sysbus_connect_irq(busdev, i * 2 + 1,
qdev_get_gpio_in(s->gic, ppibase + 30));
}
}
| 1threat |
void s390_memory_init(ram_addr_t mem_size)
{
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
memory_region_init_ram(ram, NULL, "s390.ram", mem_size, &error_abort);
vmstate_register_ram_global(ram);
memory_region_add_subregion(sysmem, 0, ram);
s390_skeys_init();
}
| 1threat |
How to sort in descending order with numpy? : <p>I have a numpy array like this:</p>
<pre><code>A = array([[1, 3, 2, 7],
[2, 4, 1, 3],
[6, 1, 2, 3]])
</code></pre>
<p>I would like to sort the rows of this matrix in descending order and get the arguments of the sorted matrix like this:</p>
<pre><code>As = array([[3, 1, 2, 0],
[1, 3, 0, 2],
[0, 3, 2, 1]])
</code></pre>
<p>I did the following:</p>
<pre><code>import numpy
A = numpy.array([[1, 3, 2, 7], [2, 4, 1, 3], [6, 1, 2, 3]])
As = numpy.argsort(A, axis=1)
</code></pre>
<p>But this gives me the sorting in ascending order. Also, after I spent some time looking for a solution in the internet, I expect that there must be an argument to <code>argsort</code> function from numpy that would reverse the order of sorting. But, apparently <strong>there is no such argument! Why!?</strong> </p>
<p>There is an argument called <code>order</code>. I tried, by guessing, <code>numpy.argsort(..., order=reverse)</code> but it does not work.</p>
<p>I looked for a solution in previous questions here and I found that I can do:</p>
<pre><code>import numpy
A = numpy.array([[1, 3, 2, 7], [2, 4, 1, 3], [6, 1, 2, 3]])
As = numpy.argsort(A, axis=1)
As = As[::-1]
</code></pre>
<p>For some reason, <code>As = As[::-1]</code> does not give me the desired output.</p>
<p>Well, I guess it must be simple but I am missing something.</p>
<p>How can I sort a numpy array in descending order?</p>
| 0debug |
How to connect to a distant mysql database using asp.net : <p>I want to connect to a disant mysql database wich is located in another server using Asp.net C#.
How can i did it ?
Thanks.</p>
| 0debug |
Get Selector of found elment : Short question,
I'm iteration through a list of li's to get the li which is in the center of the screen (on scroll) with this function:
var findMiddleElement = (function(docElm){
var viewportHeight = docElm.clientHeight,
elements = $('li');
return function(e){
var middleElement;
if( e && e.type == 'resize' )
viewportHeight = docElm.clientHeight;
elements.each(function(){
var pos = this.getBoundingClientRect().top;
// if an element is more or less in the middle of the viewport
if( pos > viewportHeight/2.5 && pos < viewportHeight/1.5 ){
middleElement = this;
return false; // stop iteration
}
});
console.log(middleElement);
}
})(document.documentElement);
This works great so far. The Problem is that 'middleElement' will return something like this:
<li style="padding-top: 12.8438px; padding-bottom: 12.8438px;">Menu Item 8</li>
I need to add a CSS style to it. Since
middleElement.css
doesn't work, I need a way to get the selector of the found element. Any Ideas?
Thank you very much!
| 0debug |
(check(k.ToString() == 1)) : <p>I have a maybe simple problem. When i start program it show "Operator '==' cannot be applied to operands of type 'string' and 'int'. I dont know what to do with it. Thanks for every help.
Here is code: </p>
<pre><code> class Program
{
static bool check(string input_number)
{
for (int i = 0; i < input_number.Length / 2; i++)
if (input_number[i] != input_number[input_number.Length - i - 1])
return false;
return true;
}
static void Main(string[] args)
{
var results = from i in Enumerable.Range(100, 900)
from j in Enumerable.Range(i, 1000 - i)
let k = i * j
where (check(k.ToString() == 1)
orderby k descending
select new { i, j, k };
var highestResult = results.FirstOrDefault();
if (highestResult == null)
Console.WriteLine("There are no palindromes!");
else
Console.WriteLine($"The highest palindrome is {highestResult.i} * {highestResult.j} = {highestResult.k}");
Console.ReadKey();
}
}
</code></pre>
| 0debug |
int ff_lock_avcodec(AVCodecContext *log_ctx, const AVCodec *codec)
{
if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init)
return 0;
if (ff_mutex_lock(&codec_mutex))
return -1;
if (atomic_fetch_add(&entangled_thread_counter, 1)) {
av_log(log_ctx, AV_LOG_ERROR,
"Insufficient thread locking. At least %d threads are "
"calling avcodec_open2() at the same time right now.\n",
atomic_load(&entangled_thread_counter));
ff_avcodec_locked = 1;
ff_unlock_avcodec(codec);
return AVERROR(EINVAL);
}
av_assert0(!ff_avcodec_locked);
ff_avcodec_locked = 1;
return 0;
}
| 1threat |
Can anyone explain me the eval() and dict()? : price_dict["Price"] = price_dict["Price"].apply(lambda x : dict(eval(x)) )
df = price_dict['Price'].apply(pd.Series)
can anyone explain to me the above equations? | 0debug |
ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h : <p>I upgraded to imagemagick-7.0.4-3.sierra and now my previously installed RMagck 2.16 fails. I checked for MagicWand:</p>
<p><code>
$ find /usr/local -name MagickWand.h
/usr/local/Cellar/imagemagick/7.0.4-3/include/ImageMagick-7/MagickWand/MagickWand.h
</code></p>
<p>So it seems to be there. Also I reinstalled and relinked pgk-config. Didn't help as well. Any ideas? </p>
| 0debug |
i have a one matrix 5*5 ,i want to print that matrix into 2*2 as many as possible matrices comes? : i have a 3*3 matrix,
I want to print that matrix into 2*2 matrices
For Example.
2 5 3
5 8 9
1 4 5
Comes to 2*2 matrices
2 5
5 8
5 8
1 4
5 3
8 9
8 9
4 5
This is the process,, | 0debug |
How to add a string to array in a simple way - C++ : <p>So I have this problem my teacher gave me which is: Enter the names and salaries of 5 employees into two arrays and print the name of the employee who has the highest salary.</p>
<p>Im not sure how to input a string to an array and link it to the other array, this is what I wrote:</p>
<pre><code>#include <iostream>
#include <string>
using namespace std;
int main()
{
int salary, x, y;
string name;
int Arr1[5];
int Arr2[5];
x = 0;
y = 0;
for (int i = 0; i <= 5; i++) {
cin >> Arr1[name];
cin >> Arr2[x];
if (x > y) {
x = y;
}
}
cout << "Employee" << Arr1[name]<< "has the biggest salary of:" << y << endl;
return 0;
}
</code></pre>
| 0debug |
UItext field value is not updating when i change the value : I have one uitext field, when my app load and user can edit my uitext field value and can send it to server. But when i did that, what the value i am entering in my text field is not updating to my server.
For example, if i keep the default value as `0`, and if i edit my uitext field value and if i send it to server. Still my default `0` value is showing in my server.
Please help me out. !
Here my code that i am asigning the uitext field label value to string variable. And i am sending that value to server.
var proqty : String?
proqty = productQty.text
I dont know whether my value is updating in my `proqty` or not.
Thanks in advance !! | 0debug |
show static rows one by one using java script : I have the following table
<table class="hTab">
<tr class="hTr"> </tr>
<tr class="hTr"> </tr>
<tr class="hTr"> </tr>
</table>
<tr> <input type=button value="Show 1 more" id="onemore" /></tr>
I have used following Jquery code to show the rows one by one ( I have declared 10 rows in the table
var currentrow = 0;
$('#hTab #hTr').hide();
$('#hTab #tr:eq(0)').show();
$("#onemore").click(function () {
currentrow++;
$('#hTab #hTr:eq(' + currentrow + ')').show();
});
but at the moment it's not working. if anyone could show the error in my code will be very helpful | 0debug |
I am a error in my Python code : Right now I'm doing a easy videogame in Python using the libraty Turtle but this error appeared and I don't know how to solve it.
the error is:
Any suggestions?
My code is here:
pastebin.com/wu5jM0gT
error:
Traceback (most recent call last):
File "C:/Users/ricar/PycharmProjects/Juego/Juego.py", line 122, in <module>
objetivo.movimiento()
File "C:/Users/ricar/PycharmProjects/Juego/Juego.py", line 91, in movimiento
self.forward(self.speed)
File "C:\Python27\lib\lib-tk\turtle.py", line 1553, in forward
self._go(distance)
File "C:\Python27\lib\lib-tk\turtle.py", line 1520, in _go
ende = self._position + self._orient * distance
File "C:\Python27\lib\lib-tk\turtle.py", line 277, in __mul__
return Vec2D(self[0]*other, self[1]*other)
TypeError: unsupported operand type(s) for *: 'float' and 'instancemethod'`
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.