problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
i am trying to display the selection of the combo Box in the Selection panel's text field : public void actionPerformed (ActionEvent event)
{
JComboBox cb = (JComboBox) event.getSource();
Object selected = cb.getSelectedItem();
textField.setText((String) cb.getSelectedItem());
}
});
| 0debug
|
How to make a 'Select' component as required in Material UI (React JS) : <p>I want to display like an error with red color unless there is a selected option.
Is there any way to do it. </p>
| 0debug
|
node-gyp compiling against wrong NODE_MODULE_VERSION : <p>I've set up a Gitlab CI pipeline which is compiling a native nodejs addon in the first stage and running some tests with it in the second one.
The job is running on the same Docker image: </p>
<pre><code>FROM ubuntu:18.04
RUN apt update
RUN apt install -y git cmake gcc build-essential nodejs npm curl
RUN npm i -g n
RUN n latest
RUN npm i -g node-gyp
RUN npm i -g yarn
</code></pre>
<p>Although the both stages are running on the same docker image, I get the following error message when running the test:</p>
<pre><code>Error: The module '<path_to_module>'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 57.
</code></pre>
<p>Even giving node-gyp the desired target in form of the current nodejs version doesn't change this:</p>
<pre><code>node-gyp configure --target=$(node --version)
node-gyp build --target=$(node --version)
</code></pre>
<p>Downgrading the nodejs version makes the error disappear:<br>
In the Dockerfile:</p>
<pre><code>RUN n 8.15.0
</code></pre>
<p>How can I compile my native addon against the LTS version of nodejs (currently 10.15.1)</p>
| 0debug
|
Restarting AWS lambda function to clear cache : <p>I have a AWS Lambda function that creates an object from a s3 call in cold start. I then hold the object in the cache while the function is warm to keep load times down. When files are changed in s3, I have a trigger to run the lambda, but not all the running instances of lambda restart and pull from s3.</p>
<p>Is there a way to bring down all instances of lambda forcing a full cold start?</p>
<p>Also, I don't want to use python.</p>
| 0debug
|
Electron app cant find sqlite3 module : <p>In my electron app I have installed sqlite3 via npm</p>
<pre><code>npm install sqlite3
</code></pre>
<p>But once i try to interact with the database it cant find the database, here is the log:</p>
<blockquote>
<p>Uncaught Error: Cannot find module 'D:\play\electron-quick-start\node_modules\sqlite3\lib\binding\electron-v1.3-win32-x64\node_sqlite3.node'</p>
</blockquote>
<p>Here is JS code:</p>
<pre><code>console.log('whooooo');
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('../db/info.db');
db.serialize(function () {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", function (err, row) {
console.log(row.id + ": " + row.info);
});
});
db.close();
</code></pre>
<p>I also try in this way:</p>
<pre><code>npm install sqlite3 --build-from-source
</code></pre>
<p>but it fails to install!</p>
<p>Also, i am using Python3. How do you install a module to work with electron? </p>
| 0debug
|
Combining integers into a DateTime c# : I have 3 integer values and I'm trying to combine them to create a datetime variable. I'm trying to do this as I'm needing the user to specify the year through a datetimepicker and then in an array I need the date to start at the first day of the first month of that year.
Currently I have,
int b = 1;
int m = 1;
int y = dateTimePicker1.Value.Year;
DateTime newdate = new DateTime(b, m, y);
I've tried a whole range of different ways of combing the integers together to form 1/1/2017. I know that the integers are holding the correct values when the error appears, but the newdate value is 01/01/0001 12:00:00:AM.
I dont know why the integer y is being changed from 2017 to 0001?
As a result the error message is, Year, Month and Day parameters describe an un-representable DateTime.
| 0debug
|
How to use keyboards fonction with _getch(), as it is possible with getline()? : My problem is that I want to do a special thing when my user is pushing tabulation in the terminal. My first code explains that :
char buffer[100];
while (true)
{
std::cin.getline(buffer, 100); // do IMMEDIATELY something if 'tabulation' was used ?
}
So I asked myself how to check every chars ? I tried with **_getch();**
while (true)
{
c = _getch();
if (c == '\t')
// do something special
else
std::cout << (char)c;
}
But now, I can't use any specials functions keys as arrows, del, suppr, etc... I can't ***move*** into what am I typing as I can with `getline()`
So is there any solutions to do a special interruption in a middle of a `getline()` ?
Or is it possible to use `_getch()` in a different way ?
I also tried to do an other thread (one with `getline()` and the other with `_getch()` for checking every ) but I'm not so sure about what I can do with threads.
It could be possible to handle every special function (arrows keys, del, suppr, etc...) 'manually' but I'm looking for another solution.
Thank you !
| 0debug
|
Update code to swift 2 : <p>How do i update following code to swift 2 i am new</p>
<pre><code>if let rtf = NSBundle.mainBundle().URLForResource("rtfdoc", withExtension: "rtf", subdirectory: nil, localization: nil) {
let attributedString = NSAttributedString(fileURL: rtf, options: [NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType], documentAttributes: nil, error: nil)
textView.attributedText = attributedString
textView.editable = false
</code></pre>
| 0debug
|
static int nic_can_receive(void *opaque)
{
dp8393xState *s = opaque;
if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN))
return 0;
if (s->regs[SONIC_ISR] & SONIC_ISR_RBE)
return 0;
return 1;
}
| 1threat
|
How do I make every Monday Bold in the monthCalendar control? : <p>I am developing an application. I initially wanted to allow the user to ONLY select a Monday. After spending a considerable amount of time, I found out that that wont be possible unless i create my own control.</p>
<p>Therefore i wanted to know how do I make Monday's Bold (and even change the background color) so it's more noticeable?</p>
<p>Is there a way to programatically select a Monday (of the same week) no matter what day is selected on the week?</p>
<p>For example, if they click 2/16, that 2/13 would automatically be selected.</p>
| 0debug
|
Image in <title> : <p>As far as I read, the <code><title></code> element just accepts plain text.</p>
<p><a href="https://i.stack.imgur.com/ZBMDS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZBMDS.png" alt="title image"></a>
<a href="https://i.stack.imgur.com/zO0rP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zO0rP.png" alt="title image 2"></a></p>
<p>So how they managed to add an image to it?</p>
| 0debug
|
Intellij: Change project indent from 4 spaces to 2 spaces : <p>Currently, all of my project files are indented with 4 spaces. I want to change that to 2 spaces as my organization uses 2 as an standard, but can't find any answers.</p>
| 0debug
|
cannot write mode RGBA as JPEG : <p>I am learning to use 'pillow 5.0' following book 'Automate the boring stuff with python'</p>
<p>The info about the image object</p>
<pre><code>In [79]: audacious = auda
In [80]: print(audacious.format, audacious.size, audacious.mode)
PNG (1094, 960) RGBA
</code></pre>
<p>When I tried to convert filetype, it report error.</p>
<pre><code>In [83]: audacious.save('audacious.jpg')
OSError: cannot write mode RGBA as JPEG
</code></pre>
<p>There's no such a
n error in book.</p>
| 0debug
|
Is it possible to use image-set *and* multiple images at the same time? : <p>I'm currently going through with my team and finishing up our latest site, optimizing images and all that good stuff.</p>
<p>I've come across a small dilemma.
We have many background images. I wish to optimize them on supporting browsers using image-set, but I also love using <a href="https://csswizardry.com/2016/10/improving-perceived-performance-with-multiple-background-images/" rel="nofollow noreferrer">this technique</a> to improve perceived load times and for the nice added touch it gives. If I <em>do</em> have to choose, of course I'll go for the optimization.</p>
<p><strong>So</strong>, my question to you all is this:
Can I use image-set as one of multiple backgrounds? If so, can you provide a working example? I gave it a go, but the browser rejected the code completely and so I just got the strikeouts in the inspector.</p>
<p>Here is an example of my code (as I am working in liquid and would prefer to not have to translate this it to true CSS unless needed):</p>
<pre><code>background: image-set(
url("URL") 1x,
url("URL") 2x,
url("URL") 3x,
url("URL") 4x,
) center / 100% auto no-repeat,
linear-gradient(to right, #564029 0%, #6c5a43 50%, #6c573c 75%, #5d472f 100%) center / 100% auto no-repeat,
#72573c;
</code></pre>
<p>Feel free to point out if I've just missed something in my code. If nothing else, I hope this serves as something for someone else to stumble upon.</p>
<p>As far as things I've looked into for reference:</p>
<ul>
<li>I've looked at <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Backgrounds_and_Borders/Using_multiple_backgrounds" rel="nofollow noreferrer">multiple background examples</a></li>
<li>I've looked at <a href="https://www.hongkiat.com/blog/css-image-set/" rel="nofollow noreferrer">image-set examples</a></li>
<li>I did a reasonable dive into Google to try and find an example of the two combined. I won't say I was surprised to find nothing.</li>
</ul>
<p>Final note, I am aware that the -webkit- prefix is still necessary. </p>
| 0debug
|
Find minimum value in a dictionary : <p>Suppose we have a python dictionary that stores grades with respect to roll numbers.
dict = {1:90,2:40,3:98}. If we use min(dict) then the output will be 1. How can we find the least marks out of the group(in this case 40). Also can we find the index of the returned value?</p>
| 0debug
|
What's the difference between Cluster and Instance in AWS Aurora RDS : <p>I guess the title is pretty objective, but just to clarify:</p>
<p>When you create an Aurora Database Instance, it is asked to give a name for a Database Instance, a Database Cluster and a Database (where the name of the Database is optional, and no databases are created if it is not specified...). When you create another instance, you have to give the name for both again, and neither of them can be the same one as the first ones.</p>
<p>So, what's the difference between an Aurora Database Instance and an Aurora Database Cluster?</p>
<p>Also, can (and when do) you connect to each one of them?</p>
<p>Thanks!!</p>
| 0debug
|
how to find application builder in apex 5 to build first application : I got started with oracle apex 5 and lately finished apex installation, I want to start building first application.. I found in apex documentation that I should start with application builder but I didn't find it in my environment.
when I login to apex the environment appears as in this image.[enter image description here][1]
[1]: http://i.stack.imgur.com/kHFto.jpg
| 0debug
|
static int gif_encode_close(AVCodecContext *avctx)
{
GIFContext *s = avctx->priv_data;
av_frame_free(&avctx->coded_frame);
av_freep(&s->lzw);
av_freep(&s->buf);
return 0;
}
| 1threat
|
Using plotly without online plotly account : <p>Is it possible to use the plotly library to create charts in python without having an online plotly account? I think the code is opensource <a href="https://github.com/plotly/plotly.py" rel="noreferrer">https://github.com/plotly/plotly.py</a>. I would like to know whether we can use this without an online account.</p>
| 0debug
|
static int qcow2_update_ext_header(BlockDriverState *bs,
const char *backing_file, const char *backing_fmt)
{
size_t backing_file_len = 0;
size_t backing_fmt_len = 0;
BDRVQcowState *s = bs->opaque;
QCowExtension ext_backing_fmt = {0, 0};
int ret;
if (backing_fmt && !backing_file) {
return -EINVAL;
}
if (backing_fmt) {
ext_backing_fmt.len = cpu_to_be32(strlen(backing_fmt));
ext_backing_fmt.magic = cpu_to_be32(QCOW_EXT_MAGIC_BACKING_FORMAT);
backing_fmt_len = ((sizeof(ext_backing_fmt)
+ strlen(backing_fmt) + 7) & ~7);
}
if (backing_file) {
backing_file_len = strlen(backing_file);
}
size_t header_size = sizeof(QCowHeader) + backing_file_len
+ backing_fmt_len;
if (header_size > s->cluster_size) {
return -ENOSPC;
}
size_t ext_size = header_size - sizeof(QCowHeader);
uint8_t buf[ext_size];
size_t offset = 0;
size_t backing_file_offset = 0;
if (backing_file) {
if (backing_fmt) {
int padding = backing_fmt_len -
(sizeof(ext_backing_fmt) + strlen(backing_fmt));
memcpy(buf + offset, &ext_backing_fmt, sizeof(ext_backing_fmt));
offset += sizeof(ext_backing_fmt);
memcpy(buf + offset, backing_fmt, strlen(backing_fmt));
offset += strlen(backing_fmt);
memset(buf + offset, 0, padding);
offset += padding;
}
memcpy(buf + offset, backing_file, backing_file_len);
backing_file_offset = sizeof(QCowHeader) + offset;
}
ret = bdrv_pwrite(bs->file, sizeof(QCowHeader), buf, ext_size);
if (ret < 0) {
goto fail;
}
uint64_t be_backing_file_offset = cpu_to_be64(backing_file_offset);
uint32_t be_backing_file_size = cpu_to_be32(backing_file_len);
ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, backing_file_offset),
&be_backing_file_offset, sizeof(uint64_t));
if (ret < 0) {
goto fail;
}
ret = bdrv_pwrite(bs->file, offsetof(QCowHeader, backing_file_size),
&be_backing_file_size, sizeof(uint32_t));
if (ret < 0) {
goto fail;
}
ret = 0;
fail:
return ret;
}
| 1threat
|
static void avc_luma_mid_16w_msa(const uint8_t *src, int32_t src_stride,
uint8_t *dst, int32_t dst_stride,
int32_t height)
{
uint32_t multiple8_cnt;
for (multiple8_cnt = 2; multiple8_cnt--;) {
avc_luma_mid_8w_msa(src, src_stride, dst, dst_stride, height);
src += 8;
dst += 8;
}
}
| 1threat
|
how to allow ECS task access to RDS : <p>I have an ECS task executed from a Lambda function. This task will perform some basic SQL operations (e.g. SELECT, INSERT, UPDATE) on an RDS instance running MySQL. What is the proper way to manage access from the ECS task to RDS?</p>
<p>I am currently connecting to RDS using a security group rule where port 3306 allows a connection from a particular IP address (where an EC2 instance resides).</p>
<p>I am in the process of moving this functionality from EC2 to the ECS task. I looked into IAM policies, but the actions appear to manage AWS CLI RDS operations, and are likely not the solution here. Thanks!</p>
| 0debug
|
Cisco VPN client on Ubuntu 16.04 LTS : <p>I am trying to install Cisco VPN Client on Ubuntu, but I am facing problems.
So How can I install it on Ubuntu 16.04 LTS ?</p>
| 0debug
|
How to split string into arrays based on html tag : <p>I have a string having HTML tags and I would like to explode into arrays as like below</p>
<p>The tags I am considering to explode are : <code>p, h1, h2, h3, h4, h5, <ul>, <ol></code></p>
<p>Example: </p>
<pre><code>$data ="<p> Paragraph 1 </p> <h2>h2 tag 1 </h2> <p> Paragraph 2.</p> <p>Paragraph 3 </p> <ol> <li>pizza</li> <li>burgers</li> <li>salad</li> </ol> <ul> <li> <ul> <li> One </li> <li>Twp </li> <li>Three</li> </ul> </li> </ul> <p> Paragraph
5 </p> <p>Paragraph 6:</p> <h4> h4 tag</h4> <h1> h4 tag</h1> <h4> h4 tag</h4>"
</code></pre>
<p>I need the following output:</p>
<pre><code>$array_tags= [
0 => <p> Paragraph 1 </p>,
1 => <h2>h2 tag 1 </h2>,
2 => <p> Paragraph 2 </p>,
3 => <p> Paragraph 3 </p>,
4 => <ol> <li>pizza</li> <li>burgers</li> <li>salad</li> </ol>,
5 => <p> Paragraph 4 </p>,
6 => <ul> <li> <ul> <li> One </li> <li>Twp </li> <li>Three</li> </ul> </li> </ul>,
7 => <p> Paragraph 5 </p>,
8 => <p> Paragraph 6 </p>,
9 => <h4> h4 tag</h4>,
10 => <h1> h1 tag</h1>,
];
</code></pre>
<p>Could someone please help here? Thanks in advance!</p>
| 0debug
|
Russell's paradox in C++ templates : <p>Consider this program:</p>
<pre><code>#include <iostream>
#include <type_traits>
using namespace std;
struct russell {
template <typename barber,
typename = typename enable_if<!is_convertible<barber, russell>::value>::type>
russell(barber) {}
};
russell verify1() { return 42L; }
russell verify2() { return 42; }
int main ()
{
verify1();
verify2();
cout << is_convertible<long, russell>::value;
cout << is_convertible<int, russell>::value;
return 0;
}
</code></pre>
<p>If some type <code>barber</code> is not convertible to <code>russell</code>. we attempt to create a paradox by making it convertible (enabling a converting constructor).</p>
<p>The output is <code>00</code> with three popular compilers, though constructors are evidently working. </p>
<p>I suspect the behaviour should be undefined, but cannot find anything in the standard.</p>
<p>What should the output of this program be, and why?</p>
| 0debug
|
C/C++ convert int to char (ASCII value) : I am trying to convert an `int` to a `char` using ASCII value. the `int` is randomly generated between `97` and `122` (from a to z).
So my question is all about how to make a random number between 97 and 122 and how to convert this value to a char.
(before I was able to make it easily but it's been a while I didn't code in C/C++, so I don't remember well how it works)
| 0debug
|
How to reset the index to 0 in an arraylist : As per the flow..
I added 3 values to arraylist
then removed the value for the index 1
then when i am trying to display all values using for loop, i am getting below error.
**Code** marked where the exception occurred
[Code][1]
Below is the error message
[error][2]
[1]: http://i.stack.imgur.com/nY4Wc.png
[2]: http://i.stack.imgur.com/Sr2f5.png
| 0debug
|
While doesn't approve true requirement : <p>Variable i will be 0 in the end. Am I having serious problem in visual studio or in my brain? </p>
<pre><code>double value = 0.0001;
int i = 0;
while(value < 0)
{
value *= 10;
i++;
}
Console.WriteLine(i);
Console.ReadLine();
</code></pre>
| 0debug
|
Prohibit app access in android : <p>My question is if it's possible to create an app where the user can temporarily block several apps, so he can prohibit using an app for an optimal time?</p>
| 0debug
|
Can't get data from JSON status undefined? : <p>I am trying to get the <code>status</code> of <code>de.zip-code</code> but get a error <code>Cannot read property 'status' of undefined</code>. In my js file I have this </p>
<p><code>$.getJSON("link", function(json) { let creditcheck = json.de_zip_code.status;</code> and more.</p>
<pre><code>{
de.zip-code: {
status: "RED",
link: "link",
text: "text"
},
glasvezel-availability: {
status: "RED",
link: "link",
text: "text"
}
}
</code></pre>
| 0debug
|
Why do round() and math.ceil() give different values for negative numbers in Python 3? : <p>Why do round() and math.ceil() give different values for negative numbers in Python 3?</p>
<p>For example,</p>
<pre><code>round(-5.5) = -6
round(-5.7) = -6
math.ceil(-5.5) = -5
math.ceil(-5.7) = -5
</code></pre>
| 0debug
|
static int sdp_parse_rtpmap(AVCodecContext *codec, RTSPStream *rtsp_st, int payload_type, const char *p)
{
char buf[256];
int i;
AVCodec *c;
const char *c_name;
get_word_sep(buf, sizeof(buf), "/", &p);
if (payload_type >= RTP_PT_PRIVATE) {
RTPDynamicProtocolHandler *handler= RTPFirstDynamicPayloadHandler;
while(handler) {
if (!strcasecmp(buf, handler->enc_name) && (codec->codec_type == handler->codec_type)) {
codec->codec_id = handler->codec_id;
rtsp_st->dynamic_handler= handler;
if(handler->open) {
rtsp_st->dynamic_protocol_context= handler->open();
}
break;
}
handler= handler->next;
}
} else {
codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);
}
c = avcodec_find_decoder(codec->codec_id);
if (c && c->name)
c_name = c->name;
else
c_name = (char *)NULL;
if (c_name) {
get_word_sep(buf, sizeof(buf), "/", &p);
i = atoi(buf);
switch (codec->codec_type) {
case CODEC_TYPE_AUDIO:
av_log(codec, AV_LOG_DEBUG, " audio codec set to : %s\n", c_name);
codec->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE;
codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;
if (i > 0) {
codec->sample_rate = i;
get_word_sep(buf, sizeof(buf), "/", &p);
i = atoi(buf);
if (i > 0)
codec->channels = i;
}
av_log(codec, AV_LOG_DEBUG, " audio samplerate set to : %i\n", codec->sample_rate);
av_log(codec, AV_LOG_DEBUG, " audio channels set to : %i\n", codec->channels);
break;
case CODEC_TYPE_VIDEO:
av_log(codec, AV_LOG_DEBUG, " video codec set to : %s\n", c_name);
break;
default:
break;
}
return 0;
}
return -1;
}
| 1threat
|
TextInputLayout set error without message? : <p>Is is possible to set error on Text Input Layout without showing any error message (i'm already doing it in another place)?.</p>
<pre><code>textinputlayout.setError("");
</code></pre>
<p>won't work unfortunately.</p>
<p>What i basically need is the textInputLayout to change its line color to red, but i need to do it programmatically. Thank you</p>
| 0debug
|
Python post request with Bearer token : <p>Im trying to make a script that post data on REST service together with Bearer token. </p>
<p>Here is working PHP example:</p>
<pre><code>$postData = array( 'app' => 'aaaa' );
$ch = curl_init($apiUrl);
curl_setopt_array($ch, array(
CURLOPT_HTTPHEADER, ['Authorization: Bearer '.$accessToken],
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_POSTFIELDS => json_encode($postData)
));
$response = curl_exec($ch);
</code></pre>
<p>Im trying to do the same with python. Here is what i got so far...</p>
<pre><code>import urllib2, urllib
import json
auth_token='kbkcmbkcmbkcbc9ic9vixc9vixc9v'
hed = {'Authorization': 'Bearer ' + auth_token}
data = urllib.urlencode({'app' : 'aaaaa'})
url = 'https://api.xy.com'
req = urllib2.Request(url=url, headers=hed, data=data)
content = urllib2.urlopen(req).read()
print content
</code></pre>
<p>I get HTTP Error 400: Bad Request.
Any help appretiated...</p>
| 0debug
|
I am still a beginner please help.Python programmers : I am still at the learning process of python,so I am a beginner obviously.I have got a question.That is a code that is written in python that should encrypt the word or sentence the user inputs.It should change every letter or number to the next one.but it doesn't work.like if I throw:**abcdefghijklmnopqrstuvwxyz1234567890**, it returns:**cceeggiikkmmooqqssuuwwyyaa2355679902**.How can I solve this and why doesn't it work?Please help ASAP
Here is the code:
joka = raw_input("PLease enter a word:" )
def replace_all(text, dic):
for i, j in dic.iteritems():
text = text.replace(i, j)
return text
reps = {'a':'b', 'b':'c', 'c':'d', 'd':'e', 'e':'f', 'f':'g', 'g':'h', 'h':'i', 'i':'j', 'j':'k', 'k':'l', 'l':'m', 'm':'n', 'n':'o', 'o':'p', 'p':'q', 'q':'r', 'r':'s', 's':'t', 't':'u', 'u':'v', 'v':'w', 'w':'x', 'x':'y', 'y':'z', 'z':'a', '1':'2', '2':'3', '3':'4', '4':'5', '5':'6', '6':'7', '7':'8', '8':'9', '9':'0', '0':'1'}
j0ka = replace_all(joka, reps)
print j0ka
| 0debug
|
e1000_can_receive(void *opaque)
{
E1000State *s = opaque;
return (s->mac_reg[RCTL] & E1000_RCTL_EN);
}
| 1threat
|
uint64_t helper_sublv(CPUAlphaState *env, uint64_t op1, uint64_t op2)
{
uint32_t res;
res = op1 - op2;
if (unlikely((op1 ^ op2) & (res ^ op1) & (1UL << 31))) {
arith_excp(env, GETPC(), EXC_M_IOV, 0);
}
return res;
}
| 1threat
|
Edit maven's settings.xml from Intellij : <p>In Netbeans, maven's <code>settings.xml</code> file is part of every project and can easily be edited from each project:</p>
<p><a href="https://i.stack.imgur.com/foPEV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/foPEV.png" alt="enter image description here"></a></p>
<p>Is there something similar in Intellij or do I need to manually open the file?</p>
| 0debug
|
My C code is kinda drunk : I'm so confused here... why this code of mine doesn't work as it SHOULD be..
Here's the code:
void print(int x) {
x = 140;
int i,total, length, XLength;
if (x < 10){XLength = 0;}
else {
int sum = 1;
for (i = 0 ; i < 10 ; i++){
total = 10 * sum; sum = total; length = x / total;
if (length < 10 && 1 <= length){ XLength = i+1; break;}
}}
XLength = pow(10,XLength);
printf("%d\n",XLength);
}
Let me explain how the code should works first: It takes an integer x and print out the highest power of 10 value it can be divided by.
So if X = 80, it should print 10 and if x = 12435, it should print 10000.
But... this doesn't work with my code perfectly... if x = 140, it prints 99 but.. if x = 1400, it prints 1000.. then again, if x = 14000 it prints 9999 and if x = 140000 it prints 100000 and the sequence continues...
I've already tried exactly the same code in Java and it works perfectly!!
Why does it not works in C??
| 0debug
|
HAproxy domain name to backend mapping for path(url) based routing : <p>Does HAProxy support domain name to backend mapping for path based routing. </p>
<p>Currently it does support maps for vhost:</p>
<pre><code>frontend xyz
<other_lines>
use_backend backend1 if { hdr(Host) -i myapp.domain1.com }
use_backend backend2 if { hdr(Host) -i myapp.domain2.com }
</code></pre>
<p>Can be rewritten using maps as:</p>
<pre><code>frontend xyz
<other_lines>
use_backend %[req.hdr(host),lower,map_dom(/path/to/map,default)]
</code></pre>
<p>With the contents of map file as:</p>
<pre><code>#domainname backendname
myapp.domain1.com backend1
myapp.domain2.com backend2
</code></pre>
<p>But if the routing is based on paths as shown in the example below:</p>
<pre><code>frontend xyz
acl host_server_myapp hdr(host) -i myapp.domain.com
acl path_path1 path_beg /path1
acl path_path2 path_beg /path2
use_backend backend1 if host_server_myapp path_path1
use_backend backend2 if host_server_myapp path_path2
</code></pre>
<p>Is it possible to have mapping for this usecase? Using <code>base</code> instead of hdr(host) might give the entire path but it will not have the flexibility of domains since <code>base</code> is string comparison. Is there an other way to convert this to haproxy maps.</p>
| 0debug
|
The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3 was found instead : <p>I'm getting the following error when I do npm run build:</p>
<blockquote>
<p>The Angular Compiler requires TypeScript >=3.4.0 and <3.5.0 but 3.5.3
was found instead.</p>
</blockquote>
<p>I've tried following things separately:</p>
<blockquote>
<p>npm install typescript@">=3.4.0 <3.5.0". Then deleted node_modules and package.json. Run npm install</p>
<p>npm update --force.
Then deleted node_modules and package.json. Run npm install</p>
</blockquote>
<p>I'm still getting the error:</p>
<p>My package.json contains following dependencies:</p>
<pre><code> "dependencies": {
"@angular/animations": "8.1.0",
"@angular/cdk": "^8.0.2",
"@angular/cli": "^8.1.0",
"@angular/common": "8.1.0",
"@angular/compiler": "8.1.0",
"@angular/core": "8.1.0",
"@angular/forms": "8.1.0",
"@angular/http": "7.2.15",
"@angular/material": "^8.0.2",
"@angular/platform-browser": "8.1.0",
"@angular/platform-browser-dynamic": "8.1.0",
"@angular/router": "8.1.0",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"angular-user-idle": "^2.1.2",
"angular2-cookie": "^1.2.6",
"core-js": "^2.6.7",
"rxjs": "6.5.2",
"rxjs-tslint": "^0.1.5",
"stream": "0.0.2",
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.801.0",
"@angular/compiler-cli": "8.1.0",
"@angular/language-service": "8.1.0",
"@types/jasmine": "~3.3.13",
"@types/jasminewd2": "~2.0.6",
"@types/node": "~12.6.1",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"protractor": "~5.4.2",
"ts-node": "~8.3.0",
"tslint": "~5.18.0",
"typescript": "^3.4.5"
}
</code></pre>
<p>ng --version gives following output:</p>
<pre><code>Angular CLI: 8.1.2
Node: 10.16.0
OS: win32 x64
Angular: 8.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.2
@angular-devkit/build-angular 0.801.2
@angular-devkit/build-optimizer 0.801.2
@angular-devkit/build-webpack 0.801.2
@angular-devkit/core 8.1.2
@angular-devkit/schematics 8.1.2
@angular/cdk 8.1.1
@angular/cli 8.1.2
@angular/http 7.2.15
@angular/material 8.1.1
@ngtools/webpack 8.1.2
@schematics/angular 8.1.2
@schematics/update 0.801.2
rxjs 6.5.2
typescript 3.5.3
webpack 4.35.2
</code></pre>
<p>What could be going wrong here?</p>
| 0debug
|
How does Docker for Windows run Linux containers? : <p>In the old versions of Docker for Windows, I remember it explicitly said it used a linux VM for the kernel.</p>
<p>But since the new stable version (released in July 2016 I think), it says</p>
<p><code>Docker for Windows is a native Windows application with a native user interface and auto-update capability, deeply integrated with Windows native virtualization, Hyper-V, networking and file system
</code></p>
<p>If I understand correctly, the specified base image is for the user space and the host's kernel is used.
So, if I specify that I'm using an ubuntu base image to run the echo command, how does the Windows kernel come into play?</p>
<p>Or am I completely misunderstanding something?</p>
| 0debug
|
How to install Mermaid to render flowcharts in markdown? : <p>I'm trying to render a flowchart in a markdown file using Mermaid. I have a ReadMe.md file in my GitHub repository, and I'd like to include a basic flowchart to help describe the contents. But I can't figure out how to get it to work. Would someone be able to post some more specific instructions on how to render a simple example?</p>
<p>In this link (<a href="http://unpkg.com/mermaid@8.0.0-rc.8/README.md" rel="noreferrer">https://unpkg.com/mermaid@8.0.0-rc.8/README.md</a>), there's an example code snippet for the Mermaid installation:</p>
<pre><code> ```
https://unpkg.com/mermaid@7.1.0/dist/
```
</code></pre>
<p>I included that code, then tried to make the flowchart in the next code snippet:</p>
<pre><code> ```
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
</code></pre>
<p>But all it does is print that text out in the markdown file when I preview it.</p>
<p>It seems like it's possible based on the Mermaid ReadMe: <a href="http://github.com/knsv/mermaid/blob/master/README.md" rel="noreferrer">https://github.com/knsv/mermaid/blob/master/README.md</a>. But when I looked at the code it's actually a picture of the flowchart, not a rendering of code. So maybe what I'm asking isn't possible?</p>
<p>Would appreciate any help! </p>
| 0debug
|
Delete multiple data from multiple tables in sql : Hi i need help of making a sql query, when i delete the main category it should delete all the data of my subcategory and all the products related to that subcategory can it be dont in one query ? basically deleting data from 3 tables
| 0debug
|
RxBindings For Spinner? : <p>i am new android and rxjava. i have been through many examples where we listen for events with rxbindings. such as this</p>
<pre><code> RxView.clicks(b).subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
// do some work here
}
});
</code></pre>
<p>or</p>
<pre><code>RxTextView.textChanges(name)
.subscribe(new Action1<String>() {
@Override
public void call(String value) {
// do some work with the updated text
}
});
</code></pre>
<p>now i am trying to do the same for android spinner. i want to listen for itemselected event. can anyone help?</p>
| 0debug
|
Laravel: Access Model instance in Form Request when using Route/Model binding : <p>I have some route/model binding set up in my project for one of my models, and that works just fine. I'm able to use my binding in my route path and accept an instance of my model as a parameter to the relevant method in my controller.</p>
<p>Now I'm trying to do some work with this model, so I have created a method in my controller that accepts a Form Request so I can carry out some validation.</p>
<pre><code>public function edit(EditBrandRequest $request, Brand $brand)
{
// ...
</code></pre>
<p>Each different instance of my model can be validated differently, so I need to be able to use an instance of the model in order to build a custom set of validation rules.</p>
<p><strong>Is there a way of getting the instance of the model, that is injected into the controller from the Form Request?</strong></p>
<p>I have tried type-hinting the model instance in the Form Request's constructor</p>
<pre><code>class EditBrandRequest extends Request
{
public function __construct(Brand $brand)
{
dd($brand);
}
</code></pre>
<p>I have also tried type-hinting the model instance in the Form Request's <code>rules()</code> method.</p>
<pre><code>class EditBrandRequest extends Request
{
// ...
public function rules(Brand $brand)
{
dd($brand);
</code></pre>
<p>In both instances I am provided an empty/new instance of the model, rather than the instance I am expecting.</p>
<p>Of course, I could always get around this by not bothering with Form Requests and just generate the rules in the controller and validate manually - but I would rather do it the <em>Laravel way</em> if it's possible.</p>
<p>Thanks</p>
| 0debug
|
How to get webpage content on Kotlin : <p>I am new in Kotlin Programming and I want to get <a href="http://www.google.com" rel="nofollow noreferrer">Google</a> html content<br>
But i don't know how can I do this</p>
| 0debug
|
Normalised Weapon Damage Formula : <p>I would like to create a balanced weapon Formula as the start for the damage output of the player. Other factors will be stacked on this formula, but i would like a base to start with. </p>
<p>So what i am looking for is a formulae that lets different types of weapons deal the same damage over a 10 second interval.</p>
<p>For example, my assault rifle has an rpm of 700 which makes it shoot 11 times per second. </p>
<p>Whereas my pistol has an rpm of 120 which makes it shot twice per second.</p>
<p>I want to calculate how much damage each weapon does on each shot to accumulate For example, 200 damage in 10 seconds, regardless of fire rate.</p>
<p>How would i go about doing this?</p>
| 0debug
|
Export Tensorflow graphs from Python for use in C++ : <p>Exactly how should python models be exported for use in c++?</p>
<p>I'm trying to do something similar to this tutorial:
<a href="https://www.tensorflow.org/versions/r0.8/tutorials/image_recognition/index.html" rel="noreferrer">https://www.tensorflow.org/versions/r0.8/tutorials/image_recognition/index.html</a></p>
<p>I'm trying to import my own TF model in the c++ API in stead of the inception one. I adjusted input size and the paths, but strange errors keep popping up. I spent all day reading stack overflow and other forums but to no avail.</p>
<p>I've tried two methods for exporting the graph.</p>
<p>Method 1: metagraph.</p>
<pre><code>...loading inputs, setting up the model, etc....
sess = tf.InteractiveSession()
sess.run(tf.initialize_all_variables())
for i in range(num_steps):
x_batch, y_batch = batch(50)
if i%10 == 0:
train_accuracy = accuracy.eval(feed_dict={
x:x_batch, y_: y_batch, keep_prob: 1.0})
print("step %d, training accuracy %g"%(i, train_accuracy))
train_step.run(feed_dict={x: x_batch, y_: y_batch, keep_prob: 0.5})
print("test accuracy %g"%accuracy.eval(feed_dict={
x: features_test, y_: labels_test, keep_prob: 1.0}))
saver = tf.train.Saver(tf.all_variables())
checkpoint =
'/home/sander/tensorflow/tensorflow/examples/cat_face/data/model.ckpt'
saver.save(sess, checkpoint)
tf.train.export_meta_graph(filename=
'/home/sander/tensorflow/tensorflow/examples/cat_face/data/cat_graph.pb',
meta_info_def=None,
graph_def=sess.graph_def,
saver_def=saver.restore(sess, checkpoint),
collection_list=None, as_text=False)
</code></pre>
<p>Method 1 yields the following error when trying to run the program:</p>
<pre><code>[libprotobuf ERROR
google/protobuf/src/google/protobuf/wire_format_lite.cc:532] String field
'tensorflow.NodeDef.op' contains invalid UTF-8 data when parsing a protocol
buffer. Use the 'bytes' type if you intend to send raw bytes.
E tensorflow/examples/cat_face/main.cc:281] Not found: Failed to load
compute graph at 'tensorflow/examples/cat_face/data/cat_graph.pb'
</code></pre>
<p>I also tried another method of exporting the graph:</p>
<p>Method 2: write_graph:</p>
<pre><code>tf.train.write_graph(sess.graph_def,
'/home/sander/tensorflow/tensorflow/examples/cat_face/data/',
'cat_graph.pb', as_text=False)
</code></pre>
<p>This version actually seems to load something, but I get an error about variables not being initialized:</p>
<pre><code>Running model failed: Failed precondition: Attempting to use uninitialized
value weight1
[[Node: weight1/read = Identity[T=DT_FLOAT, _class=["loc:@weight1"],
_device="/job:localhost/replica:0/task:0/cpu:0"](weight1)]]
</code></pre>
| 0debug
|
Location map crash in OnePlus One device : <p>my application got crash in OnePlus one device. Following is the details of device</p>
<p>Oneplus One(A0001)</p>
<p>Cyanogen 13.1- ZNH2KAS1KN </p>
<p>Android 6.0.1</p>
<p>Api Elderberry (5) </p>
<p>And logcat shows error</p>
<blockquote>
<p>Unable to start activity
ComponentInfo{com.test/com.test.DetailsActivity}:
android.view.InflateException: Binary XML file line #108: Binary XML
file line #108: Error inflating class fragment -- Stack Trace --
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.test/com.test.DetailsActivity}:
android.view.InflateException: Binary XML file line #108: Binary XML
file line #108: Error inflating class fragment at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.-wrap11(ActivityThread.java) at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
at android.os.Handler.dispatchMessage(Handler.java:102) at
android.os.Looper.loop(Looper.java:148) at
android.app.ActivityThread.main(ActivityThread.java:5461) at
java.lang.reflect.Method.invoke(Native Method) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused
by: android.view.InflateException: Binary XML file line #108: Binary
XML file line #108: Error inflating class fragment at
android.view.LayoutInflater.inflate(LayoutInflater.java:539) at
android.view.LayoutInflater.inflate(LayoutInflater.java:423) at
android.view.LayoutInflater.inflate(LayoutInflater.java:374) at
android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppComapatDelegateImplV7.java:256)
at
android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
at com.test.DetailsActivity.onCreate(DetailsActivity.java:313) at
android.app.Activity.performCreate(Activity.java:6251) at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
... 9 more Caused by: android.view.InflateException: Binary XML file
line #108: Error inflating class fragment at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:782)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at
android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at
android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at
android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at
android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at
android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515) ... 17
more Caused by: android.content.res.Resources$NotFoundException: File
/data/system/theme/icons/com.test_7f030000_0.png from drawable
resource ID #0x7f030000 at
android.content.res.Resources.openRawResource(Resources.java:1336) at
android.content.res.Resources.openRawResource(Resources.java:1306) at
maps.V.N.a(Unknown Source) at maps.D.e.a(Unknown Source) at
maps.D.p.a(Unknown Source) at maps.ad.ae.a(Unknown Source) at
maps.ad.t.a(Unknown Source) at maps.ad.M.a(Unknown Source) at
wd.onTransact(:com.google.android.gms.DynamiteModulesB:107) at
android.os.Binder.transact(Binder.java:387) at
com.google.android.gms.maps.internal.IMapFragmentDelegate$zza$zza.onCreateView(Unknown
Source) at
com.google.android.gms.maps.SupportMapFragment$zza.onCreateView(Unknown
Source) at com.google.android.gms.dynamic.zza$4.zzb(Unknown Source) at
com.google.android.gms.dynamic.zza.zza(Unknown Source) at
com.google.android.gms.dynamic.zza.onCreateView(Unknown Source) at
com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown
Source) at
com.test.fragments.CustomMapFragment.onCreateView(CustomMapFragment.java:39)
at
android.support.v4.app.Fragment.performCreateView(Fragment.java:1962)
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1036)
at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1226)
at
android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1328)
at
android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2284)
at
android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
at
android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:314)
at
android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
at
android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:754)
... 29 more Caused by: java.io.FileNotFoundException:
/data/system/theme/icons/com.test_7f030000_0.png at
android.content.res.AssetManager.openNonAssetNative(Native Method) at
android.content.res.AssetManager.openNonAsset(AssetManager.java:423)
at android.content.res.Resources.openRawResource(Resources.java:1333)
... 55 more</p>
</blockquote>
<p>I have added the map fragment in the layout file</p>
<pre><code> <fragment
android:id="@+id/fragment_map"
android:name="com.test.fragments.CustomMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:tag="fragment_map" />
public class CustomMapFragment extends SupportMapFragment {
private OnTouchListener mListener;
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = super.onCreateView(inflater, container, savedInstanceState);
TouchableWrapper frameLayout = new TouchableWrapper(getActivity());
((ViewGroup) layout).addView(frameLayout,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return layout;
}
public void setListener(OnTouchListener listener) {
mListener = listener;
}
public interface OnTouchListener {
void onTouch();
}
public class TouchableWrapper extends FrameLayout {
public TouchableWrapper(Context context) {
super(context);
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mListener.onTouch();
break;
case MotionEvent.ACTION_UP:
mListener.onTouch();
break;
}
return super.dispatchTouchEvent(event);
}
}
}
</code></pre>
<p>Let me know if anyone face the same issue and found any solution to fix this crash.</p>
| 0debug
|
Should I use the final modifier when declaring case classes? : <p>According to <a href="https://github.com/puffnfresh/wartremover">scala-wartremover</a> static analysis tool I have to put "final" in front of every case classes I create: error message says "case classes must be final".</p>
<p>According to <a href="https://github.com/sksamuel/scapegoat">scapegoat</a> (another static analysis tool for Scala) instead I shouldn't (error message: "Redundant final modifier on case class")</p>
<p>Who is right, and why?</p>
| 0debug
|
static char *make_digest_auth(HTTPAuthState *state, const char *username,
const char *password, const char *uri,
const char *method)
{
DigestParams *digest = &state->digest_params;
int len;
uint32_t cnonce_buf[2];
char cnonce[17];
char nc[9];
int i;
char A1hash[33], A2hash[33], response[33];
struct AVMD5 *md5ctx;
uint8_t hash[16];
char *authstr;
digest->nc++;
snprintf(nc, sizeof(nc), "%08x", digest->nc);
for (i = 0; i < 2; i++)
cnonce_buf[i] = av_get_random_seed();
ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
cnonce[2*sizeof(cnonce_buf)] = 0;
md5ctx = av_md5_alloc();
if (!md5ctx)
return NULL;
av_md5_init(md5ctx);
update_md5_strings(md5ctx, username, ":", state->realm, ":", password, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A1hash, hash, 16, 1);
A1hash[32] = 0;
if (!strcmp(digest->algorithm, "") || !strcmp(digest->algorithm, "MD5")) {
} else if (!strcmp(digest->algorithm, "MD5-sess")) {
av_md5_init(md5ctx);
update_md5_strings(md5ctx, A1hash, ":", digest->nonce, ":", cnonce, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A1hash, hash, 16, 1);
A1hash[32] = 0;
} else {
av_free(md5ctx);
return NULL;
}
av_md5_init(md5ctx);
update_md5_strings(md5ctx, method, ":", uri, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(A2hash, hash, 16, 1);
A2hash[32] = 0;
av_md5_init(md5ctx);
update_md5_strings(md5ctx, A1hash, ":", digest->nonce, NULL);
if (!strcmp(digest->qop, "auth") || !strcmp(digest->qop, "auth-int")) {
update_md5_strings(md5ctx, ":", nc, ":", cnonce, ":", digest->qop, NULL);
}
update_md5_strings(md5ctx, ":", A2hash, NULL);
av_md5_final(md5ctx, hash);
ff_data_to_hex(response, hash, 16, 1);
response[32] = 0;
av_free(md5ctx);
if (!strcmp(digest->qop, "") || !strcmp(digest->qop, "auth")) {
} else if (!strcmp(digest->qop, "auth-int")) {
return NULL;
} else {
return NULL;
}
len = strlen(username) + strlen(state->realm) + strlen(digest->nonce) +
strlen(uri) + strlen(response) + strlen(digest->algorithm) +
strlen(digest->opaque) + strlen(digest->qop) + strlen(cnonce) +
strlen(nc) + 150;
authstr = av_malloc(len);
if (!authstr)
return NULL;
snprintf(authstr, len, "Authorization: Digest ");
av_strlcatf(authstr, len, "username=\"%s\"", username);
av_strlcatf(authstr, len, ",realm=\"%s\"", state->realm);
av_strlcatf(authstr, len, ",nonce=\"%s\"", digest->nonce);
av_strlcatf(authstr, len, ",uri=\"%s\"", uri);
av_strlcatf(authstr, len, ",response=\"%s\"", response);
if (digest->algorithm[0])
av_strlcatf(authstr, len, ",algorithm=%s", digest->algorithm);
if (digest->opaque[0])
av_strlcatf(authstr, len, ",opaque=\"%s\"", digest->opaque);
if (digest->qop[0]) {
av_strlcatf(authstr, len, ",qop=\"%s\"", digest->qop);
av_strlcatf(authstr, len, ",cnonce=\"%s\"", cnonce);
av_strlcatf(authstr, len, ",nc=%s", nc);
}
av_strlcatf(authstr, len, "\r\n");
return authstr;
}
| 1threat
|
multer - req.file always undefined : <p>I've looked at a lot of answer for this same question, but I haven't found a working solution yet. I am trying to make a web app that you can upload files to using express and multer, and I am having a problem that no files are being uploaded and req.file is always undefined.</p>
<p>My code below</p>
<pre><code>'use strict';
var express = require('express');
var path = require('path');
var multer = require('multer')
var upload = multer({ dest: 'uploads/' })
var app = express();
require('dotenv').load();
app.use(express.static(path.join(__dirname, 'main')));
app.post('/upload', upload.single('upl'), function (req, res, next) {
// req.file is the `avatar` file
// req.body will hold the text fields, if there were any
console.log(req.file);
res.status(204).end();
})
var port = process.env.PORT || 8080;
app.listen(port, function () {
console.log('Node.js listening on port ' + port + '...');
});
</code></pre>
<p>The form</p>
<pre><code> <form class="uploadForm" action="/upload" method="post" enctype="multipart/formdata">
<label class="control-label">Select File</label>
<input name="upl" id="input-1" type="file" class="file">
<input type="submit" value="submit" />
</form>
</code></pre>
<p>Help very much appreciated, this is driving me crazy.</p>
| 0debug
|
Can I determine the version of a Java library at runtime? : <p>Is it possible to determine the version of a third party Java library at Runtime?</p>
| 0debug
|
finding streaks in pandas dataframe : <p>I have a pandas dataframe as follows:</p>
<pre><code>time winner loser stat
1 A B 0
2 C B 0
3 D B 1
4 E B 0
5 F A 0
6 G A 0
7 H A 0
8 I A 1
</code></pre>
<p>each row is a match result. the first column is the time of the match, second and third column contain winner/loser and the fourth column is one stat from the match.</p>
<p>I want to detect streaks of zeros for this stat per loser.</p>
<p>The expected result should look like this:</p>
<pre><code>time winner loser stat streak
1 A B 0 1
2 C B 0 2
3 D B 1 0
4 E B 0 1
5 F A 0 1
6 G A 0 2
7 H A 0 3
8 I A 1 0
</code></pre>
<p>In pseudocode the algorithm should work like this:</p>
<ul>
<li><code>.groupby</code> <code>loser</code> column. </li>
<li>then iterate over each row of each <code>loser</code> group</li>
<li>in each row, look at the <code>stat</code> column: if it contains <code>0</code>, then increment the <code>streak</code> value from the previous row by <code>0</code>. if it is not <code>0</code>, then start a new <code>streak</code>, that is, put <code>0</code> into the <code>streak</code> column.</li>
</ul>
<p>So the <code>.groupby</code> is clear. But then I would need some sort of <code>.apply</code> where I can look at the previous row? this is where I am stuck.</p>
| 0debug
|
What is diffrence between didChangeDependencies and initState? : <p>I am new to flutter and when I want to call my context in InitState it throw an error :
which is about
<code>BuildContext.inheritFromWidgetOfExactType</code>
but then I use didChangeDependencies and it work correctly.</p>
<p>now I have 2 question:</p>
<p>1-why we can't call our context in initState but there is no problem for didChangeDependencies ?
(because as I read in official doc <code>This method is also called immediately after [initState]</code>,
and both of them will be called before build method. )</p>
<p>2-why we have access to context outside build method ( because there we have <code>build(BuildContext context)</code> and we can use our context but in didChangeDependencies we don't have anything like <code>didChangeDependencies(BuildContext context)</code> , so from where we can call context to use it) ?</p>
| 0debug
|
Keyboard hides BottomSheetDialogFragment : <p>There are more fields below the keyboard. This happened when i updated the support library. I know it's Kotlin but it looks almost the same as java. How do I fix this issue?</p>
<p>This is what it looks like:</p>
<p><a href="https://i.stack.imgur.com/InjsP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/InjsP.png" alt="enter image description here"></a></p>
<p>My code:</p>
<pre><code>class ProjectsEditBottomSheetFragment(val privateID: String,
val publicID: String) : BottomSheetDialogFragment() {
private val mBottomSheetBehaviorCallback = object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_HIDDEN) {
dismiss()
}
}
override fun onSlide(bottomSheet: View, slideOffset: Float) {
if (slideOffset < -0.15f) {
dismiss()
}
}
}
override fun setupDialog(dialog: Dialog, style: Int) {
super.setupDialog(dialog, style)
val view = View.inflate(context, R.layout.projects_edit_sheet, null)
dialog.setContentView(view)
dialog.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
val params = (view.parent as View).layoutParams as CoordinatorLayout.LayoutParams
val behavior = params.behavior
if (behavior != null && behavior is BottomSheetBehavior<*>) {
behavior.setBottomSheetCallback(mBottomSheetBehaviorCallback)
}
// Get and set values
val realm = Realm.getDefaultInstance()
val realmObject = realm.where(ProjectsRealmObject::class.java)
.equalTo("privateID", privateID)
.findFirst()
realm.beginTransaction()
view.title_input.text = SpannableStringBuilder(realmObject.title)
view.description_input.text = SpannableStringBuilder(realmObject.description)
view.public_checkbox.isChecked = realmObject.isPublic
realm.commitTransaction()
// Keyboard
view.title_input.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
if (hasFocus) {
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).showSoftInput(view.title_input, InputMethodManager.SHOW_FORCED)
} else {
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(view.title_input.windowToken, 0)
}
}
view.description_input.onFocusChangeListener = View.OnFocusChangeListener { _, hasFocus ->
if (hasFocus) {
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).showSoftInput(view.description_input, InputMethodManager.SHOW_FORCED)
} else {
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(view.description_input.windowToken, 0)
}
}
// Click listners
view.public_layout.setOnClickListener { view.public_checkbox.toggle() }
view.cancel.setOnClickListener {
view?.hideKeyboard()
dismiss()
}
view.save.setOnClickListener {
view?.hideKeyboard()
// Save to realm
realm.beginTransaction()
realmObject.title = if (view.title_input.text.toString() == "") getString(R.string.unnamed) else view.title_input.text.toString()
realmObject.description = view.description_input.text.toString()
realmObject.isPublic = view.public_checkbox.isChecked
realmObject.synced = false
realmObject.updatedRealm = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()).toString() + ""
realm.commitTransaction()
ProjectsSync(context)
toast("Sparat")
dismiss()
}
}
}
</code></pre>
<p>xml:</p>
<pre><code><ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
app:layout_collapseMode="none"
app:behavior_hideable="false"
app:behavior_peekHeight="100dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
style="@style/Widget.Design.BottomSheet.Modal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/content">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_info_placeholder_title"
android:id="@+id/title_input"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="16dp"
android:paddingLeft="16dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_info_placeholder_description"
android:id="@+id/description_input"/>
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:clickable="true"
android:background="@drawable/click"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:id="@+id/public_layout">
<android.support.v7.widget.AppCompatCheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:id="@+id/public_checkbox"
android:layout_marginRight="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_info_placeholder_is_public"
android:layout_gravity="center_vertical"
style="@style/textMedium"/>
</LinearLayout>
<!-- Buttons -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="right"
android:paddingBottom="8dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_info_button_cancel"
android:id="@+id/cancel"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit_info_button_save"
android:id="@+id/save"
style="@style/Widget.AppCompat.Button.Borderless.Colored"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</code></pre>
<p></p>
| 0debug
|
static BlockAIOCB *raw_aio_submit(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockCompletionFunc *cb, void *opaque, int type)
{
BDRVRawState *s = bs->opaque;
if (fd_open(bs) < 0)
return NULL;
if (s->needs_alignment) {
if (!bdrv_qiov_is_aligned(bs, qiov)) {
type |= QEMU_AIO_MISALIGNED;
#ifdef CONFIG_LINUX_AIO
} else if (s->use_aio) {
return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov,
nb_sectors, cb, opaque, type);
#endif
}
}
return paio_submit(bs, s->fd, sector_num, qiov, nb_sectors,
cb, opaque, type);
}
| 1threat
|
How to get sum up rows of a column by grouping another column? : <p>My DF has two columns One is state names and another one is No of event happened.
This Data had more columns and now I want to sum up all the no of events happened by state. how can I do that? </p>
| 0debug
|
static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
int *beta, int *tc, uint8_t *no_p,
uint8_t *no_q)
{
FUNC(hevc_loop_filter_luma)(pix, sizeof(pixel), stride,
beta, tc, no_p, no_q);
}
| 1threat
|
static void truncpasses(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile)
{
int precno, compno, reslevelno, bandno, cblkno, lev;
Jpeg2000CodingStyle *codsty = &s->codsty;
for (compno = 0; compno < s->ncomponents; compno++){
Jpeg2000Component *comp = tile->comp + compno;
for (reslevelno = 0, lev = codsty->nreslevels-1; reslevelno < codsty->nreslevels; reslevelno++, lev--){
Jpeg2000ResLevel *reslevel = comp->reslevel + reslevelno;
for (precno = 0; precno < reslevel->num_precincts_x * reslevel->num_precincts_y; precno++){
for (bandno = 0; bandno < reslevel->nbands ; bandno++){
int bandpos = bandno + (reslevelno > 0);
Jpeg2000Band *band = reslevel->band + bandno;
Jpeg2000Prec *prec = band->prec + precno;
for (cblkno = 0; cblkno < prec->nb_codeblocks_height * prec->nb_codeblocks_width; cblkno++){
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
cblk->ninclpasses = getcut(cblk, s->lambda,
(int64_t)dwt_norms[codsty->transform][bandpos][lev] * (int64_t)band->i_stepsize >> 16);
}
}
}
}
}
}
| 1threat
|
please explain following out put : <p>Here, I have following code it getting output like 21,21. How 21 value comes in $a</p>
<pre><code> $a = '1';
$b = &$a;
$b = "2$b";
echo $a.", ".$b;
</code></pre>
<p>Output</p>
<pre><code> 21,21
</code></pre>
| 0debug
|
static void pc_cpu_reset(void *opaque)
{
X86CPU *cpu = opaque;
CPUX86State *env = &cpu->env;
cpu_reset(CPU(cpu));
env->halted = !cpu_is_bsp(env);
}
| 1threat
|
How to ask permission to access gallery on android M.? : <p>I have this app that will pick image to gallery and display it to the test using Imageview. My problem is it won't work on Android M. I can pick image but won't show on my test.They say i need to ask permission to access images on android M but don't know how. please help.</p>
| 0debug
|
Typescript: Create class via constructor passing in named parameters? : <p>I have a class where I have the constructor defined with 3 parameters which are all optional. I was hoping to be able to pass in named parameters so I don't need to pass in undefined.</p>
<pre><code>constructor(year?: number,
month?: number,
date?: number)
</code></pre>
<p>I was hoping to create an intance of the class like so</p>
<pre><code> const recurrenceRule = new MyNewClass(month: 6)
</code></pre>
<p>but it didn't work and i tried</p>
<pre><code> const recurrenceRule = new MyNewClass(month = 6)
</code></pre>
<p>and that didn't work.</p>
<p>The only way i got it to work was either</p>
<pre><code> const recurrenceRule = new MyNewClass(undefined, 4)
</code></pre>
<p>or</p>
<pre><code> const recurrenceRule = new MyNewClass(, 4)
</code></pre>
<p>But it seems so messy, I was hoping to pass in named arguments and becasue they are all optional I should be able to just pass in 1 - right ?</p>
| 0debug
|
What's the difference between these two : <p>Can someone please explain the difference between</p>
<pre><code>import tkinter as tk
</code></pre>
<p>and</p>
<pre><code>from tkinter import *
</code></pre>
<p>It would be so great if someone could give and example where the same task is
achieved (or an object is created) by using these two statements seperately</p>
| 0debug
|
Empty new template iOS single view project crashes due to basic layout constraints? : I created a new iOS project based off of Xcode's Single View iOS app template and was very surprised to find that adding a label and 4 basic constraints for the top, right, bottom, left position results in an immediate launch crash.
There is literally nothing else in the project, it is empty, I'm curious what is going on, has anyone else experienced something like this or am I missing something obvious?
`Assertion failure in -[UIView _nsis_center:bounds:inEngine:forLayoutGuide:],
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3698.93.8/NSLayoutConstraint_UIKitAdditions.m:3588
2019-03-13 09:59:07.873433-0600 test[5480:349128]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Error in compatibility flow'`
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/e9Goh.png
| 0debug
|
int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs,
const char *id_or_name,
Error **errp)
{
int ret;
Error *local_err = NULL;
ret = bdrv_snapshot_load_tmp(bs, id_or_name, NULL, &local_err);
if (ret == -ENOENT || ret == -EINVAL) {
error_free(local_err);
local_err = NULL;
ret = bdrv_snapshot_load_tmp(bs, NULL, id_or_name, &local_err);
}
if (local_err) {
error_propagate(errp, local_err);
}
return ret;
}
| 1threat
|
Programmatically searching google in Python using custom search : <p>I have a snippet of code using the pygoogle python module that allows me to programmatically search for some term in google succintly:</p>
<pre><code> g = pygoogle(search_term)
g.pages = 1
results = g.get_urls()[0:10]
</code></pre>
<p>I just found out that this has been discontinued unfortunately and replaced by something called the google custom search. I looked at the other related questions on SO but didn't find anything I could use. I have two questions:</p>
<p>1) Does google custom search allow me to do exactly what I am doing in the three lines above?</p>
<p>2) If yes - where can I find example code to do exactly what I am doing above? If no then what is the alternative to do what I did using pygoogle?</p>
| 0debug
|
static CharDriverState *qmp_chardev_open_file(ChardevFile *file, Error **errp)
{
int flags, in = -1, out = -1;
flags = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY;
out = qmp_chardev_open_file_source(file->out, flags, errp);
if (error_is_set(errp)) {
return NULL;
}
if (file->in) {
flags = O_RDONLY;
in = qmp_chardev_open_file_source(file->in, flags, errp);
if (error_is_set(errp)) {
qemu_close(out);
return NULL;
}
}
return qemu_chr_open_fd(in, out);
}
| 1threat
|
av_cold int ff_dvvideo_init(AVCodecContext *avctx)
{
DVVideoContext *s = avctx->priv_data;
DSPContext dsp;
static int done = 0;
int i, j;
if (!done) {
VLC dv_vlc;
uint16_t new_dv_vlc_bits[NB_DV_VLC*2];
uint8_t new_dv_vlc_len[NB_DV_VLC*2];
uint8_t new_dv_vlc_run[NB_DV_VLC*2];
int16_t new_dv_vlc_level[NB_DV_VLC*2];
done = 1;
for (i = 0, j = 0; i < NB_DV_VLC; i++, j++) {
new_dv_vlc_bits[j] = dv_vlc_bits[i];
new_dv_vlc_len[j] = dv_vlc_len[i];
new_dv_vlc_run[j] = dv_vlc_run[i];
new_dv_vlc_level[j] = dv_vlc_level[i];
if (dv_vlc_level[i]) {
new_dv_vlc_bits[j] <<= 1;
new_dv_vlc_len[j]++;
j++;
new_dv_vlc_bits[j] = (dv_vlc_bits[i] << 1) | 1;
new_dv_vlc_len[j] = dv_vlc_len[i] + 1;
new_dv_vlc_run[j] = dv_vlc_run[i];
new_dv_vlc_level[j] = -dv_vlc_level[i];
}
}
init_vlc(&dv_vlc, TEX_VLC_BITS, j,
new_dv_vlc_len, 1, 1, new_dv_vlc_bits, 2, 2, 0);
assert(dv_vlc.table_size == 1184);
for (i = 0; i < dv_vlc.table_size; i++){
int code = dv_vlc.table[i][0];
int len = dv_vlc.table[i][1];
int level, run;
if (len < 0){
run = 0;
level = code;
} else {
run = new_dv_vlc_run [code] + 1;
level = new_dv_vlc_level[code];
}
ff_dv_rl_vlc[i].len = len;
ff_dv_rl_vlc[i].level = level;
ff_dv_rl_vlc[i].run = run;
}
ff_free_vlc(&dv_vlc);
}
ff_dsputil_init(&dsp, avctx);
ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp);
s->get_pixels = dsp.get_pixels;
s->ildct_cmp = dsp.ildct_cmp[5];
s->fdct[0] = dsp.fdct;
s->idct_put[0] = dsp.idct_put;
for (i = 0; i < 64; i++)
s->dv_zigzag[0][i] = dsp.idct_permutation[ff_zigzag_direct[i]];
s->fdct[1] = dsp.fdct248;
s->idct_put[1] = ff_simple_idct248_put;
if (avctx->lowres){
for (i = 0; i < 64; i++){
int j = ff_zigzag248_direct[i];
s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2];
}
}else
memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64);
avctx->coded_frame = &s->picture;
s->avctx = avctx;
avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
return 0;
}
| 1threat
|
static void gen_compute_compact_branch(DisasContext *ctx, uint32_t opc,
int rs, int rt, int32_t offset)
{
int bcond_compute = 0;
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
if (ctx->hflags & MIPS_HFLAG_BMASK) {
#ifdef MIPS_DEBUG_DISAS
LOG_DISAS("Branch in delay / forbidden slot at PC 0x" TARGET_FMT_lx
"\n", ctx->pc);
#endif
generate_exception(ctx, EXCP_RI);
goto out;
}
switch (opc) {
case OPC_BOVC:
case OPC_BNVC:
gen_load_gpr(t0, rs);
gen_load_gpr(t1, rt);
bcond_compute = 1;
ctx->btarget = addr_add(ctx, ctx->pc + 4, offset);
if (rs <= rt && rs == 0) {
tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 4);
}
break;
case OPC_BLEZC:
case OPC_BGTZC:
gen_load_gpr(t0, rs);
gen_load_gpr(t1, rt);
bcond_compute = 1;
ctx->btarget = addr_add(ctx, ctx->pc + 4, offset);
break;
case OPC_BLEZALC:
case OPC_BGTZALC:
if (rs == 0 || rs == rt) {
tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 4);
}
gen_load_gpr(t0, rs);
gen_load_gpr(t1, rt);
bcond_compute = 1;
ctx->btarget = addr_add(ctx, ctx->pc + 4, offset);
break;
case OPC_BC:
case OPC_BALC:
ctx->btarget = addr_add(ctx, ctx->pc + 4, offset);
break;
case OPC_BEQZC:
case OPC_BNEZC:
if (rs != 0) {
gen_load_gpr(t0, rs);
bcond_compute = 1;
ctx->btarget = addr_add(ctx, ctx->pc + 4, offset);
} else {
TCGv tbase = tcg_temp_new();
TCGv toffset = tcg_temp_new();
gen_load_gpr(tbase, rt);
tcg_gen_movi_tl(toffset, offset);
gen_op_addr_add(ctx, btarget, tbase, toffset);
tcg_temp_free(tbase);
tcg_temp_free(toffset);
}
break;
default:
MIPS_INVAL("Compact branch/jump");
generate_exception(ctx, EXCP_RI);
goto out;
}
if (bcond_compute == 0) {
switch (opc) {
case OPC_JIALC:
tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 4);
case OPC_JIC:
ctx->hflags |= MIPS_HFLAG_BR;
break;
case OPC_BALC:
tcg_gen_movi_tl(cpu_gpr[31], ctx->pc + 4);
case OPC_BC:
ctx->hflags |= MIPS_HFLAG_B;
break;
default:
MIPS_INVAL("Compact branch/jump");
generate_exception(ctx, EXCP_RI);
goto out;
}
gen_branch(ctx, 4);
} else {
int fs = gen_new_label();
save_cpu_state(ctx, 0);
switch (opc) {
case OPC_BLEZALC:
if (rs == 0 && rt != 0) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_LE), t1, 0, fs);
} else if (rs != 0 && rt != 0 && rs == rt) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_GE), t1, 0, fs);
} else {
tcg_gen_brcond_tl(tcg_invert_cond(TCG_COND_GEU), t0, t1, fs);
}
break;
case OPC_BGTZALC:
if (rs == 0 && rt != 0) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_GT), t1, 0, fs);
} else if (rs != 0 && rt != 0 && rs == rt) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_LT), t1, 0, fs);
} else {
tcg_gen_brcond_tl(tcg_invert_cond(TCG_COND_LTU), t0, t1, fs);
}
break;
case OPC_BLEZC:
if (rs == 0 && rt != 0) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_LE), t1, 0, fs);
} else if (rs != 0 && rt != 0 && rs == rt) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_GE), t1, 0, fs);
} else {
tcg_gen_brcond_tl(tcg_invert_cond(TCG_COND_GE), t0, t1, fs);
}
break;
case OPC_BGTZC:
if (rs == 0 && rt != 0) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_GT), t1, 0, fs);
} else if (rs != 0 && rt != 0 && rs == rt) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_LT), t1, 0, fs);
} else {
tcg_gen_brcond_tl(tcg_invert_cond(TCG_COND_LT), t0, t1, fs);
}
break;
case OPC_BOVC:
case OPC_BNVC:
if (rs >= rt) {
TCGv t2 = tcg_temp_new();
TCGv t3 = tcg_temp_new();
TCGv t4 = tcg_temp_new();
TCGv input_overflow = tcg_temp_new();
gen_load_gpr(t0, rs);
gen_load_gpr(t1, rt);
tcg_gen_ext32s_tl(t2, t0);
tcg_gen_setcond_tl(TCG_COND_NE, input_overflow, t2, t0);
tcg_gen_ext32s_tl(t3, t1);
tcg_gen_setcond_tl(TCG_COND_NE, t4, t3, t1);
tcg_gen_or_tl(input_overflow, input_overflow, t4);
tcg_gen_add_tl(t4, t2, t3);
tcg_gen_ext32s_tl(t4, t4);
tcg_gen_xor_tl(t2, t2, t3);
tcg_gen_xor_tl(t3, t4, t3);
tcg_gen_andc_tl(t2, t3, t2);
tcg_gen_setcondi_tl(TCG_COND_LT, t4, t2, 0);
tcg_gen_or_tl(t4, t4, input_overflow);
if (opc == OPC_BOVC) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_NE), t4, 0, fs);
} else {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_EQ), t4, 0, fs);
}
tcg_temp_free(input_overflow);
tcg_temp_free(t4);
tcg_temp_free(t3);
tcg_temp_free(t2);
} else if (rs < rt && rs == 0) {
if (opc == OPC_BEQZALC) {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_EQ), t1, 0, fs);
} else {
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_NE), t1, 0, fs);
}
} else {
if (opc == OPC_BEQC) {
tcg_gen_brcond_tl(tcg_invert_cond(TCG_COND_EQ), t0, t1, fs);
} else {
tcg_gen_brcond_tl(tcg_invert_cond(TCG_COND_NE), t0, t1, fs);
}
}
break;
case OPC_BEQZC:
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_EQ), t0, 0, fs);
break;
case OPC_BNEZC:
tcg_gen_brcondi_tl(tcg_invert_cond(TCG_COND_NE), t0, 0, fs);
break;
default:
MIPS_INVAL("Compact conditional branch/jump");
generate_exception(ctx, EXCP_RI);
goto out;
}
gen_goto_tb(ctx, 1, ctx->btarget);
gen_set_label(fs);
ctx->hflags |= MIPS_HFLAG_FBNSLOT;
MIPS_DEBUG("Compact conditional branch");
}
out:
tcg_temp_free(t0);
tcg_temp_free(t1);
}
| 1threat
|
What are key points to determine SQL Server version cost? : <p>I have to design website to start migration of sql server from one version to another and based on client database requirements we will tell him the cost of this migration and which sql server version is best to use?</p>
| 0debug
|
QEMUFile *qemu_popen_cmd(const char *command, const char *mode)
{
FILE *stdio_file;
QEMUFileStdio *s;
stdio_file = popen(command, mode);
if (stdio_file == NULL) {
return NULL;
}
if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
fprintf(stderr, "qemu_popen: Argument validity check failed\n");
return NULL;
}
s = g_malloc0(sizeof(QEMUFileStdio));
s->stdio_file = stdio_file;
if(mode[0] == 'r') {
s->file = qemu_fopen_ops(s, &stdio_pipe_read_ops);
} else {
s->file = qemu_fopen_ops(s, &stdio_pipe_write_ops);
}
return s->file;
}
| 1threat
|
uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr)
{
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
uint8_t val;
k->get_config(vdev, vdev->config);
if (addr > (vdev->config_len - sizeof(val)))
return (uint32_t)-1;
val = ldub_p(vdev->config + addr);
return val;
}
| 1threat
|
"no module named PyPDF2" error : <p>I use Spyder, with Python 2.7, on a windows 10. I was able to install the PyPDF2 package with a conda command from my prompt. I said installation complete. Yet, If I try to run a simple import command:</p>
<p><code>import PyPDF2
</code></p>
<p>I get the error:</p>
<p><code>ImportError: No module named PyPDF2
</code></p>
<p>How can I fix this?</p>
| 0debug
|
import re
def remove_char(S):
result = re.sub('[\W_]+', '', S)
return result
| 0debug
|
In Excel how can I share a spreadsheet attachment in Gmail? by default it opens up Outlook : <p>Whilst open in Excel how can I send the file as an attachment in Gmail? </p>
<p>In Excel, File > Share > Email by default opens up Outlook </p>
<p>how can I change this to open up and attach by default in Gmail</p>
| 0debug
|
Swift full date with milliseconds : <p>Is any way to print full date with milliseconds?</p>
<p>For example, I'm doing this:</p>
<pre><code>print("\(NSDate())")
</code></pre>
<p>But I'm just get this:</p>
<pre><code>2016-05-09 22:07:19 +0000
</code></pre>
<p>How can I get the milliseconds too in the full date?</p>
| 0debug
|
FIRAnalyticsConnector: building for Mac Catalyst, but linking in object file built for iOS Simulator : <p>When trying to build for Mac using Catalyst, I get the following build error:</p>
<p><code>FIRAnalyticsConnector(FIRConnectorUtils_77ff1e12be6740765c87f1be0d421683.o), building for Mac Catalyst, but linking in object file built for iOS Simulator</code></p>
<p>The project builds fine for iOS andiPadOS.</p>
| 0debug
|
static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p,
int *got_frame, uint8_t *data_start,
unsigned int data_size)
{
WebPContext *s = avctx->priv_data;
AVPacket pkt;
int ret;
if (!s->initialized) {
ff_vp8_decode_init(avctx);
s->initialized = 1;
}
avctx->pix_fmt = s->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
s->lossless = 0;
if (data_size > INT_MAX) {
av_log(avctx, AV_LOG_ERROR, "unsupported chunk size\n");
return AVERROR_PATCHWELCOME;
}
av_init_packet(&pkt);
pkt.data = data_start;
pkt.size = data_size;
ret = ff_vp8_decode_frame(avctx, p, got_frame, &pkt);
if (ret < 0)
return ret;
update_canvas_size(avctx, avctx->width, avctx->height);
if (s->has_alpha) {
ret = vp8_lossy_decode_alpha(avctx, p, s->alpha_data,
s->alpha_data_size);
if (ret < 0)
return ret;
}
return ret;
}
| 1threat
|
Flutter : How to specify a device id in flutter? : <p>How to select a device id in flutter run?</p>
<blockquote>
<p>please specify a device with the '-d ' flag, or use '-d all'
to act on all devices</p>
</blockquote>
<pre><code>iPhone 6 • 54XXXXXX35130ebefd38f • ios • iOS 10.3.3
iPhone 7 Plus • BA8CXXXXXXD0-577D675d • ios • iOS 11.2 (simulator)
</code></pre>
| 0debug
|
R - Display row with biggest value in a new dataframe : <p>I have a dataframe like this one: </p>
<pre><code>x1= c("Station1", "Station2", "Station3", "Station4", "Station5", "Station6", "Station7", "Station8", "Station9", "Station10")
x2= seq(-2,10 , length=10)
x3= seq(30, 45, length=10)
x4= c(1, 3, 2, 1, 4, 2, 4, 3, 3, 1)
x5= seq(10, 100, length=10)
df = data.frame(Station=x1, Lon=x2, Lat=x3, Number=x4, Size=x5)
>df
Station Lon Lat Number Size
1 Station1 -2.0000000 30.00000 1 10
2 Station2 -0.6666667 31.66667 3 20
3 Station3 0.6666667 33.33333 2 30
4 Station4 2.0000000 35.00000 1 40
5 Station5 3.3333333 36.66667 4 50
6 Station6 4.6666667 38.33333 2 60
7 Station7 6.0000000 40.00000 4 70
8 Station8 7.3333333 41.66667 3 80
9 Station9 8.6666667 43.33333 3 90
10 Station10 10.0000000 45.00000 1 100
</code></pre>
<p>The Stations are in 4 different groups, that can be seen in the $Number column. Now I want to extract the Stations with the biggest value in the df$Size column for each group. So I want to have a new dataframe with 4 rows (one for each group) and the same columns.</p>
<p>It should look like this:</p>
<pre><code> Station Lon Lat Number Size
6 Station6 4.6666667 38.33333 2 60
7 Station7 6.0000000 40.00000 4 70
9 Station9 8.6666667 43.33333 3 90
10 Station10 10.0000000 45.00000 1 100
</code></pre>
<p>I already tried it like that to get the row number, but it doesnt work. </p>
<pre><code>index1 = df$Number=="1"
index2 = df$Number=="2"
index3 = df$Number=="3"
index4 = df$Number=="4"
df[index1][which.max(df$Size),]
</code></pre>
<p>Any ideas?</p>
| 0debug
|
pathlib Path `write_text` in append mode : <p>Is there a shortcut for python <code>pathlib.Path</code> objects to <code>write_text()</code> in append mode? </p>
<p>The standard <a href="https://docs.python.org/3/library/functions.html#open" rel="noreferrer"><code>open()</code></a> function has <code>mode="a"</code> to open a file for writing and appending to the file if that file exists, and a <code>Path</code>s <a href="https://docs.python.org/3/library/pathlib.html#pathlib.Path.open" rel="noreferrer"><code>.open()</code></a> function seems to have the same functionality (<code>my_path.open("a")</code>). </p>
<p>But what about the handy <code>.write_text('..')</code> shortcut, is there a way to use <code>pathlib</code> to open and append to a file with just doing the same things as with <code>open()</code>? </p>
<p>For clarity, I can do</p>
<pre class="lang-py prettyprint-override"><code>with my_path.open('a') as fp:
fp.write('my text')
</code></pre>
<p>but is there another way? </p>
<p><code>my_path.write_text('my text', mode='a')</code></p>
| 0debug
|
I do have many batch files but i need to cal them in vb script one after the other?please help me out? : I do have many batch files and i have a vb scrip.But i need to call all the batch files in vb script one after the other?can anyone please help me out?
| 0debug
|
i have a user table with permission, i need to get the user highest role and ignore the rest of it and then isnert it into the new app : i have this
Testing_296177 IntegrationRole
Testing_296177 Re-Marker
Testing_296177 AAT Conduct and Compliance
Testing_296177 AQAV Administrator
Testing_296177 AAT Assessment Team
Testing_296177 Internal Verifier
Testing_296177 External Verifier
Testing_296177 EPA Centre Administrator
Testing_296177 Membership Journey Managers - Assessment Audit
need to get only assessment team roles and insert it into new table consider i have million of records in teh old app that need to migrate to new one
| 0debug
|
void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1, uint32_t ipb)
{
int cssid, ssid, schid, m;
SubchDev *sch;
ORB orig_orb, orb;
uint64_t addr;
int ret = -ENODEV;
int cc;
CPUS390XState *env = &cpu->env;
uint8_t ar;
addr = decode_basedisp_s(env, ipb, &ar);
if (addr & 3) {
program_interrupt(env, PGM_SPECIFICATION, 2);
return;
}
if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) {
return;
}
copy_orb_from_guest(&orb, &orig_orb);
if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid) ||
!ioinst_orb_valid(&orb)) {
program_interrupt(env, PGM_OPERAND, 2);
return;
}
trace_ioinst_sch_id("ssch", cssid, ssid, schid);
sch = css_find_subch(m, cssid, ssid, schid);
if (sch && css_subch_visible(sch)) {
ret = css_do_ssch(sch, &orb);
}
switch (ret) {
case -ENODEV:
cc = 3;
break;
case -EBUSY:
cc = 2;
break;
case -EFAULT:
program_interrupt(env, PGM_ADDRESSING, 4);
return;
case 0:
cc = 0;
break;
default:
cc = 1;
break;
}
setcc(cpu, cc);
}
| 1threat
|
Hiveql - RIGHT() LEFT() Function : <p>Is there a function in Hiveql that is equivalent to Right() or Left() fuction form TSQL?
For example, <code>RIGHT(col1,10)</code> to get the first 10 characters from col1.</p>
<p>thank you</p>
| 0debug
|
How to downgrade vscode : <p>I am experiencing a problem with debugging in vscode just after the last update. There's something going on (<a href="https://github.com/Microsoft/vscode/issues/45657" rel="noreferrer">https://github.com/Microsoft/vscode/issues/45657</a>)</p>
<p>I'd like to check the previous version to see if my case is a problem here or in vscode but I can not find instructions on how to downgrade (I suppose it's possible)</p>
| 0debug
|
static int write_refcount_block_entries(BlockDriverState *bs,
int64_t refcount_block_offset, int first_index, int last_index)
{
BDRVQcowState *s = bs->opaque;
size_t size;
int ret;
if (cache_refcount_updates) {
return 0;
}
if (first_index < 0) {
return 0;
}
first_index &= ~(REFCOUNTS_PER_SECTOR - 1);
last_index = (last_index + REFCOUNTS_PER_SECTOR)
& ~(REFCOUNTS_PER_SECTOR - 1);
size = (last_index - first_index) << REFCOUNT_SHIFT;
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_UPDATE_PART);
ret = bdrv_pwrite(bs->file,
refcount_block_offset + (first_index << REFCOUNT_SHIFT),
&s->refcount_block_cache[first_index], size);
if (ret < 0) {
return ret;
}
return 0;
}
| 1threat
|
Simple countdown hh:mm:ss in android studio : <p>How can I create a simple countdown in Android studio with a fixed start time? It should start the count down as soon as the application is opened. The preferable format is hh:mm:ss</p>
<p>thanks</p>
| 0debug
|
Hide Selected Columns in Excel using (VBA) Click Button : I would like to ask for a help.
Here is my project. I have this data [accru]
what I want to do is to make a button Hide and Button for Unhide
Supposed that each column labeled as Date from January 2010 to January 2016
i want to hide all columns with Date March and will automatically hide all non March column.
Hope to Hear from you..
[1]: https://i.stack.imgur.com/JipIu.png
| 0debug
|
static int decode_profile_tier_level(HEVCContext *s, ProfileTierLevel *ptl)
{
int i;
HEVCLocalContext *lc = s->HEVClc;
GetBitContext *gb = &lc->gb;
ptl->profile_space = get_bits(gb, 2);
ptl->tier_flag = get_bits1(gb);
ptl->profile_idc = get_bits(gb, 5);
if (ptl->profile_idc == 1)
av_log(s->avctx, AV_LOG_DEBUG, "Main profile bitstream\n");
else if (ptl->profile_idc == 2)
av_log(s->avctx, AV_LOG_DEBUG, "Main10 profile bitstream\n");
else
av_log(s->avctx, AV_LOG_WARNING, "No profile indication! (%d)\n", ptl->profile_idc);
for (i = 0; i < 32; i++)
ptl->profile_compatibility_flag[i] = get_bits1(gb);
ptl->progressive_source_flag = get_bits1(gb);
ptl->interlaced_source_flag = get_bits1(gb);
ptl->non_packed_constraint_flag = get_bits1(gb);
ptl->frame_only_constraint_flag = get_bits1(gb);
if (get_bits(gb, 16) != 0)
return -1;
if (get_bits(gb, 16) != 0)
return -1;
if (get_bits(gb, 12) != 0)
return -1;
return 0;
}
| 1threat
|
React Native Expo change default LAN IP : <p>I've got virtual box installed. And when I look at the host > LAN > ip address is exp://192.168.56.1:19000.</p>
<p>How can I change it without disable the network? because it's my virtualbox ip and my device can't connect to it.</p>
<p>Thanks</p>
| 0debug
|
static TCGv_i32 new_tmp(void)
{
num_temps++;
return tcg_temp_new_i32();
}
| 1threat
|
FFMPEG- Convert video to images : <p>how can i convert a video to images using ffmpeg? Example am having a video with total duration 60 seconds. I want images between different set of duration like between 2-6 seconds, then between 15-24 seconds and so on. Is that possible using ffmpeg?</p>
| 0debug
|
Hide FAB when onscreen keyboard appear : <p>In Flutter, how to make <a href="https://docs.flutter.io/flutter/material/FloatingActionButton-class.html" rel="noreferrer">FAB button</a> hide when onscreen keyboard appear?</p>
<p>FAB button cover up other element when on screenkeyboard show up.</p>
<p><a href="https://i.stack.imgur.com/BOY0s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BOY0s.png" alt="enter image description here"></a></p>
| 0debug
|
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
| 1threat
|
My javasript file is not working : My javasript file is not working. I can't see it in the inspector. I think it doesn't loaded at all.
There is missing something in my file?
This is my whole js file:
$(".sf-main-menu li").click(function() {
var whatTab = $(this).index();
var howFar = 160 * whatTab;
$(".slider").css({
left: howFar + "px"
});
});
I added it to the .info file.
| 0debug
|
I need a vba code that will compare 2 worksheets and find rows with multiple identical cell values and highlight those cells : I have to compare data between 2 worksheets of excel and find the rows that have similar values. I have multiple values in a single row and these values match values from another row in a different sheet. I would like these values to be highlighted.
I have tried a code which works when I use it on small data, for example 10 rows from each sheet. But when i use it on more data, the excel just goes not responding and doesn't work even after waiting for a long time.After some more research I found out that that the overhead between the vba and excel is causing the long wait and unresponsive behavior. Please provide me with a code that will work similar to this one but in a short time.
Sub CompareRanges()
'Update 20130815
Dim WorkRng1 As Range, WorkRng2 As Range, Rng1 As Range, Rng2 As Range
xTitleId = "KutoolsforExcel"
Set WorkRng1 = Application.InputBox("Range A:", xTitleId, "", Type:=8)
Set WorkRng2 = Application.InputBox("Range B:", xTitleId, Type:=8)
For Each Rng1 In WorkRng1
rng1Value = Rng1.Value
For Each Rng2 In WorkRng2
If rng1Value = Rng2.Value Then
Rng1.Interior.Color = VBA.RGB(0, 255, 0)
Rng2.Interior.Color = VBA.RGB(0, 255, 0)
Exit For
End If
Next
Next
End Sub
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.