problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
What is the difference between DefaultHandler(Message) and "inherited" in message handlers? : <p>What exactly is the difference between calling <code>DefaultHandler(Message)</code> and <code>inherited</code> in a message handlers. e.g:</p>
<pre><code>TScrollBox = class(TScrollingWinControl)
private
...
procedure WMNCHitTest(var Message: TMessage); message WM_NCHITTEST;
...
end;
procedure TScrollBox.WMNCHitTest(var Message: TMessage);
begin
DefaultHandler(Message);
end;
</code></pre>
<p>Why not call <code>inherited</code> here? when should I use either?</p>
| 0debug
|
void ff_put_h264_qpel16_mc20_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hz_16w_msa(src - 2, stride, dst, stride, 16);
}
| 1threat
|
Angualr Material Custom theming : material angular components css is loading at last and overriding my custom theming css. MY custom css should load at end of all the base material css.
| 0debug
|
I don't know what is wrong and how to fix it : ctn =0
myfile = open("lab3.txt")
lines = myfile.readlines
for item in myfile:
ctn += item
print(int(ctn))
TypeError: unsupported operand type(s) for +=: 'int' and 'str'
| 0debug
|
gap in Jpanel (Border Layout ) : I am trying to implement the following:
import java.awt.BorderLayout;
import java.awt.Color;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class main {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
JFrame myFrame = new JFrame("Game");
JPanel east = new JPanel();
JPanel west = new JPanel();
JPanel south = new JPanel();
JPanel center = new JPanel();
myFrame.setLayout(new BorderLayout());
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setLayout(new BorderLayout());
myFrame.add(east, BorderLayout.EAST);
myFrame.add(west, BorderLayout.WEST);
myFrame.add(south, BorderLayout.SOUTH);
myFrame.add(center, BorderLayout.CENTER);
east.setBackground(Color.YELLOW);
west.setBackground(Color.RED);
south.setBackground(Color.BLUE);
center.setBackground(Color.GREEN);
myFrame.pack();
myFrame.setVisible(true);
}
}
I got this
[enter image description here][1]
But I want the east and west have bigger width
When I use:
east.setPreferredSize(new Dimension(250, 1000));
I get gaps between the panels
What am I doing wrong ?
Thanks for your time
[1]: https://i.stack.imgur.com/Ck7za.png
| 0debug
|
static uint64_t arm_thiswdog_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
arm_mptimer_state *s = (arm_mptimer_state *)opaque;
int id = get_current_cpu(s);
return timerblock_read(&s->timerblock[id * 2 + 1], addr, size);
}
| 1threat
|
How to implement pixel-wise classification for scene labeling in TensorFlow? : <p>I am working on a deep learning model using <strong>Google's TensorFlow</strong>. The model should be used to <strong>segment and label scenes</strong>. </p>
<ol>
<li>I am using the <strong>SiftFlow dataset</strong> which has <em>33 semantic
classes</em> and <em>images with 256x256 pixels</em>. </li>
<li>As a result, at my final layer using convolution and deconvolution I arrive at the following tensor(array) <em>[256, 256, 33]</em>. </li>
<li>Next I would like to
apply <em>Softmax</em> and compare the results to a semantic label of size
<em>[256, 256]</em>.</li>
</ol>
<p><strong>Questions:</strong>
Should I apply mean averaging or argmax to my final layer so its shape becomes <em>[256,256,1]</em> and then loop through each pixel and classify as if I were classying <em>256x256</em> instances? If the answer is yes, how, if not, what other options?</p>
| 0debug
|
Xamarin - apk App Size : <p>So, after all the hard-work developing the app using Xamarin.Forms, when I tried to create a release build today, I was shocked to see the app size is ~25MB - ~31MB (after SDK Only Linking, ProGuard, Creating apk for each abi). My resource folder is only in KBs. The apk actually was just 5MB in debug mode and was so happy to see it. I later realized that this is because of the option "Use Shared Runtime" which we are not supposed to use in Release Mode.</p>
<p>I then tried creating a blank Xamarin.Android app, but the release build with Linking SDK & User Assemblies, ProGuard, APK for each abi is still ~8MB to ~13MB.</p>
<p>Per the below link the minimum size is 2.9MB with the Hello World app, however I am unable to create such size. <a href="https://developer.xamarin.com/guides/android/advanced_topics/application_package_sizes/" rel="noreferrer">https://developer.xamarin.com/guides/android/advanced_topics/application_package_sizes/</a></p>
<p>For my app and the blank app I created, the necessary dlls seem to be high (example mscorlib.dll is 2.2mb etc, where as the link says after linking it will become 1 mb) Here is what I see as my assembly folder after extracting the apk
<a href="https://i.stack.imgur.com/ILtQx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ILtQx.png" alt="enter image description here"></a></p>
<p>In one of the recent Microsoft tech conferences I happened to know that "9 News" app (link below) was built using xamarin, and the creators were present on the stage. However I was surprised with it's app size. It is only 5.85 MB. I am unsure how that is achieved?</p>
<p>Can any one help me with these?</p>
<p><a href="https://play.google.com/store/apps/details?id=nineNewsAlerts.nine.com" rel="noreferrer">https://play.google.com/store/apps/details?id=nineNewsAlerts.nine.com</a></p>
<p>I am also curious to know if Microsoft doing something to improve app package sizes? Or will this be resolved if they bring .NET core to xamarin?</p>
| 0debug
|
Identity Server 4 - IDX10630: PII is hidden : <p>I'm fairly new to using encryption and rsa tokens and I'm trying to get IDentityServer4 to not use the developersigning, but one of my own. Here is what I have tried so far:</p>
<pre><code>var keyInfo = new RSACryptoServiceProvider().ExportParameters(true);
var rsaSecurityKey = new RsaSecurityKey(new RSAParameters
{
D = keyInfo.D,
DP = keyInfo.DP,
DQ = keyInfo.DQ,
Exponent = keyInfo.Exponent,
InverseQ = keyInfo.InverseQ,
Modulus = keyInfo.Modulus,
P = keyInfo.P,
Q = keyInfo.Q
});
services.AddIdentityServer()
.AddSigningCredential(rsaSecurityKey)
.AddInMemoryPersistedGrants()
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApiResources())
.AddInMemoryClients(Config.GetClients())
.AddAspNetIdentity<User>();
</code></pre>
<p>However, when I run Identity Server4 and I get redirected to sign in page from another website, I get the following error:</p>
<blockquote>
<p>IDX10630: The '[PII is hidden]' for signing cannot be smaller than '[PII is hidden]' bits. KeySize: '[PII is hidden]'.
Parameter name: key.KeySize</p>
</blockquote>
<p>I have to admit, I've been on this all weekend, trying to figure out how to use SigningCredentials and I'm not really sure what I've done wrong above.</p>
| 0debug
|
int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw,
int is_user, int is_softmmu)
{
mmu_ctx_t ctx;
int exception = 0, error_code = 0;
int access_type;
int ret = 0;
if (rw == 2) {
rw = 0;
access_type = ACCESS_CODE;
} else {
access_type = ACCESS_INT;
}
ret = get_physical_address(env, &ctx, address, rw, access_type, 1);
if (ret == 0) {
ret = tlb_set_page(env, address & TARGET_PAGE_MASK,
ctx.raddr & TARGET_PAGE_MASK, ctx.prot,
is_user, is_softmmu);
} else if (ret < 0) {
#if defined (DEBUG_MMU)
if (loglevel > 0)
cpu_dump_state(env, logfile, fprintf, 0);
#endif
if (access_type == ACCESS_CODE) {
exception = EXCP_ISI;
switch (ret) {
case -1:
if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_6xx)) {
exception = EXCP_I_TLBMISS;
env->spr[SPR_IMISS] = address;
env->spr[SPR_ICMP] = 0x80000000 | ctx.ptem;
error_code = 1 << 18;
goto tlb_miss;
} else if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_4xx)) {
} else {
error_code = 0x40000000;
}
break;
case -2:
error_code = 0x08000000;
break;
case -3:
error_code = 0x10000000;
break;
case -4:
error_code = 0x10000000;
break;
case -5:
exception = EXCP_ISEG;
error_code = 0;
break;
}
} else {
exception = EXCP_DSI;
switch (ret) {
case -1:
if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_6xx)) {
if (rw == 1) {
exception = EXCP_DS_TLBMISS;
error_code = 1 << 16;
} else {
exception = EXCP_DL_TLBMISS;
error_code = 0;
}
env->spr[SPR_DMISS] = address;
env->spr[SPR_DCMP] = 0x80000000 | ctx.ptem;
tlb_miss:
error_code |= ctx.key << 19;
env->spr[SPR_HASH1] = ctx.pg_addr[0];
env->spr[SPR_HASH2] = ctx.pg_addr[1];
goto out;
} else if (unlikely(PPC_MMU(env) == PPC_FLAGS_MMU_SOFT_4xx)) {
} else {
error_code = 0x40000000;
}
break;
case -2:
error_code = 0x08000000;
break;
case -4:
switch (access_type) {
case ACCESS_FLOAT:
exception = EXCP_ALIGN;
error_code = EXCP_ALIGN_FP;
break;
case ACCESS_RES:
error_code = 0x04000000;
break;
case ACCESS_EXT:
error_code = 0x04100000;
break;
default:
printf("DSI: invalid exception (%d)\n", ret);
exception = EXCP_PROGRAM;
error_code = EXCP_INVAL | EXCP_INVAL_INVAL;
break;
}
break;
case -5:
exception = EXCP_DSEG;
error_code = 0;
break;
}
if (exception == EXCP_DSI && rw == 1)
error_code |= 0x02000000;
env->spr[SPR_DAR] = address;
env->spr[SPR_DSISR] = error_code;
}
out:
#if 0
printf("%s: set exception to %d %02x\n",
__func__, exception, error_code);
#endif
env->exception_index = exception;
env->error_code = error_code;
ret = 1;
}
return ret;
}
| 1threat
|
C# Types that accept Indexing : <p>What are all the types that have built in indexing. For example I know ICollection and IEnumerable do not, but I'd like a list of all that do.</p>
<p>Apart from the list, if anyone can supply that, my specific problem deals with indexing all x,y points on a grid, so I'd like to access the object at x,y through an index if possible.</p>
<p>Thanks</p>
| 0debug
|
static int connect_to_sdog(const char *addr, const char *port)
{
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
int fd, ret;
struct addrinfo hints, *res, *res0;
if (!addr) {
addr = SD_DEFAULT_ADDR;
port = SD_DEFAULT_PORT;
}
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(addr, port, &hints, &res0);
if (ret) {
error_report("unable to get address info %s, %s",
addr, strerror(errno));
return -errno;
}
for (res = res0; res; res = res->ai_next) {
ret = getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV);
if (ret) {
continue;
}
fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (fd < 0) {
continue;
}
reconnect:
ret = connect(fd, res->ai_addr, res->ai_addrlen);
if (ret < 0) {
if (errno == EINTR) {
goto reconnect;
}
break;
}
dprintf("connected to %s:%s\n", addr, port);
goto success;
}
fd = -errno;
error_report("failed connect to %s:%s", addr, port);
success:
freeaddrinfo(res0);
return fd;
}
| 1threat
|
Observable vs Flowable rxJava2 : <p>I have been looking at new rx java 2 and I'm not quite sure I understand the idea of <code>backpressure</code> anymore... </p>
<p>I'm aware that we have <code>Observable</code> that does not have <code>backpressure</code> support and <code>Flowable</code> that has it.</p>
<p>So based on example, lets say I have <code>flowable</code> with <code>interval</code>:</p>
<pre><code> Flowable.interval(1, TimeUnit.MILLISECONDS, Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Long>() {
@Override
public void accept(Long aLong) throws Exception {
// do smth
}
});
</code></pre>
<p>This is going to crash after around 128 values, and thats pretty obvious I am consuming slower than getting items. </p>
<p>But then we have the same with <code>Observable</code> </p>
<pre><code> Observable.interval(1, TimeUnit.MILLISECONDS, Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Long>() {
@Override
public void accept(Long aLong) throws Exception {
// do smth
}
});
</code></pre>
<p>This will not crash at all, even when I put some delay on consuming it still works. To make <code>Flowable</code> work lets say I put <code>onBackpressureDrop</code> operator, crash is gone but not all values are emitted either.</p>
<p>So the base question I can not find answer currently in my head is why should I care about <code>backpressure</code> when I can use plain <code>Observable</code> still receive all values without managing the <code>buffer</code>? Or maybe from the other side, what advantages do <code>backpressure</code> give me in favour of managing and handling the consuming?</p>
| 0debug
|
Ruby Code. I am trying to learn Ruby and having trouble with this exercise : I am trying to learn ruby and I am working out of the book "Head First Ruby". So far I really like the book but I can not get one of the exercises to work. It is driving me crazy. I can not figure out what I have done wrong. Could someone please look over this code and tell me what is going wrong? The error I am getting is:
employee.rb:42:in `print_pay_stub': undefined method `*' for nil:NilClass (NoMethodError)
from employee.rb:56:in `<main>'
I can not seem to get the code up on this site in one box so here is also the gist link https://gist.github.com/jeffwolfram/cb72b4301feaf1adb55c7888ec2b3c6f#file-gistfile1-txt
Any help would be much appreciated.
```
class Employee
attr_reader :name
def name=(name)
end
def print_name
puts "Name: #{name}"
end
end
class SalariedEmployee < Employee
attr_reader :salary
def salary=(salary)
#code to validate and set @salary
end
def print_pay_stub
print_name
pay_for_period = (salary / 365.0) * 14
formatted_pay = format("$%.2f", pay_for_period)
puts "Pay this period: #{formatted_pay}"
end
end
class HourlyEmployee < Employee
attr_reader :hourly_wage, :hours_per_week
def hourly_wage=(hourly_wage)
#code to validate and set @hourly_wage
end
def hours_per_week=(hours_per_week)
#code to validate and set @hours_per_week
end
def print_pay_stub
print_name
pay_for_period = hourly_wage * hours_per_week * 2
formatted_pay = format("$%.2f", pay_for_period)
puts "pay This Period: #{formatted_pay}"
end
end
```
| 0debug
|
Experiment With C : <pre><code>#include<stdio.h>
int main() {
int x = 99;
printf("%d %d\n",1 > scanf("%d",&x) ? scanf("%d",&x): scanf("%d",&x),x);
}
</code></pre>
<p>So What is happening to the scanned values.
Lets say First Input is 11. so left most scanf is returning 1. So according to the rule the right most scanf will be executed. But The right most %d of printf is not printing the scanned value. It is showing 99.</p>
| 0debug
|
When do we need to send data to server? : <p>Currently, I want to display students' information in a web page. When this web page is loaded, a server sends all students'(maybe 1000+) information to a js file which is used to display information in that web page. After a user selecting some filter options (for example, student's course or country),is it a good idea to send these filter options to the server and send back some information about which students' information should be displayed? Actually, the refinement can be done within the js file without sending data to server. So I just feel that it is pointless to send filter options to the server. So when do we need to send data to server in my case? Should I send all students' information when loading the web page?</p>
| 0debug
|
I need use Id in If function, why dont work? : i would like to make script who allow enter in page only devices with equal ip adress as code but i cant make it with IF fuction...when i write x.id into function it wont work... Idea ?
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<html>
<script type="text/javascript">
window.onload = function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://api.ipify.org?format=jsonp&callback=DisplayIP";
document.getElementsByTagName("head")[0].appendChild(script);
};
function DisplayIP(response) {
var x = document.getElementById("ipaddress").innerHTML = response.ip;
}
</script>
</head>
<p id=ipaddress></p>
<form name="login">
<input type="button" onclick="check()" value="check ip">
</form>
<script language="javascript">
function check()
{
if(x.id == "22.333.444.555")
{
window.open('ipadressok.html')
}
else
{
alert("ip adress unknown")
}
}
</script>
</html>
<!-- end snippet -->
| 0debug
|
Ti-basic Raycasting (ti-83 plus) : I have tried anything, How do I do Raycasting in ti-basic, is it posibble to just draw a simple wall And move around? (i have an ti-83 plus)
| 0debug
|
How to resize image after being uploaded in ASP.NET Core 2.0 : <p>I want to resize an image and save this image multiple times with different sizes into a folder. I have tried ImageResizer or CoreCompat.System.Drawing but these libraries not compatible with .Net core 2. I have searched a lot of about this but i can't find any proper solution.
like in MVC4 i have used as:</p>
<pre><code>public ActionResult Upload(HttpPostedFileBase file)
{
if (file != null)
{
var versions = new Dictionary<string, string>();
var path = Server.MapPath("~/Images/");
//Define the versions to generate
versions.Add("_small", "maxwidth=600&maxheight=600&format=jpg";);
versions.Add("_medium", "maxwidth=900&maxheight=900&format=jpg");
versions.Add("_large", "maxwidth=1200&maxheight=1200&format=jpg");
//Generate each version
foreach (var suffix in versions.Keys)
{
file.InputStream.Seek(0, SeekOrigin.Begin);
//Let the image builder add the correct extension based on the output file type
ImageBuilder.Current.Build(
new ImageJob(
file.InputStream,
path + file.FileName + suffix,
new Instructions(versions[suffix]),
false,
true));
}
}
return RedirectToAction("Index");
}
</code></pre>
<p>but in Asp.Net core 2.0 i am stuck. i have no idea how can i implement this in .Net core 2. Any one please can help me.</p>
| 0debug
|
int64_t ff_lsb2full(StreamContext *stream, int64_t lsb){
int64_t mask = (1<<stream->msb_pts_shift)-1;
int64_t delta= stream->last_pts - mask/2;
return ((lsb - delta)&mask) + delta;
}
| 1threat
|
SQLiteDatabase error:near "in1": syntax error : I have click First button this time show error in1
<br>I have put the = in the query some error near "=": syntax error like this how to solve it .
<br>In this query i have use String Builder for concat to multiple string
public List<People> getPeople(String category_id) {
List<People> peoples = new ArrayList<>();
try {
SQLiteDatabase db = SQLiteDatabase.openDatabase(DB_PATH + DB_NAME, null, SQLiteDatabase.OPEN_READWRITE);
StringBuilder sb = new StringBuilder();
sb.append(",");
Cursor cursor = db.rawQuery("select * from people where category_id in"+(category_id + sb + category_id), null);
while (cursor.moveToNext()) {
String peopleName = cursor.getString(cursor.getColumnIndex(PEOPLE_NAME));
String peopleImage = cursor.getString(cursor.getColumnIndex(PEOPLE_IMAGE));
People people = new People();
people.setPeopleName(peopleName);
people.setPeopleImage(peopleImage);
peoples.add(people);
}
} catch (Exception e) {
Log.d("DB", e.getMessage());
}
return peoples;
}
| 0debug
|
how to make use of hashmap in following code. : how do i make use of hashmap in this code.i have rosters that hold ArrayList of students. i know hashmap use key and value pair, but i'm confuse on what would be my key and value if i use hashmap in the following classes that use arraylist.
this is my modify class where i make some modificaton on basis of user input that i get in may main class.
public class modify{
ArrayList<Roster> rList;
public modify{
rList = new ArrayList<Roster>();
}
public void addRoster(){
System.out.println("Enter name for roster: ");
String name = newObj.nextLine();
//Teacher t = new Teacher().addTeacher();
Student s = new Student().addStudent();
Roster addR = new Roster(s, name, 0);
rList.add(addR);
System.out.println("New Roster Created: ");
}//end of addRoster
/*
code
*/
}//end of class
this is my roster class. it hold the arralist of students.
public class Roster{
int id;
String name;
List<Student> students;
public Roster(Student s, String name, int id){
this.students = new ArrayList<Student>();
this.students.add(s);
this.id = ranObj.rand();
this.name = name;
}//constructor
}//end of roster
this is my student class
public class Student {
private int studentId;
public Student(String firstName, String lastName, int age) {
super( firstName, lastName, age);
this.studentId = ranObj.rand();
}
public String toString(){
return String.format("Student:\n" +
" Id = %d\n" +
" Age = %d\n" +
" firstName = %s\n" +
" lastName = %s\n\n" +
" ",getStudentId(),super.getAge(), super.getFirstName(),super.getLastName());
}// end of tostring class
}//end of student
| 0debug
|
Urgent: run visual studio project in vs code : How can I run a vs project in vs code?
when I type `dotnet run` in the terminal I get:
> Couldn't find a project to run. Ensure a project exists
| 0debug
|
static bool timer_expired_ns(QEMUTimer *timer_head, int64_t current_time)
{
return timer_head && (timer_head->expire_time <= current_time);
}
| 1threat
|
int ff_mjpeg_encode_stuffing(MpegEncContext *s)
{
int i;
PutBitContext *pbc = &s->pb;
int mb_y = s->mb_y - !s->mb_x;
int ret;
MJpegContext *m;
m = s->mjpeg_ctx;
if (s->huffman == HUFFMAN_TABLE_OPTIMAL) {
ff_mjpeg_build_optimal_huffman(m);
ff_init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len);
ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len);
s->intra_ac_vlc_length =
s->intra_ac_vlc_last_length = m->uni_ac_vlc_len;
s->intra_chroma_ac_vlc_length =
s->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len;
}
ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
s->pred, s->intra_matrix, s->chroma_intra_matrix);
ff_mjpeg_encode_picture_frame(s);
ret = ff_mpv_reallocate_putbitbuffer(s, put_bits_count(&s->pb) / 8 + 100,
put_bits_count(&s->pb) / 4 + 1000);
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Buffer reallocation failed\n");
goto fail;
}
ff_mjpeg_escape_FF(pbc, s->esc_pos);
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
put_marker(pbc, RST0 + (mb_y&7));
s->esc_pos = put_bits_count(pbc) >> 3;
fail:
for(i=0; i<3; i++)
s->last_dc[i] = 128 << s->intra_dc_precision;
return ret;
}
| 1threat
|
Forgotten arguments in function in Python (2) : It is my simple silly programm. Answer should be like “x|x”, but it is not. [enter image description here][1]
[enter image description here][2]
[1]: https://i.stack.imgur.com/ZvugG.jpg
[2]: https://i.stack.imgur.com/DrTMb.jpg
| 0debug
|
How to minify nested properties : <p>I'm using <code>terser-js</code> to minify my code.</p>
<p>The output:</p>
<pre><code>a.prototype.a = ...
a.prototype.b = ...
a.prototype.c = ...
</code></pre>
<p>What I want:</p>
<pre><code>var h = a.prototype
h.a = ...
h.b = ...
h.c = ...
</code></pre>
<p>Note that I can't write it by hand because the inputs are generated from <code>TypeScript</code>.</p>
| 0debug
|
git add command fails and keeps running : <p>I run command:</p>
<pre><code>git add .
</code></pre>
<p>and get:</p>
<pre><code>Killed: 9
</code></pre>
<p>It stops me running any git commands with a lock.</p>
<p>What is wrong with my git, I've tried rebooting, removing the directory and starting over with a new repo.</p>
| 0debug
|
It is known that we cannot declare variable two times in java.Can anyone explain the output of following code? : The output of the prograam written is Null.
class methodexample
{
int number;
String name;
void data()
{
int number=5;
int name="Rahul";
}
void display()
{
System.out.println("Number is" +number);
System.out.println("Name is " +name);
}
public static void main(String args[])
{
methodexample m=new methodexample();
m.data();
m.display();
}
}
------------------------------------------------------------------------
| 0debug
|
static int protocol_client_auth_sasl_start(VncState *vs, uint8_t *data, size_t len)
{
uint32_t datalen = len;
const char *serverout;
unsigned int serveroutlen;
int err;
char *clientdata = NULL;
if (datalen) {
clientdata = (char*)data;
clientdata[datalen-1] = '\0';
datalen--;
}
VNC_DEBUG("Start SASL auth with mechanism %s. Data %p (%d bytes)\n",
vs->sasl.mechlist, clientdata, datalen);
err = sasl_server_start(vs->sasl.conn,
vs->sasl.mechlist,
clientdata,
datalen,
&serverout,
&serveroutlen);
if (err != SASL_OK &&
err != SASL_CONTINUE) {
VNC_DEBUG("sasl start failed %d (%s)\n",
err, sasl_errdetail(vs->sasl.conn));
sasl_dispose(&vs->sasl.conn);
vs->sasl.conn = NULL;
goto authabort;
}
if (serveroutlen > SASL_DATA_MAX_LEN) {
VNC_DEBUG("sasl start reply data too long %d\n",
serveroutlen);
sasl_dispose(&vs->sasl.conn);
vs->sasl.conn = NULL;
goto authabort;
}
VNC_DEBUG("SASL return data %d bytes, nil; %d\n",
serveroutlen, serverout ? 0 : 1);
if (serveroutlen) {
vnc_write_u32(vs, serveroutlen + 1);
vnc_write(vs, serverout, serveroutlen + 1);
} else {
vnc_write_u32(vs, 0);
}
vnc_write_u8(vs, err == SASL_CONTINUE ? 0 : 1);
if (err == SASL_CONTINUE) {
VNC_DEBUG("%s", "Authentication must continue\n");
vnc_read_when(vs, protocol_client_auth_sasl_step_len, 4);
} else {
if (!vnc_auth_sasl_check_ssf(vs)) {
VNC_DEBUG("Authentication rejected for weak SSF %p\n", vs->ioc);
goto authreject;
}
if (vnc_auth_sasl_check_access(vs) < 0) {
VNC_DEBUG("Authentication rejected for ACL %p\n", vs->ioc);
goto authreject;
}
VNC_DEBUG("Authentication successful %p\n", vs->ioc);
vnc_write_u32(vs, 0);
start_client_init(vs);
}
return 0;
authreject:
vnc_write_u32(vs, 1);
vnc_write_u32(vs, sizeof("Authentication failed"));
vnc_write(vs, "Authentication failed", sizeof("Authentication failed"));
vnc_flush(vs);
vnc_client_error(vs);
return -1;
authabort:
vnc_client_error(vs);
return -1;
}
| 1threat
|
Change sheet name fro the source data in a diagram using Excel VBA : I have a diagram on a worksheet in Excel. The source data is located another sheet. I would like to redirect the source data reference in the digram to another worksheet which is identical to the first worksheet except for the actual data.
How can I get the current sheetname from the sourcedata reference in the diagram and replace that with the name of the other worksheet? I need to accomplish this using VBA.
Thanks!
| 0debug
|
How to validate a date field to allow only current dates or future dates in spring java : <p>I was asked to add a validation to the "date field". Only the present or a future date is allowed.Otherwise it shows an error message.</p>
| 0debug
|
static int ne2000_can_receive(void *opaque)
{
NE2000State *s = opaque;
if (s->cmd & E8390_STOP)
return 1;
return !ne2000_buffer_full(s);
}
| 1threat
|
Vue Cli unit test with jest how to run single test : <p>I have vue application using the vue cli 3.
During the setup process i chose jest as the testing framework.
To run my unit tests i have a script in the package.json:</p>
<pre><code>test:unit": "vue-cli-service test:unit",
</code></pre>
<p>and to run this i write in the vs code terminal:</p>
<pre><code>npm run test:unit
</code></pre>
<p>This runs all my tests that meet the specifications set up in the jest config section of the package.json file.</p>
<p>My question is how to run just a single test. Is there a specific command i need to run? or is there an vscode extension that will work with this setup. </p>
| 0debug
|
Why does we say azure functions as serverless compute service : Please help me understand why we say azure functions as serverless compute service. It does require cloud to host it and run. Cloud is also a server still why we are saying is serverless?
| 0debug
|
Find the similarity between a string input and a string column of a Data Frame. : I am new to programming.I have a pandas data frame in which two string columns are present.
Data frame is like below:
Col-1 Col-2
Animal have an apple
Fruit tiger safari
Veg Vegetable Market
Flower Garden
Here i have to create an user-defined function in Python which takes only strings(having count > 1) as input. Suppose input comes as `BOTH`, then it should throw a message `Error in Message` .
If input comes as string (Count > 2) , i need to check the similarity of that string with each element of `Col-2`. After that have to find the most similar one with respective `Col-1` value.
Expected Output :
Suppose input string is `Gardening Hobby`,
I/P O/P
Gardening Hobby Garden(60),Flower
| 0debug
|
React-Native: Facebook and Google Login : <p>I am currently trying to implement facebook and google login for a react-native app for ios and android. I must say, it is much less user-friendly than ionic for example. I have seen some libraries trying to implement this, but they all seem not to be maintained anymore.
Is there any common, reliable and stable solution which is easy to implement (if not easy to implement, really any solution that will work), to implement facebook and/or google login for react-native apps?</p>
| 0debug
|
How I can use local package in golang? : <p>Here are two <code>.go</code> files.</p>
<pre><code>├── lib.go
└── main.go
</code></pre>
<p>The <code>lib.go</code> has a package <code>libtest</code>.</p>
<pre><code>$ cat lib.go
package libtest
import (
"fmt"
)
func TestLibFunc() {
fmt.Println("This is test library function")
}
</code></pre>
<p>The <code>main.go</code> has a package <code>main</code>.</p>
<pre><code>$ cat main.go
package main
import (
"libtest"
)
func main() {
libtest.TestLibFunc()
}
</code></pre>
<p>When I tried to build them, but it's failed.</p>
<pre><code>$ go build *.go
can't load package: package main: found packages libtest (lib.go) and main (main.go) in /Users/dev/work/tmp/local-package
</code></pre>
<p>How can I use local packages in <code>main</code> package?</p>
| 0debug
|
How to solve bash syntax error on writing in a file without opening? : a bash syntax error problem
i am writing a script to insert information in files without opening the file
for i in 1 2 3 do echo This is a sample text > sample-$i.txt done
| 0debug
|
int cpu_is_bsp(CPUState *env)
{
return env->cpuid_apic_id == 0;
}
| 1threat
|
Constructing list from multi level map in Java 8 : <p>I have a multi-level map as follows:</p>
<pre><code> Map<String, Map<String, Student> outerMap =
{"cls1" : {"xyz" : Student(rollNumber=1, name="test1")},
"cls2" : {"abc" : Student(rollNumber=2, name="test2")}}
</code></pre>
<p>Now I want to construct a list of string from the above map as follows:</p>
<pre><code>["In class cls1 xyz with roll number 1",
"In class cls2 abc with roll number 2"]
</code></pre>
<p>I have written as follows, but this is not working, in this context I have gone through the post as well: <a href="https://stackoverflow.com/questions/51818929/java-8-streams-nested-maps-to-list">Java 8 Streams - Nested Maps to List</a>, but did not get much idea. </p>
<pre><code> List<String> classes = outerMap.keySet();
List<String> studentList = classes.stream()
.map(cls ->
outerMap.get(cls).keySet().stream()
.map(student -> "In class "+ cls +
student + " with roll number " +
outerMap.get(cls).get(student).getRollNum() +"\n"
).collect(Collectors.toList());
</code></pre>
| 0debug
|
show select in new td by js : <p>I need show selection id by js in class="contentsr" , this code show all in class="contentsr" we need show first select in first class="contentsr" and second select in second class="contentsr"</p>
<p>my code is this html and javascript </p>
<pre><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<td>
<select name="jens_id[]" class="jens_id" required="">
<option ></option>
<option >1</option>
<option >2</option>
</select><span class="contentsr" ></span>
</td>
</tr>
<tr>
<td>
<select name="jens_id[]" class="jens_id" required="">
<option ></option>
<option >1</option>
<option >2</option>
</select><span class="contentsr" ></span> </td>
</tr>
</table>
<script>
$(document).ready(function() {
$('.jens_id').change(function() {
statteId = $(this).val(); // or this.value
$('.contentsr').text(statteId).val();
});
});
</code></pre>
<p></p>
| 0debug
|
what is for () function corrct use here : im trying to make a code that checks if a password contains a number an uppercase and a $ symbol with for function but if i add the {} to the for function it wont work
if i do it like this it wont work :
/for(x=0;x<=10;x++) {if( isdigit(password[x])){ number++;}}/ why does removing the {} from for make it work
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <string.h>
int main()
{ int x=10,uppercase=0,number=0,dollar=0;
char password [x];
printf("enter password: ");
scanf(" %s",&password );
/*if i do it like this it wont work why ?
for(x=0;x<=10;x++) {if(isdigit(password[x])){ number++;}} */
for(x=0;x<=10;x++)
if ( isdigit(password[x])){ number++;}
for(x=0;x<=10;x++)
if ( isupper(password[x])){ uppercase++;}
for(x=0;x<=10;x++)
if ( password[x]=='$'){ dollar++;}
if( (number>=1)&&(uppercase>=1)&&(dollar>=1)){ printf("password saved");}else{ printf("invalid password");}
return 0;}
| 0debug
|
static void revert_cdlms(WmallDecodeCtx *s, int ch,
int coef_begin, int coef_end)
{
int icoef, pred, ilms, num_lms, residue, input;
num_lms = s->cdlms_ttl[ch];
for (ilms = num_lms - 1; ilms >= 0; ilms--) {
for (icoef = coef_begin; icoef < coef_end; icoef++) {
pred = 1 << (s->cdlms[ch][ilms].scaling - 1);
residue = s->channel_residues[ch][icoef];
pred += s->dsp.scalarproduct_and_madd_int16(s->cdlms[ch][ilms].coefs,
s->cdlms[ch][ilms].lms_prevvalues
+ s->cdlms[ch][ilms].recent,
s->cdlms[ch][ilms].lms_updates
+ s->cdlms[ch][ilms].recent,
s->cdlms[ch][ilms].order,
WMASIGN(residue));
input = residue + (pred >> s->cdlms[ch][ilms].scaling);
lms_update(s, ch, ilms, input);
s->channel_residues[ch][icoef] = input;
}
}
}
| 1threat
|
search and replace vulgar words in a text by using a txt file containing all the bad words with python : **hi everyone i am just a newbie with python , I wrote these lines of code,please do not laugh at me, I want to learn ! NEED Help Please**
def check_offline(text):
list_pro = open('full-list-bad.txt','r')
content = list_pro.readline()
for ligne in content :
if ligne in text :
remplacement = "*" * len(ligne)
text = text.replace(ligne ,remplacement)
print ligne
return text
print check_offline("this is a shit world " )
| 0debug
|
How to fix: error: '<filename>' does not have a commit checked out fatal: adding files failed when inputting "git add ." in command prompt : <p>I'm trying to add a ruby rails file to my repository in gitlab but it somehow wouldn't allow me to add the file saying that my file does not have commit checked out.</p>
<p>I've tried git pull, making the the file again and git adding but still wont work</p>
<p>error: '172069/08_lab_routes_controllers_views_172069_172188-Copy/adventure_game/' does not have a commit checked out
fatal: adding files failed</p>
| 0debug
|
static int mpeg_mux_init(AVFormatContext *ctx)
{
MpegMuxContext *s = ctx->priv_data;
int bitrate, i, mpa_id, mpv_id, mps_id, ac3_id, dts_id, lpcm_id, j;
AVStream *st;
StreamInfo *stream;
int audio_bitrate;
int video_bitrate;
s->packet_number = 0;
s->is_vcd = (CONFIG_MPEG1VCD_MUXER && ctx->oformat == &mpeg1vcd_muxer);
s->is_svcd = (CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer);
s->is_mpeg2 = ((CONFIG_MPEG2VOB_MUXER && ctx->oformat == &mpeg2vob_muxer) ||
(CONFIG_MPEG2DVD_MUXER && ctx->oformat == &mpeg2dvd_muxer) ||
(CONFIG_MPEG2SVCD_MUXER && ctx->oformat == &mpeg2svcd_muxer));
s->is_dvd = (CONFIG_MPEG2DVD_MUXER && ctx->oformat == &mpeg2dvd_muxer);
if(ctx->packet_size)
s->packet_size = ctx->packet_size;
else
s->packet_size = 2048;
s->vcd_padding_bytes_written = 0;
s->vcd_padding_bitrate=0;
s->audio_bound = 0;
s->video_bound = 0;
mpa_id = AUDIO_ID;
ac3_id = AC3_ID;
dts_id = DTS_ID;
mpv_id = VIDEO_ID;
mps_id = SUB_ID;
lpcm_id = LPCM_ID;
for(i=0;i<ctx->nb_streams;i++) {
st = ctx->streams[i];
stream = av_mallocz(sizeof(StreamInfo));
if (!stream)
goto fail;
st->priv_data = stream;
av_set_pts_info(st, 64, 1, 90000);
switch(st->codec->codec_type) {
case CODEC_TYPE_AUDIO:
if (st->codec->codec_id == CODEC_ID_AC3) {
stream->id = ac3_id++;
} else if (st->codec->codec_id == CODEC_ID_DTS) {
stream->id = dts_id++;
} else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
stream->id = lpcm_id++;
for(j = 0; j < 4; j++) {
if (lpcm_freq_tab[j] == st->codec->sample_rate)
break;
}
if (j == 4)
goto fail;
if (st->codec->channels > 8)
return -1;
stream->lpcm_header[0] = 0x0c;
stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4);
stream->lpcm_header[2] = 0x80;
stream->lpcm_align = st->codec->channels * 2;
} else {
stream->id = mpa_id++;
}
stream->max_buffer_size = 4 * 1024;
s->audio_bound++;
break;
case CODEC_TYPE_VIDEO:
stream->id = mpv_id++;
if (st->codec->rc_buffer_size)
stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8;
else
stream->max_buffer_size = 230*1024;
#if 0
stream->max_buffer_size = 46 * 1024;
else
stream->max_buffer_size = 230 * 1024;
#endif
s->video_bound++;
break;
case CODEC_TYPE_SUBTITLE:
stream->id = mps_id++;
stream->max_buffer_size = 16 * 1024;
break;
default:
return -1;
}
stream->fifo= av_fifo_alloc(16);
}
bitrate = 0;
audio_bitrate = 0;
video_bitrate = 0;
for(i=0;i<ctx->nb_streams;i++) {
int codec_rate;
st = ctx->streams[i];
stream = (StreamInfo*) st->priv_data;
if(st->codec->rc_max_rate || stream->id==VIDEO_ID)
codec_rate= st->codec->rc_max_rate;
else
codec_rate= st->codec->bit_rate;
if(!codec_rate)
codec_rate= (1<<21)*8*50/ctx->nb_streams;
bitrate += codec_rate;
if (stream->id==AUDIO_ID)
audio_bitrate += codec_rate;
else if (stream->id==VIDEO_ID)
video_bitrate += codec_rate;
}
if(ctx->mux_rate){
s->mux_rate= (ctx->mux_rate + (8 * 50) - 1) / (8 * 50);
} else {
bitrate += bitrate*5/100;
bitrate += 10000;
s->mux_rate = (bitrate + (8 * 50) - 1) / (8 * 50);
}
if (s->is_vcd) {
double overhead_rate;
overhead_rate = ((audio_bitrate / 8.0) / 2279) * (2324 - 2279);
overhead_rate += ((video_bitrate / 8.0) / 2294) * (2324 - 2294);
overhead_rate *= 8;
s->vcd_padding_bitrate = 2324 * 75 * 8 - (bitrate + overhead_rate);
}
if (s->is_vcd || s->is_mpeg2)
s->pack_header_freq = 1;
else
s->pack_header_freq = 2 * bitrate / s->packet_size / 8;
if (s->pack_header_freq == 0)
s->pack_header_freq = 1;
if (s->is_mpeg2)
s->system_header_freq = s->pack_header_freq * 40;
else if (s->is_vcd)
s->system_header_freq = 0x7fffffff;
else
s->system_header_freq = s->pack_header_freq * 5;
for(i=0;i<ctx->nb_streams;i++) {
stream = ctx->streams[i]->priv_data;
stream->packet_number = 0;
}
s->system_header_size = get_system_header_size(ctx);
s->last_scr = 0;
return 0;
fail:
for(i=0;i<ctx->nb_streams;i++) {
av_free(ctx->streams[i]->priv_data);
}
return AVERROR(ENOMEM);
}
| 1threat
|
Why does this doesn't work? (os.makedirs) : Please do help me in solving out the below code and say why is the os.makedirs doesnot work???
import os,pprint,sys
**while True:
print()
oq=input('Press the first directory: ')
print()
print()
ow=input('Press the next directory/name: ')
print()
p2=input('Continue with next directory? yes or no: ').lower()
if p2=='no':
break
print()
oe=input('Press the next directory/name: ')
print()
p3=input('Continue with next directory? yes or no: ').lower()
if p3=='no':
break
print()
oee=input('Press the next directory/name: ')
print()
p4=input('Continue with next directory? yes or no: ').lower()
if p4=='no':
break
print()
ot=input('Press the next directory/name: ')
print()
p5=input('Continue with next directory? yes or no: ').lower()
if p5=='no':
break
print()
oy=input('Press the next directory/name: ')
print()
p6=input('Continue with next directory? yes or no: ').lower()
if p6=='no':
break
print()
ou=input('Press the next directory/name: ')
print()
p7=input('Continue with next directory? yes or no: ').lower()
if p7=='no':
break
print()
if p2=='no':
os.makedirs(oq+'\\'+ow)
if p3=='no':
os.makedirs(oq+'\\'+ow+'\\'+oe)
if p4=='no':
os.makedirs(oq+'\\'+ow+'\\'+oe+'\\'+oee))
if p5=='no':
os.makedirs(oq+'\\'+ow+'\\'+oe+'\\'+oee+'\\'+ot)
if p6=='no':
os.makedirs(oq+'\\'+ow+'\\'+oe+'\\'+oee+'\\'+ot+'\\'+oy)
if p7=='no':
os.makedirs(oq+'\\'+ow+'\\'+oe+'\\'+oee+'\\'+ot+'\\'+oy+'\\'+ou)
ppp=input('Wannna continue???')
if ppp=='no':
sys.exit()**
| 0debug
|
static void test_acpi_tables(test_data *data)
{
int tables_nr = data->rsdt_tables_nr - 1;
int i;
for (i = 0; i < tables_nr; i++) {
AcpiSdtTable ssdt_table;
uint32_t addr;
addr = le32_to_cpu(data->rsdt_tables_addr[i + 1]);
test_dst_table(&ssdt_table, addr);
g_array_append_val(data->tables, ssdt_table);
}
}
| 1threat
|
static void test_visitor_out_union_flat(TestOutputVisitorData *data,
const void *unused)
{
QObject *arg;
QDict *qdict;
Error *err = NULL;
UserDefFlatUnion *tmp = g_malloc0(sizeof(UserDefFlatUnion));
tmp->enum1 = ENUM_ONE_VALUE1;
tmp->string = g_strdup("str");
tmp->value1 = g_malloc0(sizeof(UserDefA));
tmp->value1->boolean = true;
visit_type_UserDefFlatUnion(data->ov, &tmp, NULL, &err);
g_assert(err == NULL);
arg = qmp_output_get_qobject(data->qov);
g_assert(qobject_type(arg) == QTYPE_QDICT);
qdict = qobject_to_qdict(arg);
g_assert_cmpstr(qdict_get_str(qdict, "enum1"), ==, "value1");
g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, "str");
g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, true);
qapi_free_UserDefFlatUnion(tmp);
QDECREF(qdict);
}
| 1threat
|
int arm_reset_cpu(uint64_t cpuid)
{
CPUState *target_cpu_state;
ARMCPU *target_cpu;
DPRINTF("cpu %" PRId64 "\n", cpuid);
target_cpu_state = arm_get_cpu_by_id(cpuid);
if (!target_cpu_state) {
return QEMU_ARM_POWERCTL_INVALID_PARAM;
}
target_cpu = ARM_CPU(target_cpu_state);
if (target_cpu->powered_off) {
qemu_log_mask(LOG_GUEST_ERROR,
"[ARM]%s: CPU %" PRId64 " is off\n",
__func__, cpuid);
return QEMU_ARM_POWERCTL_IS_OFF;
}
cpu_reset(target_cpu_state);
return QEMU_ARM_POWERCTL_RET_SUCCESS;
}
| 1threat
|
static int virtio_ccw_set_guest_notifier(VirtioCcwDevice *dev, int n,
bool assign, bool with_irqfd)
{
VirtIODevice *vdev = virtio_bus_get_device(&dev->bus);
VirtQueue *vq = virtio_get_queue(vdev, n);
EventNotifier *notifier = virtio_queue_get_guest_notifier(vq);
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
if (assign) {
int r = event_notifier_init(notifier, 0);
if (r < 0) {
return r;
}
virtio_queue_set_guest_notifier_fd_handler(vq, true, with_irqfd);
if (with_irqfd) {
r = virtio_ccw_add_irqfd(dev, n);
if (r) {
virtio_queue_set_guest_notifier_fd_handler(vq, false,
with_irqfd);
return r;
}
}
if (k->guest_notifier_mask) {
k->guest_notifier_mask(vdev, n, false);
}
if (k->guest_notifier_pending &&
k->guest_notifier_pending(vdev, n)) {
event_notifier_set(notifier);
}
} else {
if (k->guest_notifier_mask) {
k->guest_notifier_mask(vdev, n, true);
}
if (with_irqfd) {
virtio_ccw_remove_irqfd(dev, n);
}
virtio_queue_set_guest_notifier_fd_handler(vq, false, with_irqfd);
event_notifier_cleanup(notifier);
}
return 0;
}
| 1threat
|
static void qemu_aio_complete(void *opaque, int ret)
{
struct ioreq *ioreq = opaque;
if (ret != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0, "%s I/O error\n",
ioreq->req.operation == BLKIF_OP_READ ? "read" : "write");
ioreq->aio_errors++;
}
ioreq->aio_inflight--;
if (ioreq->presync) {
ioreq->presync = 0;
ioreq_runio_qemu_aio(ioreq);
return;
}
if (ioreq->aio_inflight > 0) {
return;
}
if (ioreq->postsync) {
ioreq->postsync = 0;
ioreq->aio_inflight++;
bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq);
return;
}
ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
ioreq_unmap(ioreq);
ioreq_finish(ioreq);
switch (ioreq->req.operation) {
case BLKIF_OP_WRITE:
case BLKIF_OP_FLUSH_DISKCACHE:
if (!ioreq->req.nr_segments) {
break;
}
case BLKIF_OP_READ:
block_acct_done(bdrv_get_stats(ioreq->blkdev->bs), &ioreq->acct);
break;
case BLKIF_OP_DISCARD:
default:
break;
}
qemu_bh_schedule(ioreq->blkdev->bh);
}
| 1threat
|
static void do_info_cpus(Monitor *mon, QObject **ret_data)
{
CPUState *env;
QList *cpu_list;
cpu_list = qlist_new();
mon_get_cpu();
for(env = first_cpu; env != NULL; env = env->next_cpu) {
QDict *cpu;
QObject *obj;
cpu_synchronize_state(env);
obj = qobject_from_jsonf("{ 'CPU': %d, 'current': %i, 'halted': %i }",
env->cpu_index, env == mon->mon_cpu,
env->halted);
assert(obj != NULL);
cpu = qobject_to_qdict(obj);
#if defined(TARGET_I386)
qdict_put(cpu, "pc", qint_from_int(env->eip + env->segs[R_CS].base));
#elif defined(TARGET_PPC)
qdict_put(cpu, "nip", qint_from_int(env->nip));
#elif defined(TARGET_SPARC)
qdict_put(cpu, "pc", qint_from_int(env->pc));
qdict_put(cpu, "npc", qint_from_int(env->npc));
#elif defined(TARGET_MIPS)
qdict_put(cpu, "PC", qint_from_int(env->active_tc.PC));
#endif
qlist_append(cpu_list, cpu);
}
*ret_data = QOBJECT(cpu_list);
}
| 1threat
|
Selecting today Placed loan and cleared loan in provided table : I am building an application that hold user loan information; but the problem is how to select amount of loan placed today and cleared today; for example if user place loan at 7:00 AM and cleared it at the same day at 13:00 PM how could I get this loan placed today and cleared today? My example table is:
--------------------------------------------------------------------------
id | user_id | placed_loan | cleared loan | plcd date | cld_date | status
--------------------------------------------------------------------------
1 | 2 | 5000.00 | 0.00 | 19/6/12 | | 1
--------------------------------------------------------------------------
2 | 2 | 0.00 | 4000.00 | | 19/6/13 | 2
--------------------------------------------------------------------------
3 | 2 | 2000.00 | 0.00 | 19/6/14 | | 1
--------------------------------------------------------------------------
4 | 3 | 4000.00 | 0.00 | 19/6/14 | | 1
--------------------------------------------------------------------------
5 | 2 | 0.00 | 3000.00 | | 19/6/14 | 2
--------------------------------------------------------------------------
6 | 3 | 0.00 | 2000.00 | | 19/6/15 | 2
--------------------------------------------------------------------------
For example user with ID 2 on 19/6/14 placed a loan of 2000.00 and cleared a loan of 3000.00 this is to say that amount of loan placed on 19/6/14 and cleared on 19/6/14 for the user 2 is 2000.00; and remaining 1000.00 was of 19/6/12. how could I select these data?
| 0debug
|
Pip inside dockerfile under proxy : <p>I am trying to build a Docker image for elasticsearch-curator, </p>
<p>Here is the dockerfile:</p>
<pre><code>FROM alpine:3.7
RUN adduser -S curator
RUN apk add --update \
python \
python-dev \
py-pip \
build-base \
&& pip install virtualenv \
&& pip install elasticsearch-curator \
&& rm -rf /var/cache/apk/*
USER curator
ENTRYPOINT [ "/usr/bin/curator"]
</code></pre>
<p>Thing is I am under a proxy, so I must build my image with:</p>
<pre><code>docker build --no-cache --build-arg HTTP_PROXY=http://xx.xx.xx.xx:xx -t elasticsearch-curator:5.4 .
</code></pre>
<p>But when it wants to get virtualenv, I get:</p>
<pre><code>Collecting virtualenv
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8259ed350>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/virtualenv/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8259ed210>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/virtualenv/
</code></pre>
<p>I found people solving issue inserting </p>
<pre><code>ENV http_proxy http://proxy-chain.xxx.com:911/
ENV https_proxy http://proxy-chain.xxx.com:912/
</code></pre>
<p>in the Dockerfile, but it is not possible for me, because my proxy is only valid on my building, so if another person from another place want to build the image, he will need to remove http_proxy env var from Dockerfile.</p>
<p>Is there any other way to achieve it? It seems like a very common use case...</p>
| 0debug
|
Removing every 2nd element in array list : <p>I've been trying so far to write a method ,removeEvenLength that takes an ArrayList of Strings as a parameter and that removes all of the strings of even length from the list. But so far I've been getting a IndexOutOfBoundsException and I don't know why.</p>
<p>Any help would be appreciated</p>
<pre><code>public static ArrayList<String> removeEvenLength(ArrayList<String> list) {
int size = list.size();
ArrayList<String> newLst = new ArrayList<String>();
for (int x = 0; x < size; x++) {
if (list.get(x).length() % 2 == 0) {
list.remove(x);
}
}
return list;
</code></pre>
<p>}</p>
| 0debug
|
Looping through a variable in a class to find the key in a dict : I want the user to type in a name "Jim" then a def function is called in a class to look through all the names in the dict matching "Jim". If it finds the word "Jim" in the dict it will print out the value. When I run the code it just says None.
class Test(object):
def __init__(self, x=0): # So I don't get an error in (def find)
self.x = x
c = None # So I don't get an error while looping in the for loop
users = {
'John': 1,
'Jim': 2,
'Bob': 3
}
def find(self, x): # The user is suppose to type in the name "x"
for self.c in self.users: # it goes through the dictionary
if x == self.users[self.c]: # If x is equal to key it prints worked
print('worked')
else:
pass
beta = Test()
print(beta.find('Jim'))
| 0debug
|
Using immutability-helper in React to set variable object key : <p>I have a function I want to write in React. In my class I have a state object <code>fields</code> that looks like this:</p>
<pre><code>this.state = {
step: 1,
fields: {
type: '',
name: '',
subtype: '',
team: '',
agreement: ''
}
};
</code></pre>
<p>I have various functions that assign those keys using <code>immutability helper</code> that generally look like:</p>
<pre><code>assignType(attribute) {
var temp = update(this.state.fields, {
type: {$set: attribute}
});
this.setState({
fields: temp
});
}
</code></pre>
<p>What I would <em>like</em> to do is use a function that's more generic and do something like this:</p>
<pre><code>assignAttribute(field, attribute) {
var temp = update(this.state.fields, {
field: {$set: attribute}
});
this.setState({
fields: temp
});
}
</code></pre>
<p>But, this doesn't work. What can I do to use a variable key using <code>immutability-helper</code>?</p>
| 0debug
|
static int poll_frame(AVFilterLink *link)
{
AVFilterContext *s = link->src;
OverlayContext *over = s->priv;
int ret = avfilter_poll_frame(s->inputs[OVERLAY]);
if (ret == AVERROR_EOF)
ret = !!over->overpicref;
return ret && avfilter_poll_frame(s->inputs[MAIN]);
}
| 1threat
|
xCode/Swift user input from textfield : I'm trying to create a class Course with properties such as setting a var to a string/int of user input from a textField. How would I implement this in swift? I was thinking it would be something along the lines of
`class Course {
let x = self.textFieldname.text!
}`
But I wind up with an error saying "Instance member can not be used on type ViewController.
I'm a noob to iOS and swift so any help is greatly appreciated.
| 0debug
|
Getting NullPointerException at onFilterTouchEventForSecurity : <p>I have built app in which I integrate YouTube API and it is working fine without any crash but on Fabric I checked some crash whis is <code>ipf.onFilterTouchEventForSecurity</code>. Here is the full logs of the crash:</p>
<pre><code>java.lang.NullPointerException:
at ipf.onFilterTouchEventForSecurity(ipf.java:115)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2351)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2876)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2519)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2840)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1853)
at android.app.Activity.dispatchTouchEvent(Activity.java:3061)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2801)
at android.view.View.dispatchPointerEvent(View.java:10246)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5447)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5283)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4721)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4774)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4740)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4882)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4748)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4939)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4721)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4774)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4740)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4748)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4721)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7429)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7298)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7259)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7539)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java:0)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java:0)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
</code></pre>
<p>I know that this issue is not because of code but I need to prevent crashing.</p>
<p>Here is list of devices on which I am facing issue:</p>
<ol>
<li>Samsung Galaxy J7 (j7elte), 1536MB RAM, Android 6.0</li>
<li>Xiaomi Redmi Note 3 (kenzo), 2048MB RAM, Android 6.0</li>
<li>Lenovo TB3-710F (TB3-710F), 1024MB RAM, Android 5.0</li>
<li>Xiaomi Redmi 3S (land), 2048MB RAM, Android 6.0</li>
<li>LeTV Le 2 (le_s2_ww), 3072MB RAM, Android 6.0</li>
<li>LGE LG Stylus2 4G (ph2), 2048MB RAM, Android 6.0</li>
<li>Infocus M2_3G (G10), 10124MB RAM, Android 4.4</li>
</ol>
| 0debug
|
consumer.How to specify partition to read? [kafka] : <p>I am introducing with kafka and I want to know how to specify partition when I consume messages from topic.</p>
<p>I have found several picture like this:</p>
<p><a href="https://i.stack.imgur.com/PeZlZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PeZlZ.png" alt="enter image description here"></a></p>
<p>It means that 1 consumer can consume messages from several partitions but 1 partition can be read by single consumer(within consumer group) </p>
<p>Also I have read several examples for consumer and it looks like this:</p>
<pre><code>Properties props = new Properties();
props.put("bootstrap.servers", "localhost:9092");
props.put("group.id", "consumer-tutorial");
props.put("key.deserializer", StringDeserializer.class.getName());
props.put("value.deserializer", StringDeserializer.class.getName());
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
</code></pre>
<p>and: </p>
<h2>1.subscribe:</h2>
<pre><code>consumer.subscribe(Arrays.asList(“foo”, “bar”));
</code></pre>
<h2>2. poll</h2>
<pre><code> try {
while (running) {
ConsumerRecords<String, String> records = consumer.poll(1000);
for (ConsumerRecord<String, String> record : records)
System.out.println(record.offset() + ": " + record.value());
}
} finally {
consumer.close();
}
</code></pre>
<p>How does this work? From which partition will I read messages? </p>
| 0debug
|
static void text_console_resize(QemuConsole *s)
{
TextCell *cells, *c, *c1;
int w1, x, y, last_width;
last_width = s->width;
s->width = surface_width(s->surface) / FONT_WIDTH;
s->height = surface_height(s->surface) / FONT_HEIGHT;
w1 = last_width;
if (s->width < w1)
w1 = s->width;
cells = g_malloc(s->width * s->total_height * sizeof(TextCell));
for(y = 0; y < s->total_height; y++) {
c = &cells[y * s->width];
if (w1 > 0) {
c1 = &s->cells[y * last_width];
for(x = 0; x < w1; x++) {
*c++ = *c1++;
}
}
for(x = w1; x < s->width; x++) {
c->ch = ' ';
c->t_attrib = s->t_attrib_default;
c++;
}
}
g_free(s->cells);
s->cells = cells;
}
| 1threat
|
void qmp_x_blockdev_del(bool has_id, const char *id,
bool has_node_name, const char *node_name, Error **errp)
{
AioContext *aio_context;
BlockBackend *blk;
BlockDriverState *bs;
if (has_id && has_node_name) {
error_setg(errp, "Only one of id and node-name must be specified");
return;
} else if (!has_id && !has_node_name) {
error_setg(errp, "No block device specified");
return;
}
if (has_id) {
blk = blk_by_name(id);
if (!blk) {
error_setg(errp, "Cannot find block backend %s", id);
return;
}
if (blk_legacy_dinfo(blk)) {
error_setg(errp, "Deleting block backend added with drive-add"
" is not supported");
return;
}
if (blk_get_refcnt(blk) > 1) {
error_setg(errp, "Block backend %s is in use", id);
return;
}
bs = blk_bs(blk);
aio_context = blk_get_aio_context(blk);
} else {
blk = NULL;
bs = bdrv_find_node(node_name);
if (!bs) {
error_setg(errp, "Cannot find node %s", node_name);
return;
}
if (bdrv_has_blk(bs)) {
error_setg(errp, "Node %s is in use by %s",
node_name, bdrv_get_parent_name(bs));
return;
}
aio_context = bdrv_get_aio_context(bs);
}
aio_context_acquire(aio_context);
if (bs) {
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_DRIVE_DEL, errp)) {
goto out;
}
if (!blk && !bs->monitor_list.tqe_prev) {
error_setg(errp, "Node %s is not owned by the monitor",
bs->node_name);
goto out;
}
if (bs->refcnt > 1) {
error_setg(errp, "Block device %s is in use",
bdrv_get_device_or_node_name(bs));
goto out;
}
}
if (blk) {
monitor_remove_blk(blk);
blk_unref(blk);
} else {
QTAILQ_REMOVE(&monitor_bdrv_states, bs, monitor_list);
bdrv_unref(bs);
}
out:
aio_context_release(aio_context);
}
| 1threat
|
how to check type of variable in typescript +angular? : <p>could you please tell me how to check typeof of variable in typescript + angular ?</p>
<pre><code>import { Component } from '@angular/core';
interface Abc {
name : string
}
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
name = 'Angular 6';
a:Abc= {
name:"sss"
}
constructor(){
console.log(typeof this.a)
// console.log(this.a instanceof Abc)
}
}
</code></pre>
<p>It should give <code>true</code> and <code>false</code></p>
<p><a href="https://stackblitz.com/edit/angular-jfargi?file=src/app/app.component.ts" rel="noreferrer">https://stackblitz.com/edit/angular-jfargi?file=src/app/app.component.ts</a></p>
| 0debug
|
Getting errors when executing app in real device first time from Android Studio : <p>I have recently installed Android Studio and executing my first android app in real device but getting belows errors. </p>
<p>Can anyone please help me regarding this</p>
<blockquote>
<p>org.gradle.internal.exceptions.LocationAwareException: Could not
determine the dependencies of task ':app:processDebugResources'. at
org.gradle.initialization.exception.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:99)
at
org.gradle.initialization.exception.DefaultExceptionAnalyser.collectFailures(DefaultExceptionAnalyser.java:65)
at
org.gradle.initialization.exception.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
at
org.gradle.initialization.exception.StackTraceSanitizingExceptionAnalyser.transform(StackTraceSanitizingExceptionAnalyser.java:29)
at
org.gradle.initialization.DefaultGradleLauncher.finishBuild(DefaultGradleLauncher.java:174)
at
org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:165)
at
org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
at
org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
at
org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
at
org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
at
org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
at
org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
at
org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
at
org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
at
org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
at
org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:55)
at
org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at
org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at
org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
at
org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at
org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
at
org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
at
org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
at
org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at
org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
at
org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
at
org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
at
org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
at
org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
at
org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
at
org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
at
org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
at
org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
at
org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
at
org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
at
org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
at
org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
at
org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
at
org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
at
org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
at
org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at
org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at
org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
at
org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
at
org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
at
org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
at
org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
at
org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
at
org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at
org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at
org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38) at
org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at
org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
at
org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
at
org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at
org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at
org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at
org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at
org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by:
org.gradle.api.internal.tasks.TaskDependencyResolveException: Could
not determine the dependencies of task ':app:processDebugResources'.
at
org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:68)
at
org.gradle.execution.plan.TaskDependencyResolver.resolveDependenciesFor(TaskDependencyResolver.java:46)
at
org.gradle.execution.plan.LocalTaskNode.getDependencies(LocalTaskNode.java:106)
at
org.gradle.execution.plan.LocalTaskNode.resolveDependencies(LocalTaskNode.java:79)
at
org.gradle.execution.plan.DefaultExecutionPlan.addEntryTasks(DefaultExecutionPlan.java:167)
at
org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.addEntryTasks(DefaultTaskExecutionGraph.java:139)
at
org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:48)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:57)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$200(DefaultBuildConfigurationActionExecuter.java:26)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter$2.proceed(DefaultBuildConfigurationActionExecuter.java:63)
at
org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:44)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:57)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$200(DefaultBuildConfigurationActionExecuter.java:26)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter$2.proceed(DefaultBuildConfigurationActionExecuter.java:63)
at
org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:47)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.configure(DefaultBuildConfigurationActionExecuter.java:57)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.access$200(DefaultBuildConfigurationActionExecuter.java:26)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter$1.run(DefaultBuildConfigurationActionExecuter.java:43)
at org.gradle.internal.Factories$1.create(Factories.java:25) at
org.gradle.api.internal.project.DefaultProjectStateRegistry.withLenientState(DefaultProjectStateRegistry.java:132)
at
org.gradle.api.internal.project.DefaultProjectStateRegistry.withLenientState(DefaultProjectStateRegistry.java:124)
at
org.gradle.execution.DefaultBuildConfigurationActionExecuter.select(DefaultBuildConfigurationActionExecuter.java:39)
at
org.gradle.initialization.DefaultGradleLauncher$CalculateTaskGraph.run(DefaultGradleLauncher.java:333)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at
org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at
org.gradle.initialization.DefaultGradleLauncher.constructTaskGraph(DefaultGradleLauncher.java:218)
at
org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
... 73 more Caused by:
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException:
Could not resolve all task dependencies for configuration
':app:_internal_aapt2_binary'. at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1175)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$2100(DefaultConfiguration.java:135)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationTaskDependency.visitDependencies(DefaultConfiguration.java:1657)
at
org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext$TaskGraphImpl.getNodeValues(CachingTaskDependencyResolveContext.java:106)
at
org.gradle.internal.graph.CachingDirectedGraphWalker$GraphWithEmpyEdges.getNodeValues(CachingDirectedGraphWalker.java:211)
at
org.gradle.internal.graph.CachingDirectedGraphWalker.doSearch(CachingDirectedGraphWalker.java:121)
at
org.gradle.internal.graph.CachingDirectedGraphWalker.findValues(CachingDirectedGraphWalker.java:73)
at
org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:66)
... 102 more Caused by:
org.gradle.internal.resolve.ModuleVersionResolveException: Could not
resolve com.android.tools.build:aapt2:3.4.2-5326820. Required by:
project :app at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:103)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolve(RepositoryChainComponentMetaDataResolver.java:63)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.ComponentResolversChain$ComponentMetaDataResolverChain.resolve(ComponentResolversChain.java:95)
at
org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:63)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState.resolve(ComponentState.java:193)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.ComponentState.getMetadata(ComponentState.java:143)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.calculateTargetConfigurations(EdgeState.java:173)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.EdgeState.attachToTargetConfigurations(EdgeState.java:129)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.attachToTargetRevisionsSerially(DependencyGraphBuilder.java:318)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.resolveEdges(DependencyGraphBuilder.java:217)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:170)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.builder.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:131)
at
org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultArtifactDependencyResolver.resolve(DefaultArtifactDependencyResolver.java:121)
at
org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolveGraph(DefaultConfigurationResolver.java:171)
at
org.gradle.api.internal.artifacts.ivyservice.ShortCircuitEmptyConfigurationResolver.resolveGraph(ShortCircuitEmptyConfigurationResolver.java:86)
at
org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingConfigurationResolver.resolveGraph(ErrorHandlingConfigurationResolver.java:73)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$7.run(DefaultConfiguration.java:580)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at
org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphIfRequired(DefaultConfiguration.java:571)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$600(DefaultConfiguration.java:135)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$6.run(DefaultConfiguration.java:551)
at
org.gradle.api.internal.project.DefaultProjectStateRegistry$SafeExclusiveLockImpl.withLock(DefaultProjectStateRegistry.java:244)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveExclusively(DefaultConfiguration.java:547)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveToStateOrLater(DefaultConfiguration.java:542)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveGraphForBuildDependenciesIfRequired(DefaultConfiguration.java:692)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$3700(DefaultConfiguration.java:135)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationTaskDependency.visitDependencies(DefaultConfiguration.java:1652)
... 107 more Caused by:
org.gradle.internal.resolve.ModuleVersionResolveException: Could not
resolve com.android.tools.build:aapt2:3.4.2-5326820. at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$resolveComponentMetaData$5(ErrorHandlingModuleComponentRepository.java:161)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:251)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:227)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.performOperationWithRetries(ErrorHandlingModuleComponentRepository.java:220)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:158)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.process(ComponentMetaDataResolveState.java:69)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentMetaDataResolveState.resolve(ComponentMetaDataResolveState.java:61)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.findBestMatch(RepositoryChainComponentMetaDataResolver.java:138)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.findBestMatch(RepositoryChainComponentMetaDataResolver.java:119)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver.resolveModule(RepositoryChainComponentMetaDataResolver.java:92)
... 137 more Caused by: org.gradle.api.resources.ResourceException:
Could not get resource
'<a href="https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820.pom" rel="nofollow noreferrer">https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820.pom</a>'.
at
org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at
org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
at
org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:201)
at
org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.access$300(DefaultCacheAwareExternalResourceAccessor.java:54)
at
org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:89)
at
org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor$1.create(DefaultCacheAwareExternalResourceAccessor.java:81)
at
org.gradle.cache.internal.ProducerGuard$AdaptiveProducerGuard.guardByKey(ProducerGuard.java:97)
at
org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:81)
at
org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoords(DefaultExternalResourceArtifactResolver.java:133)
at
org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:97)
at
org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.resolveArtifact(DefaultExternalResourceArtifactResolver.java:64)
at
org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.parseMetaDataFromArtifact(AbstractRepositoryMetadataSource.java:69)
at
org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.create(AbstractRepositoryMetadataSource.java:59)
at
org.gradle.api.internal.artifacts.repositories.metadata.DefaultMavenPomMetadataSource.create(DefaultMavenPomMetadataSource.java:38)
at
org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolveStaticDependency(ExternalResourceResolver.java:243)
at
org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.doResolveComponentMetaData(MavenResolver.java:126)
at
org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveComponentMetaData(ExternalResourceResolver.java:444)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$ResolveAndCacheRepositoryAccess.resolveComponentMetaData(CachingModuleComponentRepository.java:373)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$resolveComponentMetaData$3(ErrorHandlingModuleComponentRepository.java:159)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.lambda$tryResolveAndMaybeBlacklist$15(ErrorHandlingModuleComponentRepository.java:228)
at
org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.tryResolveAndMaybeBlacklist(ErrorHandlingModuleComponentRepository.java:242)
... 145 more Caused by:
org.gradle.internal.resource.transport.http.HttpRequestException:
Could not GET
'<a href="https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820.pom" rel="nofollow noreferrer">https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820.pom</a>'.
at
org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:93)
at
org.gradle.internal.resource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:76)
at
org.gradle.internal.resource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:80)
at
org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:42)
at
org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:28)
at
org.gradle.internal.resource.transfer.DefaultExternalResourceConnector.openResource(DefaultExternalResourceConnector.java:56)
at
org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor.openResource(ProgressLoggingExternalResourceAccessor.java:37)
at
org.gradle.internal.resource.transfer.AccessorBackedExternalResource.withContentIfPresent(AccessorBackedExternalResource.java:130)
at
org.gradle.internal.resource.BuildOperationFiringExternalResourceDecorator$11.call(BuildOperationFiringExternalResourceDecorator.java:237)
at
org.gradle.internal.resource.BuildOperationFiringExternalResourceDecorator$11.call(BuildOperationFiringExternalResourceDecorator.java:229)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
at
org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
at
org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at
org.gradle.internal.resource.BuildOperationFiringExternalResourceDecorator.withContentIfPresent(BuildOperationFiringExternalResourceDecorator.java:229)
at
org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.copyToCache(DefaultCacheAwareExternalResourceAccessor.java:199)
... 163 more Caused by:
org.apache.http.conn.HttpHostConnectException: Connect to
dl.google.com:443 [dl.google.com/172.217.166.14] failed: Connection
timed out: connect at
org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:159)
at
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:373)
at
org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:394)
at
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at
org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at
org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:132)
at
org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:109)
at
org.gradle.internal.resource.transport.http.HttpClientHelper.executeGetOrHead(HttpClientHelper.java:98)
at
org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:89)
... 179 more Caused by: java.net.ConnectException: Connection timed
out: connect at
org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:339)
at
org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
... 191 more</p>
</blockquote>
| 0debug
|
static void gen_ldx(DisasContext *dc, uint32_t code, uint32_t flags)
{
I_TYPE(instr, code);
TCGv addr = tcg_temp_new();
TCGv data;
if (likely(instr.b != R_ZERO)) {
data = dc->cpu_R[instr.b];
} else {
data = tcg_temp_new();
}
tcg_gen_addi_tl(addr, load_gpr(dc, instr.a), instr.imm16s);
tcg_gen_qemu_ld_tl(data, addr, dc->mem_idx, flags);
if (unlikely(instr.b == R_ZERO)) {
tcg_temp_free(data);
}
tcg_temp_free(addr);
}
| 1threat
|
RXJS: SwitchMap converts string into single characters unexpectedly : <p>I am playing around with RXJS for TypeScript and stumbled upon an issue that I cannot explain myself. I have an <code>observable</code> that emits multiple strings. I then want to apply <code>switchMap</code> to it which is supposed to prepend "a" to each of those strings:</p>
<pre><code>var o = Observable.create((observer) => {
observer.next("hi")
observer.next("bla")
})
o.switchMap(str => "a" + str).subscribe(str => console.log(str))
</code></pre>
<p>My expected output:</p>
<pre><code>ahi
abla
</code></pre>
<p>Actual output:</p>
<pre><code>a
h
i
a
b
l
a
</code></pre>
<p>So somewhere between switchMap and subscribe, the string gets broken down into characters apparently.</p>
<p>Can someone explain why this happens?</p>
| 0debug
|
int mjpeg_init(MpegEncContext *s)
{
MJpegContext *m;
m = malloc(sizeof(MJpegContext));
if (!m)
return -1;
build_huffman_codes(m->huff_size_dc_luminance,
m->huff_code_dc_luminance,
bits_dc_luminance,
val_dc_luminance);
build_huffman_codes(m->huff_size_dc_chrominance,
m->huff_code_dc_chrominance,
bits_dc_chrominance,
val_dc_chrominance);
build_huffman_codes(m->huff_size_ac_luminance,
m->huff_code_ac_luminance,
bits_ac_luminance,
val_ac_luminance);
build_huffman_codes(m->huff_size_ac_chrominance,
m->huff_code_ac_chrominance,
bits_ac_chrominance,
val_ac_chrominance);
s->mjpeg_ctx = m;
return 0;
}
| 1threat
|
Angular 2/4 Edit Form Populate FormArray Controls : <p>I'm trying to implement an edit form for a model with nested attributes (FormArray). I'm having trouble with the syntax and I'm uncertain whether I'm on the right track. The attributes for the main form work, it's the nested form I'm having problems with. Here's what I have so far.</p>
<p>Here I initiate the form group:</p>
<pre><code>private initForm() {
this.subscription = this.expenseService.getExpense(this.id)
.subscribe(
expense => {
this.expense = expense;
this.patchForm();
}
);
this.expenseEditForm = this.fb.group({
date: '',
amount: '',
check_number: '',
debit: '',
payee_id: '',
notes: '',
expense_expense_categories_attributes:[]
});
}
</code></pre>
<p>Here I patch the form to set values from an object retrieved from my backend API.</p>
<pre><code>private patchForm() {
this.expenseEditForm.setValue({
date: '',
amount: this.expense.amount_cents,
check_number: this.expense.check_number,
debit: this.expense.debit,
payee_id: '',
notes: this.expense.notes,
expense_expense_categories_attributes: this.fb.array([
this.setExpenseCategories(),
])
});
}
</code></pre>
<p>This is where I'm stuck. How do I push onto a FormArray. If I try to push, I get an error stating that push it doesn't exist on FormArray. </p>
<pre><code>private setExpenseCategories() {
for ( let expenseCategories of this.expense.expense_expense_categories){
this.fb.array.push([
this.fb.group({
expense_category_id: [expenseCategories.expense_category_id, Validators.required],
amount: [expenseCategories.amount_cents]
])
});
}
}
</code></pre>
<p>Just in case it's needed. Here's my html.</p>
<pre><code><div
*ngFor="let expensecategoriesCtl of expenseEditForm.controls.expense_expense_categories_attributes.controls let i = index"
[formGroupName]="i"
style="margin-top: 10px;">
<md-card>
<md-select class="full-width-input"
placeholder="Expense Category"
id="expense_category_id"
formControlName="expense_category_id"
>
<md-option *ngFor="let expenseCategory of expenseCategories" value="{{expenseCategory.id}}">
{{expenseCategory.category}}
</md-option>
</md-select>
<md-input-container class="full-width-input">
<input
mdInput placeholder="Amount"
type="number"
formControlName="amount">
</md-input-container>
</md-card>
</div>
</code></pre>
| 0debug
|
Notification DropBox Api Android : I 'm trying to implements notifications for an android Application : i am using dropbox api : https://www.dropbox.com/developers/apps.
The point is i'm a newbie, i've never done something like that, i have read a bit about that i should use a JSON request ? I have not found any tutorial related to notification with dropbox api for android.
Can someone help me ? Which steps should i follow etc ??
Any help is welcomed.
Thank you very much.
| 0debug
|
Value For Dict - Python : I have a code to get a specific value from yahoo API. The problem is it matched the IF statement but it returns None and also again its going to the else loop for some reason. Can some one help me out pls. Very new to python.
I want to get the value of key astronomy as return and simple help to correct the give code will help me to move further.
------------------------------------------------------------------------
import requests
def walk(d = None,val = None):
if val == 'astronomy':
return (val,d)
else:
for k,v in d.items():
if isinstance(v,dict):
p = d[k]
walk(d=p,val=k)
r = requests.get('https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22nome%2C%20ak%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys',stream = True)
n = r.json()
b = walk(d=n)
print(b)
---------------------------------------------
Thanks
| 0debug
|
static bool pte64_match(target_ulong pte0, target_ulong pte1,
bool secondary, target_ulong ptem)
{
return (pte0 & HPTE64_V_VALID)
&& (secondary == !!(pte0 & HPTE64_V_SECONDARY))
&& HPTE64_V_COMPARE(pte0, ptem);
}
| 1threat
|
No overload matches this call. Type 'string' is not assignable to type 'Signals' : <p>I am using typescript to build a micro service and handling signals as well. The code was working fine till few days ago but recently it started throwing error. Couldn't find a fix for the issue. </p>
<p>code for handling signals. It is just part of the file.
<code>src/main.ts</code></p>
<pre><code> enum signals {
SIGHUP = 1,
SIGINT = 2,
SIGTERM = 15
}
const shutdown = (signal, value) => {
logger.warn("shutdown!")
Db.closeAll()
process.exit(value)
}
Object.values(signals).forEach(signal => {
process.on(signal, () => {
logger.warn(`process received a ${signal} signal`)
shutdown(signal, signals[signal])
})
})
</code></pre>
<p>When I do <code>ts-node src/main.ts</code> The following error throws and fails and exit.</p>
<pre><code>
/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:245
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/main.ts:35:16 - error TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type 'string | signals' is not assignable to parameter of type 'Signals'.
Type 'string' is not assignable to type 'Signals'.
35 process.on(signal, () => {
~~~~~~
node_modules/@types/node/base.d.ts:653:9
653 on(event: Signals, listener: SignalsListener): this;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The last overload is declared here.
at createTSError (/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:245:12)
at reportTSError (/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:249:19)
at getOutput (/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:362:34)
at Object.compile (/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:395:32)
at Module.m._compile (/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:473:43)
at Module._extensions..js (module.js:663:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/meraj/.nvm/versions/node/v8.10.0/lib/node_modules/ts-node/src/index.ts:476:12)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
</code></pre>
<p>Any fix would be appreciated. Or If you can tell why it was working earlier just 2 days ago and not now. </p>
| 0debug
|
Using async and await with export const : <p>I can't make this work...it's says: await is a reserved word. Yes, of course it is...and I'd like to use :) </p>
<p>What's wrong ?</p>
<pre><code>export const loginWithToken = async () => {
return dispatch => {
dispatch({type: SESSION_LOGIN_IN_PROGRESS, payload: true})
let storedData = await ReadFromLocalDB('user')
console.log(storedData)
if (!storedData) {
invalidToken(null, dispatch)
}
else {
storedData = JSON.parse(storedData)
SessionLoginWithToken(storedData.session.token).then(res => {
console.log(res)
loginSuccessfully(res, dispatch, true)
})
}
}
}
</code></pre>
<p>My ReadFromLocalDB is this:</p>
<pre><code>export const ReadFromLocalDB = async (key) => {
return AsyncStorage.getItem(key)
}
</code></pre>
<p>it's return a promise</p>
| 0debug
|
How write mysql to sort data by month starting from current month : I have one table with one column named 'created_at'. Now i want to all records group by month and order by month start from current month.
Can any buddy help to resolve this issue?
| 0debug
|
How to load the google maps api <script> in my react app only when it is required? : <p>I want to try and use the google maps API to show a map but I'm wondering if there's a better way to load the <code><script></code> tag than putting it in my index.html.</p>
<p>I would like for the script to load only when I go to the <code>/map</code> route. So, I would want to remove it from my <code>index.html</code> and load it dynamically. However, I also want to make sure that if its already been loaded that I don't try and load it again.</p>
<p>I'm not sure if there is a library to handle this. What I've tried so far (but failed) is to create a <code>loadScript</code> function which appends a <code><script></code> to the actual dom and assigns it a key so in this case <code>'google-maps</code>. </p>
<p>Thanks</p>
| 0debug
|
What do 'instruction prefixes' mean in modern x86 : <p>To get an understanding on why Bulldozer was subpar I've been looking at Agner Fog's excellent microarchitecture book, in it on page 178 under bulldozer it has this paragraph.</p>
<blockquote>
<p>Instructions with up to three prefixes can be decoded in one clock cycle. There is a very large penalty for instructions with more than three
prefixes. Instructions with 4-7 prefixes take 14-15 clock cycles extra
to decode. Instructions with 8-11 prefixes take 20-22 clock cycles
extra, and instructions with 12-14 prefixes take 27 - 28 clock cycles
extra. It is therefore not recommended to make NOP instructions longer
with more than three prefixes. The prefix count for this rule includes
operand size, address size, segment, repeat, lock, REX and XOP
prefixes. A three-bytes VEX prefix counts as one, while a two-bytes
VEX prefix does not count. Escape codes (0F, 0F38, 0F3A) do not count.</p>
</blockquote>
<p>When I searched for prefixes I was hit with very technical definitions far and away beyond my abilities. Or, suggested that they were limited to 4 per instruction which conflicts with the above extract.</p>
<p>So in simple terms, can someone explain what they are/do and why you might want to tack on up to 14+ onto an instruction instead of breaking it up?</p>
| 0debug
|
getting Attendance Record for 12 Month in Sql-2008 : here is my table Structure
tbl_fullleaves:
leaveID(int)
EmpID(int)
Normalleaves(double)
SSL(double)
MonthId(int)
YearId(int)
----
monthid=1 for jan ,monthid=2 for feb so on
yearid=1 from where i started leaves incremental on yearly
Data in form :
----------
Given Picture
[1]: https://i.stack.imgur.com/YKknn.png
Need to Display:
Empid Normalleave_jan SSl_jan Normalleave_feb SSl_feb Normalleave_mar SSl_mar
2 3.25 4.5 3.75 0 0 4.5
waiting for answer thanks in advance
| 0debug
|
Vector3.Lerp bug? : <p><strong>I know how to move GameObject over time, but I have a weird bug.</strong></p>
<p>I am trying to create nice animation where the camera moves forward on button click and backward on second button click.</p>
<p>I am using the code from <a href="https://chicounity3d.wordpress.com/2014/05/23/how-to-lerp-like-a-pro/" rel="nofollow noreferrer">here</a> to do the animation and have a weird problem.</p>
<p>This is my code:</p>
<pre><code>private float time = 5, current;
public void MoveBackward()
{
StartCotoutine(MoveTo(Vector3.zero));
}
public void MoveForward()
{
StartCotoutine(MoveTo(new Vector3(0,0,15)));
}
private IEnumerator MoveTo(Vector3 target)
{
current=0;
while(transform.position!=target)
{
transform.position = Vector3.Lerp(transform.position, target, current/time);
current = Mathf.Clamp(current+Time.deltaTime,0,time);
yield return null;
}
}
</code></pre>
<p><strong>The forward motion works good, but for some reason when I try to move backwards it moves too fast. I tried to print the result (current/time) and in the backwards movement it is 0.1 (approximately) when the transform reaches to the destination.</strong></p>
<p>P.S. - I am running another <code>Cotoutine</code> in the background (if it matters)</p>
<p>Do you know why it happens¿</p>
<p>Thanks in advance</p>
| 0debug
|
Custom tooltip contents @ ngx-charts | Angular2+ | TypeScript : <p>I've been trying to set a custom label in a line chart's tooltip , e.g., modified number of minutes in HH:mm format (74 min --> 1:14), for quite some time now, but unfortunately without any success. Displaying the value as 1.283(...3) is not an alternative.</p>
<p><a href="https://i.stack.imgur.com/zKreK.png" rel="noreferrer">Number to HH:mm as tooltip label</a></p>
<p>Does anybody know how to preserve the x and y axis values (a date and a number respectively), and modify the tooltip display value?</p>
<p>For example: <a href="https://swimlane.github.io/ngx-charts/#/ngx-charts/line-chart" rel="noreferrer">https://swimlane.github.io/ngx-charts/#/ngx-charts/line-chart</a></p>
<p>Instead of having a tooltip that displays Color, Country name and Number,
--> Color, Country name and String (Number > 3000 ? 'high' : 'low';)</p>
<p><strong>Current behavior</strong>
Works as intended.</p>
<p><strong>Expected behavior</strong>
To display custom labels.</p>
<p><strong>Reproduction of the problem</strong>
Link in the description above</p>
<p><strong>What is the motivation / use case for changing the behavior?</strong>
Being able to customize tooltips' contents</p>
<p><strong>Please tell us about your environment:</strong>
OS: Win 10 x64, IDE: Eclipse EE</p>
<p><strong>ngx-charts version:</strong> 3.0.2</p>
<p><strong>Angular version:</strong> 6.0.2</p>
<p><strong>Browser:</strong> [all]</p>
<p><strong>Language:</strong> [TypeScript 2.3.3]</p>
| 0debug
|
Load Pretrained glove vectors in python : <p>I have downloaded pretrained glove vector file from the internet. It is a .txt file. I am unable to load and access it. It is easy to load and access a word vector binary file using gensim but I don't know how to do it when it is a text file format.</p>
<p>Thanks in advance</p>
| 0debug
|
AmazonS3ClientBuilder.defaultClient() fails to account for region? : <p>The Amazon Java SDK has marked the Constructors for <code>AmazonS3Client</code> deprecated in favor of some <code>AmazonS3ClientBuilder.defaultClient()</code>. Following the recommendation, though, does not result in an AmazonS3 client that works the same. In particular, the client has somehow failed to account for Region. If you run the tests below, the <code>thisFails</code> test demonstrates the problem.</p>
<pre><code>public class S3HelperTest {
@Test
public void thisWorks() throws Exception {
AmazonS3 s3Client = new AmazonS3Client(); // this call is deprecated
s3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());
assertNotNull(s3Client);
}
@Test
public void thisFails() throws Exception {
AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient();
/*
* The following line throws like com.amazonaws.SdkClientException:
* Unable to find a region via the region provider chain. Must provide an explicit region in the builder or
* setup environment to supply a region.
*/
s3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).build());
}
}
com.amazonaws.SdkClientException: Unable to find a region via the region provider chain. Must provide an explicit region in the builder or setup environment to supply a region.
at com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:371)
at com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:337)
at com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)
at com.amazonaws.services.s3.AmazonS3ClientBuilder.defaultClient(AmazonS3ClientBuilder.java:54)
at com.climate.tenderfoot.service.S3HelperTest.thisFails(S3HelperTest.java:21)
...
</code></pre>
<p>Is this an AWS SDK Bug? Is there some "region default provider chain" or some mechanism to derive the region from the Environment and set it into the client? It seems really weak that the method to replace the deprecation doesn't result in the same capability.</p>
| 0debug
|
static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t size)
{
VirtIONet *n = qemu_get_nic_opaque(nc);
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
VirtIODevice *vdev = VIRTIO_DEVICE(n);
struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
struct virtio_net_hdr_mrg_rxbuf mhdr;
unsigned mhdr_cnt = 0;
size_t offset, i, guest_offset;
if (!virtio_net_can_receive(nc)) {
return -1;
}
if (!virtio_net_has_buffers(q, size + n->guest_hdr_len - n->host_hdr_len)) {
return 0;
}
if (!receive_filter(n, buf, size))
return size;
offset = i = 0;
while (offset < size) {
VirtQueueElement elem;
int len, total;
const struct iovec *sg = elem.in_sg;
total = 0;
if (virtqueue_pop(q->rx_vq, &elem) == 0) {
if (i == 0)
return -1;
error_report("virtio-net unexpected empty queue: "
"i %zd mergeable %d offset %zd, size %zd, "
"guest hdr len %zd, host hdr len %zd "
"guest features 0x%" PRIx64,
i, n->mergeable_rx_bufs, offset, size,
n->guest_hdr_len, n->host_hdr_len,
vdev->guest_features);
exit(1);
}
if (elem.in_num < 1) {
error_report("virtio-net receive queue contains no in buffers");
exit(1);
}
if (i == 0) {
assert(offset == 0);
if (n->mergeable_rx_bufs) {
mhdr_cnt = iov_copy(mhdr_sg, ARRAY_SIZE(mhdr_sg),
sg, elem.in_num,
offsetof(typeof(mhdr), num_buffers),
sizeof(mhdr.num_buffers));
}
receive_header(n, sg, elem.in_num, buf, size);
offset = n->host_hdr_len;
total += n->guest_hdr_len;
guest_offset = n->guest_hdr_len;
} else {
guest_offset = 0;
}
len = iov_from_buf(sg, elem.in_num, guest_offset,
buf + offset, size - offset);
total += len;
offset += len;
if (!n->mergeable_rx_bufs && offset < size) {
virtqueue_discard(q->rx_vq, &elem, total);
return size;
}
virtqueue_fill(q->rx_vq, &elem, total, i++);
}
if (mhdr_cnt) {
virtio_stw_p(vdev, &mhdr.num_buffers, i);
iov_from_buf(mhdr_sg, mhdr_cnt,
0,
&mhdr.num_buffers, sizeof mhdr.num_buffers);
}
virtqueue_flush(q->rx_vq, i);
virtio_notify(vdev, q->rx_vq);
return size;
}
| 1threat
|
static int decode_packet(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000ResLevel *rlevel, int precno,
int layno, uint8_t *expn, int numgbits)
{
int bandno, cblkny, cblknx, cblkno, ret;
if (!(ret = get_bits(s, 1))){
j2k_flush(s);
return 0;
} else if (ret < 0)
return ret;
for (bandno = 0; bandno < rlevel->nbands; bandno++){
Jpeg2000Band *band = rlevel->band + bandno;
Jpeg2000Prec *prec = band->prec + precno;
int pos = 0;
if (band->coord[0][0] == band->coord[0][1]
|| band->coord[1][0] == band->coord[1][1])
continue;
for (cblkny = prec->yi0; cblkny < prec->yi1; cblkny++)
for(cblknx = prec->xi0, cblkno = cblkny * band->cblknx + cblknx; cblknx < prec->xi1; cblknx++, cblkno++, pos++){
Jpeg2000Cblk *cblk = band->cblk + cblkno;
int incl, newpasses, llen;
if (cblk->npasses)
incl = get_bits(s, 1);
else
incl = tag_tree_decode(s, prec->cblkincl + pos, layno+1) == layno;
if (!incl)
continue;
else if (incl < 0)
return incl;
if (!cblk->npasses)
cblk->nonzerobits = expn[bandno] + numgbits - 1 - tag_tree_decode(s, prec->zerobits + pos, 100);
if ((newpasses = getnpasses(s)) < 0)
return newpasses;
if ((llen = getlblockinc(s)) < 0)
return llen;
cblk->lblock += llen;
if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0)
return ret;
cblk->lengthinc = ret;
cblk->npasses += newpasses;
}
}
j2k_flush(s);
if (codsty->csty & JPEG2000_CSTY_EPH) {
if (bytestream2_peek_be16(&s->g) == JPEG2000_EPH) {
bytestream2_skip(&s->g, 2);
} else {
av_log(s->avctx, AV_LOG_ERROR, "EPH marker not found.\n");
}
}
for (bandno = 0; bandno < rlevel->nbands; bandno++){
Jpeg2000Band *band = rlevel->band + bandno;
int yi, cblknw = band->prec[precno].xi1 - band->prec[precno].xi0;
for (yi = band->prec[precno].yi0; yi < band->prec[precno].yi1; yi++){
int xi;
for (xi = band->prec[precno].xi0; xi < band->prec[precno].xi1; xi++){
Jpeg2000Cblk *cblk = band->cblk + yi * cblknw + xi;
if (bytestream2_get_bytes_left(&s->g) < cblk->lengthinc)
return AVERROR(EINVAL);
bytestream2_get_bufferu(&s->g, cblk->data, cblk->lengthinc);
cblk->length += cblk->lengthinc;
cblk->lengthinc = 0;
}
}
}
return 0;
}
| 1threat
|
static target_ulong h_set_dabr(PowerPCCPU *cpu, sPAPRMachineState *spapr,
target_ulong opcode, target_ulong *args)
{
return H_HARDWARE;
}
| 1threat
|
How do I display array object information? : <pre><code> <html>
<head>
<script>
var contacts =[];
function getInfo() {
var firstName = prompt("Enter first name");
var lastName = prompt("Enter last name");
var emailId = prompt("Enter Email ID");
var phoneNo = prompt("Enter Phone number");
var person ={
fname : firstName,
lname : lastName,
email : emailId,
phone : phoneNo
};
contacts.push(person);
var currPerson = contacts[contacts.length-1]; //take last pushed object from the array
if(currPerson.lname.toUpperCase().charAt(0)==='Z'){
document.getElementById("mydiv").innerHTML +=currPerson.fname+" "+currPerson.lname + '<br/>';
}
}
</script>
<body>
<button onclick="getInfo()">Get Person Info</button>
<p>----------------------------</p>
<div id="mydiv"></div>
</body>
</html>
</code></pre>
<p><a href="https://i.stack.imgur.com/WYv2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WYv2a.png" alt="Output"></a></p>
<blockquote>
<p>When I click on billa zopper, his <strong>details(full name,phone and email)</strong> should appear on right hand side in the same page. How do I achieve this? I know DOM is an option. But how do I link the DOM with the array elements? </p>
</blockquote>
| 0debug
|
How to access specific item from list and replace it using groovy : I have a issue in accessing the list items and replacing specific item from it.Below is the resulting list after splitting string by new line('\n').
def lst = [Node: , Message group: , Application: appl, Severity: critical];
My question here is to how to access specific item from the list and replace that with empty value using Groovy script. Can someone help me out to solve this issue, as it is bit urgent. Thanks in advance.
I mean for example , access 'Application' from the list and set its value to empty('') using groovy script
| 0debug
|
BigQuery: convert epoch to TIMESTAMP : <p>I'm trying to range-join two tables, like so</p>
<pre><code>SELECT *
FROM main_table h
INNER JOIN
test.delay_pairs d
ON
d.interval_start_time_utc < h.visitStartTime
AND h.visitStartTime < d.interval_end_time_utc
</code></pre>
<p>where <code>h.visitStartTime</code> is an <code>INT64</code> epoch and <code>d.interval_start_time_utc</code> and <code>d.interval_end_time_utc</code> are proper <code>TIMESTAMP</code>s.</p>
<p>The above fails with</p>
<pre><code>No matching signature for operator < for argument types: TIMESTAMP, INT64. Supported signature: ANY < ANY
</code></pre>
<p>Neither wrapping <code>h.visitStartTime</code> in <code>TIMESTAMP()</code> nor <code>CAST(d.interval_start_time_utc AS INT64)</code> work. How do I make the two comparable in BigQuery's Standard SQL dialect?</p>
| 0debug
|
python 3.6 appending list created duplicates : <p>My program will calculate a final grade, I believe thats all correct up until Im creating multiple entries. when i enter 'y' to enter another student the second student copies into the first students list then dulplicates itself resulting in a copy and not my first original entry. so instead of having mike, jim, and mary its mary, mary, and mary.</p>
<pre><code>#This program will calculate a classes final grades.
def get_grades():
print("\nEnter grades for assignments 1-5 (0-20 PT scale)")
assignment1 = eval(input("\nEnter assignment 1 grade: "))
assignment2 = eval(input("Enter '' 2 grade: "))
assignment3 = eval(input("Enter '' 3 grade: "))
assignment4 = eval(input("Enter '' 4 grade: "))
assignment5 = eval(input("Enter '' 5 grade: "))
total = (assignment1 + assignment2 + assignment3 + assignment4 + assignment5)
print("\nEnter the Midterm and Final exam grades (0-100 PT scale))")
midterm = eval(input("\nMidterm grade: "))
final = eval(input("Final grade: "))
exam_avg = (final + midterm)/2
print("\nEnter the participation grade (0-10 PT scale)")
participation = int(input("Participation: "))
final_grade = (total*0.45) + (exam_avg*0.45) + participation
return final_grade
def determine_let_grade(final_grade):
if final_grade > 100 or final_grade < 0:
return "ERROR!"
elif final_grade <= 100 and final_grade > 90:
return "A"
elif final_grade <= 89 and final_grade > 80:
return "B"
elif final_grade <= 79 and final_grade > 70:
return "C"
elif final_grade <= 69 and final_grade > 60:
return "D"
elif final_grade <= 59:
return "F"
def main():
print("This program will calculate your students final grades.")
studentList = []
another_student = "y"
while another_student == 'y':
name = input("\nEnter the student's name: ")
net_id = int(input("Enter the student's Identification number: "))
fnl_grade = get_grades()
let_grade = determine_let_grade(fnl_grade)
studentList.append([name, net_id, fnl_grade, let_grade])
another_student = input("\nEnter y or n to add another student: ")
for student in range(len(studentList)):
print("\nStudent Name:", name.title() ,"\nStudent-ID:", net_id ,"\nFinal Grade:",fnl_grade ,"\nLetter Grade:", let_grade)
print()
input ("Please press Enter to quit the program")
main()
</code></pre>
| 0debug
|
static inline int get_len(LZOContext *c, int x, int mask)
{
int cnt = x & mask;
if (!cnt) {
while (!(x = get_byte(c)))
cnt += 255;
cnt += mask + x;
}
return cnt;
}
| 1threat
|
static void xlnx_dp_set_dpdma(Object *obj, const char *name, Object *val,
Error **errp)
{
XlnxDPState *s = XLNX_DP(obj);
if (s->console) {
DisplaySurface *surface = qemu_console_surface(s->console);
XlnxDPDMAState *dma = XLNX_DPDMA(val);
xlnx_dpdma_set_host_data_location(dma, DP_GRAPHIC_DMA_CHANNEL,
surface_data(surface));
}
}
| 1threat
|
If else statement error in Python : <p>I keep getting the error Invalid syntax on the first elif. I am pretty sure the syntax is right, but I have no clue why I keep getting this error.</p>
<pre><code>def make_tracker(self):
self.region = re.search(r'CLI Command: \'show system information\'',line)
if self.region:
self.region = "show system information"
return self.region
self.region = re.search(r'CLI Command: \'show card detail\'',line)
elif self.region:
#The error is on the elif statement it self ^
self.region = "CPM or IOM"
return self.region
self.region = re.search(r'CLI Command: \'show mda detail\'',line)
elif self.region:
self.region = "MDA"
else:
print"Could not Enter any of the regions"
</code></pre>
| 0debug
|
Curl POST request using pycurl : <p>someone can me explain how can i use curl request below in pycurl library:</p>
<p><code>curl -X POST --user 'username:password' url</code></p>
<p>Thanks.</p>
| 0debug
|
def convert(list):
s = [str(i) for i in list]
res = int("".join(s))
return (res)
| 0debug
|
void pci_bridge_exitfn(PCIDevice *pci_dev)
{
PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev);
assert(QLIST_EMPTY(&s->sec_bus.child));
QLIST_REMOVE(&s->sec_bus, sibling);
pci_bridge_region_cleanup(s);
memory_region_destroy(&s->address_space_mem);
memory_region_destroy(&s->address_space_io);
}
| 1threat
|
Get value to the right of the decimal in python : <p>If I print 5/4 I get 1.25. How do I just get the .25 part. </p>
<pre><code>print(5/4)
1.25
</code></pre>
| 0debug
|
When I click on item spinner show me listview(android studio, spinner, databse, listview) : I have one question. I want to make app with spinner and list and when I click item on spinner open to new list, no new activity just to update list from database.
Example I have Europe and Africa in spinner and when I click Europe show me list with European countries, when I click Africa show me list with African countries. I search this on internet but I can not find this.
| 0debug
|
Pulling data into d3.js : <p>I'm new to D3, and with a background in server-side development I find a few things confusing. I still struggle to understand how to bring data in from outside sources. In my case, I can see the benefit of pulling data from the database on demand and visualizing it, but how does that data get into D3? I've attempted to pull it in through Ajax, but I haven't found a good D3 v4 demo that covers this. Are there any? Do most people write to csv/json/tsv files and import that way? </p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.