problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to import a python module where filename contains '-' character : <p>Is it possible to import a module that contains '-' characters in the filename?</p>
<p>i.e.</p>
<pre><code>import my-python-module
</code></pre>
<p>or do you have to rename the file, i.e.</p>
<pre><code>mv my-python-module.py my_python_module.py
</code></pre>
<p>and then..</p>
<pre><code>import my_python_module
</code></pre>
| 0debug |
static void svq3_luma_dc_dequant_idct_c(int16_t *output, int16_t *input, int qp)
{
const int qmul = svq3_dequant_coeff[qp];
#define stride 16
int i;
int temp[16];
static const uint8_t x_offset[4] = { 0, 1 * stride, 4 * stride, 5 * stride };
for (i = 0; i < 4; i++) {
const int z0 = 13 * (input[4 * i + 0] + input[4 * i + 2]);
const int z1 = 13 * (input[4 * i + 0] - input[4 * i + 2]);
const int z2 = 7 * input[4 * i + 1] - 17 * input[4 * i + 3];
const int z3 = 17 * input[4 * i + 1] + 7 * input[4 * i + 3];
temp[4 * i + 0] = z0 + z3;
temp[4 * i + 1] = z1 + z2;
temp[4 * i + 2] = z1 - z2;
temp[4 * i + 3] = z0 - z3;
}
for (i = 0; i < 4; i++) {
const int offset = x_offset[i];
const int z0 = 13 * (temp[4 * 0 + i] + temp[4 * 2 + i]);
const int z1 = 13 * (temp[4 * 0 + i] - temp[4 * 2 + i]);
const int z2 = 7 * temp[4 * 1 + i] - 17 * temp[4 * 3 + i];
const int z3 = 17 * temp[4 * 1 + i] + 7 * temp[4 * 3 + i];
output[stride * 0 + offset] = (z0 + z3) * qmul + 0x80000 >> 20;
output[stride * 2 + offset] = (z1 + z2) * qmul + 0x80000 >> 20;
output[stride * 8 + offset] = (z1 - z2) * qmul + 0x80000 >> 20;
output[stride * 10 + offset] = (z0 - z3) * qmul + 0x80000 >> 20;
}
}
| 1threat |
What is internal implementation of make(map[type1]type2) in Golang? : <p>Golang is a native programming language. So there is a lot of limitation than dynamic languages (like python and ruby).</p>
<p>When initialize Maps as <code>m := make(Map[string]int)</code>, this map <code>m</code> seems to be able to contain infinity many key-values.</p>
<p>But when initialize Maps with maps literal or make with cap, The maps cannot contain infinity many key-values.</p>
<p>Some article said that make without cap allocate a huge amount of memory to this map. But this is not option, because if it was true, there will be a giant memory consumption when initialize single map. But no matter what computer hardware monitoring tools I use, the memory is no difference between before and during my program runs.</p>
<pre><code>
func main(){
Hello()
}
func Hello(){
m := make(SizeRecord)
l := 10000000
for i := 0; i < l; i++ {
m[strconv.Itoa(i)] = Size{float64(rand.Intn(100)), float64(rand.Intn(100)), float64(rand.Intn(100))}
}
fmt.Println(m)
}
</code></pre>
<p>The program take a while to be executed.</p>
<p>I also read an article <a href="https://blog.golang.org/go-maps-in-action" rel="nofollow noreferrer">Go maps in action</a>, it said (I don't know if I have understood correctly) that make without cap use an alternative implementation to represent map and use an unified interface to access the map as the other maps with limited capacity.</p>
<p>If my understanding is wrong, could any body tell me what correct one is?</p>
<p>If I am correct, why didn't golang implement all maps in this way?</p>
| 0debug |
rows to column transformation in python : <p>i have a csv file like this: </p>
<p>AVG_TP90<br>
11 </p>
<p>10 </p>
<p>6 </p>
<p>6 </p>
<p>AVG_TP65 AVG_TP80 AVG_TP90</p>
<p>20 25 31</p>
<p>16 19 28</p>
<p>12 14 16</p>
<p>11 13 16</p>
<p>USED_GB </p>
<p>14453 </p>
<p>14045 </p>
<p>13964 </p>
<p>13753 </p>
<p>the output should be:</p>
<p>AVG_TP90 11 10 6 6
AVG_TP65 20 16 12 11
AVG_TP80 25 19 14 13
AVG_TP90 31 28 16 16
USED_GB 14453 14045 13964 13753</p>
<p>How can it be done by python code?</p>
| 0debug |
Repeat an array with multiple elements multiple times in JavaScript : <p>In JavaScript, how can I repeat an array which contains multiple elements, in a concise manner?</p>
<p>In Ruby, you could do</p>
<pre><code>irb(main):001:0> ["a", "b", "c"] * 3
=> ["a", "b", "c", "a", "b", "c", "a", "b", "c"]
</code></pre>
<p>I looked up the lodash library, and didn't find anything that was directly applicable. <a href="https://github.com/lodash/lodash/issues/1436" rel="noreferrer">Feature request: repeat arrays.</a> is a feature request for adding it to lodash, and the best workaround given there is</p>
<pre><code>const arrayToRepeat = [1, 2, 3];
const numberOfRepeats = 3;
const repeatedArray = _.flatten(_.times(numberOfRepeats, _.constant(arrayToRepeat)));
</code></pre>
<p>The questions <a href="https://stackoverflow.com/questions/1295584/most-efficient-way-to-create-a-zero-filled-javascript-array">Most efficient way to create a zero filled JavaScript array?</a> and <a href="https://stackoverflow.com/questions/12503146/create-an-array-with-same-element-repeated-multiple-times">Create an array with same element repeated multiple times</a> focus on repeating just a single element multiple times, whereas I want to repeat an array which has multiple elements.</p>
<p>Using reasonably well-maintained libraries is acceptable.</p>
| 0debug |
static void bt_l2cap_sdp_sdu_in(void *opaque, const uint8_t *data, int len)
{
struct bt_l2cap_sdp_state_s *sdp = opaque;
enum bt_sdp_cmd pdu_id;
uint8_t rsp[MAX_PDU_OUT_SIZE - PDU_HEADER_SIZE], *sdu_out;
int transaction_id, plen;
int err = 0;
int rsp_len = 0;
if (len < 5) {
fprintf(stderr, "%s: short SDP PDU (%iB).\n", __func__, len);
return;
}
pdu_id = *data ++;
transaction_id = (data[0] << 8) | data[1];
plen = (data[2] << 8) | data[3];
data += 4;
len -= 5;
if (len != plen) {
fprintf(stderr, "%s: wrong SDP PDU length (%iB != %iB).\n",
__func__, plen, len);
err = SDP_INVALID_PDU_SIZE;
goto respond;
}
switch (pdu_id) {
case SDP_SVC_SEARCH_REQ:
rsp_len = sdp_svc_search(sdp, rsp, data, len);
pdu_id = SDP_SVC_SEARCH_RSP;
break;
case SDP_SVC_ATTR_REQ:
rsp_len = sdp_attr_get(sdp, rsp, data, len);
pdu_id = SDP_SVC_ATTR_RSP;
break;
case SDP_SVC_SEARCH_ATTR_REQ:
rsp_len = sdp_svc_search_attr_get(sdp, rsp, data, len);
pdu_id = SDP_SVC_SEARCH_ATTR_RSP;
break;
case SDP_ERROR_RSP:
case SDP_SVC_ATTR_RSP:
case SDP_SVC_SEARCH_RSP:
case SDP_SVC_SEARCH_ATTR_RSP:
default:
fprintf(stderr, "%s: unexpected SDP PDU ID %02x.\n",
__func__, pdu_id);
err = SDP_INVALID_SYNTAX;
break;
}
if (rsp_len < 0) {
err = -rsp_len;
rsp_len = 0;
}
respond:
if (err) {
pdu_id = SDP_ERROR_RSP;
rsp[rsp_len ++] = err >> 8;
rsp[rsp_len ++] = err & 0xff;
}
sdu_out = sdp->channel->sdu_out(sdp->channel, rsp_len + PDU_HEADER_SIZE);
sdu_out[0] = pdu_id;
sdu_out[1] = transaction_id >> 8;
sdu_out[2] = transaction_id & 0xff;
sdu_out[3] = rsp_len >> 8;
sdu_out[4] = rsp_len & 0xff;
memcpy(sdu_out + PDU_HEADER_SIZE, rsp, rsp_len);
sdp->channel->sdu_submit(sdp->channel);
}
| 1threat |
static inline void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed){
int i;
if(v){
const int a= FFABS(v);
const int e= av_log2(a);
put_rac(c, state+0, 0);
assert(e<=9);
for(i=0; i<e; i++){
put_rac(c, state+1+i, 1);
}
put_rac(c, state+1+i, 0);
for(i=e-1; i>=0; i--){
put_rac(c, state+22+i, (a>>i)&1);
}
if(is_signed)
put_rac(c, state+11 + e, v < 0);
}else{
put_rac(c, state+0, 1);
}
}
| 1threat |
If instead of ArrayList to manage lists of arrays use commands? : If instead ArraList to manage lists of commands use arrays
How I had to have managed the growth of these, considering the number of commands that can exceed the initial size of the array? | 0debug |
def Sort(sub_li):
sub_li.sort(key = lambda x: x[1])
return sub_li | 0debug |
void gen_pc_load(CPUState *env, TranslationBlock *tb,
unsigned long searched_pc, int pc_pos, void *puc)
{
env->regs[15] = gen_opc_pc[pc_pos];
} | 1threat |
Mysql database Insert duplicate foriegn key problem : #1062 - Duplicate entry '8' for key 'user_id'
A Mysql database Insert duplicate foriegn key problem
anyone to solve this problem | 0debug |
static void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc,
const int16_t *chrUSrc, const int16_t *chrVSrc,
const int16_t *alpSrc,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest,
uint8_t *aDest, int dstW, int chrDstW)
{
int p= 4;
const int16_t *src[4]= { alpSrc + dstW, lumSrc + dstW, chrUSrc + chrDstW, chrVSrc + chrDstW };
uint8_t *dst[4]= { aDest, dest, uDest, vDest };
x86_reg counter[4]= { dstW, dstW, chrDstW, chrDstW };
while (p--) {
if (dst[p]) {
__asm__ volatile(
"mov %2, %%"REG_a" \n\t"
".p2align 4 \n\t"
"1: \n\t"
"movq (%0, %%"REG_a", 2), %%mm0 \n\t"
"movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"
"psraw $7, %%mm0 \n\t"
"psraw $7, %%mm1 \n\t"
"packuswb %%mm1, %%mm0 \n\t"
MOVNTQ(%%mm0, (%1, %%REGa))
"add $8, %%"REG_a" \n\t"
"jnc 1b \n\t"
:: "r" (src[p]), "r" (dst[p] + counter[p]),
"g" (-counter[p])
: "%"REG_a
);
}
}
}
| 1threat |
proc SQL SAS Basic : Hi all I want an answer for this,
the input i have is
ABC123
The output i want is 123ABC
how to print the output in this format (ie BackwardS) using Proc SQL??
Thanks in advance | 0debug |
best manner to learn how to make a program that can handle animation : <p>this is my first question on this website, I only have experience looking for questions other people made. I am very interested in machine learning and there is a youtube channel that hosts videos like this one <a href="https://www.youtube.com/watch?v=GOFws_hhZs8&t=27s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=GOFws_hhZs8&t=27s</a> </p>
<p>My goal is not only to replicate the internal mathematical process of the program, wich I am confident I know how to do, but creating a program that can have the graphics handling that the one of the video has. As a physicist, my programs, from the computer science point of view, are extremely basic:They pick a text file, do some calculations, and write/plot data results. I already know python, fortran (useless for this task) and a little bit of C. So, finally my question:</p>
<p>What programming language and IDE would you recommend me to learn? </p>
<p>Thank you so much</p>
| 0debug |
static void gen_srs(DisasContext *s,
uint32_t mode, uint32_t amode, bool writeback)
{
int32_t offset;
TCGv_i32 addr = tcg_temp_new_i32();
TCGv_i32 tmp = tcg_const_i32(mode);
gen_helper_get_r13_banked(addr, cpu_env, tmp);
tcg_temp_free_i32(tmp);
switch (amode) {
case 0:
offset = -4;
break;
case 1:
offset = 0;
break;
case 2:
offset = -8;
break;
case 3:
offset = 4;
break;
default:
abort();
}
tcg_gen_addi_i32(addr, addr, offset);
tmp = load_reg(s, 14);
gen_aa32_st32(tmp, addr, get_mem_index(s));
tcg_temp_free_i32(tmp);
tmp = load_cpu_field(spsr);
tcg_gen_addi_i32(addr, addr, 4);
gen_aa32_st32(tmp, addr, get_mem_index(s));
tcg_temp_free_i32(tmp);
if (writeback) {
switch (amode) {
case 0:
offset = -8;
break;
case 1:
offset = 4;
break;
case 2:
offset = -4;
break;
case 3:
offset = 0;
break;
default:
abort();
}
tcg_gen_addi_i32(addr, addr, offset);
tmp = tcg_const_i32(mode);
gen_helper_set_r13_banked(cpu_env, tmp, addr);
tcg_temp_free_i32(tmp);
}
tcg_temp_free_i32(addr);
}
| 1threat |
Drawing curved SVG arrow lines from div to div : <p>I want to draw two curved arrow lines using SVG to connect two elements to indicate they go back and forth, like this:</p>
<p><a href="https://i.stack.imgur.com/sH53l.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sH53l.png" alt="enter image description here"></a></p>
<p>I've read a bit about SVG but I'm not totally sure how to create a line that's vertical. </p>
<p>Second, if SVG takes coordinates, do I have to find the coordinate position of the elements before creating the SVG drawing? Does it have to be re-drawn if the window size is adjusted?</p>
| 0debug |
cursor.execute('SELECT * FROM users WHERE username = ' + user_input) | 1threat |
how to extract resources files from .dat file? : I already have the extractor source about .dat file.
but this source is used in other games.
however, the two games were made in the same company and maintain a similar format.
so I want to get help.
// Sample Code.....
#define WIN32_LEARN_AND_MEAN
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <memory.h>
#include <direct.h>
struct dat
{ // total 25byte
unsigned long offset; // 4byte
char name[13]; // 13byte
unsigned long size; // 4byte;
char *data; // 4byte;
};
int main(int argc, char **argv)
{
int value;
char input[512];
printf(" * Select mode\n 1: Pack\n 2: Unpack\n Choose: ");
scanf("%d", &value);
if(value == 1)
{
printf("\n\n *Mode: Pack\n Datname: ");
scanf("%s", input);
dat_pack(input);
}
else if(value == 2)
{
printf("\n\n *Mode: Unpack\n Datname: ");
scanf("%s", input);
dat_unpack(input);
}
printf("\nPress any key to continue\n");
fflush(stdin);
getch();
return 0;
}
int dat_unpack(char *file_name)
{
FILE *fp;
fp = fopen(file_name, "rb");
if (fp == 0)
{
printf(" File does not exist: %s\n", file_name);
return 0;
}
else
{
long i;
long len;
long total;
struct dat *dat;
fread(&total, 4, 1, fp);
len = sizeof(struct dat);
dat = malloc(len*total);
memset(dat, 0, len*total);
*strstr(file_name, ".") = 0; // cute trick :p
printf("\n reading Infomation... ");
for (i = 0; i<total; i++)
{
fread(&(dat[i]), 17, 1, fp);
if (i > 0) dat[i - 1].size = dat[i].offset - dat[i - 1].offset;
}
printf("ok.\n Total %d data(s) in dat file.\n", --total);
for (i = 0; i<total; i++)
{
file_write(&(dat[i]), fp, file_name);
}
printf(" Unpack Complete!\n");
free(dat);
fclose(fp);
}
return 1;
}
and this source can be unpack the next things.
[mon.dat is working upper source.][1]
[1]: https://i.stack.imgur.com/xykes.png
so, then,
now I want to extract something from a '.dat file'
that looks something like this:
[cthugha.dat - it was not working from upper extract sources][2]
[2]: https://i.stack.imgur.com/7CD0m.png
:(
Please let me know what I need to do in order to extract the components of the cthugha.dat file I listed below.
| 0debug |
(Solved) OpenCV: How do I make a Mat colorized where the Mask is white : I am new to opencv and just doing a basic RGB color filter. I was doing this by testing each pixel, but that's inefficient. So I tried (Java)Core.inRange but that returns a mask (black and white) and I need a colored Mat. Here is what I currently have(Java):
//frame is input, out is output
Scalar minValues = new Scalar(RFrom, GFrom, BFrom);
Scalar maxValues = new Scalar(RTo, GTo, BTo);
Mat mask = new Mat();
Core.inRange(frame, minValues, maxValues, mask);
Core.bitwise_and(frame, mask, out);
Wow. Cool.
Almost done with writing the question and I tried switching "out" and "frame" in and using frame.copyTo(out, mask); instead of Core.bitwise_and(frame, mask, out);
It worked!!
I'm posting this for anyone else who is new or is having problems.
Here is my final code:
//frame is input, out is output
Scalar minValues = new Scalar(RFrom, GFrom, BFrom);
Scalar maxValues = new Scalar(RTo, GTo, BTo);
Mat mask = new Mat();
Core.inRange(frame, minValues, maxValues, mask);
frame.copyTo(out, mask); | 0debug |
how to hidden parent element innertext in jquery : I want to hidden parent element of inner text without affect or changing the child element texts. Please suggest this.
<div>
test
<span>span element</span>
</div>
Jquery:
var $value= $('div').children().remove().end().text();
| 0debug |
Random numbers in table : <p>I'm trying to make 2 tables where one will store numbers and second will display this numbers twice also user decides how many numbers will be generated.</p>
<pre><code>Example:
Table1 -> 67 9 4 -78 -29
Table2 -> 67 67 9 9 4 4 -78 -78 -29 -29
</code></pre>
<p>Current code:</p>
<pre><code>#region TablesTest
Console.Write("Enter n: ");
int n = Convert.ToInt32(Console.ReadLine());
int[] table1 = new int[n];
int[] table2 = new int[n];
Random rnd = new Random();
for (int i = 0; i < n; i++)
{
table1[i] = rnd.Next(-100, 100);
foreach (int x in table1)
{
table2[i] = table1[i] + table1[i];
Console.Write(table2[i]);
}
}
Console.ReadKey();
#endregion
</code></pre>
| 0debug |
How to add android studio library : <p>may some one explain me how can I add a library to my android studio's project?</p>
<p>This is the library: <a href="https://github.com/code-troopers/android-betterpickers" rel="nofollow noreferrer">https://github.com/code-troopers/android-betterpickers</a></p>
<p>I'd like to use the recurrence picker. Thanks in advance</p>
| 0debug |
Prevent DataFrame.partitionBy() from removing partitioned columns from schema : <p>I am partitioning a DataFrame as follows:</p>
<pre><code>df.write.partitionBy("type", "category").parquet(config.outpath)
</code></pre>
<p>The code gives the expected results (i.e. data partitioned by type & category). However, the "type" and "category" columns are removed from the data / schema. Is there a way to prevent this behaviour?</p>
| 0debug |
static int proxy_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
fs->fd = v9fs_request(ctx->private, T_OPEN, NULL, "sd", fs_path, flags);
if (fs->fd < 0) {
errno = -fs->fd;
fs->fd = -1;
}
return fs->fd;
}
| 1threat |
Docker - Restrictions regarding naming container : <p><br>
I have questions regarding restrictions about naming containers.
I search online and saw different issue and answers.</p>
<ol>
<li>what is the maximum characters number in naming container?</li>
<li>which special characters are not allowed in docker container name? (e.g. '*', '$', ',', '_' ...)</li>
</ol>
| 0debug |
Windows Bash (WSL) - sudo: no tty present and no askpass program specified : <p>After following <a href="http://www.omgubuntu.co.uk/2016/08/upgrade-bash-windows-10-ubuntu-16-04-lts" rel="noreferrer">this tutroial</a> I get the following error when trying to run the commands as user or even sudo:</p>
<blockquote>
<p>sudo: no tty present and no askpass program specified</p>
</blockquote>
<p>The comments from <a href="http://www.omgubuntu.co.uk/2016/08/upgrade-bash-windows-10-ubuntu-16-04-lts#post-2819669254" rel="noreferrer">Lurdan</a> in this article state that you need to run </p>
<pre><code>sudo -S <YOUR_COMMAND>
chmod 0666 /dev/tty
</code></pre>
<p><code>chmod</code> doesn't work but <code>sudo -S</code> does, but surely there's another fix?</p>
| 0debug |
Changing ASP.NET Identity Password : <p>I have a class that creates a user by searching for the email and making sure it doesn't exist and it creates a user:</p>
<pre><code>public async Task EnsureSeedDataAsync()
{
if (await _userManager.FindByEmailAsync("test@theworld.com") == null)
{
// Add the user.
var newUser = new CRAMSUser()
{
UserName = "test",
Email = "test@crams.com"
};
await _userManager.CreateAsync(newUser, "P@ssw0rd!");
}
}
</code></pre>
<p>I am trying create another class to change the password, with the same method but I am confused as to how to create a currentUser object to be passed into the RemovePassword and AddPassword calls. This is what I have so far :</p>
<pre><code> public async Task ChangePassword()
{
if (await _userManager.FindByEmailAsync("test@theworld.com") != null)
{
_userManager.RemovePasswordAsync(currentUser);
_userManager.AddPasswordAsync(currentUser, "newPassword");
}
}
</code></pre>
<p><strong>Can someone please direct me in the right direction as I am new to this and don't know how to transfer the currentUser object, that contains the email that is being searched.</strong></p>
| 0debug |
how To Poster Emotions In Java Swings : PROBLEM:I have a code java that i would like to poster a character Unicode like the capture image.I succeed to poster in System.out.println but in java swings i could not to poster the caractere.
Question : How can i poster the caracter Unicode in jtextpane and i see the emotions.
[enter image description here][1]
[1]: https://i.stack.imgur.com/ddJsu.png
enter code here
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextPane textPane = new JTextPane();
System.out.println(String.valueOf("\u2622"));
textPane.setContentType("text/html");
textPane.setText("c'est " + String.valueOf("\u2622"));
frame.getContentPane().add(textPane, BorderLayout.CENTER);
}
| 0debug |
"left side of comma operator.." error in html content of render : <p>Its straightforward process;</p>
<p>Here is the origin render method I want it to be(I want my table outside of div):
<a href="https://i.stack.imgur.com/P8S6B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/P8S6B.png" alt="enter image description here"></a></p>
<p>but jsx compiler dont allow it for some reason? </p>
<p>but if i move the table inside of div element;
everything looks ok.
<a href="https://i.stack.imgur.com/Gj0Is.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gj0Is.png" alt="enter image description here"></a></p>
<p>so only diff is place of table. <strong>why jsx interfere this process ? why its necessary ?</strong></p>
| 0debug |
static void tcx_update_display(void *opaque)
{
TCXState *ts = opaque;
ram_addr_t page, page_min, page_max;
int y, y_start, dd, ds;
uint8_t *d, *s;
void (*f)(TCXState *s1, uint8_t *d, const uint8_t *s, int width);
if (ts->ds->depth == 0)
return;
page = ts->vram_offset;
y_start = -1;
page_min = 0xffffffff;
page_max = 0;
d = ts->ds->data;
s = ts->vram;
dd = ts->ds->linesize;
ds = 1024;
switch (ts->ds->depth) {
case 32:
f = tcx_draw_line32;
break;
case 15:
case 16:
f = tcx_draw_line16;
break;
default:
case 8:
f = tcx_draw_line8;
break;
case 0:
return;
}
for(y = 0; y < ts->height; y += 4, page += TARGET_PAGE_SIZE) {
if (cpu_physical_memory_get_dirty(page, VGA_DIRTY_FLAG)) {
if (y_start < 0)
y_start = y;
if (page < page_min)
page_min = page;
if (page > page_max)
page_max = page;
f(ts, d, s, ts->width);
d += dd;
s += ds;
f(ts, d, s, ts->width);
d += dd;
s += ds;
f(ts, d, s, ts->width);
d += dd;
s += ds;
f(ts, d, s, ts->width);
d += dd;
s += ds;
} else {
if (y_start >= 0) {
dpy_update(ts->ds, 0, y_start,
ts->width, y - y_start);
y_start = -1;
}
d += dd * 4;
s += ds * 4;
}
}
if (y_start >= 0) {
dpy_update(ts->ds, 0, y_start,
ts->width, y - y_start);
}
if (page_min <= page_max) {
cpu_physical_memory_reset_dirty(page_min, page_max + TARGET_PAGE_SIZE,
VGA_DIRTY_FLAG);
}
}
| 1threat |
Split a Sentences String into sentence per line in Java : <p>I want to split the sentences into one sentence per line in Java.</p>
<p>Input String:
"Volatility returned to the municipal bond market during the first half of the funds’ fiscal year as investors weighed the potential impact of the U.S. presidential election, strengthening economic conditions and rising interest rates. The market was further pressured by a record level of municipal bond issuance in 2016. Against this backdrop, all six funds registered declines, ranging from –0.92% for American Funds Short-Term Tax-Exempt Bond Fund to –3.77% for American High-Income Municipal Bond Fund. (See pages 4 through 10 for fund specific results and information.)"</p>
<p>Output:</p>
<p>Sentence1: Volatility returned to the municipal bond market during the first half of the funds’ fiscal year as investors weighed the potential impact of the U.S. presidential election, strengthening economic conditions and rising interest rates. </p>
<p>Sentence2: The market was further pressured by a record level of municipal bond issuance in 2016. Against this backdrop, all six funds registered declines, ranging from –0.92% for American Funds Short-Term Tax-Exempt Bond Fund to –3.77% for American High-Income Municipal Bond Fund. </p>
<p>Sentence3:(See pages 4 through 10 for fund specific results and information.</p>
<p>I have written a java code to split the Sentences when .('Full stop') occurs, A new line has been coming after U.S.</p>
<p>string = string.replace(". ", ".\n") </p>
| 0debug |
def sum_num(numbers):
total = 0
for x in numbers:
total += x
return total/len(numbers) | 0debug |
static void start_input(DBDMA_channel *ch, int key, uint32_t addr,
uint16_t req_count, int is_last)
{
DBDMA_DPRINTF("start_input\n");
if (!addr || key > KEY_STREAM3) {
kill_channel(ch);
return;
}
ch->io.addr = addr;
ch->io.len = req_count;
ch->io.is_last = is_last;
ch->io.dma_end = dbdma_end;
ch->io.is_dma_out = 0;
ch->processing = 1;
ch->rw(&ch->io);
}
| 1threat |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
How to Disable Responsiveness in Boostrap in col-lg-up (CSS) : I want to my site was responsive on phones and tablets but i want to make it static on computers. How can i make it?
I was thinking bout somehow disabling responsive in col-lg and up. but how to do this? | 0debug |
static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
MOVStreamContext *sc;
unsigned int i, entries;
int64_t duration=0;
int64_t total_sample_count=0;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
avio_r8(pb);
avio_rb24(pb);
entries = avio_rb32(pb);
av_dlog(c->fc, "track[%i].stts.entries = %i\n",
c->fc->nb_streams-1, entries);
if (!entries)
return 0;
if (entries >= UINT_MAX / sizeof(*sc->stts_data))
return AVERROR(EINVAL);
sc->stts_data = av_malloc(entries * sizeof(*sc->stts_data));
if (!sc->stts_data)
return AVERROR(ENOMEM);
sc->stts_count = entries;
for (i=0; i<entries; i++) {
int sample_duration;
int sample_count;
sample_count=avio_rb32(pb);
sample_duration = avio_rb32(pb);
sc->stts_data[i].count= sample_count;
sc->stts_data[i].duration= sample_duration;
av_dlog(c->fc, "sample_count=%d, sample_duration=%d\n",
sample_count, sample_duration);
duration+=(int64_t)sample_duration*sample_count;
total_sample_count+=sample_count;
}
st->nb_frames= total_sample_count;
if (duration)
st->duration= duration;
sc->track_end = duration;
return 0;
}
| 1threat |
is it possible to React.useState(() => {}) in React? : <p>is it possible to use a <code>function</code> as my React Component's state ?</p>
<p>example code here:</p>
<pre><code>// typescript
type OoopsFunction = () => void;
export function App() {
const [ooops, setOoops] = React.useState<OoopsFunction>(
() => console.log('default ooops')
);
return (
<div>
<div onClick={ ooops }>
Show Ooops
</div>
<div onClick={() => {
setOoops(() => console.log('other ooops'))
}}>
change oops
</div>
</div>
)
}
</code></pre>
<p>but it doesn't works ... the <code>defaultOoops</code> will be invoked at very beginning, and when clicking <code>change oops</code>, the <code>otrher ooops</code> will be logged to console immediately not logging after clicking <code>Show Ooops</code> again.</p>
<p>why ?</p>
<p>is it possible for me to use a function as my component's state ? </p>
<p>or else React has its special ways to process such <code>the function state</code> ? </p>
| 0debug |
static void virtio_blk_handle_flush(VirtIOBlockReq *req, MultiReqBuffer *mrb)
{
block_acct_start(bdrv_get_stats(req->dev->bs), &req->acct, 0,
BLOCK_ACCT_FLUSH);
virtio_submit_multiwrite(req->dev->bs, mrb);
bdrv_aio_flush(req->dev->bs, virtio_blk_flush_complete, req);
}
| 1threat |
Javascript Document Write (help me please..) : i have a homewrk. write javascript ( Documentwrite)
cn help me ? please..
<html>
<head>
<script type="text/javascript">
function myFunction() {
var x1 = document.test.x1.value;
var y1 = document.test.y1.value;
var x = parseInt(x1)*parseInt(y1)
document.getElementById("x").value = x;
}
</script>
</head>
<body>
<br>
<form name="test">
inpout<br><br>
<input type="number" name="x1" id="x1" style="width:70px"> X *
<input type="number" name="y1" id="y1" style="width:70px"> Y
<br><br>
<input type="button" name="Solve" value="Solve" onclick="myFunction()" ><br>
<br><br>
OutPut =<output type="number" name="x" id="x" style="width:100px"></output> <br><br>
Documen.write X = .... Y =...
</form>
</center>
</body>
</html>
i wn write X = ... and Y = .... sme input on form...
help please | 0debug |
static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src)
{
if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) {
dest[0] =
dest[8] =
dest[16] =
dest[24] =
dest[32] =
dest[40] =
dest[48] =
dest[56] = src[0];
} else {
IDCT_COL(dest, src);
}
}
| 1threat |
onSave() (for any Entity saved with Hibernate/Spring Data Repositories) : <p>If my Entity has calculated fields should be update before saving to database (db <code>insert</code> or <code>update</code>)
How can I hook a method call before Hibernate or Spring Data Repository <code>save()</code></p>
| 0debug |
def remove_kth_element(list1, L):
return list1[:L-1] + list1[L:] | 0debug |
def first(arr,x,n):
low = 0
high = n - 1
res = -1
while (low <= high):
mid = (low + high) // 2
if arr[mid] > x:
high = mid - 1
elif arr[mid] < x:
low = mid + 1
else:
res = mid
high = mid - 1
return res | 0debug |
how can i solved . error on connection string in c# : i have a database with sql server 2012 authontication called "box"
i build an aplplication in c#.. what i want to do is :
attach this database file into client matchine to run an application without setup sql server.
1- from mycomputer --> manage--> i stoped the sql server serviice
2- i copy database files (box.mdf and box_log.ldf) inside application directory.
3- build connection string to connect with database as:
(
this work correctly: conn.ConnectionString = "Data Source=BASIM-PC\\SQLSERVER2012;Initial Catalog=box;Persist Security Info=True;User ID=basimbox;Password=f1977";
but this error:conn.ConnectionString = @"Data Source=.\sqlexpress;Initial Catalog=box;Persist Security Info=True;User ID=basimbox;Password=f1977";
)
plz my friend help me!!! | 0debug |
Can I use multiple method on a future builder? : <pre><code> @override
Widget build(BuildContext context) {
widget.groupid;
widget.event_id;
var futureBuilder = new FutureBuilder(
future: _getAllTickets(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
print(snapshot.connectionState);
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
return new Text('...');
default:
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
else
return createListTickets(context, snapshot);
}
},
);
return new Scaffold(
body: futureBuilder,
);
}
Widget createListTickets(BuildContext context, AsyncSnapshot snapshot) {
List values = snapshot.data;
child: new Card(
child:
new Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
new Text(
values[index]["ticket_type_id"].toString(), style:
const TextStyle(
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
fontSize: 25.0)),
}
_getAllTickets() async {
final response = await http.get(
"https...}"
, headers: {
HttpHeaders.AUTHORIZATION: access_token
});
returnTickets = json.decode(response.body);
return returnTickets;
}
_getTicketType() async {
for (i = 0; i < (returnTickets?.length ?? 0); i++) {
/*print("https....);*/
final responseType = await http.get(
"https...}"
, headers: {
HttpHeaders.AUTHORIZATION: access_token
});
Map<String, dynamic> hey = json.decode(responseType.body);
}
</code></pre>
<p>Hi everyone, I have a question.
As I am sending multiple API request and building dynamically a card with the response that I get in return, I was wondering if I could include more that one method within future: _getAllTickets(), + (another method), as I would like to substitute values[index]["ticket_type_id"] with values[index]["name"], which name is a new index response that I have got through the method _getTicketType().
Thank you in advance!</p>
| 0debug |
Excel VBS macro to modify form control : I am wanting to create a macro in Excel 2013 that will modify the linked cell of a check box.
For example, say I have a buttload of check boxes in column D that I want to link to D1, D2, D3, all the way to D999999 or whatever. I can use a loop to do the repetitive part, but I don't know how I can tell it to change the linked value.
Thank you! | 0debug |
static int sort_stt(FFV1Context *s, uint8_t stt[256])
{
int i, i2, changed, print = 0;
do {
changed = 0;
for (i = 12; i < 244; i++) {
for (i2 = i + 1; i2 < 245 && i2 < i + 4; i2++) {
#define COST(old, new) \
s->rc_stat[old][0] * -log2((256 - (new)) / 256.0) + \
s->rc_stat[old][1] * -log2((new) / 256.0)
#define COST2(old, new) \
COST(old, new) + COST(256 - (old), 256 - (new))
double size0 = COST2(i, i) + COST2(i2, i2);
double sizeX = COST2(i, i2) + COST2(i2, i);
if (sizeX < size0 && i != 128 && i2 != 128) {
int j;
FFSWAP(int, stt[i], stt[i2]);
FFSWAP(int, s->rc_stat[i][0], s->rc_stat[i2][0]);
FFSWAP(int, s->rc_stat[i][1], s->rc_stat[i2][1]);
if (i != 256 - i2) {
FFSWAP(int, stt[256 - i], stt[256 - i2]);
FFSWAP(int, s->rc_stat[256 - i][0], s->rc_stat[256 - i2][0]);
FFSWAP(int, s->rc_stat[256 - i][1], s->rc_stat[256 - i2][1]);
}
for (j = 1; j < 256; j++) {
if (stt[j] == i)
stt[j] = i2;
else if (stt[j] == i2)
stt[j] = i;
if (i != 256 - i2) {
if (stt[256 - j] == 256 - i)
stt[256 - j] = 256 - i2;
else if (stt[256 - j] == 256 - i2)
stt[256 - j] = 256 - i;
}
}
print = changed = 1;
}
}
}
} while (changed);
return print;
}
| 1threat |
How do you explicitly convert a string to a list. Python : <p>How do I split this string into a list of entities:</p>
<p><code>String=('Sues Badge', '£1.70', '3', '13')</code></p>
<p>I know that this string may look like a list already, but the program see it as a string. I have tried <code>String.split(",","")</code> however this did not work.</p>
<p>Desired Output</p>
<p><code>List= [Sues Badge,£1.70,3,13]</code></p>
| 0debug |
void migrate_del_blocker(Error *reason)
{
migration_blockers = g_slist_remove(migration_blockers, reason);
}
| 1threat |
void ff_atrac_iqmf(float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp)
{
int i, j;
float *p1, *p3;
memcpy(temp, delayBuf, 46*sizeof(float));
p3 = temp + 46;
for(i=0; i<nIn; i+=2){
p3[2*i+0] = inlo[i ] + inhi[i ];
p3[2*i+1] = inlo[i ] - inhi[i ];
p3[2*i+2] = inlo[i+1] + inhi[i+1];
p3[2*i+3] = inlo[i+1] - inhi[i+1];
}
p1 = temp;
for (j = nIn; j != 0; j--) {
float s1 = 0.0;
float s2 = 0.0;
for (i = 0; i < 48; i += 2) {
s1 += p1[i] * qmf_window[i];
s2 += p1[i+1] * qmf_window[i+1];
}
pOut[0] = s2;
pOut[1] = s1;
p1 += 2;
pOut += 2;
}
memcpy(delayBuf, temp + nIn*2, 46*sizeof(float));
}
| 1threat |
int av_reallocp(void *ptr, size_t size)
{
void **ptrptr = ptr;
void *ret;
ret = av_realloc(*ptrptr, size);
if (!ret) {
return AVERROR(ENOMEM);
*ptrptr = ret;
| 1threat |
Font and background color not working : I have a table which I wnat a black background and white text, some reason it's defaulting to white background and black text. What have I done wrong here?
#title{
font-family: Arial;
font color:#ffffff
background-color: #000000
}
| 0debug |
Getting absolute value from binary int using bitwise : flt32 flt32_abs (flt32 x) {
int mask=x>>31;
printMask(mask,32);
puts("Original");
printMask(x,32);
x=x^mask;
puts("after XOR");
printMask(x,32);
x=x-mask;
puts("after x-mask");
printMask(x,32);
return x;
}
Heres my code, the value -32 is returning .125. I'm confused because it's a pretty straight up formula for abs on bits, but I seem to be missing something. Any ideas? Thanks y'all. | 0debug |
static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
float X_high[64][40][2], const float X_low[32][40][2],
const float (*alpha0)[2], const float (*alpha1)[2],
const float bw_array[5], const uint8_t *t_env,
int bs_num_env)
{
int i, j, x;
int g = 0;
int k = sbr->kx[1];
for (j = 0; j < sbr->num_patches; j++) {
for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) {
float alpha[4];
const int p = sbr->patch_start_subband[j] + x;
while (g <= sbr->n_q && k >= sbr->f_tablenoise[g])
g++;
g--;
if (g < 0) {
av_log(ac->avctx, AV_LOG_ERROR,
"ERROR : no subband found for frequency %d\n", k);
return -1;
}
alpha[0] = alpha1[p][0] * bw_array[g] * bw_array[g];
alpha[1] = alpha1[p][1] * bw_array[g] * bw_array[g];
alpha[2] = alpha0[p][0] * bw_array[g];
alpha[3] = alpha0[p][1] * bw_array[g];
for (i = 2 * t_env[0]; i < 2 * t_env[bs_num_env]; i++) {
const int idx = i + ENVELOPE_ADJUSTMENT_OFFSET;
X_high[k][idx][0] =
X_low[p][idx - 2][0] * alpha[0] -
X_low[p][idx - 2][1] * alpha[1] +
X_low[p][idx - 1][0] * alpha[2] -
X_low[p][idx - 1][1] * alpha[3] +
X_low[p][idx][0];
X_high[k][idx][1] =
X_low[p][idx - 2][1] * alpha[0] +
X_low[p][idx - 2][0] * alpha[1] +
X_low[p][idx - 1][1] * alpha[2] +
X_low[p][idx - 1][0] * alpha[3] +
X_low[p][idx][1];
}
}
}
if (k < sbr->m[1] + sbr->kx[1])
memset(X_high + k, 0, (sbr->m[1] + sbr->kx[1] - k) * sizeof(*X_high));
return 0;
}
| 1threat |
static void lowpass_line_complex_c(uint8_t *dstp, ptrdiff_t width, const uint8_t *srcp,
ptrdiff_t mref, ptrdiff_t pref)
{
const uint8_t *srcp_above = srcp + mref;
const uint8_t *srcp_below = srcp + pref;
const uint8_t *srcp_above2 = srcp + mref * 2;
const uint8_t *srcp_below2 = srcp + pref * 2;
int i;
for (i = 0; i < width; i++) {
dstp[i] = av_clip_uint8((4 + (srcp[i] << 2)
+ ((srcp[i] + srcp_above[i] + srcp_below[i]) << 1)
- srcp_above2[i] - srcp_below2[i]) >> 3);
}
}
| 1threat |
How does the static password work in the default Laravel user factory? : <p>Per this link, <a href="https://laravel.com/docs/5.4/database-testing#writing-factories" rel="noreferrer">https://laravel.com/docs/5.4/database-testing#writing-factories</a>, the default Laravel user factory tests the value of a static <code>$password</code> variable. If it is falsey, it bcrypts 'secret' and uses that.</p>
<p>How does one go about setting the value of the static variable <code>$password</code>? Obviously I don't want to import it at the time the function is declared (since that would defeat the purpose of making it variable). I realise that I can override the value of password by passing an array to the <code>make()</code> method, but this is a different thing altogether.</p>
| 0debug |
Cannot use JSX unless the '--jsx' flag is provided : <p>I have looked around a bit for a solution to this problem. All of them suggest adding <code>"jsx": "react"</code> to your tsconfig.json file. Which I have done. Another one was to add <code>"include: []"</code>, which I have also done. However, I am still getting the error when I am trying to edit <code>.tsx</code>files. Below is my tsconfig file.</p>
<pre><code>{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"allowJs": true,
"checkJs": false,
"jsx": "react",
"outDir": "./build",
"rootDir": "./lib",
"removeComments": true,
"noEmit": true,
"pretty": true,
"skipLibCheck": true,
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true
},
"include": [
"./lib/**/*"
],
"exclude": [
"node_modules"
]
}
</code></pre>
<p>Any suggestions would be helpful. I am using babel 7 to compile all the code with the env, react and typescript presets. If you guys need more files to help debug this, let me know.</p>
| 0debug |
return an array of object's names sorted by the object's age from youngest to oldest : <p>im given an array of objects. The objects contain the properties name and age . i have to return an array of object's names sorted by the object's age from youngest to oldest.</p>
<pre><code>sortArray([{name:'bob', age:96}, {name:'tom', age:24}, {name:'tim', age:65}])
</code></pre>
<p>should just return ['tom', 'tim', 'bob']</p>
| 0debug |
Parsing SQL into a hierachial result to analyze it : <p>Is there any library (prefferably in Python) which can parse SQL queries (the PostgreSQL kind), and give me a structured representation of them? There is <a href="https://github.com/andialbrecht/sqlparse" rel="nofollow">sqlparse</a>, but that doesn't allow me to easily figure out (say) the table that a query is using. I only need support for <code>SELECT</code> queries, but some of them can be quite complex.</p>
| 0debug |
mips_mipssim_init(MachineState *machine)
{
ram_addr_t ram_size = machine->ram_size;
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
char *filename;
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *isa = g_new(MemoryRegion, 1);
MemoryRegion *ram = g_new(MemoryRegion, 1);
MemoryRegion *bios = g_new(MemoryRegion, 1);
MIPSCPU *cpu;
CPUMIPSState *env;
ResetData *reset_info;
int bios_size;
if (cpu_model == NULL) {
#ifdef TARGET_MIPS64
cpu_model = "5Kf";
#else
cpu_model = "24Kf";
#endif
}
cpu = cpu_mips_init(cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
reset_info->cpu = cpu;
reset_info->vector = env->active_tc.PC;
qemu_register_reset(main_cpu_reset, reset_info);
memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram",
ram_size);
memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
&error_abort);
vmstate_register_ram_global(bios);
memory_region_set_readonly(bios, true);
memory_region_add_subregion(address_space_mem, 0, ram);
memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios);
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE);
g_free(filename);
} else {
bios_size = -1;
}
if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
!kernel_filename && !qtest_enabled()) {
error_report("Could not load MIPS bios '%s', and no "
"-kernel argument was specified", bios_name);
exit(1);
} else {
env->active_tc.PC = (target_long)(int32_t)0xbfc00000;
}
if (kernel_filename) {
loaderparams.ram_size = ram_size;
loaderparams.kernel_filename = kernel_filename;
loaderparams.kernel_cmdline = kernel_cmdline;
loaderparams.initrd_filename = initrd_filename;
reset_info->vector = load_kernel();
}
cpu_mips_irq_init_cpu(env);
cpu_mips_clock_init(env);
memory_region_init_alias(isa, NULL, "isa_mmio",
get_system_io(), 0, 0x00010000);
memory_region_add_subregion(get_system_memory(), 0x1fd00000, isa);
if (serial_hds[0])
serial_init(0x3f8, env->irq[4], 115200, serial_hds[0],
get_system_io());
if (nd_table[0].used)
mipsnet_init(0x4200, env->irq[2], &nd_table[0]);
}
| 1threat |
How to identify Pandas' backend for Parquet : <p>I understand that Pandas can read and write to and from Parquet files using different backends: <code>pyarrow</code> and <code>fastparquet</code>.</p>
<p>I have a Conda distribution with the Intel distribution and "it works": I can use <code>pandas.DataFrame.to_parquet</code>. However I do not have <code>pyarrow</code> installed so I guess that <code>fastparquet</code> is used (which I cannot find either).</p>
<p>Is there a way to identify which backend is used?</p>
| 0debug |
How to read Sentinel-2 data in R : <p>I want to classify Sentinel-2 data using ANN. If anyone knows how to do it in R. Please let's me know</p>
<pre><code>df<-read.csv(file.choose())
head(df)
</code></pre>
| 0debug |
[Vue warn]: Failed to mount component: template or render function not defined in Webpack 4 : <p>I started getting this error once I upgraded to Webpack and related dependencies to v4: <code>[Vue warn]: Failed to mount component: template or render function not defined.</code></p>
<p>Here's the relevant snippets of my <code>package.json</code> and <code>webpack.config.js</code> before and after:</p>
<p>Before upgrade:</p>
<p><code>package.json</code></p>
<pre><code>{
"dependencies": {
"vue": "^2.5.0",
"vue-template-compiler": "^2.5.0"
},
"devDependencies": {
"babel-core": "^6.9.0",
"babel-loader": "^6.2.4",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.26.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-without-strict": "^0.0.4",
"babel-preset-es2017": "^6.24.1",
"babel-preset-latest": "^6.24.1",
"css-loader": "^0.26.0",
"eslint": "^4.3.0",
"husky": "^0.14.3",
"lint-staged": "^4.0.2",
"resolve-url-loader": "^1.6.0",
"sass-loader": "^4.0.1",
"stats-webpack-plugin": "^0.2.1",
"style-loader": "^0.13.1",
"uglifyjs-webpack-plugin": "^1.1.6",
"vue-loader": "^12.1.0",
"webpack": "3.10.0",
"webpack-dev-server": "^2.3.0",
"webpack-monitor": "^1.0.13"
}
}
</code></pre>
<p><code>webpack.config.js</code></p>
<pre><code> {
resolve: {
modules: [
path.join(__dirname, '..', 'webpack'),
'node_modules/'
],
alias: {
vue: process.env.NODE_ENV === 'production' ? 'vue/dist/vue.min.js' : 'vue/dist/vue.js',
libs: 'libs/'
}
},
plugins: [
new StatsPlugin('manifest.json', {
chunkModules: false,
source: false,
chunks: false,
modules: false,
assets: true
})],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
presets: ['es2015']
}
}
]
}, {
test: /\.vue$/,
exclude: /node_modules/,
use: [
{
loader: 'vue-loader'
}
]
},
{
test: /\.js$/,
include: [
path.resolve(process.cwd(), 'node_modules/')
],
use: [
{
loader: 'babel-loader',
options: {
plugins: ['transform-es2015-block-scoping'],
cacheDirectory: true
}
}
],
},
]
}
};
</code></pre>
<p>After upgrade:</p>
<p><code>package.json</code></p>
<pre><code>{
"dependencies": {
"vue": "^2.5.13",
"vue-template-compiler": "^2.5.13"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-latest": "^6.24.1",
"css-loader": "^0.26.0",
"eslint": "^4.3.0",
"husky": "^0.14.3",
"lint-staged": "^4.0.2",
"resolve-url-loader": "^1.6.0",
"sass-loader": "^4.0.1",
"stats-webpack-plugin": "^0.2.1",
"style-loader": "^0.13.1",
"uglifyjs-webpack-plugin": "^1.1.6",
"vue-loader": "^14.1.1",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.9",
"webpack-dev-server": "^3.0.0",
"webpack-monitor": "^1.0.13"
}
}
</code></pre>
<p><code>webpack.config.js</code></p>
<pre><code>{
resolve: {
modules: [
path.join(__dirname, '..', 'webpack'),
'node_modules/'
],
alias: {
vue: process.env.NODE_ENV === 'production' ? 'vue/dist/vue.min.js' : 'vue/dist/vue.js',
libs: 'libs/'
}
},
plugins: [
new StatsPlugin('manifest.json', {
chunkModules: false,
source: false,
chunks: false,
modules: false,
assets: true
})],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
]
}, {
test: /\.vue$/,
exclude: /node_modules/,
use: [
{
loader: 'vue-loader'
}
]
},
{
test: /\.js$/,
include: [
path.resolve(process.cwd(), 'node_modules/')
],
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
],
},
]
}
};
</code></pre>
<p><strong>What is expected?</strong></p>
<p>Vue components work without errors after upgrading</p>
<p><strong>What is actually happening?</strong></p>
<p>Most Vue components show an error and fail to load: <code>[Vue warn]: Failed to mount component: template or render function not defined.</code></p>
| 0debug |
Getting a value in ViewController from AppDelegate : <p>I am trying to get the value in ViewController from AppDelegate, but I am not able to do so. </p>
<p>I have only one ViewController. I tried to make the value as a constant or variable. None of them works. </p>
<p>I am not sure if this is the correct approach, but I tried to use rootViewController to access. </p>
<pre><code>class ViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
var test:String = "test"
// let test = "test"
}
}
</code></pre>
<p>in AppDelegate</p>
<pre><code> func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let viewController = self.window?.rootViewController as? ViewController
print("from_viewC \(String(describing: viewController?.test)))")
}
</code></pre>
| 0debug |
void cpu_exec_init(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
CPUClass *cc = CPU_GET_CLASS(cpu);
CPUState *some_cpu;
int cpu_index;
#if defined(CONFIG_USER_ONLY)
cpu_list_lock();
#endif
cpu_index = 0;
CPU_FOREACH(some_cpu) {
cpu_index++;
}
cpu->cpu_index = cpu_index;
cpu->numa_node = 0;
QTAILQ_INIT(&cpu->breakpoints);
QTAILQ_INIT(&cpu->watchpoints);
#ifndef CONFIG_USER_ONLY
cpu->as = &address_space_memory;
cpu->thread_id = qemu_get_thread_id();
#endif
QTAILQ_INSERT_TAIL(&cpus, cpu, node);
#if defined(CONFIG_USER_ONLY)
cpu_list_unlock();
#endif
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
}
#if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
cpu_save, cpu_load, env);
assert(cc->vmsd == NULL);
assert(qdev_get_vmsd(DEVICE(cpu)) == NULL);
#endif
if (cc->vmsd != NULL) {
vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
}
} | 1threat |
Proptypes for custom react hooks : <p>With react hooks coming, should we use prop-types for React custom hooks e.g,</p>
<pre><code>import React from 'react';
import PropTypes from 'prop-types';
const useTitle = title => {
React.useEffect(() => {
document.title = title;
}, [title]);
}
useTitle.propTypes = {
title: PropTypes.string.isRequired,
};
export default useTitle;
</code></pre>
<p>Is the above a good approach to validate the param(s) passed to a custom react hooks or should there be a different way for validation the props/params passed to custom hook which is basically just a simple function. </p>
| 0debug |
Invalid or unexpected token html/php : <p>I am printing a php variable with html and the results are as follows:</p>
<pre><code><div class='chaty'>
<div class='chatDesc' id='9503e253936e716f18d9c57b4f97d618'>
<div class='tit'>Creator: </div>
<div class='iriss'><i id='close_chatn'
onclick='closeChat(9503e253936e716f18d9c57b4f97d618)' class='material-
icons'>close</i></div>
<form action='mypage.php' method='post'>
<div class='authr_name'><button value='John Brown' name='userlink'
class='subm_as_text'>Hitsuji</button></div>
</form>
<div class='titd'><h3>Description</h3></div>
<div class='description_chat'>TThe Army of JOhn</div>
</div>
<span onclick='openChat(9503e253936e716f18d9c57b4f97d618)'>&#9776;</span>
<div class='chatname'><h3>John Army</h3></div>
<div class='chatback'></div>
<div class='underlie'><p>Users: 1</p><p> Created: 2017/07/23 11:31:06am</p>
</div>
</div>
</code></pre>
<p>I get an invalid or unexpected token in chrome and openChat() won't work. The error is on the line where
<code><span onclick='openChat(9503e253936e716f18d9c57b4f97d618)'>&#9776;</span></code></p>
| 0debug |
Matlab - Hide a 1MB file in an Image's invaluable bits (Watermarking) : <p>I have to store a 1MByte word file into a 512x512 pixels image using Matlab and extract it again. The only thing that I know is that we have to remove the invaluable bits of the image (the ones that are all noise) and store our fie there.
Unfortunately I know nothing about both Matlab and Image Processing.</p>
<p>Thanks All.</p>
| 0debug |
Date object will return 1537865065664 on two Difference Date Object in java : <p>I want time difference in second using new Date().getTime() in java.
But i will return me long digit like this 1537865065664.
How can i get difference between two Date() object.
I will attached few part of my code below.</p>
<pre><code> Date starttime=new Date();
long diff= new Date().getTime() - starttime.getTime()
System.out.println("hangupClicked New Time :: "+new Date().getTime()+" :: "+starttime.getTime());
</code></pre>
<p>Output ::
hangupClicked New Time :: 1537865248609 :: 1537865348612</p>
| 0debug |
NFC Integeration in ios application : <p>Is there any Documentation or API Available that will help in creating NFC based Application for IPhone 6 and 6s Device in IOS. </p>
| 0debug |
Serialize Java 8 LocalDate as yyyy-mm-dd with Gson : <p>I am using Java 8 and the latest <code>RELEASE</code> version (via Maven) of <a href="https://github.com/google/gson" rel="noreferrer">Gson</a>.
If I serialize a <a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html" rel="noreferrer"><code>LocalDate</code></a> I get something like this</p>
<pre><code>"birthday": {
"year": 1997,
"month": 11,
"day": 25
}
</code></pre>
<p>where I would have preferred <code>"birthday": "1997-11-25"</code>. Does Gson also support the more concise format out-of-the-box, or do I have to implement a custom serializer for <code>LocalDate</code>s? </p>
<p>(I've tried <code>gsonBuilder.setDateFormat(DateFormat.SHORT)</code>, but that does not seem to make a difference.)</p>
| 0debug |
Creating a local notification in response to a push notification (from firebase) in cordova/ionic : <p>I'm building an application using Ionic Framework that implements a chat function similar to good-old facebook messenger, in that i want to notify users of a chat message, but if they view it elsewhere, i want to remove the notification from their home screen.</p>
<p>I'm using firebase as a back-end for push notifications (though that could be changed i suppose).</p>
<p>I know that you can't expire a remote notification, but i've been told you can expire + remove a local notification, so my question is - <strong>can i reliably receive a remote notification, create a local one, and display that, and then in response to a notification with a scope of 'expire' or 'remove', delete a local notification so that my users don't see a duplication of information?</strong></p>
<p>Most plugins tend to detect the status of the app and add a remote notification to the homescreen with the info you've pushed by default, is there a way to avoid this?</p>
<p>Thanks guys.</p>
<p>EDIT:
- Local notifications: <a href="http://ionicframework.com/docs/native/local-notifications/" rel="noreferrer">http://ionicframework.com/docs/native/local-notifications/</a>
- Firebase cloud messaging: <a href="https://github.com/fechanique/cordova-plugin-fcm" rel="noreferrer">https://github.com/fechanique/cordova-plugin-fcm</a></p>
| 0debug |
static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{
return bdrv_get_info(bs->file->bs, bdi);
}
| 1threat |
How to create two x-axes label using chart.js : <p>There is a way to create two label for y-axes. But how do you make a multiple x-axes label in chart.js? eg: example as in this picture:
<a href="https://i.stack.imgur.com/mSrNv.png" rel="noreferrer">How to group (two-level) axis labels</a></p>
| 0debug |
canvas element has extra wide upper border. How can i fix it? : why my page has a lot of empty space between buttons and canvas. when i upload some image
please describe my mistake
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<html>
<input type="file" name="img" id="uploadimage" size="1">
<a id="downloadLnk" download="img.jpg">download</a>
</p>
</td>
<head>
<script>
function draw() { //upload
var ctx = document.getElementById('canvas').getContext('2d'),
img = new Image(),
f = document.getElementById("uploadimage").files[0],
url = window.zURL || window.URL,
src = url.createObjectURL(f);
img.src = src;
img.onload = function() {
var parkBg = new Image(600, 500);
document.body.appendChild(parkBg);
parkBg.src = src;
}
}
function download() { //upload
var dt = canvas.toDataURL('image/jpeg');
this.href = dt;
};
downloadLnk.addEventListener('click', download, false);
document.getElementById("uploadimage").addEventListener("change", draw, false)
</script>
</head>
<body>
<canvas id="canvas"></canvas>
</body>
</html>
<!-- end snippet -->
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
| 0debug |
static int decode_mb_cabac(H264Context *h) {
MpegEncContext * const s = &h->s;
const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
int mb_type, partition_count, cbp = 0;
int dct8x8_allowed= h->pps.transform_8x8_mode;
s->dsp.clear_blocks(h->mb);
tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
if( h->slice_type != I_TYPE && h->slice_type != SI_TYPE ) {
int skip;
if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 )
predict_field_decoding_flag(h);
if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped )
skip = h->next_mb_skipped;
else
skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y );
if( skip ) {
if( FRAME_MBAFF && (s->mb_y&1)==0 ){
s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP;
h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 );
if(h->next_mb_skipped)
predict_field_decoding_flag(h);
else
h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
}
decode_mb_skip(h);
h->cbp_table[mb_xy] = 0;
h->chroma_pred_mode_table[mb_xy] = 0;
h->last_qscale_diff = 0;
return 0;
}
}
if(FRAME_MBAFF){
if( (s->mb_y&1) == 0 )
h->mb_mbaff =
h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
}else
h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME);
h->prev_mb_skipped = 0;
compute_mb_neighbors(h);
if( ( mb_type = decode_cabac_mb_type( h ) ) < 0 ) {
av_log( h->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" );
return -1;
}
if( h->slice_type == B_TYPE ) {
if( mb_type < 23 ){
partition_count= b_mb_type_info[mb_type].partition_count;
mb_type= b_mb_type_info[mb_type].type;
}else{
mb_type -= 23;
goto decode_intra_mb;
}
} else if( h->slice_type == P_TYPE ) {
if( mb_type < 5) {
partition_count= p_mb_type_info[mb_type].partition_count;
mb_type= p_mb_type_info[mb_type].type;
} else {
mb_type -= 5;
goto decode_intra_mb;
}
} else {
assert(h->slice_type == I_TYPE);
decode_intra_mb:
partition_count = 0;
cbp= i_mb_type_info[mb_type].cbp;
h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode;
mb_type= i_mb_type_info[mb_type].type;
}
if(MB_FIELD)
mb_type |= MB_TYPE_INTERLACED;
h->slice_table[ mb_xy ]= h->slice_num;
if(IS_INTRA_PCM(mb_type)) {
const uint8_t *ptr;
unsigned int x, y;
ptr= h->cabac.bytestream;
if(h->cabac.low&0x1) ptr--;
if(CABAC_BITS==16){
if(h->cabac.low&0x1FF) ptr--;
}
for(y=0; y<16; y++){
const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3);
for(x=0; x<16; x++){
tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", *ptr);
h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= *ptr++;
}
}
for(y=0; y<8; y++){
const int index= 256 + 4*(y&3) + 32*(y>>2);
for(x=0; x<8; x++){
tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", *ptr);
h->mb[index + (x&3) + 16*(x>>2)]= *ptr++;
}
}
for(y=0; y<8; y++){
const int index= 256 + 64 + 4*(y&3) + 32*(y>>2);
for(x=0; x<8; x++){
tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", *ptr);
h->mb[index + (x&3) + 16*(x>>2)]= *ptr++;
}
}
ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr);
h->cbp_table[mb_xy] = 0x1ef;
h->chroma_pred_mode_table[mb_xy] = 0;
s->current_picture.qscale_table[mb_xy]= 0;
h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, 0);
memset(h->non_zero_count[mb_xy], 16, 16);
s->current_picture.mb_type[mb_xy]= mb_type;
return 0;
}
if(MB_MBAFF){
h->ref_count[0] <<= 1;
h->ref_count[1] <<= 1;
}
fill_caches(h, mb_type, 0);
if( IS_INTRA( mb_type ) ) {
int i, pred_mode;
if( IS_INTRA4x4( mb_type ) ) {
if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) {
mb_type |= MB_TYPE_8x8DCT;
for( i = 0; i < 16; i+=4 ) {
int pred = pred_intra_mode( h, i );
int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred );
fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
}
} else {
for( i = 0; i < 16; i++ ) {
int pred = pred_intra_mode( h, i );
h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred );
}
}
write_back_intra_pred_mode(h);
if( check_intra4x4_pred_mode(h) < 0 ) return -1;
} else {
h->intra16x16_pred_mode= check_intra_pred_mode( h, h->intra16x16_pred_mode );
if( h->intra16x16_pred_mode < 0 ) return -1;
}
h->chroma_pred_mode_table[mb_xy] =
pred_mode = decode_cabac_mb_chroma_pre_mode( h );
pred_mode= check_intra_pred_mode( h, pred_mode );
if( pred_mode < 0 ) return -1;
h->chroma_pred_mode= pred_mode;
} else if( partition_count == 4 ) {
int i, j, sub_partition_count[4], list, ref[2][4];
if( h->slice_type == B_TYPE ) {
for( i = 0; i < 4; i++ ) {
h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h );
sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type;
}
if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] |
h->sub_mb_type[2] | h->sub_mb_type[3]) ) {
pred_direct_motion(h, &mb_type);
if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) {
for( i = 0; i < 4; i++ )
if( IS_DIRECT(h->sub_mb_type[i]) )
fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 );
}
}
} else {
for( i = 0; i < 4; i++ ) {
h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h );
sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count;
h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type;
}
}
for( list = 0; list < h->list_count; list++ ) {
for( i = 0; i < 4; i++ ) {
if(IS_DIRECT(h->sub_mb_type[i])) continue;
if(IS_DIR(h->sub_mb_type[i], 0, list)){
if( h->ref_count[list] > 1 )
ref[list][i] = decode_cabac_mb_ref( h, list, 4*i );
else
ref[list][i] = 0;
} else {
ref[list][i] = -1;
}
h->ref_cache[list][ scan8[4*i]+1 ]=
h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i];
}
}
if(dct8x8_allowed)
dct8x8_allowed = get_dct8x8_allowed(h);
for(list=0; list<h->list_count; list++){
for(i=0; i<4; i++){
if(IS_DIRECT(h->sub_mb_type[i])){
fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4);
continue;
}
h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ];
if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){
const int sub_mb_type= h->sub_mb_type[i];
const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;
for(j=0; j<sub_partition_count[i]; j++){
int mpx, mpy;
int mx, my;
const int index= 4*i + block_width*j;
int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ];
pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy);
mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 );
my = mpy + decode_cabac_mb_mvd( h, list, index, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
if(IS_SUB_8X8(sub_mb_type)){
mv_cache[ 1 ][0]=
mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx;
mv_cache[ 1 ][1]=
mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my;
mvd_cache[ 1 ][0]=
mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx;
mvd_cache[ 1 ][1]=
mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy;
}else if(IS_SUB_8X4(sub_mb_type)){
mv_cache[ 1 ][0]= mx;
mv_cache[ 1 ][1]= my;
mvd_cache[ 1 ][0]= mx - mpx;
mvd_cache[ 1 ][1]= my - mpy;
}else if(IS_SUB_4X8(sub_mb_type)){
mv_cache[ 8 ][0]= mx;
mv_cache[ 8 ][1]= my;
mvd_cache[ 8 ][0]= mx - mpx;
mvd_cache[ 8 ][1]= my - mpy;
}
mv_cache[ 0 ][0]= mx;
mv_cache[ 0 ][1]= my;
mvd_cache[ 0 ][0]= mx - mpx;
mvd_cache[ 0 ][1]= my - mpy;
}
}else{
uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0];
p[0] = p[1] = p[8] = p[9] = 0;
pd[0]= pd[1]= pd[8]= pd[9]= 0;
}
}
}
} else if( IS_DIRECT(mb_type) ) {
pred_direct_motion(h, &mb_type);
fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4);
fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4);
dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
} else {
int list, mx, my, i, mpx, mpy;
if(IS_16X16(mb_type)){
for(list=0; list<h->list_count; list++){
if(IS_DIR(mb_type, 0, list)){
const int ref = h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 0 ) : 0;
fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1);
}else
fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1);
}
for(list=0; list<h->list_count; list++){
if(IS_DIR(mb_type, 0, list)){
pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy);
mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 );
my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4);
fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
}else
fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4);
}
}
else if(IS_16X8(mb_type)){
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){
const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 8*i ) : 0;
fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1);
}else
fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1);
}
}
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){
pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy);
mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 );
my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4);
fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4);
}else{
fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4);
}
}
}
}else{
assert(IS_8X16(mb_type));
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){
const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 4*i ) : 0;
fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1);
}else
fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1);
}
}
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
if(IS_DIR(mb_type, i, list)){
pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy);
mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 );
my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 );
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4);
fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4);
}else{
fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4);
}
}
}
}
}
if( IS_INTER( mb_type ) ) {
h->chroma_pred_mode_table[mb_xy] = 0;
write_back_motion( h, mb_type );
}
if( !IS_INTRA16x16( mb_type ) ) {
cbp = decode_cabac_mb_cbp_luma( h );
cbp |= decode_cabac_mb_cbp_chroma( h ) << 4;
}
h->cbp_table[mb_xy] = h->cbp = cbp;
if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) {
if( decode_cabac_mb_transform_size( h ) )
mb_type |= MB_TYPE_8x8DCT;
}
s->current_picture.mb_type[mb_xy]= mb_type;
if( cbp || IS_INTRA16x16( mb_type ) ) {
const uint8_t *scan, *scan8x8, *dc_scan;
int dqp;
if(IS_INTERLACED(mb_type)){
scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0;
scan= s->qscale ? h->field_scan : h->field_scan_q0;
dc_scan= luma_dc_field_scan;
}else{
scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0;
scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
dc_scan= luma_dc_zigzag_scan;
}
h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h );
if( dqp == INT_MIN ){
av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y);
return -1;
}
s->qscale += dqp;
if(((unsigned)s->qscale) > 51){
if(s->qscale<0) s->qscale+= 52;
else s->qscale-= 52;
}
h->chroma_qp = get_chroma_qp(h->pps.chroma_qp_index_offset, s->qscale);
if( IS_INTRA16x16( mb_type ) ) {
int i;
if( decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16) < 0)
return -1;
if( cbp&15 ) {
for( i = 0; i < 16; i++ ) {
if( decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, h->dequant4_coeff[0][s->qscale], 15) < 0 )
return -1;
}
} else {
fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1);
}
} else {
int i8x8, i4x4;
for( i8x8 = 0; i8x8 < 4; i8x8++ ) {
if( cbp & (1<<i8x8) ) {
if( IS_8x8DCT(mb_type) ) {
if( decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8,
scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64) < 0 )
return -1;
} else
for( i4x4 = 0; i4x4 < 4; i4x4++ ) {
const int index = 4*i8x8 + i4x4;
if( decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale], 16) < 0 )
return -1;
}
} else {
uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ];
nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
}
}
}
if( cbp&0x30 ){
int c;
for( c = 0; c < 2; c++ ) {
if( decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4) < 0)
return -1;
}
}
if( cbp&0x20 ) {
int c, i;
for( c = 0; c < 2; c++ ) {
const uint32_t *qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp];
for( i = 0; i < 4; i++ ) {
const int index = 16 + 4 * c + i;
if( decode_cabac_residual(h, h->mb + 16*index, 4, index - 16, scan + 1, qmul, 15) < 0)
return -1;
}
}
} else {
uint8_t * const nnz= &h->non_zero_count_cache[0];
nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
}
} else {
uint8_t * const nnz= &h->non_zero_count_cache[0];
fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1);
nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] =
nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0;
h->last_qscale_diff = 0;
}
s->current_picture.qscale_table[mb_xy]= s->qscale;
write_back_non_zero_count(h);
if(MB_MBAFF){
h->ref_count[0] >>= 1;
h->ref_count[1] >>= 1;
}
return 0;
}
| 1threat |
WHY THREAD GOES TO SLEEP FIRST AND SETS TEXT VIEW LATER IN AN ACTIVITY here : >*here is the code eg of result set in android first activity with ui having 3 edit text and 3 buttons or text view i need to set values in 2nd text view to display total marks which is calculated from first 3 edit views and sleep for 10sec in main method without using thread but i am getting op ie after going to sleep 10sec and immediatly showing total text view and navigated to next activity ie mentioned in code so how to wait for 10sec after setting total*
EditText etMarkOne,etMarkTwo,etMarkThree;
TextView tvTMarks,tvTotal,tvGrade;`
int m1,m2,m3,Tmarks;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
inilizeViewControls();
eventHandlingonViewControls();
}
private void eventHandlingonViewControls() {tvTotal.setOnClickListener(this);
}
private void inilizeViewControls() {
etMarkOne= (EditText) findViewById(R.id.etMarkOne);
etMarkTwo= (EditText) findViewById(R.id.etMarkTwo);
etMarkThree= (EditText) findViewById(R.id.etMarkThree);
tvGrade= (TextView) findViewById(R.id.tvGrade);
tvTMarks= (TextView) findViewById(R.id.tvTMarks);
tvTotal= (TextView) findViewById(R.id.tvTotal);
}
@Override
public void onClick(View v) {
m1= Integer.parseInt(etMarkOne.getText().toString());
m2= Integer.parseInt(etMarkTwo.getText().toString());
m3= Integer.parseInt(etMarkThree.getText().toString());
Tmarks=m1+m2+m3;
tvTMarks.setText(""+Tmarks);
Thread.sleep(2000);
Intent i= new Intent(MainActivity.this,ResultActivity.class);
i.putExtra("Tmarks",Tmarks);
i.putExtra(" m1", m1);
i.putExtra(" m2", m2);
i.putExtra(" m3",m3);
startActivityForResult(i,1);}
} | 0debug |
I need to provide details of my AWS EC2 Instance via SSH... How do i do this? Thanks : I need give server access to someone to help debug my code.
Can someone please explain what/where I can find the SSH Credentials. I am new to all of this so apologizes.... | 0debug |
Error in using rand function : <p>I tried using the rand() function with min = 4 and max = 10:</p>
<pre><code>s = rand() % 10 + 4;
</code></pre>
<p>and some of the results were above 10.How is this possible?</p>
| 0debug |
Hidden markdown text on GitHub : <p>Is there anything in markdown syntax specifically on GitHub to support hidden text?</p>
<p>I just want to put some to-do notes in <code>README.md</code> for myself, not to be visible.</p>
| 0debug |
How do I run code multiple times in a sing run? : I am working in java using eclipse. Here i am calculating average utilization of machines. I want to run this code 20 time and then need to take average of this code. Is it possible to do the same. I am using simple formula for calculations:
AU=ActCPUtime/(max*3);
I need to run this program for different values of ActCPUtime and max which i can get in different run. Please help me out with this. Thank You
| 0debug |
Boto3 S3, sort bucket by last modified : <p>I need to fetch a list of items from S3 using Boto3, but instead of returning default sort order (descending) I want it to return it via reverse order.</p>
<p>I know you can do it via awscli:</p>
<pre><code>aws s3api list-objects --bucket mybucketfoo --query "reverse(sort_by(Contents,&LastModified))"
</code></pre>
<p>and its doable via the UI console (not sure if this is done client side or server side)</p>
<p>I cant seem to see how to do this in Boto3.</p>
<p>I am currently fetching all the files, and then sorting...but that seems overkill, especially if I only care about the 10 or so most recent files.</p>
<p>The filter system seems to only accept the Prefix for s3, nothing else.</p>
| 0debug |
int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
{
int id, sr, ch, ba, tag, bps;
id = avctx->codec_id;
sr = avctx->sample_rate;
ch = avctx->channels;
ba = avctx->block_align;
tag = avctx->codec_tag;
bps = av_get_exact_bits_per_sample(avctx->codec_id);
if (bps > 0 && ch > 0 && frame_bytes > 0)
return (frame_bytes * 8) / (bps * ch);
bps = avctx->bits_per_coded_sample;
switch (id) {
case CODEC_ID_ADPCM_ADX: return 32;
case CODEC_ID_ADPCM_IMA_QT: return 64;
case CODEC_ID_ADPCM_EA_XAS: return 128;
case CODEC_ID_AMR_NB:
case CODEC_ID_GSM:
case CODEC_ID_QCELP:
case CODEC_ID_RA_144:
case CODEC_ID_RA_288: return 160;
case CODEC_ID_IMC: return 256;
case CODEC_ID_AMR_WB:
case CODEC_ID_GSM_MS: return 320;
case CODEC_ID_MP1: return 384;
case CODEC_ID_ATRAC1: return 512;
case CODEC_ID_ATRAC3: return 1024;
case CODEC_ID_MP2:
case CODEC_ID_MUSEPACK7: return 1152;
case CODEC_ID_AC3: return 1536;
}
if (sr > 0) {
if (id == CODEC_ID_TTA)
return 256 * sr / 245;
if (ch > 0) {
if (id == CODEC_ID_BINKAUDIO_DCT)
return (480 << (sr / 22050)) / ch;
}
}
if (ba > 0) {
if (id == CODEC_ID_SIPR) {
switch (ba) {
case 20: return 160;
case 19: return 144;
case 29: return 288;
case 37: return 480;
}
}
}
if (frame_bytes > 0) {
if (id == CODEC_ID_TRUESPEECH)
return 240 * (frame_bytes / 32);
if (id == CODEC_ID_NELLYMOSER)
return 256 * (frame_bytes / 64);
if (bps > 0) {
if (id == CODEC_ID_ADPCM_G726)
return frame_bytes * 8 / bps;
}
if (ch > 0) {
switch (id) {
case CODEC_ID_ADPCM_4XM:
case CODEC_ID_ADPCM_IMA_ISS:
return (frame_bytes - 4 * ch) * 2 / ch;
case CODEC_ID_ADPCM_IMA_SMJPEG:
return (frame_bytes - 4) * 2 / ch;
case CODEC_ID_ADPCM_IMA_AMV:
return (frame_bytes - 8) * 2 / ch;
case CODEC_ID_ADPCM_XA:
return (frame_bytes / 128) * 224 / ch;
case CODEC_ID_INTERPLAY_DPCM:
return (frame_bytes - 6 - ch) / ch;
case CODEC_ID_ROQ_DPCM:
return (frame_bytes - 8) / ch;
case CODEC_ID_XAN_DPCM:
return (frame_bytes - 2 * ch) / ch;
case CODEC_ID_MACE3:
return 3 * frame_bytes / ch;
case CODEC_ID_MACE6:
return 6 * frame_bytes / ch;
case CODEC_ID_PCM_LXF:
return 2 * (frame_bytes / (5 * ch));
}
if (tag) {
if (id == CODEC_ID_SOL_DPCM) {
if (tag == 3)
return frame_bytes / ch;
else
return frame_bytes * 2 / ch;
}
}
if (ba > 0) {
int blocks = frame_bytes / ba;
switch (avctx->codec_id) {
case CODEC_ID_ADPCM_IMA_WAV:
return blocks * (1 + (ba - 4 * ch) / (4 * ch) * 8);
case CODEC_ID_ADPCM_IMA_DK3:
return blocks * (((ba - 16) * 2 / 3 * 4) / ch);
case CODEC_ID_ADPCM_IMA_DK4:
return blocks * (1 + (ba - 4 * ch) * 2 / ch);
case CODEC_ID_ADPCM_MS:
return blocks * (2 + (ba - 7 * ch) * 2 / ch);
}
}
if (bps > 0) {
switch (avctx->codec_id) {
case CODEC_ID_PCM_DVD:
return 2 * (frame_bytes / ((bps * 2 / 8) * ch));
case CODEC_ID_PCM_BLURAY:
return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8);
case CODEC_ID_S302M:
return 2 * (frame_bytes / ((bps + 4) / 4)) / ch;
}
}
}
}
return 0;
}
| 1threat |
What does "-log" stand for in MySQL version? : <p>When I query the version of my MySQL server (<code>SELECT VERSION()</code>) it returns "5.7.16-log". What does that "-log" stand for?</p>
<p>It's the standard download of the community edition.</p>
| 0debug |
This code should reverse my input of "123ab 445 Hello" to "ba321 544 olleh", however, I get "olleh 544 ba321" as my output. Why is this happening? : import java.util.StringTokenizer;
import java.util.Scanner;
public class LessNaiveEncryption {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("Provide an input sentence: ");
String userInput = keyboard.nextLine();
StringTokenizer strTokenizer = new StringTokenizer(userInput, " ", true);
System.out.print("The output sentence is : ");
while (strTokenizer.hasMoreTokens()) {
strTokenizer.nextToken();
}
StringBuilder blob = new StringBuilder(userInput);
blob.reverse();
System.out.println(blob);
System.out.print("\n");
}
} | 0debug |
How do i get the value of text inside of the file using Qt? : the data of my file.txt is below:
Student_ID=0001
Student_Name=joseph
Student_GradeLevel=2
How do i get the value, let say i want to get the Student_ID using Qt.
Thanks. | 0debug |
static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
{
int64_t total_sectors = bmds->total_sectors;
int64_t cur_sector = bmds->cur_sector;
BlockDriverState *bs = bmds->bs;
BlkMigBlock *blk;
int nr_sectors;
if (bmds->shared_base) {
qemu_mutex_lock_iothread();
while (cur_sector < total_sectors &&
!bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH,
&nr_sectors)) {
cur_sector += nr_sectors;
}
qemu_mutex_unlock_iothread();
}
if (cur_sector >= total_sectors) {
bmds->cur_sector = bmds->completed_sectors = total_sectors;
return 1;
}
bmds->completed_sectors = cur_sector;
cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1);
nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) {
nr_sectors = total_sectors - cur_sector;
}
blk = g_malloc(sizeof(BlkMigBlock));
blk->buf = g_malloc(BLOCK_SIZE);
blk->bmds = bmds;
blk->sector = cur_sector;
blk->nr_sectors = nr_sectors;
blk->iov.iov_base = blk->buf;
blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE;
qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);
blk_mig_lock();
block_mig_state.submitted++;
blk_mig_unlock();
qemu_mutex_lock_iothread();
blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov,
nr_sectors, blk_mig_read_cb, blk);
bdrv_reset_dirty(bs, cur_sector, nr_sectors);
qemu_mutex_unlock_iothread();
bmds->cur_sector = cur_sector + nr_sectors;
return (bmds->cur_sector >= total_sectors);
}
| 1threat |
ionic 2 - Error Could not find an installed version of Gradle either in Android Studio : <p>I create ionic 2 project and add diagnostic cordova plugin like this :</p>
<pre><code>ionic plugin add cordova.plugins.diagnostic
npm install --save @ionic-native/diagnostic
</code></pre>
<p>and add android platform like this :</p>
<pre><code>ionic platform add android@latest
</code></pre>
<p>but when build with <code>ionic build android</code> console give me this error :</p>
<pre><code>Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
</code></pre>
<p>and I try to download manualy gradle.3.3-all.zip and change this distributionUrl var in platform/android/cordova/lib/builders/GradleBuilder.js</p>
<pre><code> var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip'
</code></pre>
<p>to:</p>
<pre><code>var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file:///E:/gradles/gradle-3.3-all.zip';
</code></pre>
<p>but not working and console give me last error.</p>
<p>I dont know how to add gradle for android@latest version</p>
| 0debug |
Moving the WinForm through coding/pressing a button : <p>I was looking for an easy way of moving the form when the user presses a button. I'm making an rpg game and when the player attacks/gets attacked I want the Form to sort of "shake" a little, meaning moving it from left to right a few times or something along those lines.</p>
<p>Thanks for any answers, Joe.</p>
| 0debug |
static int g723_1_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
G723_1_Context *p = avctx->priv_data;
int16_t unq_lpc[LPC_ORDER * SUBFRAMES];
int16_t qnt_lpc[LPC_ORDER * SUBFRAMES];
int16_t cur_lsp[LPC_ORDER];
int16_t weighted_lpc[LPC_ORDER * SUBFRAMES << 1];
int16_t vector[FRAME_LEN + PITCH_MAX];
int offset, ret;
int16_t *in = (const int16_t *)frame->data[0];
HFParam hf[4];
int i, j;
highpass_filter(in, &p->hpf_fir_mem, &p->hpf_iir_mem);
memcpy(vector, p->prev_data, HALF_FRAME_LEN * sizeof(int16_t));
memcpy(vector + HALF_FRAME_LEN, in, FRAME_LEN * sizeof(int16_t));
comp_lpc_coeff(vector, unq_lpc);
lpc2lsp(&unq_lpc[LPC_ORDER * 3], p->prev_lsp, cur_lsp);
lsp_quantize(p->lsp_index, cur_lsp, p->prev_lsp);
memcpy(vector + LPC_ORDER, p->prev_data + SUBFRAME_LEN,
sizeof(int16_t) * SUBFRAME_LEN);
memcpy(vector + LPC_ORDER + SUBFRAME_LEN, in,
sizeof(int16_t) * (HALF_FRAME_LEN + SUBFRAME_LEN));
memcpy(p->prev_data, in + HALF_FRAME_LEN,
sizeof(int16_t) * HALF_FRAME_LEN);
memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN);
perceptual_filter(p, weighted_lpc, unq_lpc, vector);
memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN);
memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX);
memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN);
scale_vector(vector, vector, FRAME_LEN + PITCH_MAX);
p->pitch_lag[0] = estimate_pitch(vector, PITCH_MAX);
p->pitch_lag[1] = estimate_pitch(vector, PITCH_MAX + HALF_FRAME_LEN);
for (i = PITCH_MAX, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++)
comp_harmonic_coeff(vector + i, p->pitch_lag[j >> 1], hf + j);
memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX);
memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN);
memcpy(p->prev_weight_sig, vector + FRAME_LEN, sizeof(int16_t) * PITCH_MAX);
for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++)
harmonic_filter(hf + j, vector + PITCH_MAX + i, in + i);
inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, 0);
lsp_interpolate(qnt_lpc, cur_lsp, p->prev_lsp);
memcpy(p->prev_lsp, cur_lsp, sizeof(int16_t) * LPC_ORDER);
offset = 0;
for (i = 0; i < SUBFRAMES; i++) {
int16_t impulse_resp[SUBFRAME_LEN];
int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1];
int16_t flt_in[SUBFRAME_LEN];
int16_t zero[LPC_ORDER], fir[LPC_ORDER], iir[LPC_ORDER];
memset(zero, 0, sizeof(int16_t) * LPC_ORDER);
memset(vector, 0, sizeof(int16_t) * PITCH_MAX);
memset(flt_in, 0, sizeof(int16_t) * SUBFRAME_LEN);
flt_in[0] = 1 << 13;
synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1),
zero, zero, flt_in, vector + PITCH_MAX, 1);
harmonic_filter(hf + i, vector + PITCH_MAX, impulse_resp);
flt_in[0] = 0;
memcpy(fir, p->perf_fir_mem, sizeof(int16_t) * LPC_ORDER);
memcpy(iir, p->perf_iir_mem, sizeof(int16_t) * LPC_ORDER);
synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1),
fir, iir, flt_in, vector + PITCH_MAX, 0);
memcpy(vector, p->harmonic_mem, sizeof(int16_t) * PITCH_MAX);
harmonic_noise_sub(hf + i, vector + PITCH_MAX, in);
acb_search(p, residual, impulse_resp, in, i);
gen_acb_excitation(residual, p->prev_excitation,p->pitch_lag[i >> 1],
&p->subframe[i], p->cur_rate);
sub_acb_contrib(residual, impulse_resp, in);
fcb_search(p, impulse_resp, in, i);
gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[i >> 1],
&p->subframe[i], RATE_6300);
memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN,
sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN));
for (j = 0; j < SUBFRAME_LEN; j++)
in[j] = av_clip_int16((in[j] << 1) + impulse_resp[j]);
memcpy(p->prev_excitation + PITCH_MAX - SUBFRAME_LEN, in,
sizeof(int16_t) * SUBFRAME_LEN);
synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1),
p->perf_fir_mem, p->perf_iir_mem,
in, vector + PITCH_MAX, 0);
memmove(p->harmonic_mem, p->harmonic_mem + SUBFRAME_LEN,
sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN));
memcpy(p->harmonic_mem + PITCH_MAX - SUBFRAME_LEN, vector + PITCH_MAX,
sizeof(int16_t) * SUBFRAME_LEN);
in += SUBFRAME_LEN;
offset += LPC_ORDER;
}
if ((ret = ff_alloc_packet2(avctx, avpkt, 24)))
return ret;
*got_packet_ptr = 1;
avpkt->size = pack_bitstream(p, avpkt->data, avpkt->size);
return 0;
}
| 1threat |
SwiftyJSON Shuffle : <p>Using Swift 2, I have the following code:</p>
<pre><code>var datas = SwiftyJSON.JSON(json)
// now datas has products. I need to shuffle products and get them in random order
datas["products"] = datas["products"].shuffle()
</code></pre>
<p>Unfortunately, that didn't work.</p>
<p>Any help to make it work?</p>
| 0debug |
static void usb_xhci_realize(struct PCIDevice *dev, Error **errp)
{
int i, ret;
Error *err = NULL;
XHCIState *xhci = XHCI(dev);
dev->config[PCI_CLASS_PROG] = 0x30;
dev->config[PCI_INTERRUPT_PIN] = 0x01;
dev->config[PCI_CACHE_LINE_SIZE] = 0x10;
dev->config[0x60] = 0x30;
usb_xhci_init(xhci);
if (xhci->msi != ON_OFF_AUTO_OFF) {
ret = msi_init(dev, 0x70, xhci->numintrs, true, false, &err);
assert(!ret || ret == -ENOTSUP);
if (ret && xhci->msi == ON_OFF_AUTO_ON) {
error_append_hint(&err, "You have to use msi=auto (default) or "
"msi=off with this machine type.\n");
error_propagate(errp, err);
return;
}
assert(!err || xhci->msi == ON_OFF_AUTO_AUTO);
error_free(err);
}
if (xhci->numintrs > MAXINTRS) {
xhci->numintrs = MAXINTRS;
}
while (xhci->numintrs & (xhci->numintrs - 1)) {
xhci->numintrs++;
}
if (xhci->numintrs < 1) {
xhci->numintrs = 1;
}
if (xhci->numslots > MAXSLOTS) {
xhci->numslots = MAXSLOTS;
}
if (xhci->numslots < 1) {
xhci->numslots = 1;
}
if (xhci_get_flag(xhci, XHCI_FLAG_ENABLE_STREAMS)) {
xhci->max_pstreams_mask = 7;
} else {
xhci->max_pstreams_mask = 0;
}
xhci->mfwrap_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, xhci_mfwrap_timer, xhci);
memory_region_init(&xhci->mem, OBJECT(xhci), "xhci", LEN_REGS);
memory_region_init_io(&xhci->mem_cap, OBJECT(xhci), &xhci_cap_ops, xhci,
"capabilities", LEN_CAP);
memory_region_init_io(&xhci->mem_oper, OBJECT(xhci), &xhci_oper_ops, xhci,
"operational", 0x400);
memory_region_init_io(&xhci->mem_runtime, OBJECT(xhci), &xhci_runtime_ops, xhci,
"runtime", LEN_RUNTIME);
memory_region_init_io(&xhci->mem_doorbell, OBJECT(xhci), &xhci_doorbell_ops, xhci,
"doorbell", LEN_DOORBELL);
memory_region_add_subregion(&xhci->mem, 0, &xhci->mem_cap);
memory_region_add_subregion(&xhci->mem, OFF_OPER, &xhci->mem_oper);
memory_region_add_subregion(&xhci->mem, OFF_RUNTIME, &xhci->mem_runtime);
memory_region_add_subregion(&xhci->mem, OFF_DOORBELL, &xhci->mem_doorbell);
for (i = 0; i < xhci->numports; i++) {
XHCIPort *port = &xhci->ports[i];
uint32_t offset = OFF_OPER + 0x400 + 0x10 * i;
port->xhci = xhci;
memory_region_init_io(&port->mem, OBJECT(xhci), &xhci_port_ops, port,
port->name, 0x10);
memory_region_add_subregion(&xhci->mem, offset, &port->mem);
}
pci_register_bar(dev, 0,
PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64,
&xhci->mem);
if (pci_bus_is_express(dev->bus) ||
xhci_get_flag(xhci, XHCI_FLAG_FORCE_PCIE_ENDCAP)) {
ret = pcie_endpoint_cap_init(dev, 0xa0);
assert(ret >= 0);
}
if (xhci->msix != ON_OFF_AUTO_OFF) {
msix_init(dev, xhci->numintrs,
&xhci->mem, 0, OFF_MSIX_TABLE,
&xhci->mem, 0, OFF_MSIX_PBA,
0x90);
}
}
| 1threat |
Custom render blocks inside content area : I created content area for jquery tabs. The sturcture is like on image
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/f4fHK.jpg
----------
If I try to render this structure through view of a block. I can't emulate it.
Since I have to put all li's inside one ul and all divs inside "tab-content" | 0debug |
Parse error: unexpected end of the file, can't find it : <p>i'm trying to fix a error, i maked a little search and they send that was something because { or } not closed propely, but i can't find it. </p>
<p>The code is this one:</p>
<p><strong>Parse error: syntax error, unexpected end of file in /movies.php on line 176</strong>
the code <a href="https://gist.github.com/anonymous/258531c7a81517c47de5" rel="nofollow">https://gist.github.com/anonymous/258531c7a81517c47de5</a></p>
| 0debug |
I am trying to access Phpmyadmin and look & create databases but I am not able to login : <p>I am working to get access to phpmyadmin by using Xampp on my windows 10. I am unable to login. I have tried many things which includes:</p>
<p>1) delete "ib_logfile0" and ib_logfile1
2) Restarting machine
3) Changing username and password and trying that in the below code
4) making 'AllowNoPassword' true and false both in below code.
5) checking skype and all ports </p>
<p>I am confused now what can I do. I am new to php and mysql and don't know much of codes. I am attaching my Xampp interface also below:
<a href="https://i.stack.imgur.com/1Uuvg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Uuvg.png" alt="enter image description here"></a></p>
<p>Code in my config.inc.php</p>
<pre><code> /* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
</code></pre>
<p><a href="https://i.stack.imgur.com/zfxNC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zfxNC.png" alt="enter image description here"></a></p>
| 0debug |
E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only : <blockquote>
<p>Although my App is working fine but I am receiving these errors in the logcat. Can anyone tell me what are these errors?</p>
</blockquote>
<pre><code>09-08 00:23:34.969 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:44.266 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:46.687 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:47.027 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:49.262 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:52.229 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:53.448 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:56.331 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
09-08 00:23:58.833 1481-1546/? E/ActivityManager: Invalid thumbnail dimensions: 0x0
09-08 00:23:59.173 4011-4030/? E/ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
</code></pre>
| 0debug |
Wrog encryption with Russian String in Intellij IDEA : I am trying to send a message that contains English and Russian String, but Russian string are displayed as ?????...
PrintWriter writer = new PrintWriter(clientSocket.getOutputStream());
writer.println("English" + "На русском");
writer.flush();
Is there an opportunity to fix this in Intellij IDEA? | 0debug |
static void test_pci_spec(void)
{
AHCIQState *ahci;
ahci = ahci_boot();
ahci_test_pci_spec(ahci);
ahci_shutdown(ahci);
}
| 1threat |
SQL JOIN Tables SQL Fiddle? : I am working on a SQL project from one of my courses, using SQL Fiddle. Somehow I cannot extract some information, I've tried all sorts of different queries but I cannot get the correct results.
I have the following three tables:
A(PK:Course_Code, Course_Name)
B(PK and FK:Course_Code, PK and FK: Book_ID, PK and FK:Title, PK and FK:ISBN)
C(PK:Book_ID, PK:Title, PK:ISBN)
I want to extract the Book_ID and Title for which Course_Name = 'Data Management'.
Does anybody know the solution? I would really appreciate your help :) Thanks in advance!
| 0debug |
How to increase the collection view image width & height equal to screen in swift 4.2? : How to increase the collection view image width & height equal to screen in swift 4.2 ? | 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.