problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Picker In IOS App : how to create a view controller that is used as a picker, it shows up from the bottom of a screen over the current context, and covers just a part of the screen. After a value is picked, it is passed back to a view controller that presented the picker in ios
| 0debug
|
remove more then one id sql server : how to remove more then one id remove, except number 1 id please see below image, i want query how do this
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/YawZD.jpg
| 0debug
|
How to convert flutter TimeOfDay to DateTime? : <p>I have time picker which returns TimeOfDay object but I have save that value in a database as an integer of milliseconds which obtained from DateTime.millisecondsSinceEpoch</p>
| 0debug
|
Managing SQLite Database in Android Studio : <p>I'm new to android application development. I'm trying to create a basic SQL Table with some values inserted.When I'm trying to extract the values from the table, some Exception is caught. </p>
<p>Can anyone please help.</p>
<pre><code>Database Helper:
package com.example.mathialagan.app1;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import static java.security.AccessController.getContext;
/**
* Created by MATHIALAGAN on 3/12/2017.
*/
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String db_name= "Employee_Details.db";
public static final String table_name="Table_1";
public static final String column_1= "ID";
public static final String column_2= "Name";
public static final String column_3= "Surname";
public static final String column_4= "Joining_Year";
public DatabaseHelper(Context context) {
super(context, db_name, null, 1);
//SQLiteDatabase db= this.getWritableDatabase()
}
@Override
public void onCreate(SQLiteDatabase db) {
// db.execSQL("CREATE TABLE" + table_name + "(ID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, Surname TEXT, Joining_Year INTEGER)");
String CREATE_DATABASE = "CREATE TABLE " + table_name + "(" +
column_1 + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
column_2 + " TEXT, "+
column_3 +" TEXT, "+
column_4+ " TEXT"+")" ;
db.execSQL(CREATE_DATABASE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS" + table_name);
onCreate(db);
}
public boolean insertData (String name, String surname, String yr)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put(column_2, name);
cv.put(column_3, surname);
cv.put(column_4, yr);
long result=db.insert(table_name, null, cv);
if (result == -1)
return false;
else
return true;
}
public Cursor getAllData()
{
SQLiteDatabase db = this.getWritableDatabase();
// Cursor res = db.rawQuery("SELECT * FROM" + table_name, null);
Cursor res = db.rawQuery("SELECT * FROM" + table_name, null);
return res;
}
</code></pre>
<p>}</p>
<p>MainActivity:</p>
<pre><code>package com.example.mathialagan.app1;
import android.database.Cursor;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
DatabaseHelper myDb;
EditText editName, editSurname, editYear , please;
Button btnAddData, btnView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myDb = new DatabaseHelper(this);
editName = (EditText)findViewById(R.id.editText);
editSurname = (EditText)findViewById(R.id.editText2);
editYear = (EditText)findViewById(R.id.editText3);
please = (EditText)findViewById(R.id.editText4) ;
btnAddData = (Button)findViewById(R.id.button);
btnView = (Button)findViewById(R.id.button2);
adddata();
viewData();
}
public void adddata()
{
btnAddData.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean isInserted = myDb.insertData(editName.getText().toString(),
editSurname.getText().toString(),
editYear.getText().toString());
if (isInserted == true)
Toast.makeText(MainActivity.this, "SUCCESS", Toast.LENGTH_SHORT).show();
else
Toast.makeText(MainActivity.this, "HAVE TO WORK MORE", Toast.LENGTH_SHORT).show();
}
}
);
}
public void viewData()
{
btnView.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
Cursor res = myDb.getAllData();
if (res.getCount() == 0) {
Toast.makeText(MainActivity.this, "Nothing in DB", Toast.LENGTH_SHORT).show();
return;
} else {
StringBuffer bf = new StringBuffer();
while (res.moveToNext()) {
bf.append("ID:" + res.getString(0) + "\n");
bf.append("NAME:" + res.getString(1) + "\n");
bf.append("SURNAME:" + res.getString(2) + "\n");
bf.append("JOINING YEAR:" + res.getString(3) + "\n");
}
showMessage("Data " , bf.toString());
}
}
catch (Exception e)
{
Toast.makeText(MainActivity.this,"DB ", Toast.LENGTH_SHORT).show();
}
}
}
);
}
public void showMessage (String title, String message)
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
</code></pre>
<p>}</p>
| 0debug
|
audio_get_output_timestamp(AVFormatContext *s1, int stream,
int64_t *dts, int64_t *wall)
{
AlsaData *s = s1->priv_data;
snd_pcm_sframes_t delay = 0;
*wall = av_gettime();
snd_pcm_delay(s->h, &delay);
*dts = s1->streams[0]->cur_dts - delay;
}
| 1threat
|
python tkinter set askopenfilename to entry : I'm trying to set askopenfilename to entry box. But I don't know how to do it. Please help me out. I would greatly appreciate it.
import Tkinter as tk
from tkFileDialog import *
import ttk
class ESA(tk.Tk):
def __init__(self,*args,**kwargs):
tk.Tk.__init__(self,*args,**kwargs)
container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames={}
for f in (newProject, existingProject, exportProject):
frame = f(container, self)
self.frames[f] = frame
frame.grid(row=0, column=0, sticky = "nsew")
self.show_frame(newProject)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
class newProject(tk.Frame):
def load_file(self):
global fname,logo
self.fname = askopenfilename(initialdir=r"C:\Users",filetypes=(
('JPEG / JFIF','*.jpg'),('Portable Network Graphics','*.png'),('Windows Bitmap','*.bmp'),
("All files", "*.*") ))
newProject.__init__.clientLogoEntry.delete(0, END)
newProject.__init__.clientLogoEntry.insert(0, self.fname)
def __init__ (self, parent, controller):
tk.Frame.__init__(self,parent)
stepOne = tk.LabelFrame(self, text=" 1. Configuration:")
stepOne.grid(row=1, columnspan=7, sticky='WE', \
padx=5, pady=5, ipadx=5, ipady=5)
logo = tk.StringVar()
clientLogoEntry = tk.Entry(stepOne, textvariable=logo)
clientLogoEntry.grid(row=4, column=1, sticky="WE", pady=2)
stepOne.button = tk.Button(stepOne, text="Browse...", command=self.load_file, width=10)
stepOne.button.grid(row=4, column=7, sticky="W")
It's giving me this error
> File "C:\Users\Vincent Law\Desktop\23.py", line 36, in load_file
> newProject.__init__.clientLogoEntry.delete(0, END) AttributeError: 'function' object has no attribute 'clientLogoEntry'
| 0debug
|
int ff_eval_refl(int *refl, const int16_t *coefs, AVCodecContext *avctx)
{
int b, i, j;
int buffer1[LPC_ORDER];
int buffer2[LPC_ORDER];
int *bp1 = buffer1;
int *bp2 = buffer2;
for (i=0; i < LPC_ORDER; i++)
buffer2[i] = coefs[i];
refl[LPC_ORDER-1] = bp2[LPC_ORDER-1];
if ((unsigned) bp2[LPC_ORDER-1] + 0x1000 > 0x1fff) {
av_log(avctx, AV_LOG_ERROR, "Overflow. Broken sample?\n");
return 1;
}
for (i = LPC_ORDER-2; i >= 0; i--) {
b = 0x1000-((bp2[i+1] * bp2[i+1]) >> 12);
if (!b)
b = -2;
b = 0x1000000 / b;
for (j=0; j <= i; j++) {
#if CONFIG_FTRAPV
int a = bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12);
if((int)(a*(unsigned)b) != a*(int64_t)b)
return 1;
#endif
bp1[j] = ((bp2[j] - ((refl[i+1] * bp2[i-j]) >> 12)) * b) >> 12;
}
if ((unsigned) bp1[i] + 0x1000 > 0x1fff)
return 1;
refl[i] = bp1[i];
FFSWAP(int *, bp1, bp2);
}
return 0;
}
| 1threat
|
Ambient declaration with an imported type in TypeScript : <p>I have a declaration file in my TypeScript project like so:</p>
<pre><code>// myapp.d.ts
declare namespace MyApp {
interface MyThing {
prop1: string
prop2: number
}
}
</code></pre>
<p>This works great and I can use this namespace anywhere in my project without having to import it.</p>
<p>I now need to import a type from a 3rd party module and use it in my ambient declaration:</p>
<pre><code>// myapp.d.ts
import {SomeType} from 'module'
declare namespace MyApp {
interface MyThing {
prop1: string
prop2: number
prop3: SomeType
}
}
</code></pre>
<p>The compiler now complains that it can't find namespace 'MyApp', presumably because the import prevents it from being ambient.</p>
<p>Is there some easy way to retain the ambient-ness of the declaration whilst utilising 3rd-party types?</p>
| 0debug
|
Python-File to Dictionary? : I have two columns in this text file like this:
William 2
David 3
Victor 5
Jack 1
Gavin 4
And I want it to be like this in a dict:
d = {'William': 2,'David': 3,'Victor': 5,'Jack': 1,'Gavin': 4}
Is anyone knows how to do this in python?
Please help me! Thank You!
| 0debug
|
Clearing a static list in C# : <p>I'm trying to clear a static list from my "playerStats" script which I use to access static variables globally. Adding elements to the list works just fine (with playerStats.myList.Add(levelNumber)), but when I try to use myList.Clear I get this error: </p>
<p><em>"Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement"</em>.</p>
<p>Here is the relevant code: First the list definition inside the playerStats class:</p>
<pre><code>{
public static List<int> myList = new List<int>();
}
</code></pre>
<p>And this is then on another script referencing the playerStats:</p>
<pre><code>public void goBack()
{
playerStats.myList.Clear;
SceneManager.LoadScene(0);
}
</code></pre>
<p>Why can't I clear the list like this?</p>
| 0debug
|
How to use SEP in for loop? : <p>I can't sep="_" in my code</p>
<p>How can i do.</p>
<pre><code>'''python'''
def sequence(num):
for i in range(1, num+1):
print(i, sep="_", end=""
sequence()
</code></pre>
<pre><code>num = 6
i want = 1_2_3_4_5_6
but it show = 123456
</code></pre>
| 0debug
|
Export existing CodePipeline/CodeBuild projects to Cloudformation : <p><strong>Is there a way to export existing CodePipeline/CodeBuild projects to Cloudformation?</strong></p>
<p>I'm in the process of converting our existing CI/CD infrastructure into code so it would be easy to replicate them on other AWS regions.</p>
<p>Currently, we've done all our CodePipeline/CodeBuild projects through the AWS console in the browser and obviously, this is tedious and error-prone.</p>
| 0debug
|
its about the javascript programming : <p>I want to develop a website which takes a voice or speech input from the user.</p>
<p>example:
if a user says that he wants to login so he should be redirected to the login page .
Note:
the input should be in the form of speech i.e the user shoulf speak "i want to login"</p>
<p>so now there a problem exist i dont know how to do it</p>
<p>i searched for it online but there is a api called as WEB SPEECH API but i am not understanding how to use it</p>
<p>so are there any related answers to that ?</p>
<p>i would appreciate if the answers are related using the above API .
or any other related suggestions
thank you</p>
| 0debug
|
Boolean Validaiton : I am facing a little problem here.
I have fetch the data from data using following code,
class CreateGrounddetails < ActiveRecord::Migration
def change
create_table :grounddetails do |t|
t.string :name
t.datetime :working_hours
t.string :address
t.string :contact_no
t.string :email
t.integer :number_of_grounds
t.text :description
t.boolean :featured_ground #Featured
t.timestamps null: false
end
end
end
I have a boolean values stored in the field "featured_ground", now i want to fetch only the data which has "TRUE" value for "featured_ground".
How can i achieve that ?
Thank you in advance.
| 0debug
|
Reading float values without losing the precision : <p>I have a dataset ((12008 * 12008) matrix stored as csv format ) containing floating-point numeric values such as:</p>
<pre><code>0.00000000000000000129097521168892,0.00000822381709160264,-0.0000202130952444797,-0.0000242966927641499,0.000030546233920949,0.0000371753288365733,-0.00000425477255333099,0.0000417806937053693,-0.0000108963812606789,-0.0000116825931954974,0.00000630880107874073,-0.0000148294201214316,0.000015379692507603,0.00000188679818192867,0.00000244261959932239,-0.00000000000000000151132910441927,-0.0000219241408193178,0.000017429377110585,0.00000870784208574737,0.0000364006097348257,0.0000113488247245831,0.000000061277075989572,0.00000139732542828701,0.000000106947553933263,0.0000326417023213338,0.000000461629854407632,0.0000154355086839126,-0.00000952557006126632,-0.00000661974638741755,0.0000100492673229086,-0.00000234761929597247,0.000000562031028984242,-0.0000111189586356939,0.0000147613296909272,-0.0000412808264307332,0.0000144980218289582,-0.00000396573532860471,0.00000284216015813941,-0.000000340292198448977,0.000000000000000000673559708847384,-0.000000000000000000477244282125147,0.0000295672329145256,0.000000265057585538249,-0.0000259880981140332,-0.000000655572300400449,0.0000275203484322834,0.00000939709816031401,-0.000000722013848489603,-0.000000131975990695569,-0.0000305715257167805,0.0000166359409438876,-0.0000108549024616569,0.0000035413589251256,0.0000134733827428785,0.00000033136969072632,-0.0000000227012317723535,0.0000251344669810146,0.00000507204772254958,-0.00000000193093573409854,
</code></pre>
<p>I noticed when I read it to a float buffer, I lose the precision too much so I get something like:</p>
<pre><code>0.0000000
-0.000082
</code></pre>
<p>I want to read the exact values from the dataset <strong>without losing the precision</strong> to a buffer in my program. I use the following small program to read but I am not sure how to modify it so that it does not lose the precision:</p>
<pre><code>float *data = malloc((12008 * 12008) * sizeof(float));
FILE *fp ;
fp=fopen("./eig_matrix.csv","rb");
if(fp!= NULL) fread(data, (12008 * 12008)*sizeof(float),1,fp);
fclose(fp);
</code></pre>
| 0debug
|
React Navigation Header in Functional Components with Hooks : <p>I am trying to inject custom headers to React functional components that are using Hooks.</p>
<p>So for example I have the following React functional component with some hooks:</p>
<pre><code>function StoryHome(props) {
const [communityObj, setCommunityObj] = useState({
uid: null,
name: null,
});
...
}
StoryHome.navigationOptions = {
title: 'Stories',
headerTitleStyle: {
textAlign: 'left',
fontFamily: 'OpenSans-Regular',
fontSize: 24,
},
headerTintColor: 'rgba(255,255,255,0.8)',
headerBackground: (
<LinearGradient
colors={['#4cbdd7', '#3378C3']}
start={{ x: 0, y: 1 }}
end={{ x: 1, y: 1 }}
style={{ flex: 1 }}
/>
),
headerRightContainerStyle: {
paddingRight: 10,
},
headerRight: (
<TouchableOpacity onPress={navigation.navigate('storiesList')}>
<Ionicons
name="ios-search-outline"
size={25}
color="white"
left={20}
/>
</TouchableOpacity>
)
};
export default StoryHome;
</code></pre>
<p>So this sort of works, except with the <code>TouchableOpacity</code> part. </p>
<p>First, I don't get the <code>Ionicon</code> to render correctly and second, I don't have access to the <code>navigation</code> object outside of the functional component.</p>
<p>I would love to continue using Hooks but can't seem to figure this one out.</p>
| 0debug
|
How to format time to "H:i:s" in laravel using carbon : <p>I would like to find total time spent on a project given that the user enters the "start time" and "stop time". I have been able to access the time spent but it comes as an array of Date Interval. </p>
<p>I want to just format the results to "H:i:s" (Hour:Minute:Seconds)</p>
<p>Here's the code from my controller</p>
<p>I have already declare the use of Carbon Class(use Carbon/Carbon;) at the top of the controller</p>
<pre><code> $start = Carbon::parse($request->strt_time);
$end = Carbon::parse($request->stp_time);
$time_spent = $end->diff($start);
$spent_time = $time_spent->format('H:i:s');
</code></pre>
<p>I expect the output to be 00:00:00 but I am getting a string "H:i:s"</p>
| 0debug
|
How do I solve this error with Illegal Configuration? : <p>I'm trying to connect an outlet from a view ,inside a cell ,inside a collection view , to my view controller file ,but I keep getting this error . </p>
<p>Illegal Configuration: The runningCard outlet from the HomeViewController to the UIView is invalid. Outlets cannot be connected to repeating content.</p>
<p>What should I do ?</p>
| 0debug
|
static void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx) {
int i;
for (i = 0; i < avctx->channels; i++) {
AacPsyChannel *pch = &ctx->ch[i];
if (avctx->flags & CODEC_FLAG_QSCALE)
pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm;
else
pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000);
for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++)
pch->prev_energy_subshort[i] = 10.0f;
}
}
| 1threat
|
static void migrate_check_parameter(QTestState *who, const char *parameter,
const char *value)
{
QDict *rsp, *rsp_return;
const char *result;
rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");
rsp_return = qdict_get_qdict(rsp, "return");
result = g_strdup_printf("%" PRId64,
qdict_get_try_int(rsp_return, parameter, -1));
g_assert_cmpstr(result, ==, value);
QDECREF(rsp);
}
| 1threat
|
static void __attribute__((destructor)) coroutine_pool_cleanup(void)
{
Coroutine *co;
Coroutine *tmp;
QSLIST_FOREACH_SAFE(co, &pool, pool_next, tmp) {
QSLIST_REMOVE_HEAD(&pool, pool_next);
qemu_coroutine_delete(co);
}
qemu_mutex_destroy(&pool_lock);
}
| 1threat
|
How can i get my rpg to run correctly? I am a noob at coding : im a bit of a noob to python, and coding in general so bare with me. Im trying to get this rpg program to work, but i cant figure it out. I run it and well, you will see when you run the program. For some reason when i run this it stops at 1,2,3,4 after every move i make. Am i not returning anything? What am i doing wrong here, and how can i improve my orgaization and code in the future?
import math
import random
class character:
def __init__(self, hp, max_hp, att, exp, int):
self.hp = hp
self.max_hp = max_hp
self.att = att
self.exp = exp
self.int = int
class enemy:
def __init__(self, hp, max_hp, att, exp, int):
self.hp = hp
self.max_hp = max_hp
self.att = att
self.exp = exp
self.int = int
charspells = ['Fireball']
Loop = True
def fireball(character, enemy):
enemy.hp -= character.int
print('You did, ',character.int ,'to the enemy')
print('Enemy.hp', enemy.hp)
return enemy.hp
items = []
mainc = character(100, 100, 10, 0, 10)
tai_lopez = enemy(30, 30, 5, 0, 10)
def character_battle(character, enemy):
choice = input('What would you like to do?\n 1. Attack \n 2. Spells \n 3. Items \n 4. Run')
if choice == input('1'):
print('You attack the enemy!')
enemy.hp -= character.att
print('You dealt', character.att, 'to the enemy!')
print('Enemy hp =', enemy.hp)
if choice == input('2'):
spellchoice = input('Which spell do you wish to call?')
print('1.', charspells[0],'\n' '2.', charspells[1], '\n' 'q', 'exit')
if spellchoice == ('1'):
print('You used fireball!')
fireball(character, enemy)
elif spellchoice == ('2'):
if charspells[1] != 'Lightning bolt':
print('It doesnt exist, sorry')
# ill add more spell fucntions later
if spellchoice == ('3'):
print('You went back to the menu')
if choice == input('3'):
if items == []:
print('You are gay and have no items')
if items == ['potions']:
print ('homo')
#placeholder ill add the fucntion later
elif choice == input('4'):
Loop = False
def enemy_battle(enemy, character):
a = random.randint(0,50)
if a <= 35:
print('The enemy attacks you!')
character.hp -= enemy.att
print('Your hp =', character.hp)
elif a <= 50:
print('The enemy uses mind attacks bruh')
character.hp -= enemy.int
print('Your hp =', character.hp)
def battle_loop(character, enemy):
Loop1 = True
while Loop1 == True:
while enemy.hp > 0 and character.hp > 0:
character_battle(character, enemy)
enemy_battle(character, enemy)
if enemy.hp <= 0:
print('You Won')
Loop1 = False
if character.hp <= 0:
print('You lost')
exit()
battle_loop(mainc, tai_lopez)
| 0debug
|
How to customize look/feel of React Native ListView's RefreshControl : <p>React Native's ListView has a built-in pull-to-refresh control called <a href="https://facebook.github.io/react-native/docs/refreshcontrol.html" rel="noreferrer">RefreshControl</a>. It's super easy to use.</p>
<p>I'd like to customize the look and feel of the control to use a different visual design, such as using a material design progress indicator.</p>
<p>How can I customize the look of the RefreshControl in React Native?</p>
| 0debug
|
static void avc_loopfilter_cb_or_cr_inter_edge_hor_msa(uint8_t *data,
uint8_t bs0, uint8_t bs1,
uint8_t bs2, uint8_t bs3,
uint8_t tc0, uint8_t tc1,
uint8_t tc2, uint8_t tc3,
uint8_t alpha_in,
uint8_t beta_in,
uint32_t img_width)
{
v16u8 alpha, beta;
v8i16 tmp_vec;
v8i16 bs = { 0 };
v8i16 tc = { 0 };
v16u8 p0, q0, p0_asub_q0, p1_asub_p0, q1_asub_q0;
v16u8 is_less_than;
v16u8 is_less_than_beta, is_less_than_alpha, is_bs_greater_than0;
v8i16 p0_r, q0_r;
v16u8 p1_org, p0_org, q0_org, q1_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v16i8 negate_tc, sign_negate_tc;
v8i16 tc_r, negate_tc_r;
v16i8 zero = { 0 };
tmp_vec = (v8i16) __msa_fill_b(bs0);
bs = __msa_insve_h(bs, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs1);
bs = __msa_insve_h(bs, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs2);
bs = __msa_insve_h(bs, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs3);
bs = __msa_insve_h(bs, 3, tmp_vec);
if (!__msa_test_bz_v((v16u8) bs)) {
tmp_vec = (v8i16) __msa_fill_b(tc0);
tc = __msa_insve_h(tc, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc1);
tc = __msa_insve_h(tc, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc2);
tc = __msa_insve_h(tc, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc3);
tc = __msa_insve_h(tc, 3, tmp_vec);
is_bs_greater_than0 = (v16u8) (zero < (v16i8) bs);
alpha = (v16u8) __msa_fill_b(alpha_in);
beta = (v16u8) __msa_fill_b(beta_in);
p1_org = LOAD_UB(data - (img_width << 1));
p0_org = LOAD_UB(data - img_width);
q0_org = LOAD_UB(data);
q1_org = LOAD_UB(data + img_width);
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
is_less_than = is_less_than & is_bs_greater_than0;
is_less_than = (v16u8) __msa_ilvr_d((v2i64) zero, (v2i64) is_less_than);
if (!__msa_test_bz_v(is_less_than)) {
negate_tc = zero - (v16i8) tc;
sign_negate_tc = __msa_clti_s_b(negate_tc, 0);
negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc);
tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc);
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r,
negate_tc_r, tc_r, p0_r, q0_r);
p0 = (v16u8) __msa_pckev_b(zero, (v16i8) p0_r);
q0 = (v16u8) __msa_pckev_b(zero, (v16i8) q0_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than);
STORE_UB(q0_org, data);
STORE_UB(p0_org, (data - img_width));
}
}
}
| 1threat
|
Eliminating Duplicates in an array : <p>Here is the problem I am working on: "Write a method that returns a new array by eliminating the duplicate values in the array using the following method header:</p>
<p>public static int[] eliminateDuplicates(int[] list)</p>
<p>Write a test program that read in ten integers, invokes the method and displays the result."</p>
<p>Here is the code I have:</p>
<pre><code> public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int[] list = new int[10];
System.out.print("Enter ten numbers:");
for (int i = 0; i < list.length; i++) {
list[i] = input.nextInt();
}
System.out.print("The distinct numbers are: ");
for(int i = 0; i < 10; i++){
if( list[i] != -1){
System.out.print(eliminateDuplicates(list));
}
}
}
public static int[] eliminateDuplicates(int[] list) {
for(int i = 0; i < 10; i++){
for(int j = i + 1; j < 10; j++){
if (list[i] == list[j]){
list[i]= -1;
}
}
}
return list;
</code></pre>
<p>}
}</p>
<p>My issue is my output is really strange, this is what I'm getting "[I@55f96302[I@55f96302[I@55f96302[I@55f96302[I@55f96302[I@55f96302[I@55f96302"</p>
<p>Can anyone tell me where I'm going wrong? Or a suggestion of where to start fixing it? I'm still a beginner, so I haven't learned a whole lot (like hashsets or anything).</p>
<p>You have my many thanks </p>
| 0debug
|
CharDriverState *chr_testdev_init(void)
{
TestdevCharState *testdev;
CharDriverState *chr;
testdev = g_malloc0(sizeof(TestdevCharState));
testdev->chr = chr = g_malloc0(sizeof(CharDriverState));
chr->opaque = testdev;
chr->chr_write = testdev_write;
chr->chr_close = testdev_close;
return chr;
}
| 1threat
|
static int open_in(HLSContext *c, AVIOContext **in, const char *url)
{
AVDictionary *tmp = NULL;
int ret;
av_dict_copy(&tmp, c->avio_opts, 0);
ret = avio_open2(in, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp);
av_dict_free(&tmp);
return ret;
}
| 1threat
|
Fastest assembly code for finding the square root. Explanation needed : <p>I'm currently making a program in C that needs to find billions of square roots. I looked up which known code finds the square root faster and came across this code which is seemingly the fastest. <a href="https://www.codeproject.com/Articles/69941/Best-Square-Root-Method-Algorithm-Function-Precisi" rel="nofollow noreferrer">https://www.codeproject.com/Articles/69941/Best-Square-Root-Method-Algorithm-Function-Precisi</a></p>
<pre><code>double inline __declspec (naked) __fastcall sqrt(double n)
{
_asm fld qword ptr[esp + 4]
_asm fsqrt
_asm ret 8
}
</code></pre>
<p>I don't know much about assembly language so can someone please explain what this code does algorithmically and what those keywords mean?</p>
| 0debug
|
static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, int nag)
{
int i;
int offset_temp = 0;
for (i = 0; i < index_table->nb_segments; i++) {
MXFIndexTableSegment *s = index_table->segments[i];
edit_unit = FFMAX(edit_unit, s->index_start_position);
if (edit_unit < s->index_start_position + s->index_duration) {
int64_t index = edit_unit - s->index_start_position;
if (s->edit_unit_byte_count)
offset_temp += s->edit_unit_byte_count * index;
else if (s->nb_index_entries) {
if (s->nb_index_entries == 2 * s->index_duration + 1)
index *= 2;
if (index < 0 || index > s->nb_index_entries) {
av_log(mxf->fc, AV_LOG_ERROR, "IndexSID %i segment at %"PRId64" IndexEntryArray too small\n",
index_table->index_sid, s->index_start_position);
return AVERROR_INVALIDDATA;
}
offset_temp = s->stream_offset_entries[index];
} else {
av_log(mxf->fc, AV_LOG_ERROR, "IndexSID %i segment at %"PRId64" missing EditUnitByteCount and IndexEntryArray\n",
index_table->index_sid, s->index_start_position);
return AVERROR_INVALIDDATA;
}
if (edit_unit_out)
*edit_unit_out = edit_unit;
return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out);
} else {
offset_temp += s->edit_unit_byte_count * s->index_duration;
}
}
if (nag)
av_log(mxf->fc, AV_LOG_ERROR, "failed to map EditUnit %"PRId64" in IndexSID %i to an offset\n", edit_unit, index_table->index_sid);
return AVERROR_INVALIDDATA;
}
| 1threat
|
SQLSTATE[28000] [1045] - I'm sorry to ask this as a complete newb : My tech/web/developers are asleep for 7 more hours ($)#(*@)
While a terribly noob, I'm dangerous enough to understand steps you tell me to take!
SQLSTATE[28000] [1045] Access denied for user 'XXXXX'@'localhost' (using password: YES)
I created this user with appropriate privileges in myphpadmin.
I'm just hoping to have someone with some helpful tips:
https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw I've read that and have questions:
1) Will the error message be the same if I have a user name but the password is different or will it give me a different error (methinks the error is the same regardless) but need to be sure.
2) Could this issue have anything whatsoever to do with too little hard drive space?
3) GRANT ALL PRIVILEGES ON `XXXXXXX_%`.* TO 'XXXXXXX'@'localhost'WITH GRANT OPTION;
I ran this query, this user has full privleges:
REVOKE ALL PRIVILEGES ON `XXXXXXX_%` . * FROM 'XXXXXXX'@'localhost';
REVOKE GRANT OPTION ON `XXXXXXX_%` . * FROM 'XXXXXXX'@'localhost';
GRANT ALL PRIVILEGES ON `XXXXXXX_%` . * TO 'XXXXXXX'@'localhost';
Was this the right thing to do?
4) I have access to the app/etc/local.xml file, what - if anything should I check in there to see if I'm on the right track? I see the user name appropriately listed there but...
I cannot seem to find a reference to the livedb for dbname anywhere in myPHPadmin, where could I look?
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[XXXXXXX]]></username>
<password><![CDATA[XXXXXXXXXX]]></password>
<dbname><![CDATA[XXXXX_livedb]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
any advice would help:)
| 0debug
|
Label encoding: Python : I have to label my data row wise in csv considering two parameters :
1. VE in range 0.9 to 1.3 or 0
2. Calculated load value in range 20 to 50
I have to label these as 1
and others as - 1 by adding another column
I have tried numpy.where and pandas.where but it gives an error saying series is ambiguous.
[Snippet of csv][1]
[1]: https://i.stack.imgur.com/FBWvF.png
| 0debug
|
Or operator vs. Ternary operator : <p>Which piece of code is faster, or just better?</p>
<hr>
<p><strong>Ternary operator</strong></p>
<pre><code>action = typeMap[type] ? typeMap[type] : typeMap['default'];
</code></pre>
<hr>
<p><strong>Or operator</strong></p>
<pre><code>action = typeMap[type] || typeMap['default']
</code></pre>
<hr>
<p>Thank you!</p>
| 0debug
|
static void do_io_interrupt(CPUS390XState *env)
{
S390CPU *cpu = s390_env_get_cpu(env);
LowCore *lowcore;
IOIntQueue *q;
uint8_t isc;
int disable = 1;
int found = 0;
if (!(env->psw.mask & PSW_MASK_IO)) {
cpu_abort(CPU(cpu), "I/O int w/o I/O mask\n");
}
for (isc = 0; isc < ARRAY_SIZE(env->io_index); isc++) {
uint64_t isc_bits;
if (env->io_index[isc] < 0) {
continue;
}
if (env->io_index[isc] > MAX_IO_QUEUE) {
cpu_abort(CPU(cpu), "I/O queue overrun for isc %d: %d\n",
isc, env->io_index[isc]);
}
q = &env->io_queue[env->io_index[isc]][isc];
isc_bits = ISC_TO_ISC_BITS(IO_INT_WORD_ISC(q->word));
if (!(env->cregs[6] & isc_bits)) {
disable = 0;
continue;
}
if (!found) {
uint64_t mask, addr;
found = 1;
lowcore = cpu_map_lowcore(env);
lowcore->subchannel_id = cpu_to_be16(q->id);
lowcore->subchannel_nr = cpu_to_be16(q->nr);
lowcore->io_int_parm = cpu_to_be32(q->parm);
lowcore->io_int_word = cpu_to_be32(q->word);
lowcore->io_old_psw.mask = cpu_to_be64(get_psw_mask(env));
lowcore->io_old_psw.addr = cpu_to_be64(env->psw.addr);
mask = be64_to_cpu(lowcore->io_new_psw.mask);
addr = be64_to_cpu(lowcore->io_new_psw.addr);
cpu_unmap_lowcore(lowcore);
env->io_index[isc]--;
DPRINTF("%s: %" PRIx64 " %" PRIx64 "\n", __func__,
env->psw.mask, env->psw.addr);
load_psw(env, mask, addr);
}
if (env->io_index[isc] >= 0) {
disable = 0;
}
continue;
}
if (disable) {
env->pending_int &= ~INTERRUPT_IO;
}
}
| 1threat
|
static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,
unsigned int size)
{
S390PCIBusDevice *pbdev;
uint32_t io_int_word;
uint32_t fid = data >> ZPCI_MSI_VEC_BITS;
uint32_t vec = data & ZPCI_MSI_VEC_MASK;
uint64_t ind_bit;
uint32_t sum_bit;
uint32_t e = 0;
DPRINTF("write_msix data 0x%" PRIx64 " fid %d vec 0x%x\n", data, fid, vec);
pbdev = s390_pci_find_dev_by_fid(fid);
if (!pbdev) {
e |= (vec << ERR_EVENT_MVN_OFFSET);
s390_pci_generate_error_event(ERR_EVENT_NOMSI, 0, fid, addr, e);
return;
}
if (!(pbdev->fh & FH_MASK_ENABLE)) {
return;
}
ind_bit = pbdev->routes.adapter.ind_offset;
sum_bit = pbdev->routes.adapter.summary_offset;
set_ind_atomic(pbdev->routes.adapter.ind_addr + (ind_bit + vec) / 8,
0x80 >> ((ind_bit + vec) % 8));
if (!set_ind_atomic(pbdev->routes.adapter.summary_addr + sum_bit / 8,
0x80 >> (sum_bit % 8))) {
io_int_word = (pbdev->isc << 27) | IO_INT_WORD_AI;
s390_io_interrupt(0, 0, 0, io_int_word);
}
}
| 1threat
|
Fetch() takes too long : I have a js function fetch that needs to fetch some data and then I have other functions that relly on fetched information in order for them to work. As a result, my fetch takes too long so other functions give me an error that there is no "data" for functions to use. How can I make it so that before any of my functions start to work, first fetch gathers information?
```
console.log("Hello");
fetch("https://api.propublica.org/congress/v1/113/senate/members.json",{
method:"GET",
headers:{
"Content-type": "application/json",
"X-API-Key": "eKDuyBWdpQGhsiKGi7geFoBmJR3kCRIRUGRWIASL"
}
})
.then( (response)=>{
if(response.ok){
return response.json();
}else{
throw new Error('BAD HTTP stuff');
}
})
.then( (data) => {
console.log(data);
})
.catch( (err) =>{
console.log('ERROR: ', err.message);
});
```
| 0debug
|
.ini file load environment variable : <p>I am using <a href="http://alembic.readthedocs.io/en/latest/" rel="noreferrer">Alembic</a> for migrations implementation in a <code>Flask</code> project. There is a <code>alembic.ini</code> file where the database configs must be specified:</p>
<p><code>sqlalchemy.url = driver://user:password@host/dbname</code></p>
<p>Is there a way to specify the parameters from the environment variables? I've tried to load them in this way <code>$(env_var)</code> but with no success. Thanks!</p>
| 0debug
|
static int set_sps(HEVCContext *s, const HEVCSPS *sps)
{
int ret;
int num = 0, den = 0;
pic_arrays_free(s);
ret = pic_arrays_init(s, sps);
if (ret < 0)
goto fail;
s->avctx->coded_width = sps->width;
s->avctx->coded_height = sps->height;
s->avctx->width = sps->output_width;
s->avctx->height = sps->output_height;
s->avctx->pix_fmt = sps->pix_fmt;
s->avctx->sample_aspect_ratio = sps->vui.sar;
s->avctx->has_b_frames = sps->temporal_layer[sps->max_sub_layers - 1].num_reorder_pics;
if (sps->vui.video_signal_type_present_flag)
s->avctx->color_range = sps->vui.video_full_range_flag ? AVCOL_RANGE_JPEG
: AVCOL_RANGE_MPEG;
else
s->avctx->color_range = AVCOL_RANGE_MPEG;
if (sps->vui.colour_description_present_flag) {
s->avctx->color_primaries = sps->vui.colour_primaries;
s->avctx->color_trc = sps->vui.transfer_characteristic;
s->avctx->colorspace = sps->vui.matrix_coeffs;
} else {
s->avctx->color_primaries = AVCOL_PRI_UNSPECIFIED;
s->avctx->color_trc = AVCOL_TRC_UNSPECIFIED;
s->avctx->colorspace = AVCOL_SPC_UNSPECIFIED;
}
ff_hevc_pred_init(&s->hpc, sps->bit_depth);
ff_hevc_dsp_init (&s->hevcdsp, sps->bit_depth);
ff_videodsp_init (&s->vdsp, sps->bit_depth);
if (sps->sao_enabled) {
av_frame_unref(s->tmp_frame);
ret = ff_get_buffer(s->avctx, s->tmp_frame, AV_GET_BUFFER_FLAG_REF);
if (ret < 0)
goto fail;
s->frame = s->tmp_frame;
}
s->sps = sps;
s->vps = (HEVCVPS*) s->vps_list[s->sps->vps_id]->data;
if (s->vps->vps_timing_info_present_flag) {
num = s->vps->vps_num_units_in_tick;
den = s->vps->vps_time_scale;
} else if (sps->vui.vui_timing_info_present_flag) {
num = sps->vui.vui_num_units_in_tick;
den = sps->vui.vui_time_scale;
}
if (num != 0 && den != 0)
av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
num, den, 1 << 30);
return 0;
fail:
pic_arrays_free(s);
s->sps = NULL;
return ret;
}
| 1threat
|
static TCGReg tcg_out_tlb_read(TCGContext *s, TCGMemOp opc,
TCGReg addrlo, TCGReg addrhi,
int mem_index, bool is_read)
{
int cmp_off
= (is_read
? offsetof(CPUArchState, tlb_table[mem_index][0].addr_read)
: offsetof(CPUArchState, tlb_table[mem_index][0].addr_write));
int add_off = offsetof(CPUArchState, tlb_table[mem_index][0].addend);
TCGReg base = TCG_AREG0;
TCGMemOp s_bits = opc & MO_SIZE;
if (TCG_TARGET_REG_BITS == 64) {
if (TARGET_LONG_BITS == 32) {
tcg_out_ext32u(s, TCG_REG_R4, addrlo);
addrlo = TCG_REG_R4;
} else {
tcg_out_rld(s, RLDICL, TCG_REG_R3, addrlo,
64 - TARGET_PAGE_BITS, 64 - CPU_TLB_BITS);
}
}
if (add_off >= 0x8000) {
QEMU_BUILD_BUG_ON(offsetof(CPUArchState,
tlb_table[NB_MMU_MODES - 1][1])
> 0x7ff0 + 0x7fff);
tcg_out32(s, ADDI | TAI(TCG_REG_TMP1, base, 0x7ff0));
base = TCG_REG_TMP1;
cmp_off -= 0x7ff0;
add_off -= 0x7ff0;
}
if (TCG_TARGET_REG_BITS == 32 || TARGET_LONG_BITS == 32) {
tcg_out_rlw(s, RLWINM, TCG_REG_R3, addrlo,
32 - (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
32 - (CPU_TLB_BITS + CPU_TLB_ENTRY_BITS),
31 - CPU_TLB_ENTRY_BITS);
} else {
tcg_out_shli64(s, TCG_REG_R3, TCG_REG_R3, CPU_TLB_ENTRY_BITS);
}
tcg_out32(s, ADD | TAB(TCG_REG_R3, TCG_REG_R3, base));
if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_R4, TCG_REG_R3, cmp_off);
tcg_out_ld(s, TCG_TYPE_I32, TCG_REG_TMP1, TCG_REG_R3, cmp_off + 4);
} else {
tcg_out_ld(s, TCG_TYPE_TL, TCG_REG_TMP1, TCG_REG_R3, cmp_off);
}
tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_R3, TCG_REG_R3, add_off);
if (TCG_TARGET_REG_BITS == 32 || TARGET_LONG_BITS == 32) {
tcg_out_rlw(s, RLWINM, TCG_REG_R0, addrlo, 0,
(32 - s_bits) & 31, 31 - TARGET_PAGE_BITS);
} else if (s_bits) {
if ((opc & MO_AMASK) == MO_ALIGN) {
tcg_out_rld(s, RLDICL, TCG_REG_R0, addrlo,
64 - TARGET_PAGE_BITS, TARGET_PAGE_BITS - s_bits);
tcg_out_rld(s, RLDICL, TCG_REG_R0, TCG_REG_R0, TARGET_PAGE_BITS, 0);
} else {
tcg_out32(s, ADDI | TAI(TCG_REG_R0, addrlo, (1 << s_bits) - 1));
tcg_out_rld(s, RLDICR, TCG_REG_R0, TCG_REG_R0,
0, 63 - TARGET_PAGE_BITS);
}
} else {
tcg_out_rld(s, RLDICR, TCG_REG_R0, addrlo, 0, 63 - TARGET_PAGE_BITS);
}
if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) {
tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP1,
0, 7, TCG_TYPE_I32);
tcg_out_cmp(s, TCG_COND_EQ, addrhi, TCG_REG_R4, 0, 6, TCG_TYPE_I32);
tcg_out32(s, CRAND | BT(7, CR_EQ) | BA(6, CR_EQ) | BB(7, CR_EQ));
} else {
tcg_out_cmp(s, TCG_COND_EQ, TCG_REG_R0, TCG_REG_TMP1,
0, 7, TCG_TYPE_TL);
}
return addrlo;
}
| 1threat
|
qemu_irq *mcf_intc_init(MemoryRegion *sysmem,
target_phys_addr_t base,
CPUM68KState *env)
{
mcf_intc_state *s;
s = g_malloc0(sizeof(mcf_intc_state));
s->env = env;
mcf_intc_reset(s);
memory_region_init_io(&s->iomem, &mcf_intc_ops, s, "mcf", 0x100);
memory_region_add_subregion(sysmem, base, &s->iomem);
return qemu_allocate_irqs(mcf_intc_set_irq, s, 64);
}
| 1threat
|
What is the purpose of marking the set function (setter) as constexpr? : <p>I cannot understand the purpose of marking the setter function as <code>constexpr</code>, that is allowed since C++14.
My misunderstanding comes from the next situation:
I declare a class with a constexpr c-tor, and I am about to use it in a constexpr context, by creating a constexpr instance of that class <code>constexpr Point p1</code>. An object <code>p1</code> now is constant and its value could not be changed, so the <code>constexpr</code> setter could not be called.
On the other hand, when I create an instance of my <code>class Point</code> in a non-constexpr context <code>Point p</code>, I can call the setter for that object, but now setter will not execute at compile-time, because the object is not constexpr!</p>
<p>As a result, I do not understand how can I enhance the performance of my code using <code>constexpr</code> for setters.</p>
<p>This is the code that demonstrates calling a constexpr setter on an non-constexpr object, that means run-time computation, instead of the compile-time:</p>
<pre><code>class Point {
public:
constexpr Point(int a, int b)
: x(a), y(b) {}
constexpr int getX() const noexcept { return x; }
constexpr int getY() const noexcept { return y; }
constexpr void setX(int newX) noexcept { x = newX; }
constexpr void setY(int newY) noexcept { y = newY; }
private:
int x;
int y;
};
int main() {
Point p{4, 2};
constexpr Point p1{4, 2};
p.setX(2);
}
</code></pre>
<p>Could anyone help me to understand what is the purpose of marking the setter function as <code>constexpr</code>?</p>
| 0debug
|
Free test environment (URL) to test my JMeter load tests? : <p>Is there test environment (URL) which is available on the internet to practice my load tests? </p>
<p>I need to test my JMeter test simulating x2000 virtual users, is there a portal online which would enable me to test my newly created load test? </p>
| 0debug
|
How do you go through a text file and print the next number in python? : <p>How do you go through a text file and print the next ascending number with other information (already able to do this)? </p>
<p>For my code I need to assign a number to something the user inputs and so far I am able to do everything but get the number to print onto the text file. I would like my file to be formatted in the following way:</p>
<p><em>1 abcd</em></p>
<p><em>2 efgh</em></p>
<p>I need the code to go through the text file and see what the highest number is then print the next number with the information. Like I said before I'm having no trouble with the information part just the part on adding the numbers.</p>
<p>I have thought about doing an <em>if</em> statement however that would mean going through a lot of numbers and sooner or later it will need updating with more numbers. As well as this, it would be very time consuming as well as memory consuming.</p>
<p>I have also thought about using a <em>for</em> statement however I haven't been able to find a way of it working.</p>
<p>Any help would be greatly appreciated. Thanks</p>
| 0debug
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
void fork_start(void)
{
mmap_fork_start();
qemu_mutex_lock(&tb_ctx.tb_lock);
cpu_list_lock();
}
| 1threat
|
static void sysbus_esp_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = sysbus_esp_realize;
dc->reset = sysbus_esp_hard_reset;
dc->vmsd = &vmstate_sysbus_esp_scsi;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
| 1threat
|
When we use zevenzip.dll in my code using c#, geting error The runtime has encountered a fatal error. : when we use zevenzip.dll in my code using #, geting error The runtime has encountered a fatal error. The address of the error was at 0xdf7535b8, on thread 0x2224. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common source
My code is
SevenZipExtractor.SetLibraryPath(@"D:\\Projects\\XML2U\\WindowsFormsApplication1\\WindowsFormsApplication1\\bin\\Debug\\SevenZipSharp.dll");
SevenZipCompressor compressor = new SevenZipCompressor();
compressor.ArchiveFormat = OutArchiveFormat.Zip;
compressor.CompressionMode = CompressionMode.Create;
compressor.TempFolderPath = System.IO.Path.GetTempPath();
compressor.VolumeSize = 10000000;
compressor.CompressDirectory(backupFolder, destination);
| 0debug
|
label1 = label2 is it possible? : I have a function that returns an object as Label for the sake of understanding lets call is "lblStatus".
public Label statusUpdater(int x)
{
Label lblStatus = new Label();
if (x=1)
{
lblStatus.text = "I like Cheese!";
}
else
{
lblStatus.text = "And I don't care!";
}
return lblStatus;
}
label1=myclass.statusUpdater(1);
**Would this be possible?** All I really need is to give all properties from a label to another. Not [this][1]
[1]: https://stackoverflow.com/questions/42131132/label1-property-join-label2-property
| 0debug
|
How do I make a slack bot leave a channel? : <p>bots cannot use the regular channels.leave api call, so how do I make a bot leave a channel, short of kicking it? I need it to leave a channel where I do not have rights to kick users.</p>
| 0debug
|
i am trying to do not show slide 1 in carousel bootstrap any one please help me : *i am trying to not show first slide after loading the page but dont know what to do and how to do so any one can give me any solution about this *
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- banner starts here -->
<div class=" slider header">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner slider">
<div class="item active slider">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Cap-ferrat-coast-from-mt-b_crop_1200x400.jpg/800px-Cap-ferrat-coast-from-mt-b_crop_1200x400.jpg" alt="1">
</div>
<div class="item slider">
<img src="https://upload.wikimedia.org/wikipedia/commons/0/03/Mount_Fuji_as_seen_across_lake_Kawaguchi%2C_with_Fujikawaguchiko_town_in_the_foreground_seen_early_in_the_evening._Honshu_Island._Japan.jpg" alt="2">
</div>
<div class="item slider" id>
<img src="https://vignette.wikia.nocookie.net/greatwar/images/c/c3/7f720cbede625085e7ccd46503c944aa-d5b1ubs.jpg/revision/latest/scale-to-width-down/639?cb=20121118022453" alt="3">
</div>
</div>
<!-- Left and right controls -->
<a class=" left carousel-control" data-target="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class=" right carousel-control" data-target="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<!-- banner ends here -->
<!-- end snippet -->
i am not able to understand what to do and how to do just wanna do this
i dont think so it was tough but i dont got this
i just dont wanna show the first slide again after runing all three slides
after the third slide 2nd slide will be show
| 0debug
|
how can i write my source code in python so that it works in DASH framework : i have written my code in python using Jupyer Notebook and is working fine.
I need help on how to write that code in DASH or make it work in dash
```
PATH = 'products.csv'
data = pd.read_csv(PATH)
colors = ['#f4cb42', '#cd7f32', '#a1a8b5'] #gold,bronze,silver
medal_counts = data.Categories.value_counts(sort=True)
labels = medal_counts.index
values = medal_counts.values
pie = go.Pie(labels=labels, values=values, marker=dict(colors=colors))
layout = go.Layout(title='Sales by CATEGORIES ')
fig = go.Figure(data=[pie], layout=layout)
py.iplot(fig)
```
the code draws a pie chart
| 0debug
|
Using SHA 1 Encryption in Laravel : I want to encrypt some strings of character using sha1 hash in laravel. but no matter what the strings are, they are all returning the same hash. Please, i need to know why it is so, or what am i doing wrong . See below my code:
$lice = $serial->sname.$serial->company.$serial->effDate.$serial->ltype;
//$serial->sname is MTS;
//$serial->company is Godowns Technology;
//$serial->effDate is 2017-01-24;
//$serial->ltype is Trial
$lice2= sha1($lice);
$lice3 = chunk_split($lice2,5,'-');
$lice4 =strtoupper($lice3);
based on the information above, the $lice4 is always return:
DA39A-3EE5E-6B4B0-D3255-BFEF9-56018-90AFD-80709
Please, i need assitance on this
| 0debug
|
Remove background-color from string in c# : <p>I want to remove background-color attribute from string (html)
example :</p>
<pre><code><p style=\"background-color:#eeeeee\">Hellow world</p>
</code></pre>
<p>will be </p>
<pre><code><p >Hellow world</p>
</code></pre>
<p>or </p>
<pre><code><p style=\"\">Hellow world</p>
</code></pre>
<p>in c#</p>
| 0debug
|
A keybindings.json per workspace in Visual Studio Code : <p>Is it possible to have a keybindings.json as part of the workspace settings instead of the user settings?</p>
<p>Since I have specific tasks associated to my workspace, I would also like to be able to assign workspace-specific shortcuts. Because I would use these shortcuts on my separate Windows and Linux environments, I would not prefer to see these key binding definitions end up amongst my environment-specific user settings.</p>
| 0debug
|
Sql Statement to get most recent records based on date time : I need help with query to fetch most recent record based on DateTime field in data base.its format is YYYY-MM-DD HH:MINS:SEC:Milliseconds
when ever new records get created in database only those records must be fetched and display on third party application.
Below queries fetch all records on application, can we put it in subquery and pull only recent records or any other best way
SELECT User.ID, User_State.Name, User_State.Code, User_State.TestState, Details.FirstName, Details.LastName,
Details.LoginName, User_State.DateTime,call.QueueCalls, call.CallsAband
FROM User INNER JOIN
User_State ON User.ID = User_State.ID INNER JOIN
Details ON User.ID = Details.ID INNER JOIN
Call ON User_State.Key = Call.Key Where User_State.DateTime >= CONVERT(DateTIme, DATEDIFF(DAY,0,GETDATE())) order by DateTime DESC
Thanks
| 0debug
|
How to make migrations for a reusable Django app? : <p>I am making a reusable Django app without a project. This is the directory structure:</p>
<pre><code>/
/myapp/
/myapp/models.py
/myapp/migrations/
/myapp/migrations/__init__.py
</code></pre>
<p>When I run <code>django-admin makemigrations</code> I get the following error:</p>
<pre><code>django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
</code></pre>
<p>Obviously, this is because I don't have a settings module configured, because this is a reusable app. However, I would still like to ship migrations with my app. How can I make them?</p>
| 0debug
|
How to understand the &-sign in Less/SCSS? : <p>I'm trying to understand the & sign in Less. According to lesscss.org, the & represents the current selector parent. So what does it mean in the instance below? The css for the container class is obvious. But what does the &-footer, .CancelButton and &-thresholds apply to?</p>
<pre><code>.container {
display: flex;
margin: 8px 0 8px 0;
line-height: 32px;
&-footer {
display: flex;
margin: 24px 0 8px 8px;
height: 32px;
justify-content: flex-end;
.CancelButton {
margin: 0;
}
}
&-thresholds {
margin: 24px 0;
}
}
</code></pre>
| 0debug
|
c# how to make tool window maximum size set to datagridview : Quick question, I have a windows form application that I am making where I have a sizeable tool window with a datagridview filling up it's entirety. The datagridview is bigger than the window's default size so I made it so the user can expand the window however the form is able to expand past the size of the datagridview which makes it look odd. You can see past the grid and the background color of the form is revealed, etc.
Is there a way to make the window where it can only be expanded to the maximum size of the full datagridview?
Thank you!
| 0debug
|
void ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
int numCB, int max_steps, int *closest_cb,
AVLFG *rand_state)
{
int dist;
elbg_data elbg_d;
elbg_data *elbg = &elbg_d;
int i, j, k, last_error, steps=0;
int *dist_cb = av_malloc(numpoints*sizeof(int));
int *size_part = av_malloc(numCB*sizeof(int));
cell *list_buffer = av_malloc(numpoints*sizeof(cell));
cell *free_cells;
int best_dist, best_idx = 0;
elbg->error = INT_MAX;
elbg->dim = dim;
elbg->numCB = numCB;
elbg->codebook = codebook;
elbg->cells = av_malloc(numCB*sizeof(cell *));
elbg->utility = av_malloc(numCB*sizeof(int));
elbg->nearest_cb = closest_cb;
elbg->points = points;
elbg->utility_inc = av_malloc(numCB*sizeof(int));
elbg->scratchbuf = av_malloc(5*dim*sizeof(int));
elbg->rand_state = rand_state;
do {
free_cells = list_buffer;
last_error = elbg->error;
steps++;
memset(elbg->utility, 0, numCB*sizeof(int));
memset(elbg->cells, 0, numCB*sizeof(cell *));
elbg->error = 0;
for (i=0; i < numpoints; i++) {
best_dist = distance_limited(elbg->points + i*elbg->dim, elbg->codebook + best_idx*elbg->dim, dim, INT_MAX);
for (k=0; k < elbg->numCB; k++) {
dist = distance_limited(elbg->points + i*elbg->dim, elbg->codebook + k*elbg->dim, dim, best_dist);
if (dist < best_dist) {
best_dist = dist;
best_idx = k;
}
}
elbg->nearest_cb[i] = best_idx;
dist_cb[i] = best_dist;
elbg->error += dist_cb[i];
elbg->utility[elbg->nearest_cb[i]] += dist_cb[i];
free_cells->index = i;
free_cells->next = elbg->cells[elbg->nearest_cb[i]];
elbg->cells[elbg->nearest_cb[i]] = free_cells;
free_cells++;
}
do_shiftings(elbg);
memset(size_part, 0, numCB*sizeof(int));
memset(elbg->codebook, 0, elbg->numCB*dim*sizeof(int));
for (i=0; i < numpoints; i++) {
size_part[elbg->nearest_cb[i]]++;
for (j=0; j < elbg->dim; j++)
elbg->codebook[elbg->nearest_cb[i]*elbg->dim + j] +=
elbg->points[i*elbg->dim + j];
}
for (i=0; i < elbg->numCB; i++)
vect_division(elbg->codebook + i*elbg->dim,
elbg->codebook + i*elbg->dim, size_part[i], elbg->dim);
} while(((last_error - elbg->error) > DELTA_ERR_MAX*elbg->error) &&
(steps < max_steps));
av_free(dist_cb);
av_free(size_part);
av_free(elbg->utility);
av_free(list_buffer);
av_free(elbg->cells);
av_free(elbg->utility_inc);
av_free(elbg->scratchbuf);
}
| 1threat
|
Non duplicate numbers in visual studio c# : I am making a C# script in visual studio for windows forms...
I need no get non duplicated numbers, and that is wha I have tried in that script, what happens is that I get this random numbers, but sometimes, those numbers are duplicated, so I would like if you tell me which mistake I have made, or even if the mistake is in that piece of code.
thanks.
[1]: https://i.stack.imgur.com/RmLUa.png
| 0debug
|
static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dest,
int width, int height, int src1Stride,
int src2Stride, int dstStride)
{
int h;
for (h=0; h < height; h++) {
int w;
if (width >= 16)
#if COMPILE_TEMPLATE_SSE2
__asm__(
"xor %%"REG_a", %%"REG_a" \n\t"
"1: \n\t"
PREFETCH" 64(%1, %%"REG_a") \n\t"
PREFETCH" 64(%2, %%"REG_a") \n\t"
"movdqa (%1, %%"REG_a"), %%xmm0 \n\t"
"movdqa (%1, %%"REG_a"), %%xmm1 \n\t"
"movdqa (%2, %%"REG_a"), %%xmm2 \n\t"
"punpcklbw %%xmm2, %%xmm0 \n\t"
"punpckhbw %%xmm2, %%xmm1 \n\t"
"movntdq %%xmm0, (%0, %%"REG_a", 2) \n\t"
"movntdq %%xmm1, 16(%0, %%"REG_a", 2) \n\t"
"add $16, %%"REG_a" \n\t"
"cmp %3, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
: "memory", XMM_CLOBBERS("xmm0", "xmm1", "xmm2",) "%"REG_a
);
#else
__asm__(
"xor %%"REG_a", %%"REG_a" \n\t"
"1: \n\t"
PREFETCH" 64(%1, %%"REG_a") \n\t"
PREFETCH" 64(%2, %%"REG_a") \n\t"
"movq (%1, %%"REG_a"), %%mm0 \n\t"
"movq 8(%1, %%"REG_a"), %%mm2 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm2, %%mm3 \n\t"
"movq (%2, %%"REG_a"), %%mm4 \n\t"
"movq 8(%2, %%"REG_a"), %%mm5 \n\t"
"punpcklbw %%mm4, %%mm0 \n\t"
"punpckhbw %%mm4, %%mm1 \n\t"
"punpcklbw %%mm5, %%mm2 \n\t"
"punpckhbw %%mm5, %%mm3 \n\t"
MOVNTQ" %%mm0, (%0, %%"REG_a", 2) \n\t"
MOVNTQ" %%mm1, 8(%0, %%"REG_a", 2) \n\t"
MOVNTQ" %%mm2, 16(%0, %%"REG_a", 2) \n\t"
MOVNTQ" %%mm3, 24(%0, %%"REG_a", 2) \n\t"
"add $16, %%"REG_a" \n\t"
"cmp %3, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
: "memory", "%"REG_a
);
#endif
for (w= (width&(~15)); w < width; w++) {
dest[2*w+0] = src1[w];
dest[2*w+1] = src2[w];
}
dest += dstStride;
src1 += src1Stride;
src2 += src2Stride;
}
__asm__(
#if !COMPILE_TEMPLATE_SSE2
EMMS" \n\t"
#endif
SFENCE" \n\t"
::: "memory"
);
}
| 1threat
|
Splitting a file records into fix number records : <p>I am having a big file having 10,000 rows, I have to call an API for those records, but only 100 rows can be used at a time, so need to pass 100 rows at a time to that restapi and it needs to be done on scala only. </p>
| 0debug
|
static int encode_superframe(AVCodecContext *avctx,
unsigned char *buf, int buf_size, void *data){
WMACodecContext *s = avctx->priv_data;
const short *samples = data;
int i, total_gain;
s->block_len_bits= s->frame_len_bits;
s->block_len = 1 << s->block_len_bits;
apply_window_and_mdct(avctx, samples, avctx->frame_size);
if (s->ms_stereo) {
float a, b;
int i;
for(i = 0; i < s->block_len; i++) {
a = s->coefs[0][i]*0.5;
b = s->coefs[1][i]*0.5;
s->coefs[0][i] = a + b;
s->coefs[1][i] = a - b;
}
}
if (buf_size < 2 * MAX_CODED_SUPERFRAME_SIZE) {
av_log(avctx, AV_LOG_ERROR, "output buffer size is too small\n");
return AVERROR(EINVAL);
}
#if 1
total_gain= 128;
for(i=64; i; i>>=1){
int error= encode_frame(s, s->coefs, buf, buf_size, total_gain-i);
if(error<0)
total_gain-= i;
}
#else
total_gain= 90;
best= encode_frame(s, s->coefs, buf, buf_size, total_gain);
for(i=32; i; i>>=1){
int scoreL= encode_frame(s, s->coefs, buf, buf_size, total_gain-i);
int scoreR= encode_frame(s, s->coefs, buf, buf_size, total_gain+i);
av_log(NULL, AV_LOG_ERROR, "%d %d %d (%d)\n", scoreL, best, scoreR, total_gain);
if(scoreL < FFMIN(best, scoreR)){
best = scoreL;
total_gain -= i;
}else if(scoreR < best){
best = scoreR;
total_gain += i;
}
}
#endif
encode_frame(s, s->coefs, buf, buf_size, total_gain);
assert((put_bits_count(&s->pb) & 7) == 0);
i= s->block_align - (put_bits_count(&s->pb)+7)/8;
assert(i>=0);
while(i--)
put_bits(&s->pb, 8, 'N');
flush_put_bits(&s->pb);
return put_bits_ptr(&s->pb) - s->pb.buf;
}
| 1threat
|
Why Deprecated issues come up : <p>Deprecated: Function create_function() is deprecated in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme-child/functions.php on line 20</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; lateset_tweets has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-twitter.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; fb_likebox_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-facebook.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pulsar_video_widgets has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-video.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pulsar_flickr has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-flickr.php on line 10</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_mailchimp_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-mailchimp.php on line 24</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_ln_quickcontact_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-quickcontact.php on line 24</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_recentposts_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-recentposts.php on line 22</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_testimonials_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-testimonials.php on line 22</p>
<p>Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; pm_eventposts_widget has a deprecated constructor in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/includes/widget-events.php on line 24</p>
<p>Deprecated: Function create_function() is deprecated in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/functions.php on line 223</p>
<p>Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/u2ot620l4yik/public_html/wp-content/plugins/js_composer/include/classes/core/class-vc-mapper.php on line 111</p>
<p>Notice: Undefined index: opt-invalid-security-code-error in /home/u2ot620l4yik/public_html/wp-content/themes/Vienna-theme/functions.php on line 1017</p>
| 0debug
|
static int init(AVFilterContext *ctx, const char *args)
{
EvalContext *eval = ctx->priv;
char *args1 = av_strdup(args);
char *expr, *buf, *bufptr;
int ret, i;
eval->class = &aevalsrc_class;
av_opt_set_defaults(eval);
buf = args1;
i = 0;
while (expr = av_strtok(buf, ":", &bufptr)) {
ret = av_expr_parse(&eval->expr[i], expr, var_names,
NULL, NULL, NULL, NULL, 0, ctx);
if (ret < 0)
i++;
if (bufptr && *bufptr == ':') {
bufptr++;
break;
buf = NULL;
eval->nb_channels = i;
if (bufptr && (ret = av_set_options_string(eval, bufptr, "=", ":")) < 0)
if (eval->chlayout_str) {
int n;
ret = ff_parse_channel_layout(&eval->chlayout, eval->chlayout_str, ctx);
if (ret < 0)
n = av_get_channel_layout_nb_channels(eval->chlayout);
if (n != eval->nb_channels) {
av_log(ctx, AV_LOG_ERROR,
"Mismatch between the specified number of channels '%d' "
"and the number of channels '%d' in the specified channel layout '%s'\n",
eval->nb_channels, n, eval->chlayout_str);
ret = AVERROR(EINVAL);
} else {
eval->chlayout = av_get_default_channel_layout(eval->nb_channels);
if (!eval->chlayout) {
av_log(ctx, AV_LOG_ERROR, "Invalid number of channels '%d' provided\n",
eval->nb_channels);
ret = AVERROR(EINVAL);
if ((ret = ff_parse_sample_rate(&eval->sample_rate, eval->sample_rate_str, ctx)))
eval->duration = -1;
if (eval->duration_str) {
int64_t us = -1;
if ((ret = av_parse_time(&us, eval->duration_str, 1)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid duration: '%s'\n", eval->duration_str);
eval->duration = (double)us / 1000000;
eval->n = 0;
end:
av_free(args1);
return ret;
| 1threat
|
modify item in database table : I have this sqlite database :
private static final String TAG = "DatabaseHelper";
private static final String TABLE_NAME = "people_table";
private static final String COL1 = "_id";
private static final String COL2 = "Hour";
private static final String COL3 = "Minutes";
private static final String COL4 = "On_Off";
How cand I modify the value of the On_Off fom 1 -> 0 and 0 -> 1 Pseudocod:
public void OnAlarm()
{
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL( "UPDATE " + TABLE_NAME + " SET " + COL4 + "=1 WHERE ");
}
public void OffAlarm()
{
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL( "UPDATE " + TABLE_NAME + " SET " + COL4 + "=0 WHERE ");
}
| 0debug
|
javascript array remove every other element : i'm looking for a way to remove array other elements.
but i don't know how to do it.
this is my array:
```
musics: [
{
id: 1,
cover: require('~/assets/images/cover/music/ali_zand_vakili_jadeh_shab.jpg'),
title: 'جاده شب',
artist: 'علی زند وکیلی',
source: 'http://media.mtvpersian.net/2019/Mar/21/Ali%20Zand%20Vakili%20-%20Jadeh%20Shab.mp3'
},
{
id: 2,
cover: require('~/assets/images/cover/music/amin_hayaei_divoone_misazi.jpg'),
title: 'دیوونه میسازی',
artist: 'امین حیایی',
source: 'https://cdnmrtehran.ir/media/mp3s_128/Amin_Hayaei/Singles/amin_hayaei_divoone_misazi.mp3'
},
{
id: 3,
cover: require('~/assets/images/cover/music/emad_talebzadeh_maghrour.jpg'),
title: 'مغرور',
artist: 'عماد طالب زاده',
source: 'https://cdnmrtehran.ir/media/mp3s_128/Emad_Talebzadeh/Singles/emad_talebzadeh_maghrour.mp3'
},
{
id: 4,
cover: require('~/assets/images/cover/music/farzad_farzin_jazzab.jpg'),
title: 'جذاب',
artist: 'فرزاد فرزین',
source: 'https://cdnmrtehran.ir/media/mp3s_128/Farzad_Farzin/Singles/farzad_farzin_jazzab.mp3'
},
{
id: 5,
cover: require('~/assets/images/cover/music/hamid_sefat_ajayeb_shahr_merat_remix.jpg'),
title: 'عجایب شهر رمیکس',
artist: 'حمید صفت',
source: 'https://cdnmrtehran.ir/media/mp3s_128/Hamid_Sefat/Singles/hamid_sefat_ajayeb_shahr_merat_remix.mp3'
}
],
```
how to remove all elements except element with id of 3 ?
| 0debug
|
How to start a new connection with CosmoDB graph database using gremlin on version ^3 : <p>I am trying to create a new gremlin client in node js, but I cannot find any documentation how to set up the connection with both a URL and a primary key (as generated in Azure CosmosDB).</p>
<p>Examples are available how to do this in versions < v3, such as <a href="https://github.com/Azure-Samples/azure-cosmos-db-graph-nodejs-getting-started/blob/master/app.js" rel="noreferrer">here</a>.</p>
<p>Documentation on the new version of gremlin is available on the <a href="http://tinkerpop.apache.org/docs/current/reference/#gremlin-javascript" rel="noreferrer">new documentation</a>, but it does not explain how to put the primary key into the objects (the package is not very clear either, I've tried to populate "cert" and "pfx" to no avail).</p>
<p>Does anyone know how I can connect to my azure CosmosDB gremlin API with node's gremlin package v^3.0.0?</p>
| 0debug
|
How to schedules jobs with specific parameters in a Jenkins multibranch pipeline : <p>We were having 2 FreeStyle projects on Jenkins:</p>
<p>One to generate builds(daily builds+manual builds), one other to execute tests.</p>
<p>We are moving to a Multibranch pipeline on jenkins, so my understanding is that we have one project per repository, and that we should use options to have different behavior.</p>
<p>So I can create parameters, to indicate if we want to run the tests, if we want to build the setups, that part I'm ok with it.</p>
<p>My issue is that I need that by default, the tests are NOT executed(because they take a lot of time to generate, and I don't want that developers can by mistake just let the "Execute tests" option checked.</p>
<p>And I need that this option is checked when executing the daily build in the night.</p>
<p>So 2 questions:</p>
<ol>
<li>How to schedule?</li>
<li>How to provide the parameters value used for this schedule?</li>
</ol>
| 0debug
|
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
int fmt;
for (fmt = 0; fmt < AV_PIX_FMT_NB; fmt++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
if (!(desc->flags & PIX_FMT_PAL ||
fmt == AV_PIX_FMT_NV21 ||
fmt == AV_PIX_FMT_NV12))
ff_add_format(&formats, fmt);
}
ff_set_common_formats(ctx, formats);
return 0;
}
| 1threat
|
void scsi_bus_legacy_handle_cmdline(SCSIBus *bus)
{
DriveInfo *dinfo;
int unit;
for (unit = 0; unit < MAX_SCSI_DEVS; unit++) {
dinfo = drive_get(IF_SCSI, bus->busnr, unit);
if (dinfo == NULL) {
continue;
}
scsi_bus_legacy_add_drive(bus, dinfo, unit);
}
}
| 1threat
|
c# get .name property from variable : I want an c# aplication in which I can modify a specified object using an int variable or with the names saved in an array(however I Prefer using an int).
Something like this
if I have 3 buttons named bt1, bt2 and bt3, and picturepath is the path to where my pictures are ="\\".
int btnum = 1;
bt + num .backgroundpicture=picturepath+num+".png";
btnum +=1;
bt + num .backgroundpicture=picturepath+num+".png";
btnum +=1;
bt + num .backgroundpicture=picturepath+num+".png";
so that it should set the backgroundpicture of bt1 to picturepath1.png, the backgroundpicture of bt2 to picturepath2.png and the backgroundpicture of bt3 to picturepath3.png
(in a realistic schenario I will use or many objects, or When I wil create an unspecified amount of objects while running the code.)
I am sorry if my question seems quite wierd written.
| 0debug
|
Why does Number.MIN_VALUE < -1219312 (or any small value) evaluate to false? : <p>I've tried this in multiple browsers and they all evaluate to false! Am I missing something here?</p>
| 0debug
|
Java has contradictory scoping : For this code sample the Java compiler is not happy:
public class Test1 {
public static void main(String args[]) {
int x = 99;
{
int x = 10;
System.out.println(x);
}
System.out.println(x);
}
}
The compiler says "error: variable x is already defined in method main(String[])".
However, the Java compiler is completely satisfied with this:
public class Test1 {
public static void main(String args[]) {
{
int x = 10;
System.out.println(x);
}
int x = 99;
System.out.println(x);
}
}
And that, gentleladies and gentlemen, is a little piece of insanity in Java. When I look up Java scoping rules, I'm almost always seeing writers describe that variables are scoped within the block level they're in, except for instances of object level variables which retain their values for the instance lifetime - and none of them explain the rules in a way that explains the way the Java compiler deals with the code samples here. But as we can see from these two obvious examples, the scoping rules don't really work they way everyone is describing them.
Will someone explain this correctly, please, so that I am understanding it properly.
| 0debug
|
What are the implications of using the "go" version directive within a go module file (go.mod) : <p>Given the following go.mod file:</p>
<pre><code>module foo
go 1.12
require (
github.com/bar/baz v1.0.0
github.com/rat/cat v1.0.0
)
</code></pre>
<p>What does the <code>go 1.12</code> indicate? Does it prevent compiling the <code>foo</code> module against any other version of Go? Or is it simply an indicator of the <code>foo</code>'s recommended/required Go version? Is this a directive that we should update whenever a new version of go is released (every 6 months)?</p>
| 0debug
|
Java program prints too many times : import java.io.*;
import java.util.*;
public class Bowling7
{
public static void main(String[] args) throws FileNotFoundException
{
Scanner fin = new Scanner(new FileReader("bowling.txt"));
String Team, Member;
int teamw, teamb, Score;
String [] blue_members = new String[3];
String [] white_members = new String[3];
int [] blue_scores = new int[3];
int [] white_scores = new int[3];
int b = 0;
int w = 0;
System.out.println(
"This program reads the lines from the file bowling.txt to determine\n"
+ "the winner of a bowling match. The winning team, members and scores\n"
+ "are displayed on the monitor.\n");
while (fin.hasNext())
{
Member = fin.next();
Team = fin.next();
Score = fin.nextInt();
if (Team.equals("Blue"))
{
blue_members[b] = Member;
blue_scores[b] = Score;
b++;
}
else
{
white_members[w] = Member;
white_scores[w] = Score;
w++;
}
}
if(sumArray(blue_scores)>sumArray(white_scores))
{
printArray("Blue", blue_members, blue_scores);
}
else
{
printArray("White", white_members, blue_scores);
}
fin.close();
}
public static int sumArray(int[] Score)
{
int sum = 0;
for (int i = 0; i < Score.length; i++)
sum += Score[i];
return sum;
}
public static void printArray(String Team, String[] Member, int[] Score)
{
for (int i = 0; i < Member.length; i++)
{
System.out.printf("Winning team:"+Team+"\n"+Member[i]+":"+Score[i]);
{
Hello! My program keeps outputting:
This program reads the lines from the file bowling.txt to determine
the winner of a bowling match. The winning team, members and scores
are displayed on the monitor.
Winning team: Blue
Fred:20
Winning team: Blue
Hilda: 24
Winning team: Blue
Pat: 51
I need it to output:
This program reads the lines from the file bowling.txt to determine
the winner of a bowling match. The winning team, members and scores
are displayed on the monitor.
Winning Team: Blue
Player Score
Fred 20
Hilda 24
Pat 51
Any help at all would be greatly appreciated I am a newbie to java programming!
| 0debug
|
static inline int decode_bytes(const uint8_t* inbuffer, uint8_t* out, int bytes){
int i, off;
uint32_t c;
const uint32_t* buf;
uint32_t* obuf = (uint32_t*) out;
off = (intptr_t)inbuffer & 3;
buf = (const uint32_t*) (inbuffer - off);
c = av_be2ne32((0x37c511f2 >> (off*8)) | (0x37c511f2 << (32-(off*8))));
bytes += 3 + off;
for (i = 0; i < bytes/4; i++)
obuf[i] = c ^ buf[i];
return off;
}
| 1threat
|
Parse File name in Bash script : <p>I have a filename in a format like:</p>
<pre><code> Master.csv-yyyy-mm-dd.txt
example:- Master.csv.2016-07-06.txt
</code></pre>
<p>I want substring from that in the following format.</p>
<pre><code> YY-MM
</code></pre>
<p>please help me quickly </p>
| 0debug
|
How to externalize application.properties in Tomcat webserver for Spring? : <blockquote>
<p>SpringApplication will load properties from application.properties
files in the following locations and add them to the Spring
Environment:</p>
<pre><code>- A /config subdirectory of the current directory.
- The current directory
- A classpath /config package
- The classpath root
</code></pre>
<p>The list is ordered by precedence (properties defined in locations
higher in the list override those defined in lower locations).</p>
</blockquote>
<p><a href="https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files" rel="noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files</a></p>
<p>Question: when running a <code>war</code> file on a <code>tomcat</code> server: how can I add an additional location for the <code>application.properties</code> <strong>outside</strong> the classpath or the tomcat container, like <code>d:\application.properties</code>?</p>
<p>The custom location should get highest precedence regarding the locations above.</p>
<p>Problem is: I could of course add a <code>/config</code> folder inside my exploded war in the tomcat <code>webapps</code> folder, but then I'd lose any custom configuration if the webapps folder is cleaned and war is redeployed.</p>
<p>Thus I'd like to add an additional location outside.</p>
| 0debug
|
Why do I have to return Unit.INSTANCE when implementing in Java a Kotlin function that returns a Unit? : <p>If I have a Kotlin function</p>
<pre><code>fun f(cb: (Int) -> Unit)
</code></pre>
<p>and I want to call <code>f</code> from Java, I have to do it like:</p>
<pre><code>f(i -> {
dosomething();
return Unit.INSTANCE;
});
</code></pre>
<p>which looks very ugly. Why can't I just write it like <code>f(i -> dosomething());</code>, since <code>Unit</code> in Kotlin is equivalent to <code>void</code> in Java?</p>
| 0debug
|
AVFrame *ff_framequeue_take(FFFrameQueue *fq)
{
FFFrameBucket *b;
check_consistency(fq);
av_assert1(fq->queued);
b = bucket(fq, 0);
fq->queued--;
fq->tail++;
fq->tail &= fq->allocated - 1;
fq->total_frames_tail++;
fq->total_samples_tail += b->frame->nb_samples;
check_consistency(fq);
return b->frame;
}
| 1threat
|
Bootstrap 4 datepicker : <p>I want to use datepicker <a href="https://bootstrap-datepicker.readthedocs.io/en/latest/index.html" rel="noreferrer">https://bootstrap-datepicker.readthedocs.io/en/latest/index.html</a> with Bootstrap 4.</p>
<p>Following the examples on above page, I can make it work with Bootstrap 3.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<main class="container">
<div class="row" style="padding-top: 100px">
<div class="col">
<input data-date-format="dd/mm/yyyy" id="datepicker">
</div>
</div>
</main>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/js/bootstrap-datepicker.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript">
$('#datepicker').datepicker({
weekStart: 1,
daysOfWeekHighlighted: "6,0",
autoclose: true,
todayHighlight: true,
});
$('#datepicker').datepicker("setDate", new Date());
</script>
</body></code></pre>
</div>
</div>
</p>
<p>Using this code datepicker appears correctly.</p>
<p>But doing the same with Bootstrap 4:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"></head>
<body>
<main class="container">
<div class="row" style="padding-top: 100px">
<div class="col">
<input data-date-format="dd/mm/yyyy" id="datepicker">
</div>
</div>
</main>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/js/bootstrap-datepicker.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script><script type="text/javascript">
$('#datepicker').datepicker({
weekStart: 1,
daysOfWeekHighlighted: "6,0",
autoclose: true,
todayHighlight: true,
});
$('#datepicker').datepicker("setDate", new Date());
</script>
</body></code></pre>
</div>
</div>
</p>
<p>Makes it look less professional:</p>
<p><a href="https://i.stack.imgur.com/mbVFO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mbVFO.png" alt="enter image description here"></a></p>
<p>Looks like font and spacing are messed up in Bootstrap 4 version.</p>
<p>How can I get same look and feel of datepicker in Bootstrap 4?</p>
<p>Thanks</p>
| 0debug
|
How to create custom Dialog in Android Studio : <p>I have designed a custom dialog in adobe xd but now I want to initiate it as in xml and in java . So what should I do now to create a custom dialog. I know hot to build a dialog box but not a custom dialog . Please help.</p>
<p><a href="https://i.stack.imgur.com/33TNu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/33TNu.png" alt="This is my designed dialog"></a></p>
| 0debug
|
Finding variance using c# : I'm trying to Add a static method to calculate the average of a, array of integers, Overload the method in a. to also calculate an array of doubles.
Add a method to calculate the sum of an array of integers or doubles
Add a method to calculate the variance in an array of integers or doubles.
Add a method to calculate the standard deviation of an array of integers or doubles.
I've finished most of the code but ran into a problem when I created the method to calculate the variance.
I've tried different things in here but it always gives me an error, I believe that the Math.Pow is what is messing this up. Is there another way and possibly simpler way to compute the variance with the rest of the code?
class States
{
private static int Sum(int[] a)
{
int sum = 0;
for (int i = 0; i < a.Length; i++)
{
sum += a[i];
}
return sum;
}
private static double Average(int[] a)
{
int sum = Sum(a);
double Avg = (double)sum / a.Length;
return Avg;
}
private static double Var(int[] a)
{
if (a.Length > 1)
{
double Avg = Average(a);
double var = 0.0;
foreach (int A in Average)
{
// Math.Pow to calculate variance?
var += Math.Pow((A - Average)), 2.0)
}
return var;
}
else
{
return 0.0;
}
private static double StdDev(double var)
{
return Math.Sqrt(var);
}
}
}
"Foreach cannot operate on a method group"
| 0debug
|
Trouble with Slot Setting for Azure App Services : <p>I need to understand Slot Application Settings better for Azure App Services. When they apply and how to use them correctly.</p>
<p>I have 2 App Services set up each running 2 slots as below.</p>
<ol>
<li>Site 1 with slot - building-staging</li>
<li><p>Site 1 with slot - staging</p></li>
<li><p>Site 2 with slot - building-production</p></li>
<li>Site 2 with slot - production</li>
</ol>
<p>So for each site, I'd like to be able to put an invalid connectionstring for the build slot in the Application Settings blade so that the site can't be accessed and will just give you basically an error page on the azuerwebsites.net url for that slot.</p>
<p>In my production slot of each I then want to put the correct connectionstring so that once swapped they will work.</p>
<p>I can not get this to work reliably, the settings don't apply when I swap. Should I be marking the connection strings on the production slot as slot settings? Should the original one on the build slot be a slot settings? Do I need some kind of nuget package installed I'm not aware of.</p>
<p>Please help</p>
| 0debug
|
what is the point of using pm2 and docker together? : <p>We have been using pm2 quite successfully for running apps on our servers. We are currently moving to docker and we saw <a href="http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/" rel="noreferrer">http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/</a></p>
<p>But what is the point of actually using both together? Does not docker provide everything pm2 does?</p>
| 0debug
|
How should we upgrade from AngularJS 1.6.4 to the latest Angular version? : <p>I'm working on a quite large enterprise software application (web-based). We're using Angular 1.6.4 since ... forever. Due to different reasons, we want to / have to upgrade from this old version to a new Angular version. I'm thinking of Angular 8 (?).</p>
<p>First off, I noticed that there is Angular-CLI. Is this the new way to use Angular? I've also found an official <a href="https://update.angular.io/#2.0:8.0" rel="nofollow noreferrer">Angular Update guide</a>. But this only ranges from version 2.0 (and we're using 1.6.4).</p>
<p>Due to the size of our application, it will probably take weeks to months to upgrade everything. What is the best way to release this? I disklike on "big" update which moves everything from 1.6.4 to >8.0. </p>
<p>I'm a little bit lost, to be honest. It would be awesome if someone could push me in the right direction. :)</p>
<p>Have a good day!</p>
| 0debug
|
Present the old small title of UINavigationBar in SwiftUI NavigationView : <p>Until now the default <code>displayMode</code> for <code>UINavigationItem</code> was small title and it changed in SwiftUI to be large by default.</p>
<p>Is it possible to use the old small title style?</p>
| 0debug
|
static int kvm_update_routing_entry(KVMState *s,
struct kvm_irq_routing_entry *new_entry)
{
struct kvm_irq_routing_entry *entry;
int n;
for (n = 0; n < s->irq_routes->nr; n++) {
entry = &s->irq_routes->entries[n];
if (entry->gsi != new_entry->gsi) {
continue;
}
entry->type = new_entry->type;
entry->flags = new_entry->flags;
entry->u = new_entry->u;
kvm_irqchip_commit_routes(s);
return 0;
}
return -ESRCH;
}
| 1threat
|
Get Byte Position during Upload Loop : <p>I am working on a function that will write data to a remote server in chunks using a 3rd party API. Through some help on Stack Overflow I was able to accomplish this, where it is now working as expected. The problem is that I can only get a single 16kb chunk to write as I will need to advance the <code>pos</code> of where the next bytes are written to.</p>
<p>The initial write starts at 0 easily enough. Due to my unfamiliarity with this though, I am unsure if the next <code>pos</code> should just be 16 or what. If it helps, the API call <code>writeFileChunk()</code> takes 3 parameters, filepath (str), pos (int64), and data (base64 encoded string).</p>
<pre><code> reader.onload = function(evt)
{
// Get SERVER_ID from URL
var server_id = getUrlParameter('id');
$("#upload_status").text('Uploading File...');
$("#upload_progress").progressbar('value', 0);
var chunkSize = 16<<10;
var buffer = evt.target.result;
var fileSize = buffer.byteLength;
var segments = Math.ceil(fileSize / chunkSize); // How many segments do we need to divide into for upload
var count = 0;
// start the file upload
(function upload()
{
var segSize = Math.min(chunkSize, fileSize - count * chunkSize);
if (segSize > 0)
{
$("#upload_progress").progressbar('value', (count / segments));
var chunk = new Uint8Array(buffer, count++ * chunkSize, segSize); // get a chunk
var chunkEncoded = btoa(String.fromCharCode.apply(null, chunk));
// Send Chunk data to server
$.ajax({
type: "POST",
url: "filemanagerHandler.php",
data: { 'action': 'writeFileChunk', 'server_id': server_id, 'filepath': filepath, 'pos': 0, 'chunk': chunkEncoded },
dataType: 'json',
success: function(data)
{
console.log(data);
setTimeout(upload, 100);
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert("Status: " + textStatus); alert("Error: " + errorThrown); alert("Message: " + XMLHttpRequest.responseText);
}
});
}
else
{
$("#upload_status").text('Finished!');
$("#upload_progress").progressbar('value', 100);
getDirectoryListing(curDirectory);
}
})()
};
</code></pre>
| 0debug
|
CMD\DOS create Loop for run Files : I have a folder in **%temp%\test\** with some files, now i need to run each files from cmd like:
for /r %%f in (%temp%\test\*) do (
start "'%~nxI'"
)
This code not working files are .exe, jpg and others...
| 0debug
|
Edit text Password Toggle Android : <p>I am trying to show user the typed password in edit text whose input type is text Password.</p>
<p>I implemented gesturelistener over the toggle icon like this-</p>
<pre><code>public boolean onTouch(View view, MotionEvent motionEvent) {
switch (view.getId())
{
case R.id.ivPasswordToggle:
switch ( motionEvent.getAction() ) {
case MotionEvent.ACTION_DOWN:
Toast.makeText(getContext(),"show",Toast.LENGTH_SHORT).show();
etPassword.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
break;
case MotionEvent.ACTION_UP:
etPassword.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
Toast.makeText(getContext(),"hide",Toast.LENGTH_SHORT).show();
break;
}
break;
}
return true;
}
</code></pre>
<p>i dont know what is wrong, any help will be appreciated.</p>
| 0debug
|
How to integrate two application in one application in iOS : <p>How to integrate two application in one application in iOS.I need to open different application on click tab of my main application. </p>
| 0debug
|
react-native run-android builds an old version of the code onto device : <p>This occurs in both production and dev builds. I can connect to the dev server, reload, and the new code is built and runs on the device.</p>
<p>Step-by-step of what I have tried:</p>
<ol>
<li><p>Modify code.</p></li>
<li><p>Re-bundle:</p></li>
</ol>
<p><code>react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
</code></p>
<ol start="3">
<li><p><code>./gradlew clean</code></p></li>
<li><p><code>react-native run-android</code> - Builds old version</p></li>
<li><p><code>react-native run-android --variant=release</code> - Builds old version</p></li>
</ol>
<p>Is there any way to completely wipe the <code>android</code> build and build from scratch? My gut tells me that <code>run-android</code> is not performing a full clean build.</p>
| 0debug
|
static int do_req(int sockfd, AioContext *aio_context, SheepdogReq *hdr,
void *data, unsigned int *wlen, unsigned int *rlen)
{
Coroutine *co;
SheepdogReqCo srco = {
.sockfd = sockfd,
.aio_context = aio_context,
.hdr = hdr,
.data = data,
.wlen = wlen,
.rlen = rlen,
.ret = 0,
.finished = false,
};
if (qemu_in_coroutine()) {
do_co_req(&srco);
} else {
co = qemu_coroutine_create(do_co_req);
qemu_coroutine_enter(co, &srco);
while (!srco.finished) {
aio_poll(aio_context, true);
}
}
return srco.ret;
}
| 1threat
|
Datatables.net with ReactJS, render a ReactJS component in a column : <p>i have the following component with datatables:</p>
<pre><code>import React, { Component } from 'react'
import { Link } from 'react-router'
import { PanelContainer, Panel, PanelBody, Grid, Row, Col } from '@sketchpixy/rubix'
import $ from 'jquery'
import DataTable from 'datatables.net'
$.DataTable = DataTable
const columns = [{
title: '<input type="checkbox" />',
data: 'check',
}, {
title: 'Foto',
data: 'avatar',
}, {
title: 'Nombre',
data: 'name',
}, {
title: 'Dirección',
data: 'address',
}, {
title: 'Clasificación',
data: 'clasification',
}, {
title: 'Editar',
data: 'editLink',
render: x => `<a href="${x}"><i class="icon-fontello-edit"></i></a>`, // <-- this line i'm interested!
}]
class Table extends Component {
transform(content) {
return content.map(x => ({
...x,
check: '<input type="checkbox" />',
avatar: '<img src="/public/imgs/app/nico.jpg" width="40" height="40" style="border-radius: 100%;">',
clasification: `<i class="${x.clasification.icon}"></i> ${x.clasification.name}`,
}))
}
componentDidMount(nextProps, nextState) {
this.table = $(this.refs.main).DataTable({
dom: '<"data-table-wrapper"tip>',
data: [],
columns,
language: {
info: 'Mostrando _START_-_END_ de _TOTAL_ puntos',
infoEmpty: 'No hay puntos',
paginate: {
next: 'Siguiente',
previous: 'Anterior',
},
},
})
}
componentWillUpdate() {
this.table.clear()
this.table.rows.add(this.transform(this.props.data))
this.table.draw()
}
componentWillUnmount() {
$('.data-table-wrapper')
.find('table')
.DataTable()
.destroy(true)
}
render() {
return (
<table
className="table table-striped hover"
cellSpacing="0"
width="100%"
ref="main"
/>
)
}
}
export default p =>
<PanelContainer>
<Panel>
<PanelBody>
<Grid>
<Row>
<Col xs={12}>
<Table data={p.data} />
</Col>
</Row>
</Grid>
</PanelBody>
</Panel>
</PanelContainer>
</code></pre>
<p>The problem is that, with datatables, i need to render a Link with react router, using an anchorlink () is not a solution because it will re-render the whole page. So i need to render a custom component in the column with the specified link. The link is constructed with the ID.</p>
| 0debug
|
Counting unique values in Excel : <p>I have a list that looks like this:</p>
<pre><code>Location ID
______________
Boston 12
Boston 12
Boston 12
Boston 57
Boston 99
Chicago 12
Chicago 13
...
</code></pre>
<p>For each Location I want to count up the number of unique IDs. Boston would have 3 and Chicago would have 2 for example.</p>
<p>I can use Advanced filter by unique records but I want to know how to do this using an Excel formula.</p>
| 0debug
|
What means this part of JavaScript code : <p>please i need to know what means this part of code, i couldn't especially understand the condition</p>
<pre><code>var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else {
// browser global
window.classie = classie;
}
</code></pre>
| 0debug
|
How to make right loping trough while in Python : I am trying to make looping . I want an output of number from 1-10 squared
Here is my code. what is wrong ?
for num in range(1, 10):
print (num)
while num < 10:
num = num ** 2
print(str(num))
| 0debug
|
How to persist svelte store : <p>Is there any direct option to persist svelte store data so that even when the page is refreshed, data will be available. </p>
<p>I am not using local storage since I want the values to be reactive. </p>
| 0debug
|
Flutter - how to filter debug console in vscode : <p>For a few days, and without changing anything, at least deliberately, in <code>DEBUG CONSOLE</code> in <code>VSCODE</code> I get messages like:</p>
<pre><code>W/.arae_blueprin(14366): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
W/.arae_blueprin(14366): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
W/.arae_blueprin(14366): Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
W/.arae_blueprin(14366): Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
D/EGL_emulation(14366): eglMakeCurrent: 0xe1641400: ver 2 0 (tinfo 0xd5f83710)
D/EGL_emulation(14366): eglMakeCurrent: 0xc1f7c2e0: ver 2 0 (tinfo 0xbd495c10)
D/eglCodecCommon(14366): setVertexArrayObject: set vao to 6 (6) 0 0
W/.arae_blueprin(14366): Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
I/DynamiteModule(14366): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21200
I/DynamiteModule(14366): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21200
D/eglCodecCommon(14366): setVertexArrayObject: set vao to 4 (4) 0 0
D/eglCodecCommon(14366): setVertexArrayObject: set vao to 0 (0) 1 2
D/eglCodecCommon(14366): setVertexArrayObject: set vao to 0 (0) 1 2
D/eglCodecCommon(14366): setVertexArrayObject: set vao to 4 (4) 1 30
</code></pre>
<p>These messages make it difficult for me to read the logs that I send by console.</p>
<p>How can I filter them so they don't appear, or at least filter my own logs?. Thanks.</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.