problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
'Python -m' in terminal : <p>I have met this pattern for quite some time when I see people try to execute a package through python. But I am not sure what does '-m' mean here. Is it a specific pattern that you need to follow?
for example:</p>
<p><code>python -m [library] download [model]</code></p>
<p>or </p>
<pre><code>python -m venv env (to create a virtual environment in Python)
</code></pre>
<p>Anyone could explain to me?</p>
| 0debug
|
How to delete interface docker0 : <p>I would like to remove the interface docker0. It would be better to avoid creating the interface docker0 when starting the service and using directly the eth0. </p>
| 0debug
|
web interface for multiple programming languages : <p>I have written applications in three different programming languages and naturally they all run standalone over the command line atm (java, c#, python).</p>
<p>As a newbie when it comes to web development, I am looking for a solution that lets me create a web interface where I can basically press a button which then runs the code and displays it in the browser.</p>
<p>From what I can tell solutions like Django only allow me to run python code, while java and c# have their own respective frameworks. </p>
<p>Is there a framework to connect all three, or am I completely off with my assumptions about django etc.? Can you guide into a direction what I should be looking up? How does REST fit in here?</p>
<p>Thanks in advance</p>
| 0debug
|
How do I read strings into a hash in Perl : <p>I have a file with a series of random A's, G's, C's and T's in them that look like this:</p>
<pre><code>>Mary
ACGTACGTACGTAC
>Jane
CCCGGCCCCTA
>Arthur
AAAAAAAAAAT
</code></pre>
<p>I took those letters and concatinated them to end up with <code>ACGTACGTACGTACCCCGGCCCCTAAAAAAAAAAT</code>. I now have a series of positions within that concatenated sequence that are of interest to me, and I want to find the associated Names that match with those positions (coordinates). I'm using the Perl function length to calculate the legnth of each sequence, and then associate the culmulative length with the name in a hash.
So far I have:</p>
<pre><code>#! /usr/bin/perl -w
use strict;
my $seq_input = $ARGV[0];
my $coord_input = $ARGV[1];
my %idSeq; #Stores sequence and associated ID's.
open (my $INPUT, "<$seq_input") or die "unable to open $seq_input";
open (my $COORD, "<$coord_input") or die "unable to open $fcoord_input";
while (<$INPUT>) {
if ($_ = /^[AGCT/) {
$idSeq{$_
my $id = ( /^[>]/)
#put information into a hash
#loop through hash looking for coordinates that are lower than the culmulative length
foreach $id
$totallength = $totallength + length($seq)
$lengthId{$totalLength} = $id
foreach $position
foreach $length
if ($length >= $position) { print; last }
close $fasta_input;
close $coord_input;
print "Done!\n";
</code></pre>
<p>So far I'm having trouble reading the file into a hash. Also would I need an array to print the hash?</p>
| 0debug
|
static int RENAME(dct_quantize)(MpegEncContext *s,
int16_t *block, int n,
int qscale, int *overflow)
{
x86_reg last_non_zero_p1;
int level=0, q;
const uint16_t *qmat, *bias;
LOCAL_ALIGNED_16(int16_t, temp_block, [64]);
av_assert2((7&(int)(&temp_block[0])) == 0);
RENAMEl(ff_fdct) (block);
if(s->dct_error_sum)
s->denoise_dct(s, block);
if (s->mb_intra) {
int dummy;
if (n < 4){
q = s->y_dc_scale;
bias = s->q_intra_matrix16[qscale][1];
qmat = s->q_intra_matrix16[qscale][0];
}else{
q = s->c_dc_scale;
bias = s->q_chroma_intra_matrix16[qscale][1];
qmat = s->q_chroma_intra_matrix16[qscale][0];
}
if (!s->h263_aic) {
__asm__ volatile (
"mul %%ecx \n\t"
: "=d" (level), "=a"(dummy)
: "a" ((block[0]>>2) + q), "c" (ff_inverse[q<<1])
);
} else
level = (block[0] + 4)>>3;
block[0]=0;
last_non_zero_p1 = 1;
} else {
last_non_zero_p1 = 0;
bias = s->q_inter_matrix16[qscale][1];
qmat = s->q_inter_matrix16[qscale][0];
}
if((s->out_format == FMT_H263 || s->out_format == FMT_H261) && s->mpeg_quant==0){
__asm__ volatile(
"movd %%"REG_a", "MM"3 \n\t"
SPREADW(MM"3")
"pxor "MM"7, "MM"7 \n\t"
"pxor "MM"4, "MM"4 \n\t"
MOVQ" (%2), "MM"5 \n\t"
"pxor "MM"6, "MM"6 \n\t"
"psubw (%3), "MM"6 \n\t"
"mov $-128, %%"REG_a" \n\t"
".p2align 4 \n\t"
"1: \n\t"
MOVQ" (%1, %%"REG_a"), "MM"0 \n\t"
SAVE_SIGN(MM"1", MM"0")
"psubusw "MM"6, "MM"0 \n\t" + bias[0]
"pmulhw "MM"5, "MM"0 \n\t"
"por "MM"0, "MM"4 \n\t"
RESTORE_SIGN(MM"1", MM"0")
MOVQ" "MM"0, (%5, %%"REG_a") \n\t"
"pcmpeqw "MM"7, "MM"0 \n\t"
MOVQ" (%4, %%"REG_a"), "MM"1 \n\t"
MOVQ" "MM"7, (%1, %%"REG_a") \n\t"
"pandn "MM"1, "MM"0 \n\t"
PMAXW(MM"0", MM"3")
"add $"MMREG_WIDTH", %%"REG_a" \n\t"
" js 1b \n\t"
PMAX(MM"3", MM"0")
"movd "MM"3, %%"REG_a" \n\t"
"movzbl %%al, %%eax \n\t"
: "+a" (last_non_zero_p1)
: "r" (block+64), "r" (qmat), "r" (bias),
"r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64)
XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
"%xmm4", "%xmm5", "%xmm6", "%xmm7")
);
}else{
__asm__ volatile(
"movd %%"REG_a", "MM"3 \n\t"
SPREADW(MM"3")
"pxor "MM"7, "MM"7 \n\t"
"pxor "MM"4, "MM"4 \n\t"
"mov $-128, %%"REG_a" \n\t"
".p2align 4 \n\t"
"1: \n\t"
MOVQ" (%1, %%"REG_a"), "MM"0 \n\t"
SAVE_SIGN(MM"1", MM"0")
MOVQ" (%3, %%"REG_a"), "MM"6 \n\t"
"paddusw "MM"6, "MM"0 \n\t" + bias[0]
MOVQ" (%2, %%"REG_a"), "MM"5 \n\t"
"pmulhw "MM"5, "MM"0 \n\t"
"por "MM"0, "MM"4 \n\t"
RESTORE_SIGN(MM"1", MM"0")
MOVQ" "MM"0, (%5, %%"REG_a") \n\t"
"pcmpeqw "MM"7, "MM"0 \n\t"
MOVQ" (%4, %%"REG_a"), "MM"1 \n\t"
MOVQ" "MM"7, (%1, %%"REG_a") \n\t"
"pandn "MM"1, "MM"0 \n\t"
PMAXW(MM"0", MM"3")
"add $"MMREG_WIDTH", %%"REG_a" \n\t"
" js 1b \n\t"
PMAX(MM"3", MM"0")
"movd "MM"3, %%"REG_a" \n\t"
"movzbl %%al, %%eax \n\t"
: "+a" (last_non_zero_p1)
: "r" (block+64), "r" (qmat+64), "r" (bias+64),
"r" (inv_zigzag_direct16 + 64), "r" (temp_block + 64)
XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3",
"%xmm4", "%xmm5", "%xmm6", "%xmm7")
);
}
__asm__ volatile(
"movd %1, "MM"1 \n\t"
SPREADW(MM"1")
"psubusw "MM"1, "MM"4 \n\t"
"packuswb "MM"4, "MM"4 \n\t"
#if COMPILE_TEMPLATE_SSE2
"packuswb "MM"4, "MM"4 \n\t"
#endif
"movd "MM"4, %0 \n\t"
: "=g" (*overflow)
: "g" (s->max_qcoeff)
);
if(s->mb_intra) block[0]= level;
else block[0]= temp_block[0];
if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){
if(last_non_zero_p1 <= 1) goto end;
block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08];
block[0x20] = temp_block[0x10];
if(last_non_zero_p1 <= 4) goto end;
block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02];
block[0x09] = temp_block[0x03];
if(last_non_zero_p1 <= 7) goto end;
block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11];
block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20];
if(last_non_zero_p1 <= 11) goto end;
block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12];
block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04];
block[0x0C] = temp_block[0x05];
if(last_non_zero_p1 <= 16) goto end;
block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13];
block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21];
block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30];
block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22];
if(last_non_zero_p1 <= 24) goto end;
block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14];
block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06];
block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E];
block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C];
if(last_non_zero_p1 <= 32) goto end;
block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A];
block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38];
block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32];
block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24];
if(last_non_zero_p1 <= 40) goto end;
block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16];
block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17];
block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25];
block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33];
if(last_non_zero_p1 <= 48) goto end;
block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D];
block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E];
if(last_non_zero_p1 <= 56) goto end;
block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C];
block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36];
block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37];
block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
}else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){
if(last_non_zero_p1 <= 1) goto end;
block[0x04] = temp_block[0x01];
block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
if(last_non_zero_p1 <= 4) goto end;
block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02];
block[0x05] = temp_block[0x03];
if(last_non_zero_p1 <= 7) goto end;
block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11];
block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
if(last_non_zero_p1 <= 11) goto end;
block[0x1C] = temp_block[0x19];
block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B];
block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05];
if(last_non_zero_p1 <= 16) goto end;
block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13];
block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21];
block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22];
if(last_non_zero_p1 <= 24) goto end;
block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14];
block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06];
block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E];
block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C];
if(last_non_zero_p1 <= 32) goto end;
block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A];
block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38];
block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32];
block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24];
if(last_non_zero_p1 <= 40) goto end;
block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16];
block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25];
block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33];
if(last_non_zero_p1 <= 48) goto end;
block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B];
block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D];
block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E];
if(last_non_zero_p1 <= 56) goto end;
block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C];
block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36];
block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
}else{
if(last_non_zero_p1 <= 1) goto end;
block[0x01] = temp_block[0x01];
block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10];
if(last_non_zero_p1 <= 4) goto end;
block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02];
block[0x03] = temp_block[0x03];
if(last_non_zero_p1 <= 7) goto end;
block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11];
block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20];
if(last_non_zero_p1 <= 11) goto end;
block[0x19] = temp_block[0x19];
block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B];
block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05];
if(last_non_zero_p1 <= 16) goto end;
block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13];
block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21];
block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30];
block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22];
if(last_non_zero_p1 <= 24) goto end;
block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14];
block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06];
block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E];
block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C];
if(last_non_zero_p1 <= 32) goto end;
block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A];
block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38];
block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32];
block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24];
if(last_non_zero_p1 <= 40) goto end;
block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16];
block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17];
block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25];
block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33];
if(last_non_zero_p1 <= 48) goto end;
block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B];
block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D];
block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F];
block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E];
if(last_non_zero_p1 <= 56) goto end;
block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C];
block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36];
block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37];
block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F];
}
end:
return last_non_zero_p1 - 1;
}
| 1threat
|
Call async code in an Action in C# : <p>I'm calling a web service from some C# code. This code looks similar to this:</p>
<pre><code>using (var client = new HttpClient())
{
var page = "http://en.wikipedia.org/";
using (var response = await client.GetAsync(page))
{
using (var content = response.Content)
{
var result = await content.ReadAsStringAsync();
}
}
}
</code></pre>
<p>I want to execute this code within a utility method. From my understanding, an <a href="https://msdn.microsoft.com/en-us/library/018hxwa8(v=vs.110).aspx" rel="nofollow noreferrer">Action</a> delegate is suited for this. I attempted to do this using the following:</p>
<pre><code>Action action = delegate()
{
using (var client = new HttpClient())
{
var page = "http://en.wikipedia.org/";
using (var response = await client.GetAsync(page))
{
using (var content = response.Content)
{
var result = await content.ReadAsStringAsync();
}
}
}
}
</code></pre>
<p>When I wrap my web service code in an <code>Action</code> delegate, I receive a compile-time error that says:</p>
<pre><code>The 'await' operator can only be used within an async anonymous method. Consider marking this anonymous method with the 'async' modifier.
</code></pre>
<p>My question is, how do I call async code in an Action? It looks like I can't. If I can't is there another way that I can pass a block of code to a utility method for execution? What does that look like?</p>
<p>Thank you!</p>
| 0debug
|
How to use JaveScript to imitate the cutsom filter/selector in this example? : I saw this custom filter on this site (which is based on mediawiki): **https://fgo.wiki/w/%E8%8B%B1%E7%81%B5%E5%9B%BE%E9%89%B4** , and want to imitate its function on the fandom I've on for the self-learning purpose.
I did figure out how to get the certain innerTEXT from the table as the identifier for each option, and set a div to place all the option image. But I don't know what to do next, use addEventListener() or playing around with <select> tag?
The table's code I'm playing with is too long, so just put the codes here: https://a-normal-playground.fandom.com/wiki/Filter_searching_test?action=edit
The "identifier" I get from the table is:
```
var type = document.querySelectorAll("tr td:nth-last-child(1)").innerTEXT;
```
What I want to do is if the identifier of that column is not matching the "value" of the button, the column will not be showed in the result. Not sure do I need the knowledge of jquery or something else.
| 0debug
|
window.location.href = 'http://attack.com?user=' + user_input;
| 1threat
|
Cucumber on Linux vs Cucumber on Windows - Need to know the pros and cons : <p>I am not sure whether there are any specific advantages/disadvantages of using Cucumber on Linux over Cucumber on Windows. Can someone elaborate the pros and cons? Also, kindly share some trusted links for Cucumber on Linux.</p>
| 0debug
|
C#: Using arrays and initializing arrays : I'm doing some c# homework and this is the instructions:
> Create a new project called FunWithArrays.
>
> Add a class called Game and make sure it is public. Game should have a
> public 2 dimensional byte array of size 5 x 5 called BingoCard.
> BingoCard should be initialized in the constructor for the Game class.
> There should also be a public string property called PlayerName in the
> Game class. The same constructor mentioned above should receive a
> string to initialize the player's name.
>
> Back in the main method create a single dimension Game array of size
> 3. Add three new games using the names "Beth", "Chris", and "Don". Add a Random object to the main method.
>
> Pass the Game array and Random object to a static method called
> "InitilizeArray." Use a foreach loop to iterate through the games.
> Inside the foreachloop, use nested for loops to assign a random byte
> value to each of the 25 elements in the array. (hint: use something
> like (byte)rand.next() to have the Random object return a byte. Make
> sure that the random byte range is 1 to 75.
>
> Then, from the main method, pass the game array to a static method
> called "DisplayArray." Then use foreach and for loops as before to
> print out each player and that player's bingo card. The cards should
> be displayed in a table of 5 x 5 in the console.
So far, I'm stuck in the 2nd paragraph or rather the third.
In the first paragraph I made a class which seems right.
public class Game
{
//constructors
public Game() { }
public Game (string pN)
{
PlayerName = pN;
byte[,] BingoCard = new byte[5, 5];
}
//methods
public string PlayerName { get; set; }
}
and for the second paragraph, in my main method:
static void Main(string[] args)
{
//vars
const int GameSize = 3;
Random rand = new Random();
Game[] gameArray = new Game[GameSize];
Game game1 = new Game("Chris");
Game game2 = new Game("Beth");
Game game3 = new Game("Don");
InitializeArray(gameArray[], rand);
}
I'm not sure if I did the "create three new games" right, but I think it is.
Now I'm having problems with the third paragraph, should I be passing each new game (game1, game2, game3) to the gameArray and then iterate through each game with a foreach loop such as:
foreach (var game in g)
{
for (int row = 0; row < 5; row++)
{
for (int col = 0; col < 5; col++)
{
game[row, col] = (byte)r.Next();
}
}
Am I doing this correctly?
| 0debug
|
How does jest --findRelatedTests work under the hood? : <blockquote>
<p>Find and run the tests that cover a space separated list of source
files that were passed in as arguments. Useful for pre-commit hook
integration to run the minimal amount of tests necessary.</p>
</blockquote>
<p>This is in official docs, but how does this work? Does it analyze all the imports in my project and only runs tests that import the file I want to test? That's how I would write it, but is it really working like that?</p>
<p>Related question-does it use a cache when finding related tests?</p>
| 0debug
|
static void amdvi_class_init(ObjectClass *klass, void* data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
X86IOMMUClass *dc_class = X86_IOMMU_CLASS(klass);
dc->reset = amdvi_reset;
dc->vmsd = &vmstate_amdvi;
dc->hotpluggable = false;
dc_class->realize = amdvi_realize;
}
| 1threat
|
What is seeming wrong in my Main.class? That when I start it it gives me an error without saying me from which programm it was caused by : <p>I am programming a Java Plugin for Bukkit.
I am nearly finished but now the console gives me an error without a reason... Im am programming with Bukkit now for 1 year with Java i got 2 years of experience but i cant really imagine what should the problem be here...
Here it is:</p>
<pre><code>java.lang.NullPointerException
at de.master.lobby.Main.loadStrings(Main.java:893) ~[?:?]
at de.master.lobby.Main.onEnable(Main.java:314) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:741) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_191]
</code></pre>
<p>My main doesnt seem to have any errors...</p>
<p>These are the lines from 309 to 335:
It is my main.class..</p>
<pre><code>public void onEnable() {
instance = this;
loadConfig();
loadStrings();
loadCommands();
loadEvents();
Bukkit.getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
Bukkit.getConsoleSender().sendMessage("§7-------------==+==-------------");
Bukkit.getConsoleSender().sendMessage("§cPlugin version: §e0.2.5");
Bukkit.getConsoleSender().sendMessage("§cPlugin author: §eMasterphoenix");
Bukkit.getConsoleSender().sendMessage("§cPlugin status: §aaktiviert");
Bukkit.getConsoleSender().sendMessage("§7-------------==+==-------------");
if (LocationAPI.getLocation("spawn") != null) {
Location spawn = LocationAPI.getLocation("spawn");
spawn.getWorld().setTime(6000);
spawn.getWorld().setGameRuleValue("doDaylightCircle", "false");
spawn.getWorld().setGameRuleValue("doMobSpawning", "false");
}
methAutoMessengerScheduler.startCountdown();
}
</code></pre>
<p>And this the lines from 873 to 902</p>
<pre><code>rankownertab = getConfig().getString("rank.owner.tab").replaceAll("&", "§");
rankowner = getConfig().getString("rank.owner.chat").replaceAll("&", "§");
rankmanagertab = getConfig().getString("rank.manager.tab").replaceAll("&", "§");
rankmanager = getConfig().getString("rank.manager.chat").replaceAll("&", "§");
rankheaddevtab = getConfig().getString("rank.headdev.tab").replaceAll("&", "§");
rankheaddev = getConfig().getString("rank.headdev.chat").replaceAll("&", "§");
rankdevtab = getConfig().getString("rank.dev.tab").replaceAll("&", "§");
rankdev = getConfig().getString("rank.dev.chat").replaceAll("&", "§");
ranksrmodtab = getConfig().getString("rank.srmod.tab").replaceAll("&", "§");
ranksrmod = getConfig().getString("rank.srmod.chat").replaceAll("&", "§");
rankmodtab = getConfig().getString("rank.mod.tab").replaceAll("&", "§");
rankmod = getConfig().getString("rank.mod.chat").replaceAll("&", "§");
ranksuptab = getConfig().getString("rank.supporter.tab").replaceAll("&", "§");
ranksup = getConfig().getString("rank.supporter.chat").replaceAll("&", "§");
rankbuildertab = getConfig().getString("rank.builder.tab").replaceAll("&", "§");
rankbuilder = getConfig().getString("rank.builder.chat").replaceAll("&", "§");
rankyoutubertab = getConfig().getString("rank.youtuber.tab").replaceAll("&", "§");
rankyoutuber = getConfig().getString("rank.youtuber.chat").replaceAll("&", "§");
rankjryoutubertab = getConfig().getString("rank.jryoutuber.tab").replaceAll("&", "§");
rankjryoutuber = getConfig().getString("rank.jryoutuber.chat").replaceAll("&", "§");
rankplatinumtab = getConfig().getString("rank.platinum.tab").replaceAll("&", "§");
rankplatinum = getConfig().getString("rank.platinum.chat").replaceAll("&", "§");
rankmaster = getConfig().getString("rank.master.tab").replaceAll("&", "§");
rankmaster = getConfig().getString("rank.master.chat").replaceAll("&", "§");
rankprogamer = getConfig().getString("rank.progamer.tab").replaceAll("&", "§");
rankprogamer = getConfig().getString("rank.progamer.chat").replaceAll("&", "§");
rankgamer = getConfig().getString("rank.gamer.tab").replaceAll("&", "§");
rankgamer = getConfig().getString("rank.gamer.chat").replaceAll("&", "§");
rankspielertab = getConfig().getString("rank.spieler.tab").replaceAll("&", "§");
rankspieler = getConfig().getString("rank.spieler.chat").replaceAll("&", "§");
</code></pre>
<p>When you can solve the problem please say me the details how to fix it, because i dont think that there is any problem in 873 to 902....</p>
| 0debug
|
Create index for this condition using data.table in R : how to get the startdate and enddate(cumulative) from days
Variable A days stardate enddate(cumulative)
A 2 0 2
A 3 2 5
B 4 5 9
A 3 9 12
B 8 12 20
| 0debug
|
How to Improve For Loop Performance : <p>This code is pretty fast but I would like to make it faster without using HashMap.</p>
<p>I have a list of Accounts and I am currently looping them to check if <code>account.getAccountNumber().equals(accountNumber)</code></p>
<p>Is there a way to improve this using Java 8?</p>
<pre><code>public Account getAccountFromCustomer(String customerID, String accountNumber) {
List<Account> accounts = getAccountsFromCustomer(customerID);
for(Account account : accounts) {
if(account.getAccountNumber().equals(accountNumber)) {
return account;
}
}
return null;
}
</code></pre>
| 0debug
|
How does kafka handle network partitions? : <p>Kafka has the concept of a in-sync replica set, which is the set of nodes that aren't too far behind the leader. </p>
<p>What happens if the network cleanly partitions so that a minority containing the leader is on one side, and a majority containing the other in-sync nodes on the other side? </p>
<p>The minority/leader-side presumably thinks that it lost a bunch of nodes, reduces the ISR size accordingly, and happily carries on. </p>
<p>The other side probably thinks that it lost the leader, so it elects a new one and happily carries on. </p>
<p>Now we have two leaders in the same cluster, accepting writes independently. In a system that requires a majority of nodes to proceed after a partition, the old leader would step down and stop accepting writes. </p>
<p>What happens in this situation in Kafka? Does it require majority vote to change the ISR set? If so, is there a brief data loss until the leader side detects the outages?</p>
| 0debug
|
How can I check which version of Angular from browser? : <p>I'm trying to buy a angular 5 template online so I just want to confirm for angular version. I have check This question of Angular :- </p>
<p><a href="https://stackoverflow.com/questions/16017699/how-can-i-check-which-version-of-angular-im-using">How can I check which version of Angular I'm using?</a></p>
<p>But here in this question app version is shown in below image which is captured from development tool,</p>
<pre><code>ng-version is in app tag.
</code></pre>
<p><a href="https://i.stack.imgur.com/j93g1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/j93g1.png" alt="enter image description here"></a></p>
<p>But in the template which I'm trying to purchase has following structure. </p>
<pre><code>ng-version is in body tag.
</code></pre>
<p><a href="https://i.stack.imgur.com/rvYLT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rvYLT.png" alt="enter image description here"></a></p>
<p>So, Just for reconfirm I just installed Angular 5.
Here in newly installed application they show,</p>
<p><code>ng-version is in app-root.</code> </p>
<p><a href="https://i.stack.imgur.com/K5hL6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/K5hL6.png" alt="enter image description here"></a></p>
<p>That template has other files like,</p>
<pre><code><script type="text/javascript" src="inline.bundle.js"></script>
<script type="text/javascript" src="polyfills.bundle.js"></script>
<script type="text/javascript" src="styles.bundle.js"></script>
<script type="text/javascript" src="vendor.bundle.js"></script>
<script type="text/javascript" src="main.bundle.js">
</code></pre>
<p>I have also Tried with <code>angular.version</code> but it doesn't work for me.</p>
<p>So, it is confirmed that they are using Angular App not other thing but I'm confused about it's Angular-2,4 or 5.</p>
<p>Is there any otherway we can figure it that which version it's running ?</p>
| 0debug
|
What is the 4-digit octal Unix file permission system? : <p>3-digit:</p>
<p>644
(user group other)
4-digit:</p>
<p>4750
(??? user group other)
What is the first octal digit for in 4-digit octal Unix file permission notation?</p>
| 0debug
|
static void read_len_table(uint8_t *dst, GetBitContext *gb){
int i, val, repeat;
for(i=0; i<256;){
repeat= get_bits(gb, 3);
val = get_bits(gb, 5);
if(repeat==0)
repeat= get_bits(gb, 8);
while (repeat--)
dst[i++] = val;
}
}
| 1threat
|
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
| 1threat
|
document.getElementById('input').innerHTML = user_input;
| 1threat
|
Plotting multiple files with common basename : <p>I have 100 .txt files with two columns. The file names are file0, file1, file2, ..., file99. I want to plot all of them in one single graph. How can I do this in gnuplot or python or matlab or C ?</p>
| 0debug
|
How do you find the cluster & service CIDR of a Kubernetes cluster? : <p>How do you find the cluster/service CIDR for a Kubernetes cluster, once it is already running?</p>
<p>I know for Minikube, it is 10.0.0.1/24.</p>
<p>For GKE, you can find out via</p>
<pre><code>gcloud container clusters describe XXXXXXX --zone=XXXXXX |
grep -e clusterIpv4Cidr -e servicesIpv4Cidr
</code></pre>
<p>But how do you find out on a generic Kubernetes cluster, particularly via <code>kubectl</code>?</p>
| 0debug
|
Hello, I'm trying to write a program which outputs "n" (input) fibonacci numbers : **Hello!**
I am struggling with my program.
It should output n Fibonacci numbers, each on a new line. If the Fibonacci number exceeds the range of an unsigned int you should just exit the program. Moreover, you should print on a new line how many Fibonaccis of "n" are displayed.
Here is the code so far:
#include<iostream>
#include<limits>
using namespace std;
int main()
{
unsigned int n;
cout << "Please enter the amount of fibonaccis you would like to compute: " << endl;
cin >> n;
unsigned int next=1;
unsigned int current=0;
unsigned int c = current;
unsigned int temp;
unsigned int counter=1;
//This bool returns true as soon as an overflow occurs
bool overflow;
/*This bool checks, whether the newly computed
number is bigger than the previous number
(which may not be the case if an overflow occurs)*/
bool nextBigger;
/*Somehow, I could only handle the first
inputs by using "bruteforce".
If I tried to combine it with the "main loop",
it got all messy. */
if(n==0)
{
std::cout << "0" << " of " << n << endl;
}
else if(n==1)
{
std::cout << "0" << endl << "1 of " << n << endl;
}
else if(n==2)
{
std::cout << "0" << endl << "1" << endl << "2 of " << n << endl;
}
else
{ /* This for-loop increases (at least it should) a counter
by one for each computation of a valid fibonacci number*/
for(counter=1;counter<n;++counter)
{
overflow = (c > (std::numeric_limits<unsigned int>::max()-temp));
if(!overflow && nextBigger)
{
cout << next << endl;
}
else
{
break; //If overflow or next number < previous number, exit program
}
temp = next; //temp is storage variable for next
c = current; //storage variable for current
next += current; //next is being altered: it becomes the new fibonacci number
current = temp; //current gets value of temp( value of next before being altered)
}
nextBigger = (next > current);
cout << counter << " of " << n << endl; //Output of how many fibonaccis were computed
}
return 0;
}
So here is the thing. I programmed it in "Codeblocks", where it worked perfectly. But then I tried to upload it in "Codeboard" (as an assignment). In Codeboard it suddenly didn't work at all. Maybe it has to do with the different Compilers, but I really have no clue how I could fix this issue. So I am quite puzzled and I'd be very thankful for any hints, ideas, corrections or inspirations.
(I am a beginner, so I hope the code is understandable and readable. I am open for suggested improvements.)
| 0debug
|
Typescript How to filter filter array of objects to single new object : I am wanting to filter this array of objects (StopDetails) and set a new object (PickDetail) to the object in the array that has the TentativePickFlag = true.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/TUdc8.jpg
| 0debug
|
How to remove digits that comes inside parentheses using javascript? : <p>Let say '<strong>Ben-Hur (2016)</strong>'. I want to remove '<strong>(2016)</strong>'.I need only <strong>Ben-Hur</strong>.</p>
| 0debug
|
How to return multiple results from store procedure using dapper : I have two tables Attributes and Types. Both I need to return at the same time using store proc in dapper.
| 0debug
|
static inline void RENAME(yuv2rgb1)(uint16_t *buf0, uint16_t *uvbuf0, uint16_t *uvbuf1,
uint8_t *dest, int dstW, int uvalpha, int dstbpp)
{
int uvalpha1=uvalpha^4095;
const int yalpha1=0;
if(fullUVIpol || allwaysIpol)
{
RENAME(yuv2rgb2)(buf0, buf0, uvbuf0, uvbuf1, dest, dstW, 0, uvalpha, dstbpp);
return;
}
#ifdef HAVE_MMX
if( uvalpha < 2048 )
{
if(dstbpp == 32)
{
asm volatile(
YSCALEYUV2RGB1
WRITEBGR32
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax"
);
}
else if(dstbpp==24)
{
asm volatile(
"movl %4, %%ebx \n\t"
YSCALEYUV2RGB1
WRITEBGR24
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax", "%ebx"
);
}
else if(dstbpp==15)
{
asm volatile(
YSCALEYUV2RGB1
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g5Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
#endif
WRITEBGR15
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax"
);
}
else if(dstbpp==16)
{
asm volatile(
YSCALEYUV2RGB1
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g6Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
#endif
WRITEBGR16
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax"
);
}
}
else
{
if(dstbpp == 32)
{
asm volatile(
YSCALEYUV2RGB1b
WRITEBGR32
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax"
);
}
else if(dstbpp==24)
{
asm volatile(
"movl %4, %%ebx \n\t"
YSCALEYUV2RGB1b
WRITEBGR24
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax", "%ebx"
);
}
else if(dstbpp==15)
{
asm volatile(
YSCALEYUV2RGB1b
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g5Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
#endif
WRITEBGR15
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax"
);
}
else if(dstbpp==16)
{
asm volatile(
YSCALEYUV2RGB1b
#ifdef DITHER1XBPP
"paddusb "MANGLE(b5Dither)", %%mm2\n\t"
"paddusb "MANGLE(g6Dither)", %%mm4\n\t"
"paddusb "MANGLE(r5Dither)", %%mm5\n\t"
#endif
WRITEBGR16
:: "r" (buf0), "r" (buf0), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW),
"m" (yalpha1), "m" (uvalpha1)
: "%eax"
);
}
}
#else
if(dstbpp==32)
{
int i;
for(i=0; i<dstW-1; i+=2){
int Y1=yuvtab_2568[buf0[i]>>7];
int Y2=yuvtab_2568[buf0[i+1]>>7];
int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19);
int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19);
int Cb= yuvtab_40cf[U];
int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
int Cr= yuvtab_3343[V];
dest[4*i+0]=clip_table[((Y1 + Cb) >>13)];
dest[4*i+1]=clip_table[((Y1 + Cg) >>13)];
dest[4*i+2]=clip_table[((Y1 + Cr) >>13)];
dest[4*i+4]=clip_table[((Y2 + Cb) >>13)];
dest[4*i+5]=clip_table[((Y2 + Cg) >>13)];
dest[4*i+6]=clip_table[((Y2 + Cr) >>13)];
}
}
else if(dstbpp==24)
{
int i;
for(i=0; i<dstW-1; i+=2){
int Y1=yuvtab_2568[buf0[i]>>7];
int Y2=yuvtab_2568[buf0[i+1]>>7];
int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19);
int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19);
int Cb= yuvtab_40cf[U];
int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
int Cr= yuvtab_3343[V];
dest[0]=clip_table[((Y1 + Cb) >>13)];
dest[1]=clip_table[((Y1 + Cg) >>13)];
dest[2]=clip_table[((Y1 + Cr) >>13)];
dest[3]=clip_table[((Y2 + Cb) >>13)];
dest[4]=clip_table[((Y2 + Cg) >>13)];
dest[5]=clip_table[((Y2 + Cr) >>13)];
dest+=6;
}
}
else if(dstbpp==16)
{
int i;
for(i=0; i<dstW-1; i+=2){
int Y1=yuvtab_2568[buf0[i]>>7];
int Y2=yuvtab_2568[buf0[i+1]>>7];
int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19);
int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19);
int Cb= yuvtab_40cf[U];
int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
int Cr= yuvtab_3343[V];
((uint16_t*)dest)[i] =
clip_table16b[(Y1 + Cb) >>13] |
clip_table16g[(Y1 + Cg) >>13] |
clip_table16r[(Y1 + Cr) >>13];
((uint16_t*)dest)[i+1] =
clip_table16b[(Y2 + Cb) >>13] |
clip_table16g[(Y2 + Cg) >>13] |
clip_table16r[(Y2 + Cr) >>13];
}
}
else if(dstbpp==15)
{
int i;
for(i=0; i<dstW-1; i+=2){
int Y1=yuvtab_2568[buf0[i]>>7];
int Y2=yuvtab_2568[buf0[i+1]>>7];
int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19);
int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19);
int Cb= yuvtab_40cf[U];
int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U];
int Cr= yuvtab_3343[V];
((uint16_t*)dest)[i] =
clip_table15b[(Y1 + Cb) >>13] |
clip_table15g[(Y1 + Cg) >>13] |
clip_table15r[(Y1 + Cr) >>13];
((uint16_t*)dest)[i+1] =
clip_table15b[(Y2 + Cb) >>13] |
clip_table15g[(Y2 + Cg) >>13] |
clip_table15r[(Y2 + Cr) >>13];
}
}
#endif
}
| 1threat
|
Android Activity Declaration : I am working on App lock Application in android , the error I am facing is
Utils.java
public class Util {
public static void Job(Context con){
ComponentName service=new ComponentName(con,AppsService.class);
JobInfo.Builder build=new JobInfo.Builder(0,service);
build.setMinimumLatency(1*1000);
build.setOverrideDeadline(3*1000);
build.setRequiresCharging(false);
JobScheduler schedule=con.getSystemService(JobScheduler.class);
schedule.schedule(build.build());
}
}
LockActivity.java
public class LockActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lock);
final TextInputEditText pass=(TextInputEditText) findViewById(R.id.etPassword);
Button submit=(Button) findViewById(R.id.submit_button);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String password=pass.getText().toString();
DataBase data=DataBase.getInstance(LockActivity.this);
data.insertPass(password);
pass.setText("");
Intent i=new Intent(LockActivity.this,Util.class);
startActivity(i);
}
});
}
}
error is : android.content.ActivityNotFoundException: Unable to find explicit activity class {com.darkweb.android.applock/com.darkweb.android.applock.Util}; have you declared this activity in your AndroidManifest.xml?
at com.darkweb.android.applock.LockActivity$1.onClick(LockActivity.java:33)
#Line 33 includes = Intent method
| 0debug
|
How to match strings of the form "exclude=1" using regular expression? : <p>I want to use a regular expression to match strings of the form <code>exclude=1</code> where the number should be in the range of 1 to 15. </p>
<p>I've tried:
<code>str.match("/exclude\=[1-9]|exclude\=1[0-5]/")</code></p>
<p>but it does not work.</p>
<p>Thank you!</p>
| 0debug
|
static int svq3_decode_slice_header(H264Context *h)
{
MpegEncContext *const s = (MpegEncContext *) h;
const int mb_xy = h->mb_xy;
int i, header;
header = get_bits(&s->gb, 8);
if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
return -1;
} else {
int length = (header >> 5) & 3;
h->next_slice_index = get_bits_count(&s->gb) + 8*show_bits(&s->gb, 8*length) + 8*length;
if (h->next_slice_index > s->gb.size_in_bits) {
av_log(h->s.avctx, AV_LOG_ERROR, "slice after bitstream end\n");
return -1;
}
s->gb.size_in_bits = h->next_slice_index - 8*(length - 1);
skip_bits(&s->gb, 8);
if (h->svq3_watermark_key) {
uint32_t header = AV_RL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1]);
AV_WL32(&s->gb.buffer[(get_bits_count(&s->gb)>>3)+1], header ^ h->svq3_watermark_key);
}
if (length > 0) {
memcpy((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3],
&s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1));
}
skip_bits_long(&s->gb, 0);
}
if ((i = svq3_get_ue_golomb(&s->gb)) == INVALID_VLC || i >= 3){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i);
return -1;
}
h->slice_type = golomb_to_pict_type[i];
if ((header & 0x9F) == 2) {
i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1));
s->mb_skip_run = get_bits(&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width));
} else {
skip_bits1(&s->gb);
s->mb_skip_run = 0;
}
h->slice_num = get_bits(&s->gb, 8);
s->qscale = get_bits(&s->gb, 5);
s->adaptive_quant = get_bits1(&s->gb);
skip_bits1(&s->gb);
if (h->unknown_svq3_flag) {
skip_bits1(&s->gb);
}
skip_bits1(&s->gb);
skip_bits(&s->gb, 2);
while (get_bits1(&s->gb)) {
skip_bits(&s->gb, 8);
}
if (s->mb_x > 0) {
memset(h->intra4x4_pred_mode+8*h->mb2br_xy[mb_xy - 1 ]+3, -1, 4*sizeof(int8_t));
memset(h->intra4x4_pred_mode+8*h->mb2br_xy[mb_xy - s->mb_x] , -1, 8*sizeof(int8_t)*s->mb_x);
}
if (s->mb_y > 0) {
memset(h->intra4x4_pred_mode+8*h->mb2br_xy[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x));
if (s->mb_x > 0) {
h->intra4x4_pred_mode[8*h->mb2br_xy[mb_xy - s->mb_stride - 1]+3] = -1;
}
}
return 0;
}
| 1threat
|
Retrieving exact string from file using powershell script : I used the below steps to retrieve a string from file
$variable = 'abc@yahoo.com'
$test = $variable.split('@')[0];
$file = Get-Content C:\Temp\file1.txt | Where-Object { $_.Contains($test) }
This results in all lines that contain substring $test. I just want the result to contain only the lines that has exact word $test.
For example, If a line contains abc_def@yahoo.com and abc@yahoo.com I just want the result to be abc@yahoo.com
Can anyone help?
| 0debug
|
hwaddr get_pteg_offset32(PowerPCCPU *cpu, hwaddr hash)
{
CPUPPCState *env = &cpu->env;
return (hash * HASH_PTEG_SIZE_32) & env->htab_mask;
}
| 1threat
|
error when pip install mysqlclient in mac : <p>when I try to pip install mysqlclient for python show this error</p>
<pre><code> ERROR: Command errored out with exit status 1:
command: /Users/als/Desktop/Projects/sin/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/pip-egg-info
cwd: /private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/
Complete output (12 lines):
/bin/sh: mysql_config: command not found
/bin/sh: mariadb_config: command not found
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup_posix.py", line 61, in get_config
libs = mysql_config("libs")
File "/private/var/folders/30/y2trygfx15x0v9h9v8dt9dsc0000gn/T/pip-install-s44a4z2o/mysqlclient/setup_posix.py", line 29, in mysql_config
raise EnvironmentError("%s not found" % (_mysql_config_path,))
OSError: mysql_config not found
----------------------------------------
</code></pre>
<p>ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.</p>
| 0debug
|
setup_return(CPUState *env, struct emulated_sigaction *ka,
abi_ulong *rc, void *frame, int usig)
{
abi_ulong handler = (abi_ulong)ka->sa._sa_handler;
abi_ulong retcode;
int thumb = 0;
#if defined(TARGET_CONFIG_CPU_32)
#if 0
abi_ulong cpsr = env->cpsr;
if (ka->sa.sa_flags & SA_THIRTYTWO)
cpsr = (cpsr & ~MODE_MASK) | USR_MODE;
#ifdef CONFIG_ARM_THUMB
if (elf_hwcap & HWCAP_THUMB) {
thumb = handler & 1;
if (thumb)
cpsr |= T_BIT;
else
cpsr &= ~T_BIT;
}
#endif
#endif
#endif
if (ka->sa.sa_flags & TARGET_SA_RESTORER) {
retcode = (abi_ulong)ka->sa.sa_restorer;
} else {
unsigned int idx = thumb;
if (ka->sa.sa_flags & TARGET_SA_SIGINFO)
idx += 2;
if (__put_user(retcodes[idx], rc))
return 1;
#if 0
flush_icache_range((abi_ulong)rc,
(abi_ulong)(rc + 1));
#endif
retcode = ((abi_ulong)rc) + thumb;
}
env->regs[0] = usig;
env->regs[13] = h2g(frame);
env->regs[14] = retcode;
env->regs[15] = handler & (thumb ? ~1 : ~3);
#if 0
#ifdef TARGET_CONFIG_CPU_32
env->cpsr = cpsr;
#endif
#endif
return 0;
}
| 1threat
|
int walk_memory_regions(void *priv, walk_memory_regions_fn fn)
{
struct walk_memory_regions_data data;
uintptr_t i;
data.fn = fn;
data.priv = priv;
data.start = -1ul;
data.prot = 0;
for (i = 0; i < V_L1_SIZE; i++) {
int rc = walk_memory_regions_1(&data, (abi_ulong)i << V_L1_SHIFT,
V_L1_SHIFT / L2_BITS - 1, l1_map + i);
if (rc != 0) {
return rc;
}
}
return walk_memory_regions_end(&data, 0, 0);
}
| 1threat
|
basch script ignore the negative prefix on negative numbers :
a=4;
b=7;
c=5;
x =[ a-b ]
if (x -gt c) then {
echo "x is greater"
} else {
echo " something"
}
>I want compare x and c ignoring the negative prefix of c
| 0debug
|
static void test_visitor_in_alternate_number(TestInputVisitorData *data,
const void *unused)
{
Visitor *v;
Error *err = NULL;
AltStrBool *asb;
AltStrNum *asn;
AltNumStr *ans;
AltStrInt *asi;
AltIntNum *ain;
AltNumInt *ani;
v = visitor_input_test_init(data, "42");
visit_type_AltStrBool(v, &asb, NULL, &err);
error_free_or_abort(&err);
qapi_free_AltStrBool(asb);
v = visitor_input_test_init(data, "42");
visit_type_AltStrNum(v, &asn, NULL, &err);
error_free_or_abort(&err);
qapi_free_AltStrNum(asn);
v = visitor_input_test_init(data, "42");
visit_type_AltNumStr(v, &ans, NULL, &error_abort);
g_assert_cmpint(ans->type, ==, ALT_NUM_STR_KIND_N);
g_assert_cmpfloat(ans->u.n, ==, 42);
qapi_free_AltNumStr(ans);
v = visitor_input_test_init(data, "42");
visit_type_AltStrInt(v, &asi, NULL, &error_abort);
g_assert_cmpint(asi->type, ==, ALT_STR_INT_KIND_I);
g_assert_cmpint(asi->u.i, ==, 42);
qapi_free_AltStrInt(asi);
v = visitor_input_test_init(data, "42");
visit_type_AltIntNum(v, &ain, NULL, &error_abort);
g_assert_cmpint(ain->type, ==, ALT_INT_NUM_KIND_I);
g_assert_cmpint(ain->u.i, ==, 42);
qapi_free_AltIntNum(ain);
v = visitor_input_test_init(data, "42");
visit_type_AltNumInt(v, &ani, NULL, &error_abort);
g_assert_cmpint(ani->type, ==, ALT_NUM_INT_KIND_I);
g_assert_cmpint(ani->u.i, ==, 42);
qapi_free_AltNumInt(ani);
v = visitor_input_test_init(data, "42.5");
visit_type_AltStrBool(v, &asb, NULL, &err);
error_free_or_abort(&err);
qapi_free_AltStrBool(asb);
v = visitor_input_test_init(data, "42.5");
visit_type_AltStrNum(v, &asn, NULL, &error_abort);
g_assert_cmpint(asn->type, ==, ALT_STR_NUM_KIND_N);
g_assert_cmpfloat(asn->u.n, ==, 42.5);
qapi_free_AltStrNum(asn);
v = visitor_input_test_init(data, "42.5");
visit_type_AltNumStr(v, &ans, NULL, &error_abort);
g_assert_cmpint(ans->type, ==, ALT_NUM_STR_KIND_N);
g_assert_cmpfloat(ans->u.n, ==, 42.5);
qapi_free_AltNumStr(ans);
v = visitor_input_test_init(data, "42.5");
visit_type_AltStrInt(v, &asi, NULL, &err);
error_free_or_abort(&err);
qapi_free_AltStrInt(asi);
v = visitor_input_test_init(data, "42.5");
visit_type_AltIntNum(v, &ain, NULL, &error_abort);
g_assert_cmpint(ain->type, ==, ALT_INT_NUM_KIND_N);
g_assert_cmpfloat(ain->u.n, ==, 42.5);
qapi_free_AltIntNum(ain);
v = visitor_input_test_init(data, "42.5");
visit_type_AltNumInt(v, &ani, NULL, &error_abort);
g_assert_cmpint(ani->type, ==, ALT_NUM_INT_KIND_N);
g_assert_cmpfloat(ani->u.n, ==, 42.5);
qapi_free_AltNumInt(ani);
}
| 1threat
|
Why is it necessary to create a default constructor in java? : <p>The default constructor is used when no arguments are specified when a single class is instantiated but for the subclass and superclass , we need to necessarily create the default constructors ! Why? </p>
| 0debug
|
static int parse_ffconfig(const char *filename)
{
FILE *f;
char line[1024];
char cmd[64];
char arg[1024];
const char *p;
int val, errors, line_num;
FFStream **last_stream, *stream, *redirect;
FFStream **last_feed, *feed, *s;
AVCodecContext audio_enc, video_enc;
enum AVCodecID audio_id, video_id;
f = fopen(filename, "r");
if (!f) {
perror(filename);
return -1;
}
errors = 0;
line_num = 0;
first_stream = NULL;
last_stream = &first_stream;
first_feed = NULL;
last_feed = &first_feed;
stream = NULL;
feed = NULL;
redirect = NULL;
audio_id = AV_CODEC_ID_NONE;
video_id = AV_CODEC_ID_NONE;
#define ERROR(...) report_config_error(filename, line_num, &errors, __VA_ARGS__)
for(;;) {
if (fgets(line, sizeof(line), f) == NULL)
break;
line_num++;
p = line;
while (av_isspace(*p))
p++;
if (*p == '\0' || *p == '#')
continue;
get_arg(cmd, sizeof(cmd), &p);
if (!av_strcasecmp(cmd, "Port")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > 65536) {
ERROR("Invalid_port: %s\n", arg);
}
my_http_addr.sin_port = htons(val);
} else if (!av_strcasecmp(cmd, "BindAddress")) {
get_arg(arg, sizeof(arg), &p);
if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "NoDaemon")) {
} else if (!av_strcasecmp(cmd, "RTSPPort")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > 65536) {
ERROR("%s:%d: Invalid port: %s\n", arg);
}
my_rtsp_addr.sin_port = htons(atoi(arg));
} else if (!av_strcasecmp(cmd, "RTSPBindAddress")) {
get_arg(arg, sizeof(arg), &p);
if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) {
ERROR("Invalid host/IP address: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "MaxHTTPConnections")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > 65536) {
ERROR("Invalid MaxHTTPConnections: %s\n", arg);
}
nb_max_http_connections = val;
} else if (!av_strcasecmp(cmd, "MaxClients")) {
get_arg(arg, sizeof(arg), &p);
val = atoi(arg);
if (val < 1 || val > nb_max_http_connections) {
ERROR("Invalid MaxClients: %s\n", arg);
} else {
nb_max_connections = val;
}
} else if (!av_strcasecmp(cmd, "MaxBandwidth")) {
int64_t llval;
get_arg(arg, sizeof(arg), &p);
llval = strtoll(arg, NULL, 10);
if (llval < 10 || llval > 10000000) {
ERROR("Invalid MaxBandwidth: %s\n", arg);
} else
max_bandwidth = llval;
} else if (!av_strcasecmp(cmd, "CustomLog")) {
if (!ffserver_debug)
get_arg(logfilename, sizeof(logfilename), &p);
} else if (!av_strcasecmp(cmd, "<Feed")) {
char *q;
if (stream || feed) {
ERROR("Already in a tag\n");
} else {
feed = av_mallocz(sizeof(FFStream));
get_arg(feed->filename, sizeof(feed->filename), &p);
q = strrchr(feed->filename, '>');
if (*q)
*q = '\0';
for (s = first_feed; s; s = s->next) {
if (!strcmp(feed->filename, s->filename)) {
ERROR("Feed '%s' already registered\n", s->filename);
}
}
feed->fmt = av_guess_format("ffm", NULL, NULL);
snprintf(feed->feed_filename, sizeof(feed->feed_filename),
"/tmp/%s.ffm", feed->filename);
feed->feed_max_size = 5 * 1024 * 1024;
feed->is_feed = 1;
feed->feed = feed;
*last_stream = feed;
last_stream = &feed->next;
*last_feed = feed;
last_feed = &feed->next_feed;
}
} else if (!av_strcasecmp(cmd, "Launch")) {
if (feed) {
int i;
feed->child_argv = av_mallocz(64 * sizeof(char *));
for (i = 0; i < 62; i++) {
get_arg(arg, sizeof(arg), &p);
if (!arg[0])
break;
feed->child_argv[i] = av_strdup(arg);
}
feed->child_argv[i] = av_asprintf("http:
(my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" :
inet_ntoa(my_http_addr.sin_addr),
ntohs(my_http_addr.sin_port), feed->filename);
}
} else if (!av_strcasecmp(cmd, "ReadOnlyFile")) {
if (feed) {
get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
feed->readonly = 1;
} else if (stream) {
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
}
} else if (!av_strcasecmp(cmd, "File")) {
if (feed) {
get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p);
} else if (stream)
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
} else if (!av_strcasecmp(cmd, "Truncate")) {
if (feed) {
get_arg(arg, sizeof(arg), &p);
feed->truncate = strtod(arg, NULL);
}
} else if (!av_strcasecmp(cmd, "FileMaxSize")) {
if (feed) {
char *p1;
double fsize;
get_arg(arg, sizeof(arg), &p);
p1 = arg;
fsize = strtod(p1, &p1);
switch(av_toupper(*p1)) {
case 'K':
fsize *= 1024;
break;
case 'M':
fsize *= 1024 * 1024;
break;
case 'G':
fsize *= 1024 * 1024 * 1024;
break;
}
feed->feed_max_size = (int64_t)fsize;
if (feed->feed_max_size < FFM_PACKET_SIZE*4) {
ERROR("Feed max file size is too small, must be at least %d\n", FFM_PACKET_SIZE*4);
}
}
} else if (!av_strcasecmp(cmd, "</Feed>")) {
if (!feed) {
ERROR("No corresponding <Feed> for </Feed>\n");
}
feed = NULL;
} else if (!av_strcasecmp(cmd, "<Stream")) {
char *q;
if (stream || feed) {
ERROR("Already in a tag\n");
} else {
FFStream *s;
stream = av_mallocz(sizeof(FFStream));
get_arg(stream->filename, sizeof(stream->filename), &p);
q = strrchr(stream->filename, '>');
if (q)
*q = '\0';
for (s = first_stream; s; s = s->next) {
if (!strcmp(stream->filename, s->filename)) {
ERROR("Stream '%s' already registered\n", s->filename);
}
}
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
avcodec_get_context_defaults3(&video_enc, NULL);
avcodec_get_context_defaults3(&audio_enc, NULL);
audio_id = AV_CODEC_ID_NONE;
video_id = AV_CODEC_ID_NONE;
if (stream->fmt) {
audio_id = stream->fmt->audio_codec;
video_id = stream->fmt->video_codec;
}
*last_stream = stream;
last_stream = &stream->next;
}
} else if (!av_strcasecmp(cmd, "Feed")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
FFStream *sfeed;
sfeed = first_feed;
while (sfeed != NULL) {
if (!strcmp(sfeed->filename, arg))
break;
sfeed = sfeed->next_feed;
}
if (!sfeed)
ERROR("feed '%s' not defined\n", arg);
else
stream->feed = sfeed;
}
} else if (!av_strcasecmp(cmd, "Format")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
if (!strcmp(arg, "status")) {
stream->stream_type = STREAM_TYPE_STATUS;
stream->fmt = NULL;
} else {
stream->stream_type = STREAM_TYPE_LIVE;
if (!strcmp(arg, "jpeg"))
strcpy(arg, "mjpeg");
stream->fmt = ffserver_guess_format(arg, NULL, NULL);
if (!stream->fmt) {
ERROR("Unknown Format: %s\n", arg);
}
}
if (stream->fmt) {
audio_id = stream->fmt->audio_codec;
video_id = stream->fmt->video_codec;
}
}
} else if (!av_strcasecmp(cmd, "InputFormat")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
stream->ifmt = av_find_input_format(arg);
if (!stream->ifmt) {
ERROR("Unknown input format: %s\n", arg);
}
}
} else if (!av_strcasecmp(cmd, "FaviconURL")) {
if (stream && stream->stream_type == STREAM_TYPE_STATUS) {
get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p);
} else {
ERROR("FaviconURL only permitted for status streams\n");
}
} else if (!av_strcasecmp(cmd, "Author")) {
if (stream)
get_arg(stream->author, sizeof(stream->author), &p);
} else if (!av_strcasecmp(cmd, "Comment")) {
if (stream)
get_arg(stream->comment, sizeof(stream->comment), &p);
} else if (!av_strcasecmp(cmd, "Copyright")) {
if (stream)
get_arg(stream->copyright, sizeof(stream->copyright), &p);
} else if (!av_strcasecmp(cmd, "Title")) {
if (stream)
get_arg(stream->title, sizeof(stream->title), &p);
} else if (!av_strcasecmp(cmd, "Preroll")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->prebuffer = atof(arg) * 1000;
} else if (!av_strcasecmp(cmd, "StartSendOnKey")) {
if (stream)
stream->send_on_key = 1;
} else if (!av_strcasecmp(cmd, "AudioCodec")) {
get_arg(arg, sizeof(arg), &p);
audio_id = opt_codec(arg, AVMEDIA_TYPE_AUDIO);
if (audio_id == AV_CODEC_ID_NONE) {
ERROR("Unknown AudioCodec: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "VideoCodec")) {
get_arg(arg, sizeof(arg), &p);
video_id = opt_codec(arg, AVMEDIA_TYPE_VIDEO);
if (video_id == AV_CODEC_ID_NONE) {
ERROR("Unknown VideoCodec: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "MaxTime")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->max_time = atof(arg) * 1000;
} else if (!av_strcasecmp(cmd, "AudioBitRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
audio_enc.bit_rate = lrintf(atof(arg) * 1000);
} else if (!av_strcasecmp(cmd, "AudioChannels")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
audio_enc.channels = atoi(arg);
} else if (!av_strcasecmp(cmd, "AudioSampleRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
audio_enc.sample_rate = atoi(arg);
} else if (!av_strcasecmp(cmd, "AudioQuality")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
}
} else if (!av_strcasecmp(cmd, "VideoBitRateRange")) {
if (stream) {
int minrate, maxrate;
get_arg(arg, sizeof(arg), &p);
if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) {
video_enc.rc_min_rate = minrate * 1000;
video_enc.rc_max_rate = maxrate * 1000;
} else {
ERROR("Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", arg);
}
}
} else if (!av_strcasecmp(cmd, "Debug")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.debug = strtol(arg,0,0);
}
} else if (!av_strcasecmp(cmd, "Strict")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.strict_std_compliance = atoi(arg);
}
} else if (!av_strcasecmp(cmd, "VideoBufferSize")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.rc_buffer_size = atoi(arg) * 8*1024;
}
} else if (!av_strcasecmp(cmd, "VideoBitRateTolerance")) {
if (stream) {
get_arg(arg, sizeof(arg), &p);
video_enc.bit_rate_tolerance = atoi(arg) * 1000;
}
} else if (!av_strcasecmp(cmd, "VideoBitRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.bit_rate = atoi(arg) * 1000;
}
} else if (!av_strcasecmp(cmd, "VideoSize")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
av_parse_video_size(&video_enc.width, &video_enc.height, arg);
if ((video_enc.width % 16) != 0 ||
(video_enc.height % 16) != 0) {
ERROR("Image size must be a multiple of 16\n");
}
}
} else if (!av_strcasecmp(cmd, "VideoFrameRate")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
AVRational frame_rate;
if (av_parse_video_rate(&frame_rate, arg) < 0) {
ERROR("Incorrect frame rate: %s\n", arg);
} else {
video_enc.time_base.num = frame_rate.den;
video_enc.time_base.den = frame_rate.num;
}
}
} else if (!av_strcasecmp(cmd, "PixelFormat")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.pix_fmt = av_get_pix_fmt(arg);
if (video_enc.pix_fmt == AV_PIX_FMT_NONE) {
ERROR("Unknown pixel format: %s\n", arg);
}
}
} else if (!av_strcasecmp(cmd, "VideoGopSize")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.gop_size = atoi(arg);
} else if (!av_strcasecmp(cmd, "VideoIntraOnly")) {
if (stream)
video_enc.gop_size = 1;
} else if (!av_strcasecmp(cmd, "VideoHighQuality")) {
if (stream)
video_enc.mb_decision = FF_MB_DECISION_BITS;
} else if (!av_strcasecmp(cmd, "Video4MotionVector")) {
if (stream) {
video_enc.mb_decision = FF_MB_DECISION_BITS;
video_enc.flags |= CODEC_FLAG_4MV;
}
} else if (!av_strcasecmp(cmd, "AVOptionVideo") ||
!av_strcasecmp(cmd, "AVOptionAudio")) {
char arg2[1024];
AVCodecContext *avctx;
int type;
get_arg(arg, sizeof(arg), &p);
get_arg(arg2, sizeof(arg2), &p);
if (!av_strcasecmp(cmd, "AVOptionVideo")) {
avctx = &video_enc;
type = AV_OPT_FLAG_VIDEO_PARAM;
} else {
avctx = &audio_enc;
type = AV_OPT_FLAG_AUDIO_PARAM;
}
if (ffserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) {
ERROR("Error setting %s option to %s %s\n", cmd, arg, arg2);
}
} else if (!av_strcasecmp(cmd, "AVPresetVideo") ||
!av_strcasecmp(cmd, "AVPresetAudio")) {
AVCodecContext *avctx;
int type;
get_arg(arg, sizeof(arg), &p);
if (!av_strcasecmp(cmd, "AVPresetVideo")) {
avctx = &video_enc;
video_enc.codec_id = video_id;
type = AV_OPT_FLAG_VIDEO_PARAM;
} else {
avctx = &audio_enc;
audio_enc.codec_id = audio_id;
type = AV_OPT_FLAG_AUDIO_PARAM;
}
if (ffserver_opt_preset(arg, avctx, type|AV_OPT_FLAG_ENCODING_PARAM, &audio_id, &video_id)) {
ERROR("AVPreset error: %s\n", arg);
}
} else if (!av_strcasecmp(cmd, "VideoTag")) {
get_arg(arg, sizeof(arg), &p);
if ((strlen(arg) == 4) && stream)
video_enc.codec_tag = MKTAG(arg[0], arg[1], arg[2], arg[3]);
} else if (!av_strcasecmp(cmd, "BitExact")) {
if (stream)
video_enc.flags |= CODEC_FLAG_BITEXACT;
} else if (!av_strcasecmp(cmd, "DctFastint")) {
if (stream)
video_enc.dct_algo = FF_DCT_FASTINT;
} else if (!av_strcasecmp(cmd, "IdctSimple")) {
if (stream)
video_enc.idct_algo = FF_IDCT_SIMPLE;
} else if (!av_strcasecmp(cmd, "Qscale")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.flags |= CODEC_FLAG_QSCALE;
video_enc.global_quality = FF_QP2LAMBDA * atoi(arg);
}
} else if (!av_strcasecmp(cmd, "VideoQDiff")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.max_qdiff = atoi(arg);
if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) {
ERROR("VideoQDiff out of range\n");
}
}
} else if (!av_strcasecmp(cmd, "VideoQMax")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.qmax = atoi(arg);
if (video_enc.qmax < 1 || video_enc.qmax > 31) {
ERROR("VideoQMax out of range\n");
}
}
} else if (!av_strcasecmp(cmd, "VideoQMin")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
video_enc.qmin = atoi(arg);
if (video_enc.qmin < 1 || video_enc.qmin > 31) {
ERROR("VideoQMin out of range\n");
}
}
} else if (!av_strcasecmp(cmd, "LumiMask")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.lumi_masking = atof(arg);
} else if (!av_strcasecmp(cmd, "DarkMask")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
video_enc.dark_masking = atof(arg);
} else if (!av_strcasecmp(cmd, "NoVideo")) {
video_id = AV_CODEC_ID_NONE;
} else if (!av_strcasecmp(cmd, "NoAudio")) {
audio_id = AV_CODEC_ID_NONE;
} else if (!av_strcasecmp(cmd, "ACL")) {
parse_acl_row(stream, feed, NULL, p, filename, line_num);
} else if (!av_strcasecmp(cmd, "DynamicACL")) {
if (stream) {
get_arg(stream->dynamic_acl, sizeof(stream->dynamic_acl), &p);
}
} else if (!av_strcasecmp(cmd, "RTSPOption")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
av_freep(&stream->rtsp_option);
stream->rtsp_option = av_strdup(arg);
}
} else if (!av_strcasecmp(cmd, "MulticastAddress")) {
get_arg(arg, sizeof(arg), &p);
if (stream) {
if (resolve_host(&stream->multicast_ip, arg) != 0) {
ERROR("Invalid host/IP address: %s\n", arg);
}
stream->is_multicast = 1;
stream->loop = 1;
}
} else if (!av_strcasecmp(cmd, "MulticastPort")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->multicast_port = atoi(arg);
} else if (!av_strcasecmp(cmd, "MulticastTTL")) {
get_arg(arg, sizeof(arg), &p);
if (stream)
stream->multicast_ttl = atoi(arg);
} else if (!av_strcasecmp(cmd, "NoLoop")) {
if (stream)
stream->loop = 0;
} else if (!av_strcasecmp(cmd, "</Stream>")) {
if (!stream) {
ERROR("No corresponding <Stream> for </Stream>\n");
} else {
if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) {
if (audio_id != AV_CODEC_ID_NONE) {
audio_enc.codec_type = AVMEDIA_TYPE_AUDIO;
audio_enc.codec_id = audio_id;
add_codec(stream, &audio_enc);
}
if (video_id != AV_CODEC_ID_NONE) {
video_enc.codec_type = AVMEDIA_TYPE_VIDEO;
video_enc.codec_id = video_id;
add_codec(stream, &video_enc);
}
}
stream = NULL;
}
} else if (!av_strcasecmp(cmd, "<Redirect")) {
char *q;
if (stream || feed || redirect) {
ERROR("Already in a tag\n");
} else {
redirect = av_mallocz(sizeof(FFStream));
*last_stream = redirect;
last_stream = &redirect->next;
get_arg(redirect->filename, sizeof(redirect->filename), &p);
q = strrchr(redirect->filename, '>');
if (*q)
*q = '\0';
redirect->stream_type = STREAM_TYPE_REDIRECT;
}
} else if (!av_strcasecmp(cmd, "URL")) {
if (redirect)
get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p);
} else if (!av_strcasecmp(cmd, "</Redirect>")) {
if (!redirect) {
ERROR("No corresponding <Redirect> for </Redirect>\n");
} else {
if (!redirect->feed_filename[0]) {
ERROR("No URL found for <Redirect>\n");
}
redirect = NULL;
}
} else if (!av_strcasecmp(cmd, "LoadModule")) {
ERROR("Loadable modules no longer supported\n");
} else {
ERROR("Incorrect keyword: '%s'\n", cmd);
}
}
#undef ERROR
fclose(f);
if (errors)
return -1;
else
return 0;
}
| 1threat
|
How to handel success response in payubiz in surl? : in adnroid side i am getting marchent data : null.
How to show success result in App side.after successfully payment payu server return some response that response is in $_POST
$result = '';
foreach($_POST as $key=> $value){
$result .= $key . '=' . $value . ',';
$input = rtrim($result , ',');
}
echo "<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<script type='text/javascript'>
function AndroidSuccess()
{
PayU.onSuccess('status=success');
}
AndroidSuccess($input);
</script>
</head>
<body>
</body>
</html>";
| 0debug
|
Expected identifier instead and instead saw 'let' : I am trying filter the object and when I do it I am getting this error what actually it is saying I am not getting it.
> Expected identifier instead and instead saw 'let'.
This is my filter function
var arr = $scope.items; //onject data
var stringToFilter = newSortingOrder.toString();
let obj = arr.find(o => o.id === stringToFilter); //error stopping in this line.
| 0debug
|
void monitor_flush(Monitor *mon)
{
int rc;
size_t len;
const char *buf;
if (mon->skip_flush) {
return;
}
buf = qstring_get_str(mon->outbuf);
len = qstring_get_length(mon->outbuf);
if (len && !mon->mux_out) {
rc = qemu_chr_fe_write(mon->chr, (const uint8_t *) buf, len);
if (rc == len) {
QDECREF(mon->outbuf);
mon->outbuf = qstring_new();
return;
}
if (rc > 0) {
QString *tmp = qstring_from_str(buf + rc);
QDECREF(mon->outbuf);
mon->outbuf = tmp;
}
if (mon->watch == 0) {
mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT,
monitor_unblocked, mon);
}
}
}
| 1threat
|
How to reconstruct array in a certain way : Let's say I have an array
```
[-2, -1, 0, 1, 2, 3, 4];
```
And I want to reconstruct it into below
```
[0, 1, 2, 3, 4, -2, -1];
```
Is there anyway in JavaScript can achieve this?
| 0debug
|
bad alloc c++ loading file in matrix : <p>I try to load a large file (20gb) and load it into a matrix. However I get a bad_alloc error when it tries to load the file in the matrix. My code is working on Mac but doesn't on Linux. </p>
<p>Here is my code: </p>
<pre><code>std::ifstream ifs(filename, std::ifstream::binary);
loadModel(ifs);
void loadModel(std::istream& in) {
input_ = std::make_shared<Matrix>();
input_->load(in); // bad_alloc
}
</code></pre>
| 0debug
|
static void iothread_set_poll_max_ns(Object *obj, Visitor *v,
const char *name, void *opaque, Error **errp)
{
IOThread *iothread = IOTHREAD(obj);
Error *local_err = NULL;
int64_t value;
visit_type_int64(v, name, &value, &local_err);
if (local_err) {
goto out;
}
if (value < 0) {
error_setg(&local_err, "poll_max_ns value must be in range "
"[0, %"PRId64"]", INT64_MAX);
goto out;
}
iothread->poll_max_ns = value;
if (iothread->ctx) {
aio_context_set_poll_params(iothread->ctx, value, &local_err);
}
out:
error_propagate(errp, local_err);
}
| 1threat
|
How do I force a task on airflow to fail? : <p>I have a python callable <code>process_csv_entries</code> that processes csv file entries. I want my task to complete successfully only if all entries were processed successfully. Task should fail otherwise</p>
<pre><code>def process_csv_entries(csv_file):
# Boolean
file_completely_parsed = <call_to_module_to_parse_csv>
return not file_completely_parsed
CSV_FILE=<Sets path to csv file>
t1 = PythonOperator(dag=dag,
task_id='parse_csv_completely',
python_operator=process_csv_entries,
op_args=[CSV_FILE])
</code></pre>
<p>t1 seems to complete successfully irrespective of returned value.
How do I force PythonOperator task to fail?</p>
| 0debug
|
Creating a Program to pick out random strings from an array : <p>So, i wanted to create a program that picks out simple strings from an array, it sounded pretty simple to me but then i ran into problems. Here's what i wrote:</p>
<pre><code>int pickjob;
string jobs[] = {Police Officer, Fireman, Vet, Doctor, Nurse, Chemist, Waiter};
job1 = jobs[rand()%7];
job2 = jobs[rand()%7];
job3 = jobs[rand()%7];
cout << "Here i found some jobs for you, check them out\n1." << job1 << "\n2." << job2 << "\n3." << job3 << "\nGo Head and pick one out" << endl;
cin >> pickjob;
//Rest of code is below, i'll put it in if you need it ;)
</code></pre>
<p>But my problem was that everytime i ran the program the same jobs appeared everytime (Im a amaetur at C++, so if i sound stupid forgive me), so how do i make a program where it prints out diffrent jobs every time from the array.</p>
| 0debug
|
Searching List <dvd> C # : I have a DVD Rental application. And in my Store.cs (class) i need to search the Dvd.cs (class) for un rented dvds and save the film from the Movie.cs class in results in a list (getAvailableDVD).
Movie.cs has properties set & a List<dvd> & in my Dvd.cs i have an enum for availability {Available,Rented,Not Available}
im quite new to this idea, but im wanting to search the list for each Availability.Available and return its corresponding film(movie.cs)
anyone have ideas on how to approach a search method in my Store.cs?
| 0debug
|
How to add a border to your Xamarin Form Label? : <p>Hello fellow Xamarin Forms users,</p>
<p>I already found out that borders on a label are not supported out of the box by Xamarin Froms. So after some searching is still have no clue how to make it possible. Is it possible to add a border using the custom renderer? If so does someone have an example? and if not does someone have any other out of the box idea to make this possible. </p>
<p>Thank you in advance</p>
| 0debug
|
static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pic, int *got_packet)
{
libx265Context *ctx = avctx->priv_data;
x265_picture x265pic;
x265_picture x265pic_out = { { 0 } };
x265_nal *nal;
uint8_t *dst;
int payload = 0;
int nnal;
int ret;
int i;
x265_picture_init(ctx->params, &x265pic);
if (pic) {
for (i = 0; i < 3; i++) {
x265pic.planes[i] = pic->data[i];
x265pic.stride[i] = pic->linesize[i];
}
x265pic.pts = pic->pts;
x265pic.bitDepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth_minus1 + 1;
x265pic.sliceType = pic->pict_type == AV_PICTURE_TYPE_I ? X265_TYPE_I :
pic->pict_type == AV_PICTURE_TYPE_P ? X265_TYPE_P :
pic->pict_type == AV_PICTURE_TYPE_B ? X265_TYPE_B :
X265_TYPE_AUTO;
}
ret = x265_encoder_encode(ctx->encoder, &nal, &nnal,
pic ? &x265pic : NULL, &x265pic_out);
if (ret < 0)
return AVERROR_UNKNOWN;
if (!nnal)
return 0;
for (i = 0; i < nnal; i++)
payload += nal[i].sizeBytes;
ret = ff_alloc_packet(pkt, payload);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}
dst = pkt->data;
for (i = 0; i < nnal; i++) {
memcpy(dst, nal[i].payload, nal[i].sizeBytes);
dst += nal[i].sizeBytes;
if (is_keyframe(nal[i].type))
pkt->flags |= AV_PKT_FLAG_KEY;
}
pkt->pts = x265pic_out.pts;
pkt->dts = x265pic_out.dts;
switch (x265pic_out.sliceType) {
case X265_TYPE_IDR:
case X265_TYPE_I:
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
break;
case X265_TYPE_P:
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_P;
break;
case X265_TYPE_B:
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_B;
break;
}
*got_packet = 1;
return 0;
}
| 1threat
|
C# How to create a zip file from 3 directory contents : <p>pseudo code:
c:\temp\Backup.zip = (c:\Temp\Config*.* , c:\Temp\Data*.<em>, c:\Temp\scripts*.</em>)</p>
<p>Thanks in Advance!</p>
| 0debug
|
static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
{
int k, e;
int ch;
if (id_aac == TYPE_CPE && sbr->bs_coupling) {
int alpha = sbr->data[0].bs_amp_res ? 2 : 1;
int pan_offset = sbr->data[0].bs_amp_res ? 12 : 24;
for (e = 1; e <= sbr->data[0].bs_num_env; e++) {
for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
SoftFloat temp1, temp2, fac;
temp1.exp = sbr->data[0].env_facs[e][k].mant * alpha + 14;
if (temp1.exp & 1)
temp1.mant = 759250125;
else
temp1.mant = 0x20000000;
temp1.exp = (temp1.exp >> 1) + 1;
if (temp1.exp > 66) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = FLOAT_1;
}
temp2.exp = (pan_offset - sbr->data[1].env_facs[e][k].mant) * alpha;
if (temp2.exp & 1)
temp2.mant = 759250125;
else
temp2.mant = 0x20000000;
temp2.exp = (temp2.exp >> 1) + 1;
fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2));
sbr->data[0].env_facs[e][k] = fac;
sbr->data[1].env_facs[e][k] = av_mul_sf(fac, temp2);
}
}
for (e = 1; e <= sbr->data[0].bs_num_noise; e++) {
for (k = 0; k < sbr->n_q; k++) {
SoftFloat temp1, temp2, fac;
temp1.exp = NOISE_FLOOR_OFFSET - \
sbr->data[0].noise_facs[e][k].mant + 2;
temp1.mant = 0x20000000;
if (temp1.exp > 66) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = FLOAT_1;
}
temp2.exp = 12 - sbr->data[1].noise_facs[e][k].mant + 1;
temp2.mant = 0x20000000;
fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2));
sbr->data[0].noise_facs[e][k] = fac;
sbr->data[1].noise_facs[e][k] = av_mul_sf(fac, temp2);
}
}
} else {
for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) {
int alpha = sbr->data[ch].bs_amp_res ? 2 : 1;
for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){
SoftFloat temp1;
temp1.exp = alpha * sbr->data[ch].env_facs[e][k].mant + 12;
if (temp1.exp & 1)
temp1.mant = 759250125;
else
temp1.mant = 0x20000000;
temp1.exp = (temp1.exp >> 1) + 1;
if (temp1.exp > 66) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = FLOAT_1;
}
sbr->data[ch].env_facs[e][k] = temp1;
}
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
for (k = 0; k < sbr->n_q; k++){
sbr->data[ch].noise_facs[e][k].exp = NOISE_FLOOR_OFFSET - \
sbr->data[ch].noise_facs[e][k].mant + 1;
sbr->data[ch].noise_facs[e][k].mant = 0x20000000;
}
}
}
}
| 1threat
|
Measure height of TextInputLayout error container : <p>Hi I have to make layout as below, edit text has to be in <code>TextInputLayout</code> to have error and floating hint functionality, and spinner on the right must have underline. My question is how to do it, because when I'm adding <code>EditText</code> into <code>TextInputLayout</code> there is a padding bellow and both underlines aren't in the same line. Is it possible to measure somehow this error container height?
<a href="https://i.stack.imgur.com/0Gs6q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0Gs6q.png" alt="enter image description here"></a></p>
| 0debug
|
int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
uint8_t ar, uintptr_t ra)
{
CPUS390XState *env = &cpu->env;
S390PCIBusDevice *pbdev;
MemoryRegion *mr;
MemTxResult result;
int i;
uint32_t fh;
uint8_t pcias;
uint8_t len;
uint8_t buffer[128];
if (env->psw.mask & PSW_MASK_PSTATE) {
s390_program_interrupt(env, PGM_PRIVILEGED, 6, ra);
return 0;
}
fh = env->regs[r1] >> 32;
pcias = (env->regs[r1] >> 16) & 0xf;
len = env->regs[r1] & 0xff;
if (pcias > 5) {
DPRINTF("pcistb invalid space\n");
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r1, ZPCI_PCI_ST_INVAL_AS);
return 0;
}
switch (len) {
case 16:
case 32:
case 64:
case 128:
break;
default:
s390_program_interrupt(env, PGM_SPECIFICATION, 6, ra);
return 0;
}
pbdev = s390_pci_find_dev_by_fh(s390_get_phb(), fh);
if (!pbdev) {
DPRINTF("pcistb no pci dev fh 0x%x\n", fh);
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
}
switch (pbdev->state) {
case ZPCI_FS_RESERVED:
case ZPCI_FS_STANDBY:
case ZPCI_FS_DISABLED:
case ZPCI_FS_PERMANENT_ERROR:
setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE);
return 0;
case ZPCI_FS_ERROR:
setcc(cpu, ZPCI_PCI_LS_ERR);
s390_set_status_code(env, r1, ZPCI_PCI_ST_BLOCKED);
return 0;
default:
break;
}
mr = pbdev->pdev->io_regions[pcias].memory;
if (!memory_region_access_valid(mr, env->regs[r3], len, true)) {
s390_program_interrupt(env, PGM_OPERAND, 6, ra);
return 0;
}
if (s390_cpu_virt_mem_read(cpu, gaddr, ar, buffer, len)) {
s390_cpu_virt_mem_handle_exc(cpu, ra);
return 0;
}
for (i = 0; i < len / 8; i++) {
result = memory_region_dispatch_write(mr, env->regs[r3] + i * 8,
ldq_p(buffer + i * 8), 8,
MEMTXATTRS_UNSPECIFIED);
if (result != MEMTX_OK) {
s390_program_interrupt(env, PGM_OPERAND, 6, ra);
return 0;
}
}
setcc(cpu, ZPCI_PCI_LS_OK);
return 0;
}
| 1threat
|
Infinite looping alert box in javascript : <p>My question is, how come my "You got it!" alert keeps going on infinitely? I know I can make it break there, but I want to know why it keeps doing that. It should have that secret_number===answer and break out of the while loop, so obviously it's not doing that, and I don't get why. Thank you :)</p>
<pre><code>var secret_number=Math.floor((Math.random() * 10) + 1);
var answer=parseInt(prompt("Enter a number you want to try"));
while(secret_number!==answer)
{
if(answer == null || answer == "" ||isNaN(answer))
break;
if(answer>secret_number)
answer=prompt("This number is too high!");
else if(answer<secret_number)
answer=prompt("This number is too low!");
else
alert("You got it!");
}
</code></pre>
| 0debug
|
Add Icons On Android Application Activities : <p>I am building an android application and the activities has no icons of my application. How i can add icons on every activity of my android application?</p>
| 0debug
|
Why have arrays in Go? : <p>I understand the difference between arrays and slices in Go. But what I don't understand is why it is helpful to have arrays at all. Why is it helpful that an array type definition specifies a length and an element type? Why can't every "array" that we use be a slice?</p>
| 0debug
|
Calling a different class in the same src folder will not work. : I am trying to call the class, "CarFuel", from the same src folder. It is not working and shows an error.
Code for class with methods for main:
public class CarFuel {
int CarFuel = 5; //Gallons of fuel starting in car
public CarFuel(int FuelAmount){ //Constructor for defined staring fuel amount
CarFuel = FuelAmount;
}
public void GetGasoline(int amount){ //Filling up gasoline, amount = how much gasoline filled up
CarFuel = CarFuel + amount;
}
public void DrainGasoline(int amount){ //Driving car, amount = how much gasoline drained
CarFuel = CarFuel - amount;
}
public int GetGasoline(){ //returns how much gasoline is left in the end
return CarFuel;
}
}
//MAIN EXEX IN CarFuelExec
Here is the main class that uses these methods:
public class CarFuelExec {
public static void main(String[] args){
CarFuel.car = new CarFuel(0);
car.GetGasoline(36);
car.DrainGasoline(5);
System.out.println("The remaining fuel in your car is: " + car.GetGasoline + " gallons");
}
}
Could anybody tell me why CarFuel.car = new Carfuel(0); is not calling the other class and is outputting an error?
| 0debug
|
Multiple android apps : <p>I need to make around 1000 android apps with same code base but different names, logos, splash screens,images . using android library will solve the issue? One google developer account is sufficient? </p>
| 0debug
|
static void ff_wmv2_idct_add_c(uint8_t *dest, int line_size, DCTELEM *block)
{
ff_wmv2_idct_c(block);
add_pixels_clamped_c(block, dest, line_size);
}
| 1threat
|
static int cin_probe(AVProbeData *p)
{
if (p->buf_size < 18)
return 0;
if (AV_RL32(&p->buf[0]) != 0x55AA0000)
return 0;
if (AV_RL32(&p->buf[12]) != 22050 || p->buf[16] != 16 || p->buf[17] != 0)
return 0;
return AVPROBE_SCORE_MAX;
}
| 1threat
|
CPUState *cpu_copy(CPUState *env)
{
CPUState *new_env = cpu_init(env->cpu_model_str);
CPUState *next_cpu = new_env->next_cpu;
int cpu_index = new_env->cpu_index;
#if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp;
CPUWatchpoint *wp;
#endif
memcpy(new_env, env, sizeof(CPUState));
new_env->next_cpu = next_cpu;
new_env->cpu_index = cpu_index;
TAILQ_INIT(&env->breakpoints);
TAILQ_INIT(&env->watchpoints);
#if defined(TARGET_HAS_ICE)
TAILQ_FOREACH(bp, &env->breakpoints, entry) {
cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
}
TAILQ_FOREACH(wp, &env->watchpoints, entry) {
cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
wp->flags, NULL);
}
#endif
return new_env;
}
| 1threat
|
How to save structure of site/document created with a rich text editor to create read-only views and editable rich text editors again? : <p>I need to save some content of an editor in some kind of backend, which currently is unspecified. At the moment I´m struggling the structure of the created document. In the editor the user should be able to write text and place videos or images without an fixed structure of how the images and text should be placed. The user should place these 3 components in any order he wants underneath each other.</p>
<p>In practice the editor looks something like this:
<a href="https://i.stack.imgur.com/uLlhG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uLlhG.png" alt="Text and images in any order"></a></p>
<p><strong>Q: How is it possible to save the structure, to load the exact same editor the next time or to create read-only<code><div></code> containers and editable rich text editors again with the content?</strong></p>
<p>My first idea was to split the editor in smaller sub-editors as soon as the type of content changes. So for example you are starting with only one editor with text. Then the user adds another editor (for example with an button click) and adds an image. But I´m not sure if the user accepts this and nevertheless puts all content (text and images) in the first editor.
<a href="https://i.stack.imgur.com/2eOrr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2eOrr.png" alt="Several Sub-editors with different contents"></a></p>
<hr>
<p>My second idea was to save the whole <code>html</code> created inside the editors code-view and to load it back inside the editor the next time the side is ordered. But I´m not sure if it´s possible this way to create "normal" read-only <code><div></code> containers with the same content.</p>
<p>In my opinion both of my ideas aren´t that good, so i´m asking you guys what you are suggesting to do.</p>
| 0debug
|
How do you handle collection and storage of new data in an existing system? : <p>I am new to system design and have been asked to solve a problem.</p>
<p>Given a car rental service website, I need to work on a new feature.</p>
<p>The company has come up with some more data that they would like to capture and analyze along with the data that they already have.</p>
<p>This new data can be something like time and cost to assemble a car. </p>
<p>I need to understand the following:</p>
<p>1: How should I approach the problem, from API design perspective?</p>
<p>2: Is changing the schema of your tables going to do any good, if that is an option?</p>
<p>3: Which databases can be used?</p>
<p>The values once stored can be changed. For example, the time to assemble can reduce or increase, hence the users should be able to update the values.</p>
| 0debug
|
static int bdrv_rw_co(BlockDriverState *bs, int64_t sector_num, uint8_t *buf,
int nb_sectors, bool is_write, BdrvRequestFlags flags)
{
QEMUIOVector qiov;
struct iovec iov = {
.iov_base = (void *)buf,
.iov_len = nb_sectors * BDRV_SECTOR_SIZE,
};
if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) {
return -EINVAL;
}
qemu_iovec_init_external(&qiov, &iov, 1);
return bdrv_prwv_co(bs, sector_num << BDRV_SECTOR_BITS,
&qiov, is_write, flags);
}
| 1threat
|
Create multiple Postgres instances on same machine : <p>To test streaming replication, I would like to create a second Postgres instance on the same machine. The idea is that if it can be done on the test server, then it should be trivial to set it up on the two production servers.</p>
<p>The instances should use different configuration files and different data directories. I tried following the instructions here <a href="http://ubuntuforums.org/showthread.php?t=1431697" rel="noreferrer">http://ubuntuforums.org/showthread.php?t=1431697</a> but I haven't figured out how to get Postgres to use a different configuration file. If I copy the init script, the scripts are just aliases to the same Postgres instance.</p>
<p>I'm using Postgres 9.3 and the Postgres help pages say to specify the configuration file on the <code>postgres</code> command line. I'm not really sure what this means. Am I supposed to install some client for this to work? Thanks.</p>
| 0debug
|
Retrieve the tables from sql server management studio from visual studio : I am working with C# Visual studio sql server has back end. This is my code in following code I am trying to retrieve table names based on database name.The command which used that is working perfectly in sql server management studio query builder but when I am running this it showing error "Object reference not set to instance of an object" in following line- cmbAlterAdd1.Items.Add(Reader2["name"].ToString());
I given name because in result column name is coming has name only has shown image. I think I need expert advice to solve this problem please help!!
ConnectionPath = sqlPath;
DBName = databaseName;
SqlConnection con = new SqlConnection(ConnectionPath);
con.Open();
SqlCommand cmd = new SqlCommand("USE "+DBName+" SELECT name FROM sys.Tables", con);
SqlDataReader Reader2 = cmd.ExecuteReader();
while (Reader2.Read())
{
cmbAlterAdd1.Items.Add(Reader2["name"].ToString());
}
con.Close();
[IMAGE LINK][1]
[1]: http://i.stack.imgur.com/xJC7D.jpg
| 0debug
|
The best way to get images from a webpage to display on a android app image view? : <p>Im stuck and out of ideas. Does anyone know the easiest way of getting a image from a webpage and using it on your android app. Help will be appreciated.</p>
| 0debug
|
PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
{
VirtIONet *n;
static int virtio_net_id;
n = (VirtIONet *)virtio_init_pci(bus, "virtio-net",
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_NET,
PCI_VENDOR_ID_REDHAT_QUMRANET,
VIRTIO_ID_NET,
PCI_CLASS_NETWORK_ETHERNET, 0x00,
sizeof(struct virtio_net_config),
sizeof(VirtIONet));
if (!n)
return NULL;
n->vdev.get_config = virtio_net_get_config;
n->vdev.set_config = virtio_net_set_config;
n->vdev.get_features = virtio_net_get_features;
n->vdev.set_features = virtio_net_set_features;
n->vdev.bad_features = virtio_net_bad_features;
n->vdev.reset = virtio_net_reset;
n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx);
n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx);
n->ctrl_vq = virtio_add_queue(&n->vdev, 16, virtio_net_handle_ctrl);
memcpy(n->mac, nd->macaddr, ETH_ALEN);
n->status = VIRTIO_NET_S_LINK_UP;
n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
virtio_net_receive, virtio_net_can_receive, n);
n->vc->link_status_changed = virtio_net_set_link_status;
qemu_format_nic_info_str(n->vc, n->mac);
n->tx_timer = qemu_new_timer(vm_clock, virtio_net_tx_timer, n);
n->tx_timer_active = 0;
n->mergeable_rx_bufs = 0;
n->promisc = 1;
n->mac_table.macs = qemu_mallocz(MAC_TABLE_ENTRIES * ETH_ALEN);
n->vlans = qemu_mallocz(MAX_VLAN >> 3);
register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION,
virtio_net_save, virtio_net_load, n);
return (PCIDevice *)n;
}
| 1threat
|
static int ehci_state_executing(EHCIQueue *q, int async)
{
int again = 0;
int reload, nakcnt;
ehci_execute_complete(q);
if (q->usb_status == USB_RET_ASYNC) {
goto out;
}
if (q->usb_status == USB_RET_PROCERR) {
again = -1;
goto out;
}
if (!async) {
int transactCtr = get_field(q->qh.epcap, QH_EPCAP_MULT);
transactCtr--;
set_field(&q->qh.epcap, transactCtr, QH_EPCAP_MULT);
, bottom of page 82, should exit this state when transaction
}
reload = get_field(q->qh.epchar, QH_EPCHAR_RL);
if (reload) {
nakcnt = get_field(q->qh.altnext_qtd, QH_ALTNEXT_NAKCNT);
if (q->usb_status == USB_RET_NAK) {
if (nakcnt) {
nakcnt--;
}
} else {
nakcnt = reload;
}
set_field(&q->qh.altnext_qtd, nakcnt, QH_ALTNEXT_NAKCNT);
}
if ((q->usb_status == USB_RET_NAK) || (q->qh.token & QTD_TOKEN_ACTIVE)) {
ehci_set_state(q->ehci, async, EST_HORIZONTALQH);
} else {
ehci_set_state(q->ehci, async, EST_WRITEBACK);
}
again = 1;
out:
ehci_flush_qh(q);
return again;
}
| 1threat
|
Deal with segmentation fault : <p>I am trying to solve a CodeChef problem. Whenever I run it I get a segmentation fault. This is the link to the problem: <a href="https://www.codechef.com/problems/CHN09" rel="nofollow">Malvika is peculiar about color of balloons</a></p>
<p>Here is my code :</p>
<pre><code>#include<iostream>
#include<cstring>
#include<algorithm>
int main(){
std::string balloonColors;
size_t numberOfAmber;
size_t numberOfBrass;
int t;
int results[t];
std::cin >> t;
for (int i = 0; i < t; i++){
int result = 0;
std::cin >> balloonColors;
numberOfAmber = std::count(balloonColors.begin(), balloonColors.end(), 'a');
numberOfBrass = std::count(balloonColors.begin(), balloonColors.end(), 'b');
if (numberOfAmber == 0 || numberOfBrass == 0){
result = 0;
}
if (numberOfAmber <= numberOfBrass){
result = (int)numberOfAmber;
}
else {
result = (int)numberOfBrass;
}
results[i] = result;
}
for (int x = 0; x < t; x++){
std::cout << results[x] << std::endl;
}
}
</code></pre>
| 0debug
|
Can I use python for a Raspberrry based App? : I'm quite new in coding.
I want to controll my RC car with my smartphone thanks to a raspberry Pie 3.
All my researches show that I have to use Node.JS, and consequently JavaScript, to create the App.
Is there any way I can do it with Python ? Do you have an open-source exemple ?
Thks a lot.
| 0debug
|
static void gen_neon_trn_u8(TCGv t0, TCGv t1)
{
TCGv rd, tmp;
rd = new_tmp();
tmp = new_tmp();
tcg_gen_shli_i32(rd, t0, 8);
tcg_gen_andi_i32(rd, rd, 0xff00ff00);
tcg_gen_andi_i32(tmp, t1, 0x00ff00ff);
tcg_gen_or_i32(rd, rd, tmp);
tcg_gen_shri_i32(t1, t1, 8);
tcg_gen_andi_i32(t1, t1, 0x00ff00ff);
tcg_gen_andi_i32(tmp, t0, 0xff00ff00);
tcg_gen_or_i32(t1, t1, tmp);
tcg_gen_mov_i32(t0, rd);
dead_tmp(tmp);
dead_tmp(rd);
}
| 1threat
|
PHP While Loop Not Liking Two Variables : <p>I have the follow while loop in my code. I can't understand why it causes a loading error but when I remove the = from the statement, it suddenly works? Thanks in advance!</p>
<p>Here is my code (Yes, I do have a form opening and closing tags!):</p>
<pre><code> echo "<select name='cquantity'>";
$x = 0;
$limit = 1;
while ($x <= $limit) {
echo "<option value='$x'>$x</option>";
}
echo "</select>";
</code></pre>
| 0debug
|
Create a pivot table that lists out values : <p>What aggfunc do I need to use to produce a list using a pivot table? I tried using str which doesn't quite work.</p>
<p><strong>Inputs</strong></p>
<pre><code>import pandas as pd
data = {
'Test point': [0, 1, 2, 0, 1],
'Experiment': [1, 2, 3, 4, 5]
}
df = pd.DataFrame(data)
print df
pivot = pd.pivot_table(df, index=['Test point'], values=['Experiment'], aggfunc=len)
print pivot
pivot = pd.pivot_table(df, index=['Test point'], values=['Experiment'], aggfunc=str)
print pivot
</code></pre>
<p><strong>Outputs</strong></p>
<pre><code> Experiment Test point
0 1 0
1 2 1
2 3 2
3 4 0
4 5 1
Experiment
Test point
0 2
1 2
2 1
Experiment
Test point
0 0 1\n3 4\nName: Experiment, dtype: int64
1 1 2\n4 5\nName: Experiment, dtype: int64
2 2 3\nName: Experiment, dtype: int64
</code></pre>
<p><strong>Desired output</strong></p>
<pre><code> Experiment
Test point
0 1, 4
1 2, 5
2 3
</code></pre>
| 0debug
|
Block Block background on all page bootstrap : Hello i want this background on my project [like this][1]
[1]: https://i.stack.imgur.com/3XwIz.png
| 0debug
|
static int decode_slice(H264Context *h){
MpegEncContext * const s = &h->s;
const int part_mask= s->partitioned_frame ? (AC_END|AC_ERROR) : 0x7F;
s->mb_skip_run= -1;
if( h->pps.cabac ) {
int i;
align_get_bits( &s->gb );
ff_init_cabac_states( &h->cabac, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64 );
ff_init_cabac_decoder( &h->cabac,
s->gb.buffer + get_bits_count(&s->gb)/8,
( s->gb.size_in_bits - get_bits_count(&s->gb) + 7)/8);
for( i= 0; i < 460; i++ ) {
int pre;
if( h->slice_type == I_TYPE )
pre = clip( ((cabac_context_init_I[i][0] * s->qscale) >>4 ) + cabac_context_init_I[i][1], 1, 126 );
else
pre = clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 );
if( pre <= 63 )
h->cabac_state[i] = 2 * ( 63 - pre ) + 0;
else
h->cabac_state[i] = 2 * ( pre - 64 ) + 1;
}
for(;;){
int ret = decode_mb_cabac(h);
int eos;
if(ret>=0) hl_decode_mb(h);
if( ret >= 0 && h->mb_aff_frame ) {
s->mb_y++;
if(ret>=0) ret = decode_mb_cabac(h);
hl_decode_mb(h);
s->mb_y--;
}
eos = get_cabac_terminate( &h->cabac );
if( ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 1) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
if( ++s->mb_x >= s->mb_width ) {
s->mb_x = 0;
ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
if(h->mb_aff_frame) {
++s->mb_y;
}
}
if( eos || s->mb_y >= s->mb_height ) {
tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}
}
} else {
for(;;){
int ret = decode_mb_cavlc(h);
if(ret>=0) hl_decode_mb(h);
if(ret>=0 && h->mb_aff_frame){
s->mb_y++;
ret = decode_mb_cavlc(h);
if(ret>=0) hl_decode_mb(h);
s->mb_y--;
}
if(ret<0){
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
if(++s->mb_x >= s->mb_width){
s->mb_x=0;
ff_draw_horiz_band(s, 16*s->mb_y, 16);
++s->mb_y;
if(h->mb_aff_frame) {
++s->mb_y;
}
if(s->mb_y >= s->mb_height){
tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
if(get_bits_count(&s->gb) == s->gb.size_in_bits ) {
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}else{
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
}
}
if(get_bits_count(&s->gb) >= s->gb.size_in_bits && s->mb_skip_run<=0){
tprintf("slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits);
if(get_bits_count(&s->gb) == s->gb.size_in_bits ){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}else{
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
}
}
}
#if 0
for(;s->mb_y < s->mb_height; s->mb_y++){
for(;s->mb_x < s->mb_width; s->mb_x++){
int ret= decode_mb(h);
hl_decode_mb(h);
if(ret<0){
fprintf(stderr, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
if(++s->mb_x >= s->mb_width){
s->mb_x=0;
if(++s->mb_y >= s->mb_height){
if(get_bits_count(s->gb) == s->gb.size_in_bits){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}else{
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return -1;
}
}
}
if(get_bits_count(s->?gb) >= s->gb?.size_in_bits){
if(get_bits_count(s->gb) == s->gb.size_in_bits){
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, (AC_END|DC_END|MV_END)&part_mask);
return 0;
}else{
ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_ERROR|DC_ERROR|MV_ERROR)&part_mask);
return -1;
}
}
}
s->mb_x=0;
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
#endif
return -1;
}
| 1threat
|
what is difference between find() and children() in jquery? : <p>I got Question in interview. What is main difference between <strong>find()</strong> and <strong>children()</strong>.
Please answer .
Thanks in advance</p>
| 0debug
|
Split string by data size : <p>I'm using a python library that takes in a string and returns me some output. The caveat is that the max string size it takes is 200kb.</p>
<p>Lets say I have a string that's 350kb. I want to split the string such that it sends the library two requests: the first one being the first part of the string which is 200kb, and the second one being the second part of the string which is 150kb. </p>
<p>How to implement?</p>
| 0debug
|
php - get the value of div id to POST FORM : hello i would like to get the value of a div to a php form. i am using POST.
this is my code , this div also runs on jQuery , the value is changing depends on what color the user chooses:
<div id="caption">Alumina Jade Metallic</div>
i used `data-caption` to change the data of div `#caption`
and this is my sample php POST :
$action = $_POST['action'];
$fName = $_POST['form'][0]['fName'];
$lName = $_POST['form'][0]['lName'];
$address = $_POST['form'][0]['address'];
$doBirth = $_POST['form'][0]['doBirth'];
$city = $_POST['form'][0]['city'];
$zipCode = $_POST['form'][0]['zipCode'];
$email = $_POST['form'][0]['email'];
$phone = $_POST['form'][0]['phone'];
$remarks = $_POST['form'][0]['remarks'];
| 0debug
|
static pflash_t *ve_pflash_cfi01_register(hwaddr base, const char *name,
DriveInfo *di)
{
DeviceState *dev = qdev_create(NULL, "cfi.pflash01");
if (di && qdev_prop_set_drive(dev, "drive",
blk_bs(blk_by_legacy_dinfo(di)))) {
abort();
}
qdev_prop_set_uint32(dev, "num-blocks",
VEXPRESS_FLASH_SIZE / VEXPRESS_FLASH_SECT_SIZE);
qdev_prop_set_uint64(dev, "sector-length", VEXPRESS_FLASH_SECT_SIZE);
qdev_prop_set_uint8(dev, "width", 4);
qdev_prop_set_uint8(dev, "device-width", 2);
qdev_prop_set_uint8(dev, "big-endian", 0);
qdev_prop_set_uint16(dev, "id0", 0x89);
qdev_prop_set_uint16(dev, "id1", 0x18);
qdev_prop_set_uint16(dev, "id2", 0x00);
qdev_prop_set_uint16(dev, "id3", 0x00);
qdev_prop_set_string(dev, "name", name);
qdev_init_nofail(dev);
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
return OBJECT_CHECK(pflash_t, (dev), "cfi.pflash01");
}
| 1threat
|
Can arrays of pointers & 2-D array consider as same : <p>Can anyone please tell if both the entity - i.e.
2-D array <code>char array[][9]</code> and
array of pointers <code>char *array[9]</code> are same or different??</p>
| 0debug
|
static void ohci_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->init = usb_ohci_initfn_pci;
k->vendor_id = PCI_VENDOR_ID_APPLE;
k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
k->class_id = PCI_CLASS_SERIAL_USB;
dc->desc = "Apple USB Controller";
dc->props = ohci_pci_properties;
}
| 1threat
|
static inline int init_pfa_reindex_tabs(MDCT15Context *s)
{
int i, j;
const int b_ptwo = s->ptwo_fft.nbits;
const int l_ptwo = 1 << b_ptwo;
const int inv_1 = l_ptwo << ((4 - b_ptwo) & 3);
const int inv_2 = 0xeeeeeeef & ((1U << b_ptwo) - 1);
s->pfa_prereindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_prereindex));
if (!s->pfa_prereindex)
return 1;
s->pfa_postreindex = av_malloc(15 * l_ptwo * sizeof(*s->pfa_postreindex));
if (!s->pfa_postreindex)
return 1;
for (i = 0; i < l_ptwo; i++) {
for (j = 0; j < 15; j++) {
const int q_pre = ((l_ptwo * j)/15 + i) >> b_ptwo;
const int q_post = (((j*inv_1)/15) + (i*inv_2)) >> b_ptwo;
const int k_pre = 15*i + ((j - q_pre*15) << b_ptwo);
const int k_post = i*inv_2*15 + j*inv_1 - 15*q_post*l_ptwo;
s->pfa_prereindex[i*15 + j] = k_pre;
s->pfa_postreindex[k_post] = l_ptwo*j + i;
}
}
return 0;
}
| 1threat
|
static int diff_C(unsigned char *old, unsigned char *new, int os, int ns)
{
int x, y, d=0;
for (y = 8; y; y--) {
for (x = 8; x; x--) {
d += abs(new[x] - old[x]);
}
new += ns;
old += os;
}
return d;
}
| 1threat
|
whats the best way to show and hide parts of an mvc view based on some logic : Im typing on a phone so please have mercy. I just have something im thinking about and something which ive been implementing in a lot of my code which i dont think is the best way of doing things..
you know after you submit a form you may want to direct back to the same page and display a success message and want to hide the submitted form inputs for example. Other times you may direct to a page with an optional paramter, like a query string, and based on that parameter you may want to show and hide certain things on your view.
Im not sure the best way to do this because i like keeping all logic in my controller and not putting logic in my view.
You can accomplish this in webforms simply by seperating your elements in different panels and setting the hidden property in your cs controll.
The way ive been doing this in mvc (which i dont like) is for example with a ViewBag success message and an if statement in my view which checks if the viewbag is null .. if its not null it displays the success message else it displays some form inputs. Other times you dont use a viewbag... for example a checkout page for a shopping cart... in your view you might check if the cart model is empty, of it is empty display a "sorry, your cart is empty" message else display the cart table.. I dont like handling this with if logic in my view... what is the best solution? Is there another solution?
I could right out some example code here but im on my phone and my eyes are tired...
Controll:
[HttpPost]
public ActionResult Edit(Elephants elephants)
{
// do something with elephants
ViewBag.weldone = "Weldone, you have made a wonderful impact by submitting this crucial knformation about elephants to the world";
return View();
}
View:
@if(ViewBag.weldone != null)
{
<p>@ViewBag.weldone</p>
}
else
{
//something you want to hide from the page on succesfull elephant save
}
| 0debug
|
Visual Studio Code user snippets not working : <p>I've enabled the default "log" snippet in VS Code. I also added another snippet. Neither show up when I type their prefixes. I have set <code>editor.tabCompletion</code> to true.</p>
<p>Any idea why these don't work?</p>
| 0debug
|
Porting from Visual Studio to Delphi XE10 : I am porting some kind of code from Visual Studio to Delphi XE10.
Wondering how we should translate the following construct:
public event PreviewReadyDelegate PreviewReady
{
add { Scheduler.AddOrRemoveEvent(() => { _previewReady += value; }); }
remove { Scheduler.AddOrRemoveEvent(() => { _previewReady -= value; }); }
}
Help appreciated.
| 0debug
|
android studio: activity_main.xml does not include content_main.xml : I have two questions:
1)
I tried to add a button on the activity_main.xml, It shows. Then I thing the button is better placed in the content_main.xml. This time the button doesn't show. I make the button visibility to visible and the content_main visibility to visible as well. But the button still does not show.
There is warning: The surrounding layout (@layout/activity_main) did not actually include this layout. Remove tools:showIn=... from the root tag.
So I guess the reason the button does not show up is that the activity_main.xml doesn't includes the content_main.xml. If it is the cause, how to solve the problem?
2)
The options menu (for settings) displays on the centre of the tool bar, not right end. How to fix it ?
Thanks
| 0debug
|
PL/SQL create trigger /Thanks in advance : Create a trigger called biufer_customer that starts before insert or update of the column passwd in the customer table. The trigger shall verify that the password is exactly six characters long, no more, no less. Unless this requirement is fulfilled, the trigger shall stop the transaction and confirm that this error occurred.
create or replace trigger biufer_customer
before insert or update
of passwd
on customer
for each row
when (new.passwd <> 6)
begin
raise_application_error(-20001,'Wrong password!');
end;
/
| 0debug
|
How do I create a 'provisioning profile' and how do you sign in? : The Xcode error is:
Failed to create provisioning profile.
There are no devices registered in your account on the developer website. Plug in and select a device to have Xcode register it.
No profiles for 'com.Tom-s-Creations.Bouncy-Heavens' were found
Xcode couldn't find any iOS App Development provisioning profiles matching 'com.Tom-s-Creations.Bouncy-Heavens'.
Help me please.
Thanks.
| 0debug
|
How can I make my program create variables automatically and print them by it self? : <p>I've got an idea for a program that I'm not sure how to implement. How can I make the program ask the user something -- <code>input()</code> -- as many times as user responds until x command is written and (and this is the hard part) create variables automatically (e.g answer1 = x, answer2 = x, answer3 = x, answer4 = x) with their respective value assigned?
And how could I then print all those variables without having to write them manually, for example, if at the beginning 6 variables were created then the 6 variables will be printed.
I'm not asking you to write it all for me, conversely I want you to give me some tips, some functions or ideas and I will be more than grateful. Thanks in advance!!</p>
| 0debug
|
A PhP program to select album names from album mysql table, Did not understand usage of IF at preparing the statement? why should use IF at all? : $sql = "SELECT album_name FROM albums WHERE artist_id=?";
if($stmt = $link->prepare($sql)) // Doubt: why should you use if statement, can't we just write it without if statement?
{
$stmt->bind_param('i', $_POST['artist']);
$stmt->execute();
$stmt->bind_result($album);
while($stmt->fetch()) {
printf("Album: %s<br />", $album);
}
$stmt->close();
}
// Close the connection
$link->close();
| 0debug
|
Android match_parent with max_width : I have an ImageView and I want to set something like this:
`min_with=match_parent and max_width=value`
does someone know how to do that?
| 0debug
|
In Angular, how I navigate directly to a path inside a lazy loaded module? : <p>I would like to have two top level paths for logging in and registering.</p>
<p>I would prefer not having to do <code>auth/log-in</code> and <code>auth/register</code>. </p>
<p>However, the auth components are in a separate module, which is good because it shouldn't be loaded unless specifically requested.</p>
<pre><code>export const routes: Route[] = [
{ path: 'log-in', loadChildren: './auth-module/auth.module#AuthModule'},
{ path: 'register', loadChildren: './auth-module/auth.module#AuthModule'}
];
</code></pre>
<p>How can I specify when I am defining my routes that I want the <code>log-in</code> path to go to the <code>log-in</code> path <strong>inside</strong> the lazy loaded AuthModule, and the <code>register</code> path to go to the <code>register</code> path <strong>inside</strong> the lazy loaded module?</p>
| 0debug
|
vba macro: find string in column thru loop then execute checker : I created a code that will find the word 'date' value on the field/column and if available it will check the date format of th entire row, so as long as the 'date' word/string is available it keeps on checking the date. I tried some code to loop thru column but no luck don't have an idea if where to put it.
code:
Sub dateFromatChecker()
Dim lrow, lcol As Long
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Find(What:="date", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Selection.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(1, 0).Select
lrow = Selection.End(xlDown).Row
For x = 2 To lrow
If Cells(x, 2).NumberFormat <> "yyyy/dd/mm hh:mm:ss" Then
'MsgBox "Incorrect Date format, Please use this date yyyy/dd/mm hh:mm:ss"
Cells(x, 2).Interior.Color = vbBlue
Else
'MsgBox "Date is in Proper format"
End If
Next x
End Sub
My table
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/oe4R0.png
| 0debug
|
static int unix_listen_saddr(UnixSocketAddress *saddr,
bool update_addr,
Error **errp)
{
struct sockaddr_un un;
int sock, fd;
sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0);
if (sock < 0) {
error_setg_errno(errp, errno, "Failed to create Unix socket");
return -1;
}
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;
if (saddr->path && strlen(saddr->path)) {
snprintf(un.sun_path, sizeof(un.sun_path), "%s", saddr->path);
} else {
const char *tmpdir = getenv("TMPDIR");
tmpdir = tmpdir ? tmpdir : "/tmp";
if (snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX",
tmpdir) >= sizeof(un.sun_path)) {
error_setg_errno(errp, errno,
"TMPDIR environment variable (%s) too large", tmpdir);
goto err;
}
fd = mkstemp(un.sun_path);
if (fd < 0) {
error_setg_errno(errp, errno,
"Failed to make a temporary socket name in %s", tmpdir);
goto err;
}
close(fd);
if (update_addr) {
g_free(saddr->path);
saddr->path = g_strdup(un.sun_path);
}
}
if (unlink(un.sun_path) < 0 && errno != ENOENT) {
error_setg_errno(errp, errno,
"Failed to unlink socket %s", un.sun_path);
goto err;
}
if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) {
error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path);
goto err;
}
if (listen(sock, 1) < 0) {
error_setg_errno(errp, errno, "Failed to listen on socket");
goto err;
}
return sock;
err:
closesocket(sock);
return -1;
}
| 1threat
|
Is there any option to change fonts of Android app : <p>I want to know if I have a text like "hello world".
How can I set the preference of this text view that user can change the font size to medium, large and small like 20sp, 25sp, 30sp.</p>
| 0debug
|
VisualVM Calibration Step Hangs with Windows 10 : <p>Situation:</p>
<p>I have installed VisualVM 1.3.8 on my Windows 10 Anniversary Edition (and not using the one that came with the JDK 8).</p>
<p>I would like to use this to Profile a Java (Play) App.</p>
<p>What Happens:</p>
<p>When starting the CPU profiling, it first asks that I need to calibrate, and when that happens it hangs at the stage.</p>
<p><a href="http://i.stack.imgur.com/Tas82.png" rel="noreferrer">The Display showing the hanging</a></p>
<p>What I Have Tried:</p>
<p>I tried this on MacOS 8, and it does go through the calibration steps OK.</p>
<p>I have edited the etc/visualvm.conf to disable the d3d pipline feature.</p>
<p>visualvm_default_options="-J-Dsun.java2d.d3d=false -J-client -J-Xms24m -J-Xmx256m -J-XX:+IgnoreUnrecognizedVMOptions -J-Dnetbeans.accept_license_class=com.sun.tools.visualvm.modules.startup.AcceptLicense -J-Dsun.jvmstat.perdata.syncWaitMs=10000 -J-Dsun.java2d.noddraw=true"</p>
<p>The Goal:</p>
<p>Get the calibration process to complete.</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.