problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
I use andriod for first time but when i open file .java i have the error in the picture below : [enter image description here][1]
[1]: https://i.stack.imgur.com/f1Hhb.png hdhdhe
| 0debug
|
static av_cold int decode_close_mp3on4(AVCodecContext * avctx)
{
MP3On4DecodeContext *s = avctx->priv_data;
int i;
for (i = 0; i < s->frames; i++)
av_freep(&s->mp3decctx[i]);
return 0;
}
| 1threat
|
void ff_vp3_idct_c(DCTELEM *block){
idct(NULL, 0, block, 0);
}
| 1threat
|
ImportError: No module named extern : <p>I'm getting this error when trying to install any package with pip. I have two pip instances, one with Python 2.7 and other with Python 3.</p>
<pre><code> Could not import setuptools which is required to install from a source distribution.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 375, in setup_py
import setuptools # noqa
File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extern.six.moves import filterfalse, map
File "/usr/local/lib/python2.7/dist-packages/setuptools/extern/__init__.py", line 1, in <module>
from pkg_resources.extern import VendorImporter
ImportError: No module named extern
</code></pre>
<p>Even when I try to install the 'extern' module I get this error. Also when installing with Python itself, like <code>python setup.py install</code>.</p>
<p>Thanks in advance. </p>
| 0debug
|
Google reCAPTCHA data-callback not working : <p>I have built a email newsletter signup form which posts into mailchimp from my website. I have Google reCAPTCHA added to the form and have a data-callback to enable the submit button as it is initially disabled. This was working fine in all browsers last night and did tests with success & signed off on it..and went home. I got in this morning and found the subscribe button will not enable / data-callback does not work? Strange..</p>
<p>Callback</p>
<pre><code><div class="g-recaptcha" data-callback="recaptcha_callback" data-sitekey="xxxxx"></div>
</code></pre>
<p>Input button at bottom of form</p>
<pre><code><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button" disabled>
</code></pre>
<p>Scripts</p>
<pre><code><script src='https://www.google.com/recaptcha/api.js'></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
function recaptcha_callback(){
alert("callback working");
$('.button').prop("disabled", false);
}
)};
</script>
</code></pre>
| 0debug
|
static int smka_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
SmackerAudioContext *s = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
GetBitContext gb;
HuffContext h[4] = { { 0 } };
VLC vlc[4] = { { 0 } };
int16_t *samples;
uint8_t *samples8;
int val;
int i, res, ret;
int unp_size;
int bits, stereo;
int pred[2] = {0, 0};
if (buf_size <= 4) {
av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
unp_size = AV_RL32(buf);
if (unp_size > (1U<<24)) {
av_log(avctx, AV_LOG_ERROR, "packet is too big\n");
return AVERROR_INVALIDDATA;
}
init_get_bits(&gb, buf + 4, (buf_size - 4) * 8);
if(!get_bits1(&gb)){
av_log(avctx, AV_LOG_INFO, "Sound: no data\n");
*got_frame_ptr = 0;
return 1;
}
stereo = get_bits1(&gb);
bits = get_bits1(&gb);
if (stereo ^ (avctx->channels != 1)) {
av_log(avctx, AV_LOG_ERROR, "channels mismatch\n");
return AVERROR(EINVAL);
}
if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) {
av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n");
return AVERROR(EINVAL);
}
s->frame.nb_samples = unp_size / (avctx->channels * (bits + 1));
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
samples = (int16_t *)s->frame.data[0];
samples8 = s->frame.data[0];
for(i = 0; i < (1 << (bits + stereo)); i++) {
h[i].length = 256;
h[i].maxlength = 0;
h[i].current = 0;
h[i].bits = av_mallocz(256 * 4);
h[i].lengths = av_mallocz(256 * sizeof(int));
h[i].values = av_mallocz(256 * sizeof(int));
skip_bits1(&gb);
smacker_decode_tree(&gb, &h[i], 0, 0);
skip_bits1(&gb);
if(h[i].current > 1) {
res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length,
h[i].lengths, sizeof(int), sizeof(int),
h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE);
if(res < 0) {
av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
return AVERROR_INVALIDDATA;
}
}
}
if(bits) {
for(i = stereo; i >= 0; i--)
pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16);
for(i = 0; i <= stereo; i++)
*samples++ = pred[i];
for(; i < unp_size / 2; i++) {
if(get_bits_left(&gb)<0)
return AVERROR_INVALIDDATA;
if(i & stereo) {
if(vlc[2].table)
res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3);
else
res = 0;
if (res < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
return AVERROR_INVALIDDATA;
}
val = h[2].values[res];
if(vlc[3].table)
res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3);
else
res = 0;
if (res < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
return AVERROR_INVALIDDATA;
}
val |= h[3].values[res] << 8;
pred[1] += sign_extend(val, 16);
*samples++ = av_clip_int16(pred[1]);
} else {
if(vlc[0].table)
res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);
else
res = 0;
if (res < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
return AVERROR_INVALIDDATA;
}
val = h[0].values[res];
if(vlc[1].table)
res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);
else
res = 0;
if (res < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
return AVERROR_INVALIDDATA;
}
val |= h[1].values[res] << 8;
pred[0] += sign_extend(val, 16);
*samples++ = av_clip_int16(pred[0]);
}
}
} else {
for(i = stereo; i >= 0; i--)
pred[i] = get_bits(&gb, 8);
for(i = 0; i <= stereo; i++)
*samples8++ = pred[i];
for(; i < unp_size; i++) {
if(get_bits_left(&gb)<0)
return AVERROR_INVALIDDATA;
if(i & stereo){
if(vlc[1].table)
res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3);
else
res = 0;
if (res < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
return AVERROR_INVALIDDATA;
}
pred[1] += sign_extend(h[1].values[res], 8);
*samples8++ = av_clip_uint8(pred[1]);
} else {
if(vlc[0].table)
res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3);
else
res = 0;
if (res < 0) {
av_log(avctx, AV_LOG_ERROR, "invalid vlc\n");
return AVERROR_INVALIDDATA;
}
pred[0] += sign_extend(h[0].values[res], 8);
*samples8++ = av_clip_uint8(pred[0]);
}
}
}
for(i = 0; i < 4; i++) {
if(vlc[i].table)
ff_free_vlc(&vlc[i]);
av_free(h[i].bits);
av_free(h[i].lengths);
av_free(h[i].values);
}
*got_frame_ptr = 1;
*(AVFrame *)data = s->frame;
return buf_size;
}
| 1threat
|
What are 'Azure Websites' called this week? : I can't find them on the portal. I am using the portal after a few years' now. They used to be called Azure Websites. What are they called now? Where can I find them?
| 0debug
|
static void clone_tables(H264Context *dst, H264Context *src){
dst->intra4x4_pred_mode = src->intra4x4_pred_mode;
dst->non_zero_count = src->non_zero_count;
dst->slice_table = src->slice_table;
dst->cbp_table = src->cbp_table;
dst->mb2b_xy = src->mb2b_xy;
dst->mb2b8_xy = src->mb2b8_xy;
dst->chroma_pred_mode_table = src->chroma_pred_mode_table;
dst->mvd_table[0] = src->mvd_table[0];
dst->mvd_table[1] = src->mvd_table[1];
dst->direct_table = src->direct_table;
if(!dst->dequant4_coeff[0])
init_dequant_tables(dst);
dst->s.obmc_scratchpad = NULL;
ff_h264_pred_init(&dst->hpc, src->s.codec_id);
dst->dequant_coeff_pps= -1;
}
| 1threat
|
Why can't I use the wildcard (?) as type of parameter, field, local variable, or as return type of a method? : <p>The Oracle <a href="https://docs.oracle.com/javase/tutorial/java/generics/wildcards.html" rel="noreferrer">doc about Wildcards in generics</a> says,</p>
<blockquote>
<p>The wildcard can be used in a variety of situations: as the <strong>type of a
parameter</strong>, <strong>field</strong>, or <strong>local variable</strong>; sometimes as a <strong>return type</strong>
(though it is better programming practice to be more specific).</p>
</blockquote>
<p>I have tried all four in the following class, and got compiler errors on each one. Why? What am I doing wrong?</p>
<pre><code>public class MainClass {
private ? instanceFieldWithWildCardType;//ERROR
private static ? staticFieldWithWildCardType;//ERROR
private void methodWithWildCardParam(? param) {}//ERROR
private void methodWithWildCardLocalVariable() {
? localVariableWithWildCardType;//ERROR
}
private ? methodWithWildCardReturnType() {//ERROR
return null;
}
private void methodWithWildCardParam(? param) {}//ERROR
}
</code></pre>
| 0debug
|
static void tcg_out_ext8s(TCGContext *s, int dest, int src, int rexw)
{
assert(src < 4 || TCG_TARGET_REG_BITS == 64);
tcg_out_modrm(s, OPC_MOVSBL + P_REXB_RM + rexw, dest, src);
}
| 1threat
|
Android Studio, Android, ADB WIFI Connect : I want to run the android app on My device to do that I am using ADB Wifi Connect plugin. Both my phone and laptop are connected to same wifi network. I am still not able to run the app on my phone. Please give an appropriate solution.
Thanks to all
Error while connecting My android device using ADB WIFI Connect plugin.
[1]: https://i.stack.imgur.com/RlpzU.png
| 0debug
|
Intercepting Arithmetic Operations in C program : <p>Is there a way that we can call user defined function when we are calling arithmetic operator in a C program just like operator overloading in C++. using GNU GCC Compiler?
Simply,
I have a function add(), and in my C program I have arithmetic Operation</p>
<pre><code> c = a + b;
</code></pre>
<p>when I compile the program, it should call my add() function internally for + operator.</p>
<p>and Is there a way we can see what is the code that gcc compiler is calling when it encounters + operator?</p>
| 0debug
|
Illegal start of expresssion : import java.text.*;
import java.util.*;
public class Test {
public static void main(String args[]) {
public void sample(){
System.out.println("Hello Working ....");
}
}
| 0debug
|
static void vhost_net_stop_one(struct vhost_net *net,
VirtIODevice *dev)
{
struct vhost_vring_file file = { .fd = -1 };
if (net->nc->info->type == NET_CLIENT_DRIVER_TAP) {
for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
const VhostOps *vhost_ops = net->dev.vhost_ops;
int r = vhost_ops->vhost_net_set_backend(&net->dev, &file);
assert(r >= 0);
}
}
if (net->nc->info->poll) {
net->nc->info->poll(net->nc, true);
}
vhost_dev_stop(&net->dev, dev);
vhost_dev_disable_notifiers(&net->dev, dev);
}
| 1threat
|
Unknown selected data source for Port Speaker (type: Speaker)? : <p>i am getting this message in cat log multiple times :</p>
<pre><code>[avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
</code></pre>
<p>i am using this code to playback background music : </p>
<pre><code> let path = Bundle.main.path(forResource: fileName, ofType:"mp3")!
let url = URL(fileURLWithPath: path)
do {
let sound = try AVAudioPlayer(contentsOf: url)
self.player = sound
sound.prepareToPlay()
sound.volume = 0.05
sound.numberOfLoops = loops
sound.play()
} catch {
print("[PLAY SOUND][DELEGATE] error loading file -> \(fileName)")
}
</code></pre>
<p>i made a research and i found similar issues so i've added the audio category in viewdidload : </p>
<pre><code> do {
try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, mode: AVAudioSessionModeDefault)
try AVAudioSession.sharedInstance().setActive(true)
} catch {
print(error)
}
</code></pre>
<p>after i've added the above code , the background music is playing even if the phone on silent mode ! and the debugger message for <code>Unknown selected data source for Port Speaker (type: Speaker)</code> is still showing</p>
| 0debug
|
Posting to a Web API using HttpClient and Web API method [FromBody] parameter ends up being null : <p>I am attempting to POST to a Web API using the HttpClient. When I put a breakpoint in the Save method of the Web API the [FromBody] Product is null. This means that something is wrong with the way I am posting the product over to the Web API. Can someone please take a look at the below code and see where I might be going wrong. I am assuming it is something to do with headers and content types.</p>
<p><strong>POST call from a client repository to the Web API which should pass the product object through as JSON:</strong></p>
<pre><code>public async Task<Product> SaveProduct(Product product)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:99999/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
StringContent content = new StringContent(JsonConvert.SerializeObject(product));
// HTTP POST
HttpResponseMessage response = await client.PostAsync("api/products/save", content);
if (response.IsSuccessStatusCode)
{
string data = await response.Content.ReadAsStringAsync();
product = JsonConvert.DeserializeObject<Product>(data);
}
}
return product;
}
</code></pre>
<p><strong>Web API Controller Method:</strong></p>
<pre><code>[HttpPost]
[Route("save")]
public IActionResult Save([FromBody]Product product)
{
if (customer == null)
{
return HttpBadRequest();
}
_manager.SaveCustomer(product);
return CreatedAtRoute("Get", new { controller = "Product", id = product.Id }, product);
}
</code></pre>
<p>[FromBody] Product product parameter ends up being null.</p>
| 0debug
|
window.location.href = 'http://attack.com?user=' + user_input;
| 1threat
|
int net_client_init(const char *device, const char *p)
{
static const char * const fd_params[] = {
"vlan", "name", "fd", NULL
};
char buf[1024];
int vlan_id, ret;
VLANState *vlan;
char *name = NULL;
vlan_id = 0;
if (get_param_value(buf, sizeof(buf), "vlan", p)) {
vlan_id = strtol(buf, NULL, 0);
}
vlan = qemu_find_vlan(vlan_id);
if (get_param_value(buf, sizeof(buf), "name", p)) {
name = strdup(buf);
}
if (!strcmp(device, "nic")) {
static const char * const nic_params[] = {
"vlan", "name", "macaddr", "model", NULL
};
NICInfo *nd;
uint8_t *macaddr;
int idx = nic_get_free_idx();
if (check_params(nic_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
if (idx == -1 || nb_nics >= MAX_NICS) {
fprintf(stderr, "Too Many NICs\n");
ret = -1;
goto out;
}
nd = &nd_table[idx];
macaddr = nd->macaddr;
macaddr[0] = 0x52;
macaddr[1] = 0x54;
macaddr[2] = 0x00;
macaddr[3] = 0x12;
macaddr[4] = 0x34;
macaddr[5] = 0x56 + idx;
if (get_param_value(buf, sizeof(buf), "macaddr", p)) {
if (parse_macaddr(macaddr, buf) < 0) {
fprintf(stderr, "invalid syntax for ethernet address\n");
ret = -1;
goto out;
}
}
if (get_param_value(buf, sizeof(buf), "model", p)) {
nd->model = strdup(buf);
}
nd->vlan = vlan;
nd->name = name;
nd->used = 1;
name = NULL;
nb_nics++;
vlan->nb_guest_devs++;
ret = idx;
} else
if (!strcmp(device, "none")) {
if (*p != '\0') {
fprintf(stderr, "qemu: 'none' takes no parameters\n");
return -1;
}
ret = 0;
} else
#ifdef CONFIG_SLIRP
if (!strcmp(device, "user")) {
static const char * const slirp_params[] = {
"vlan", "name", "hostname", "restrict", "ip", NULL
};
if (check_params(slirp_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
if (get_param_value(buf, sizeof(buf), "hostname", p)) {
pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf);
}
if (get_param_value(buf, sizeof(buf), "restrict", p)) {
slirp_restrict = (buf[0] == 'y') ? 1 : 0;
}
if (get_param_value(buf, sizeof(buf), "ip", p)) {
slirp_ip = strdup(buf);
}
vlan->nb_host_devs++;
ret = net_slirp_init(vlan, device, name);
} else if (!strcmp(device, "channel")) {
long port;
char name[20], *devname;
struct VMChannel *vmc;
port = strtol(p, &devname, 10);
devname++;
if (port < 1 || port > 65535) {
fprintf(stderr, "vmchannel wrong port number\n");
ret = -1;
goto out;
}
vmc = malloc(sizeof(struct VMChannel));
snprintf(name, 20, "vmchannel%ld", port);
vmc->hd = qemu_chr_open(name, devname, NULL);
if (!vmc->hd) {
fprintf(stderr, "qemu: could not open vmchannel device"
"'%s'\n", devname);
ret = -1;
goto out;
}
vmc->port = port;
slirp_add_exec(3, vmc->hd, 4, port);
qemu_chr_add_handlers(vmc->hd, vmchannel_can_read, vmchannel_read,
NULL, vmc);
ret = 0;
} else
#endif
#ifdef _WIN32
if (!strcmp(device, "tap")) {
static const char * const tap_params[] = {
"vlan", "name", "ifname", NULL
};
char ifname[64];
if (check_params(tap_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
fprintf(stderr, "tap: no interface name\n");
ret = -1;
goto out;
}
vlan->nb_host_devs++;
ret = tap_win32_init(vlan, device, name, ifname);
} else
#elif defined (_AIX)
#else
if (!strcmp(device, "tap")) {
char ifname[64];
char setup_script[1024], down_script[1024];
int fd;
vlan->nb_host_devs++;
if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
if (check_params(fd_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
fd = strtol(buf, NULL, 0);
fcntl(fd, F_SETFL, O_NONBLOCK);
net_tap_fd_init(vlan, device, name, fd);
ret = 0;
} else {
static const char * const tap_params[] = {
"vlan", "name", "ifname", "script", "downscript", NULL
};
if (check_params(tap_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
ifname[0] = '\0';
}
if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
}
if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) {
pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT);
}
ret = net_tap_init(vlan, device, name, ifname, setup_script, down_script);
}
} else
#endif
if (!strcmp(device, "socket")) {
if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
int fd;
if (check_params(fd_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
fd = strtol(buf, NULL, 0);
ret = -1;
if (net_socket_fd_init(vlan, device, name, fd, 1))
ret = 0;
} else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) {
static const char * const listen_params[] = {
"vlan", "name", "listen", NULL
};
if (check_params(listen_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
ret = net_socket_listen_init(vlan, device, name, buf);
} else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) {
static const char * const connect_params[] = {
"vlan", "name", "connect", NULL
};
if (check_params(connect_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
ret = net_socket_connect_init(vlan, device, name, buf);
} else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) {
static const char * const mcast_params[] = {
"vlan", "name", "mcast", NULL
};
if (check_params(mcast_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
ret = net_socket_mcast_init(vlan, device, name, buf);
} else {
fprintf(stderr, "Unknown socket options: %s\n", p);
ret = -1;
goto out;
}
vlan->nb_host_devs++;
} else
#ifdef CONFIG_VDE
if (!strcmp(device, "vde")) {
static const char * const vde_params[] = {
"vlan", "name", "sock", "port", "group", "mode", NULL
};
char vde_sock[1024], vde_group[512];
int vde_port, vde_mode;
if (check_params(vde_params, p) < 0) {
fprintf(stderr, "qemu: invalid parameter in '%s'\n", p);
return -1;
}
vlan->nb_host_devs++;
if (get_param_value(vde_sock, sizeof(vde_sock), "sock", p) <= 0) {
vde_sock[0] = '\0';
}
if (get_param_value(buf, sizeof(buf), "port", p) > 0) {
vde_port = strtol(buf, NULL, 10);
} else {
vde_port = 0;
}
if (get_param_value(vde_group, sizeof(vde_group), "group", p) <= 0) {
vde_group[0] = '\0';
}
if (get_param_value(buf, sizeof(buf), "mode", p) > 0) {
vde_mode = strtol(buf, NULL, 8);
} else {
vde_mode = 0700;
}
ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode);
} else
#endif
if (!strcmp(device, "dump")) {
int len = 65536;
if (get_param_value(buf, sizeof(buf), "len", p) > 0) {
len = strtol(buf, NULL, 0);
}
if (!get_param_value(buf, sizeof(buf), "file", p)) {
snprintf(buf, sizeof(buf), "qemu-vlan%d.pcap", vlan_id);
}
ret = net_dump_init(vlan, device, name, buf, len);
} else {
fprintf(stderr, "Unknown network device: %s\n", device);
ret = -1;
goto out;
}
if (ret < 0) {
fprintf(stderr, "Could not initialize device '%s'\n", device);
}
out:
if (name)
free(name);
return ret;
}
| 1threat
|
Pull mysql data between 2 dates : I have searched this site for what i need but i coulldnt find anything to my specific. I have a slight difficulty about pulling data between two dates from mysql. I know the system how to write the code to filter data between two dates but the issue i am having is these two dates are in different months. Let me explain further;
For example I need to pull the data between 25 January - and 24 February. So ideally i can set these dates manually but i need them to be set automatically according to the current time stamp. today is 7th January and the start date should be 25 December and end date should be 24 January and so on. So once we reach 25th Januray and date should be set to 24th of February.
Currently i have the following code and i set them manually.
<?php
$from = strtotime('25/12/2019 00:00');
$till = strtotime('24/01/2020 23:59');
$stmt = $con -> prepare("SELECT SUM(`amount`) as `total` FROM `income` WHERE user_id = ? && time >= ? && time <= ?");
$stmt -> bind_param('iii', $user_id, $from, $till);
$stmt -> execute();
$stmt -> store_result();
$stmt -> bind_result($total_income);
$stmt -> fetch();
?>
So is there any way to set these dates automatically according to the current time?
| 0debug
|
Install Python distribution or Not : <p>I am running Debian 10 and am wondering whether it is recommended to install a python distribution on it or not. This question comes because I see that Debian 10 comes with pre-installed python 2 and python 3 plus many python modules.</p>
<p>Is it not wastage of system space installing extra python distributions like anaconda python or any similar python distribution on such system? </p>
| 0debug
|
google Geometry Library in C# : <p>I have a point (latitude,longitude) ex : 25,-80 and I'm looking for a way in c# to check if this point is in specific polygon.</p>
<p>I did some research and I found that containsLocation function contained within the Google Maps Geometry Library does exactly what I need but it is not available for c#. Here is an examples in which this method is utlized in JS:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>// This example requires the Geometry library. Include the libraries=geometry
// parameter when you first load the API. For example:
// <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=geometry">
function initMap() {
var triangleCoords = [
{lat: 25.774, lng: -80.19},
{lat: 18.466, lng: -66.118},
{lat: 32.321, lng: -64.757}
];
var coords = new google.maps.LatLng(25.774, -80.19);
var bermudaTriangle = new google.maps.Polygon({paths: triangleCoords});
var result = google.maps.geometry.poly.containsLocation(coords, bermudaTriangle);
alert('The location exist in polygon: '+result);
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&libraries=geometry&callback=initMap"
async defer></script></code></pre>
</div>
</div>
</p>
<p>I found a c# library for gmaps google maps API for C# but it does not support the function containsLocation
Is there a way to do the required above in c#?</p>
| 0debug
|
void ff_aac_coder_init_mips(AACEncContext *c) {
#if HAVE_INLINE_ASM
AACCoefficientsEncoder *e = c->coder;
int option = c->options.aac_coder;
if (option == 2) {
e->quantize_and_encode_band = quantize_and_encode_band_mips;
e->encode_window_bands_info = codebook_trellis_rate;
#if HAVE_MIPSFPU
e->search_for_quantizers = search_for_quantizers_twoloop;
#endif
}
#if HAVE_MIPSFPU
e->search_for_ms = search_for_ms_mips;
#endif
#endif
}
| 1threat
|
Generate Random numbers with probability : <p>I was wondering how I could generate a list of random number (1, 2) but with different probability.
ie : 1 has a probability of 0.6 and 2 has a probability of 0.4.</p>
<p>Thanks! </p>
| 0debug
|
cannot assign to value 'colorTouched' is a 'let' constant : <p>beginner of swift, follow the book and get the error ""</p>
<p>here is the code:</p>
<pre><code>@IBAction func buttonTouched(sender : UIButton) {
var buttonTag : Int = sender.tag
if let colorTouched = ButtonColor(rawValue: buttonTag) {
if currentPlayer == .Computer {
return
}
//error here:
if colorTouched = inputs[indexOfNextButtonToTouch] {
indexOfNextButtonToTouch += 1
if indexOfNextButtonToTouch == inputs.count {
// 玩家成功地完成了这一轮
if advanceGame() == false {
playerWins()
}
indexOfNextButtonToTouch = 0
}
else {
}
}
else {
playerLoses()
indexOfNextButtonToTouch = 0
}
}
}
</code></pre>
<p>so if I cannot use "if let colorTouched", what should I do with it?</p>
| 0debug
|
How to make an element visible after went to it's position : I want to make an object is visible when user goes to it's location.(It's a HTML document.) Here's the example code.
<HTML>
<BODY>
<div id="top">
<P>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</P>
<div id="bottom" style="visibility: hidden;">
<P>Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</P>
</div>
</BODY>
</HTML>
When user scrolled to bottom (Or typed 'pagename.html#bottom' on URL bar) bottom <div> should be visible. How to write a code for this? (Accept html,css and javascript)
| 0debug
|
Kali Linux Installing Bluto : <p>Could somebody help me with the following problem? It would be much appreciated.</p>
<p><strong>Goal</strong> : To install Bluto on Kali Linux 2020.1 using <code>sudo pip install bluto</code> command</p>
<p><strong>Problem</strong> : Install does not complete</p>
<p><strong>Error message:</strong></p>
<p><code>ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9scbuzrf/pdfminer/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9scbuzrf/pdfminer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-9scbuzrf/pdfminer/pip-egg-info
cwd: /tmp/pip-install-9scbuzrf/pdfminer/
Complete output (8 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-9scbuzrf/pdfminer/setup.py", line 3, in <module>
from pdfminer import __version__
File "/tmp/pip-install-9scbuzrf/pdfminer/pdfminer/__init__.py", line 5
print __version__
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(__version__)?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
</code></p>
<p>Im running :
Kali Linux 2020.1<br>
Python 3.8.1 (default, Jan 19 2020, 22:34:33)
git version 2.25.0
pip 20.0.2 from /home/kali/.local/lib/python3.8/site-packages/pip (python 3.8)</p>
<p><strong>Screenshot</strong> </p>
<p><a href="https://i.stack.imgur.com/8jhm4.png" rel="nofollow noreferrer">Bluto Kali Linux install error</a></p>
| 0debug
|
SSMS 2016 Error Importing Azure SQL v12 bacpac: master keys without password not supported : <p>I have done this dozens of times but just recently ran into this error. Here are the steps I have gone through to get here:</p>
<ol>
<li>Create a copy of my Azure SQL v12 database on the same server as the original</li>
<li>Export the copy-version (completely inactive from user interaction) to blob storage</li>
<li>Download the .bacpac file from blob storage to my local drive</li>
<li>In SSMS (October 2016 release) my local sql server instance, right click Databases and choose 'Import Data Tier Application'</li>
<li>Choose my recently downloaded bacpac file and start the import</li>
</ol>
<p>It only takes a few seconds for it to bomb out and I get the error:</p>
<pre><code>Error SQL72014: .Net SqlClient Data Provider: Msg 33161, Level 15, State 1, Line 1 Database master keys without password are not supported in this version of SQL Server
Error SQL72045: Script execution error. The executed script: CREATE MASTER KEY;
</code></pre>
<p>I followed the same process for the same database 1.5 months ago any everything worked fine...Is anyone else experiencing this??? I have SSDT version 14.0.61021.0 installed - not sure if that matters or not. I'm also running SQL Server 2016 Developer Edition (v13.0.1722.0).</p>
| 0debug
|
How to do retrieve slq data and display in php page : i want to retrieve particular cell data from mysql. and it should display in a php page.
details-
db name: register,
columns are: username, fullname, email, password.
i want to display 'fullname' column first row data in php.
how to do that.
| 0debug
|
hello to all, I am new in laravel framework : I am creating admin panel ...when user update her/his profile its userid read by update controller method using route name update.And update controller method return view updatedata along with array.I amusing ORM DATABASE
My controller method[update] file is
public function update($id)
{
$records = Register::find($id);
return view('updatedata',['records' => $records]);
}
My updatedata.blade.php file is
@extends('layout/master')
@section('content')
<h1 align="center">
@foreach($records as $records)
{!! Form::open(['route'=>'f.update']) !!}
<table border="2" align="center">
<tr>
<td>{!! Form::label('name','Name') !!}</td>
<td>{!! Form::text('name',$records->name) !!}</td>
</tr>
<tr>
<td>{!!Form::label('phone','Phone')!!}</td>
<td>{!! Form::text('phone',$records->phone) !!}</td>
</tr>
<tr>
<td>{!! Form::label('email','E-mail') !!}</td>
<td>{!! Form::email('email',$records->name) !!}</td>
</tr>
<tr>
<td>{!! Form::label('course','Course') !!}</td>
<td>{!! Form::select('course',['MCA'=>'MCA','BTECH'=>'BTECH','BCA'=>'BCA'],$records->course) !!}</td>
</tr>
<tr>
<td>{!! Form::label('address','Address') !!}</td>
<td>{!! Form::textarea('address', $records->address, ['size' => '30x3']) !!}</td>
</tr>
<tr>
<td colspan="2">
{!! Form::hidden('id',$records->id) !!}
</td>
</tr>
<tr>
<td colspan="2" align="center">{!! Form::submit() !!}</td>
</tr>
</table>
{!! Form::close() !!}
@endforeach
</h1>
@endsection
The error is
2/2
ErrorException in 4de1c6468785010f583b37a90fa7bed16c4e92a7.php line 10:
Trying to get property of non-object (View: C:\xampp\htdocs\laravel\resources\views\updatedata.blade.php)
| 0debug
|
Switch the integer to its opposite in python : <p>I'm wondering if there is some built in function in python that will change whatever the sign of an integer is to its opposite. </p>
<p>example of what I'm looking for:</p>
<pre><code>num = 1
num2 = -2
# where flip() is a hypothetical function
flip(num)
flip(num2)
print(num)
print(num2)
>>> -1
>>> 2
</code></pre>
<p>I know how to create my own function to do this, but it seems there may be a built-in, or some short hand way to go about it.</p>
| 0debug
|
Android - EditText set error : im trying to set error on my edit text if the user perssed the login button without fill the text fields. I have tried several codes , but nothing helped. The application was crashing every time i ran it.
**this this is the code**
public class LoginFragment extends Fragment {
private ProgressDialog progressDialog;
private FirebaseAuth firebaseAuth;
EditText email,password;
Button login;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.activity_login_fragment, container, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
firebaseAuth = firebaseAuth.getInstance();
progressDialog = new ProgressDialog(getActivity());
login = (Button)getActivity().findViewById(R.id.loginBtn);
email = (EditText)getActivity().findViewById(R.id.regEmailEt);
password = (EditText)getActivity().findViewById(R.id.regPasswordEt);
login.setOnClickListener(new View.OnClickListener() {
String email1;
String password1;
@Override
public void onClick(View v) {
if(email.getText().length() == 0){
email.setError("Please enter your email");
}
if(password.getText().length() == 0){
password.setError("Please enter your password");
}
email1 = email.getText().toString();
password1 = password.getText().toString();
progressDialog.setMessage("Processing...");
progressDialog.show();
FirebaseAuth.getInstance().createUserWithEmailAndPassword(email1, password1)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(Task<AuthResult> task) {
if (task.isSuccessful()) {
startActivity(new Intent(getActivity(), MainActivity.class));
progressDialog.dismiss();
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
Toast.makeText(getActivity(), "Error:" + e.getMessage(), Toast.LENGTH_LONG).show();
progressDialog.dismiss();
}
});
}
});
}
}
when the login button pressed it should active the setOnClickListener.
there i want to check if the text fields are empty, if they are so i want to setError in the textEdit. else , i want it to continue.
I'm pretty sure that my code is wrong, so i need your advise guys.
| 0debug
|
Can`t make password_verify() work : Okay, I hope it is not duplicate, but other posts didn`t help me.
I hash password before it is store into DB. When I want to get it back and compare with user input I always get "password does not match". I tried a lot of fixes but nothing seems to work. May be the problem is with my syntax, I am not good with php.
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
if (password_verify($RegisteredPass, $row['pass']))
{
echo "tchd";
echo "ID:".$row['id'] ."|Name:".$row['name']. "|User:".$row['user'];
}
else{
echo "pass doesn`t match";
}
}
} else {
echo "user not found";
}
Hashing password
$hassedPassword = password_hash($password, PASSWORD_DEFAULT, ['cost' => 12]);
I am not very concern about security, because it is just for a project. I just need to make it work.
| 0debug
|
How to click a "DIV" element on a site, using JavaSript : I want to click the "continue" which is given on the end of [this][1] page. It is located after the pagination, I tried to click it this way : `document.querySelector(".se-pagination-button.se-pagination-button--next").click();` but failed. Is there anyway I can click it ?
[1]: https://www.merckgroup.com/de/careers/job-search.html#query%3A%2Cpage%3A1%2Ccountry%3Aall%2Cstate%3Aall%2Ccity%3Aall%2CfunctionalArea%3Aall%2CcareerLevel%3Aall%2CemploymentType%3Aall
| 0debug
|
Count multiple rows based one one row : I think I'm just not getting search results as this should be answered somewhere here since I'm having trouble just typing a title.
My table looks like this:
Name - Element - City
Design Inc - 51024 - New York
Plant Corp - 51024 - Chicago
Energy Ltd - 9665 - Boston
If I write
Select Name, Element, City
From Table
Where City = 'New York'
Based on the Element, here it's the same value, I want the output to be a count of
For New York
Name = 2
Element = 1
The same output would be for Chicago. I'm having trouble with where clause because obviously if I put = to a city, all I get is one row.
Thanks
| 0debug
|
android studio get element position of an array : I am developing a small project in android studio where I have a listview where the data is entered through an array. But what I need is when the user selects some element from the list, based on the position of the element loading all the data in another activity
class that sends the data (position)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_noticias);
mAdapter = new NoticiasAdapter(Noticias.this, mList);
setListAdapter(mAdapter);
}
public void onResume() {
super.onResume();
preencherlista();
mAdapter.notifyDataSetChanged();
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
mList.get(position);
Intent intent = new Intent(getBaseContext(), NoticiasValor.class);
intent.putExtra("valor","position");
startActivity(intent);
}
public void preencherlista() {
mList.add(new NoticiasDados("Jose", "Maria"));
mList.add(new NoticiasDados("Maria","Alfredo"));
mList.add(new NoticiasDados("Luis","Sonia"));
}
}
class that receives and displays
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.noticas_valor_layout);
/*Intent mIntent = getIntent();
int intValue = mIntent.getIntExtra("valor",0);*/
int intValue= getIntent().getIntExtra("valor",0);
TextView a = (TextView) findViewById(R.id.txttitulo2);
a.setText(mList.get(intValue).getTitulo());
TextView b = (TextView) findViewById(R.id.txttexto2);
b.setText(mList.get(intValue).getTexto());
}
| 0debug
|
I want to clean the element in a list. If my list contains number 1 ans a stirng "1" i want to keep only one element either integer or sting. : l = [1,2,3,4,5,'1','2','3','4','nag','nag','venkat',5,6,7]
l1 = []
for i in l:
if (str(i) not in l1) and (i not in l1):
l1.append(i)
print l1
""" i want to clean my list my list contais numbers and stings.
in the above list l i have both 1 and "1"
i want to remove either 1 or "1"
i want the out put as
[1,2,3,4,5,"nag","venkat",6,7]
l = [1,2,3,4,5,'1','2','3','4','nag','nag','venkat',5,6,7]
l1 = []
for i in l:
if (str(i) not in l1) and (i not in l1):
l1.append(i)
print l1
"""
| 0debug
|
How to set AlertDialog to don't close clicking outside in flutter : <p>I built an AlertDialog to display Loading while i'm authenticating the user and when it finishes i pop it. </p>
<pre><code>Widget loadingDialog = new AlertDialog(
content: new Row(
children: <Widget>[
new CircularProgressIndicator(),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text("Loading..."),
),
],
),);
</code></pre>
<p>But, if the user taps outside the Dialog it closes. So when the auth finishes, it will still pop something (i guess the scaffol), breaking the app.
How can i make Dialog not closable? </p>
| 0debug
|
static void stellaris_enet_write(void *opaque, hwaddr offset,
uint64_t value, unsigned size)
{
stellaris_enet_state *s = (stellaris_enet_state *)opaque;
switch (offset) {
case 0x00:
s->ris &= ~value;
DPRINTF("IRQ ack %02x/%02x\n", value, s->ris);
stellaris_enet_update(s);
if (value & SE_INT_TXER)
s->tx_frame_len = -1;
break;
case 0x04:
DPRINTF("IRQ mask %02x/%02x\n", value, s->ris);
s->im = value;
stellaris_enet_update(s);
break;
case 0x08:
s->rctl = value;
if (value & SE_RCTL_RSTFIFO) {
s->rx_fifo_len = 0;
s->np = 0;
stellaris_enet_update(s);
}
break;
case 0x0c:
s->tctl = value;
break;
case 0x10:
if (s->tx_frame_len == -1) {
s->tx_frame_len = value & 0xffff;
if (s->tx_frame_len > 2032) {
DPRINTF("TX frame too long (%d)\n", s->tx_frame_len);
s->tx_frame_len = 0;
s->ris |= SE_INT_TXER;
stellaris_enet_update(s);
} else {
DPRINTF("Start TX frame len=%d\n", s->tx_frame_len);
s->tx_frame_len += 14;
if ((s->tctl & SE_TCTL_CRC) == 0)
s->tx_frame_len += 4;
s->tx_fifo_len = 0;
s->tx_fifo[s->tx_fifo_len++] = value >> 16;
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
}
} else {
s->tx_fifo[s->tx_fifo_len++] = value;
s->tx_fifo[s->tx_fifo_len++] = value >> 8;
s->tx_fifo[s->tx_fifo_len++] = value >> 16;
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
if (s->tx_fifo_len >= s->tx_frame_len) {
if ((s->tctl & SE_TCTL_CRC) == 0)
s->tx_frame_len -= 4;
if ((s->tctl & SE_TCTL_PADEN) && s->tx_frame_len < 60) {
memset(&s->tx_fifo[s->tx_frame_len], 0, 60 - s->tx_frame_len);
s->tx_fifo_len = 60;
}
qemu_send_packet(qemu_get_queue(s->nic), s->tx_fifo,
s->tx_frame_len);
s->tx_frame_len = -1;
s->ris |= SE_INT_TXEMP;
stellaris_enet_update(s);
DPRINTF("Done TX\n");
}
}
break;
case 0x14:
s->conf.macaddr.a[0] = value;
s->conf.macaddr.a[1] = value >> 8;
s->conf.macaddr.a[2] = value >> 16;
s->conf.macaddr.a[3] = value >> 24;
break;
case 0x18:
s->conf.macaddr.a[4] = value;
s->conf.macaddr.a[5] = value >> 8;
break;
case 0x1c:
s->thr = value;
break;
case 0x20:
s->mctl = value;
break;
case 0x24:
s->mdv = value;
break;
case 0x28:
break;
case 0x2c:
s->mtxd = value & 0xff;
break;
case 0x30:
case 0x34:
case 0x38:
case 0x3c:
break;
default:
hw_error("stellaris_enet_write: Bad offset %x\n", (int)offset);
}
}
| 1threat
|
javascript - Stop script from working if screen height smaller than 790 : $(function(){
if($("#PopularPosts1").length) {var o=$("#PopularPosts1"),t=$("#PopularPosts1").offset().top,i=$("#PopularPosts1").height();$(window).scroll(function(){var s=$("#upfooter2").offset().top-i-20,f=$(window).scrollTop();if(f>t?o.css({position:"fixed",top:48,width: 318}):o.css("position","static"),f>s){var n=s-f;o.css({top:n})}})}
});
| 0debug
|
Send table as an email body (not attachment ) in Python : <p>My input file is a CSV file and by running some python script which consists of the python Tabulate module, I have created a table that looks like this below:-</p>
<p><a href="http://i.stack.imgur.com/Lmjt1.png" rel="noreferrer">tabulate_output</a>
or </p>
<pre><code>| Attenuation | Avg Ping RTT in ms | TCP UP |
|---------------:|---------------------:|---------:|
| 60 | 2.31 | 106.143 |
| 70 | 2.315 | 103.624 |
</code></pre>
<p>I would like to send the this table in the email body and <strong>not as an</strong> <strong>attachment</strong> using python.</p>
<p>I have created a sendMail function and will be expecting to send the table in the mail_body.
<code>sendMail([to_addr], from_addr, mail_subject, mail_body, [file_name])
</code></p>
| 0debug
|
Appending a to-do list : <p>I am trying to make a "to do list" app. I am trying to append what I put in the input into a list under "To Do" with a "Done" button. Here is what I have so far:</p>
<p>HTML:</p>
<pre><code><!DOCTYPE html>
<html>
<link rel="stylesheet" text="text/css" href="doneit.css">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
</head>
<body>
<div id="container">
<input type="text" id="task" placeholder="New Task"/>
<button id="enter">Enter</button>
<div class="todo">
<ul id="chores"><h2>To Do:</h2></ul>
</div>
<button id="reset">New List</button>
</div>
<script type="text/javascript" src="doneit.js"></script>
</body>
</html>
</code></pre>
<p>and the Javascript:</p>
<pre><code>$(document).ready(
function() {
var chores=[];
$("#enter").click(function () {
var task = $("#task").val();
var $btn = $('<button />', {
id: "check",
type: "button",
text: "Done",
value: task,
click: function(){
var did = this.value;
$("#todo").append('<p>'+ check+'</p>');
chores.push(check);
}
});
$(".reset").click(function() {
location.reload();
});
</code></pre>
| 0debug
|
Conversion of PDF to XML using Machine Learning : <p>I was given a work to convert PDF to XML. In XML, I have to display some values which are in PDF.
And I was asked to use Python-3 and Machine Learning to extract the values.</p>
<p>Any Suggestions or ideas on how to create an ML model to extract info from PFDs.</p>
<p><strong>Problem in Detail :</strong>
if i have a pdf having values, for example : </p>
<p>emp id : 10000
name : raam</p>
<p>Then i have to extract the empid and name from PDF and display them to XML document.</p>
<p><strong>Note : The model should be able to process thousands of PDFs and convert them to XML docs.</strong></p>
<p>Thank U...</p>
| 0debug
|
Can a prompt take two arguments at the same time and parse it into two different variables : Example:
var something = prompt(variable storing a number , variable storing a string)
console.log(variable storing a string);
let me know if this is legal or just pure crap or let me know if it needs more explanation
| 0debug
|
mysqli_fetch_all() not working when table name is a variable : <p>I am trying to get an array from a database. I got the table name from a previous PHP file and I am trying to return the array. However, it only responds with an error.</p>
<p>If I replace the $db_name in the query with the name as a string it works fine but that is not what I want. I don't know why it is not working. Is it just not liking the query? It only does not work when I put in the table name as a variable.</p>
<pre><code> $db_name = $_SESSION['databaseMenu'];
echo $db_name;
$sql="SELECT feed FROM '".$db_name."' ";
$result=mysqli_query($con,$sql);
// Fetch all
$outp = mysqli_fetch_all($result,MYSQLI_ASSOC);
$arra = array_values($outp);
return $arra;
</code></pre>
<p>Like I said earlier, when the query is a simple text it returns the array however when I put in the variable it responds with the error:
'''
Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in
'''</p>
<p>Any advice is appreciated.</p>
| 0debug
|
void g_free(void *ptr)
{
size_t *p;
p = (size_t *)((char *)ptr - 16);
munmap(p, *p);
}
| 1threat
|
define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14) : <p>boost
auto_rec.hpp</p>
<p>What does mean p##(13) here:
define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14)</p>
<p>In what it translates?</p>
| 0debug
|
How access HTML image item <data-bit="155">, from CSS code in RANGE MODE 15>37 : Simple and fast:
----
HTML + CSS (no js) - code work 100% but 1 thing:
<!-- ***** HTML CODE ***** -->
<!-- (more) -->
<img src="img/sample.jpg" class="154" ></img>
<img src="img/sample.jpg" class="155" ></img>
<img src="img/sample.jpg" class="156" ></img>
<img src="img/sample.jpg" class="157" ></img>
<img src="img/sample.jpg" class="158" ></img>
<!-- (more) -->
/* ***** CSS code ***** */
.114,
.358
{
left: 50px;
}
Need to acces element in RANGE mode: [From .114 To .358]
-
-
thanks in advance
| 0debug
|
Catching ERROR_ALREADY_EXISTS and similar errors with CreateDirectory() : <p>I am looking to make a program using CreateDirectory(), RemoveDirectory(), and similar functions. One of the possible return errors from these commands ERROR_ALREADY_EXISTS. I want an if statement to catch this error and post a message on the screen and continue. </p>
| 0debug
|
React Native, AppStore requests NSLocationAlwaysUsageDescription value : <p>I have an app with React Native. I've been uploading correctly to the app store, but today the app is rejected with the following message:</p>
<blockquote>
<p>Missing Info.plist key - This app attempts to access privacy-sensitive
data without a usage description. The app's Info.plist must contain an
NSLocationAlwaysUsageDescription key with a string value explaining to
the user how the app uses this data.</p>
<p>Missing Info.plist key - This app attempts to access privacy-sensitive
data without a usage description. The app's Info.plist must contain an
NSLocationWhenInUseUsageDescription key with a string value explaining
to the user how the app uses this data.</p>
</blockquote>
<p>My app doesn't use any kind of location service. The npm packages have not changed since the last version published to the app store neither have been updated, they are the same versions.</p>
<p>So I don't understand why Apple is saying that I am attempting to access the user location.</p>
<p>It is a change in the Apple Store? How can I check where is my app trying to access the user location?</p>
<p>This is my packages.json</p>
<pre><code> "dependencies": {
"axios": "^0.17.1",
"lodash": "^4.17.4",
"moment": "^2.18.1",
"react": "^16.0.0",
"react-addons-shallow-compare": "^15.5.2",
"react-native": "0.53.0",
"react-native-drawer": "^2.3.0",
"react-native-elements": "^0.19.0",
"react-native-fetch-blob": "^0.10.5",
"react-native-fs": "^2.3.3",
"react-native-linear-gradient": "^2.0.0",
"react-native-onesignal": "^3.0.7",
"react-native-orientation": "^3.0.0",
"react-native-pdf": "^3.0.0",
"react-native-progress": "^3.4.0",
"react-native-render-html": "^3.8.1",
"react-native-router-flux": "^4.0.0-beta.28",
"react-native-vector-icons": "^4.1.1",
"react-native-video": "^2.0.0",
"react-native-video-controls": "^2.0.0",
"react-redux": "^5.0.4",
"redux": "^3.6.0",
"redux-thunk": "^2.2.0"
}
</code></pre>
<p>Thank you.</p>
| 0debug
|
T-SQL How to create function that comapres string, checks difference, and do special function : First - sorry for my english. Second - i'm learning t-SQL.
----------
**Goal:**
I want to get difference between two strings, then check in which column is this difference. If the difference is in first column, do something, if in second column - do something else.
----------
**What I'm actually doing**
Column 'messages' is a string which contains list of ID. So i am replacing all '#' with ',' and deleting last ',' what gives to me **ActualID** and **BeforeID** column. See below:
DECLARE @string VARCHAR(512);
DECLARE @string2 VARCHAR(512);
DECLARE @string3 VARCHAR(512);
SET @string = '41#42#43#44#45#46#47#48#49#50#51#52#53#54#55#56#57#58#59#';
SET @string2 = REPLACE((SELECT messages FROM USERS WHERE userid = 4), '#', ', ' )
SET @string3 = left(@string2, len(@string2) - 1);
SET @string2 = REPLACE(@string, '#', ', ' )
SET @string = left(@string2, len(@string2) - 1);
SELECT @string3 as ActualID, @string as BeforeID
[![myquery][1]][1]
[1]: https://i.stack.imgur.com/6nLDR.png
----------
So now, I want compare **BeforeID** with **ActualID**. For example:
In BeforeID we have `1, 2, 3` / In **ActualID** `1, 2, 3, 4`
In example above `4` was added. So, if it was added I want to add it to `@AddedElements`.
If `4, 5, 7` were added then `SELECT @AddedElements as AddedElements` should return `4, 5, 7` (With comas)
But, that's not all.
If **BeforeID** = `1, 5, 10, 14` and **ActualID** = `1, 5, 14` I want, that element which is in **BeforeID**, but not in **AcutalID** will be added to @DeletedElements.
So `SELECT @DeletedElements as DeletedElements` should return `10`
Added elements/Deleted elements should be returned once. I mean, full result what I want to Earn should be
`SELECT @AddedElements as AddedElements, @DeletedElements as DeletedElements`
----------
Is it possible? If, then how to do it?
| 0debug
|
Can someone explain why do I get this output in Python? : <p><a href="https://i.stack.imgur.com/31HaK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/31HaK.png" alt="enter image description here"></a>So, I'm trying to call the function grocery_shopping- which accepts as arguments-greeting, an iterable (emp_name) and a dictionary (items).
I'm passing arguments by keywords.
However the output seems slightly weird since the argument passed as emp_name is being read as items!
Can anyone help me in deciphering this (seemingly odd) behavior? </p>
| 0debug
|
how to change the key values of an array in PHP : <p>I want to know how to change the key values of an array using PHP</p>
<p>Input array :</p>
<pre><code>Array ( [2] => one [3] => Array [5] => two [6] => three [8] => four )
</code></pre>
<p>I want output like given below,</p>
<pre><code>Array ( [0] => one [1] => Array [2] => two [3] => three [4] => four )
</code></pre>
<p>Please anyone help..</p>
| 0debug
|
Prevent HTML file input from selecting files in Google Drive while using Android's native file chooser : <p>Currently I'm working on a page that allows users to upload a file to Firebase Storage. When opening the site through Google Chrome on Android and selecting a file for upload from a standard HTML file input, it uses Android's native file chooser.</p>
<p>In most cases, a user would choose a file stored locally on the device, but the file chooser also shows their Google Drive files and a user currently isn't prevented from selecting one of those files. The file is returned as a File object in Javascript, but when the upload to Firebase Storage is attempted it throws the error: "net::ERR_UPLOAD_FILE_CHANGED" and eventually exceeds it's retry limit.</p>
<p>To prevent confusion for the user, I'd like to prevent the user from selecting a Google Drive file in Android's file chooser, or at the very least recognize that it can't be uploaded and warn the user.</p>
<p>I considered checking the File object returned by the input element, but there isn't any indication to tell a local file from a Google Drive file.</p>
<pre class="lang-html prettyprint-override"><code><input type="file" id="upload_input" class="hide"/>
</code></pre>
<pre><code>$("#upload_input").change(function(e) {
if (!e.target.files) {
return;
}
const file = e.target.files[0];
uploadFile(file);
});
uploadFile(file) {
...
const storageRef = firebase.storage().ref();
const fileRef = storageRef.child(`${userID}/uploads/${file.name}`);
const uploadTask = fileRef.put(file);
...
}
</code></pre>
| 0debug
|
static void test_opts_parse_number(void)
{
Error *err = NULL;
QemuOpts *opts;
opts = qemu_opts_parse(&opts_list_01, "number1=0", false, &error_abort);
g_assert_cmpuint(opts_count(opts), ==, 1);
g_assert_cmpuint(qemu_opt_get_number(opts, "number1", 1), ==, 0);
opts = qemu_opts_parse(&opts_list_01,
"number1=18446744073709551615,number2=-1",
false, &error_abort);
g_assert_cmpuint(opts_count(opts), ==, 2);
g_assert_cmphex(qemu_opt_get_number(opts, "number1", 1), ==, UINT64_MAX);
g_assert_cmphex(qemu_opt_get_number(opts, "number2", 0), ==, UINT64_MAX);
opts = qemu_opts_parse(&opts_list_01, "number1=18446744073709551616",
false, &error_abort);
g_assert_cmpuint(opts_count(opts), ==, 1);
g_assert_cmpuint(qemu_opt_get_number(opts, "number1", 1), ==, UINT64_MAX);
opts = qemu_opts_parse(&opts_list_01, "number1=-18446744073709551616",
false, &error_abort);
g_assert_cmpuint(opts_count(opts), ==, 1);
g_assert_cmpuint(qemu_opt_get_number(opts, "number1", 1), ==, UINT64_MAX);
opts = qemu_opts_parse(&opts_list_01, "number1=0x2a,number2=052",
false, &error_abort);
g_assert_cmpuint(opts_count(opts), ==, 2);
g_assert_cmpuint(qemu_opt_get_number(opts, "number1", 1), ==, 42);
g_assert_cmpuint(qemu_opt_get_number(opts, "number2", 0), ==, 42);
opts = qemu_opts_parse(&opts_list_01, "number1=", false, &err);
g_assert_cmpuint(opts_count(opts), ==, 1);
g_assert_cmpuint(qemu_opt_get_number(opts, "number1", 1), ==, 0);
opts = qemu_opts_parse(&opts_list_01, "number1=eins", false, &err);
error_free_or_abort(&err);
g_assert(!opts);
opts = qemu_opts_parse(&opts_list_01, "number1= \t42",
false, &error_abort);
g_assert_cmpuint(opts_count(opts), ==, 1);
g_assert_cmpuint(qemu_opt_get_number(opts, "number1", 1), ==, 42);
opts = qemu_opts_parse(&opts_list_01, "number1=3.14", false, &err);
error_free_or_abort(&err);
g_assert(!opts);
opts = qemu_opts_parse(&opts_list_01, "number1=08", false, &err);
error_free_or_abort(&err);
g_assert(!opts);
opts = qemu_opts_parse(&opts_list_01, "number1=0 ", false, &err);
error_free_or_abort(&err);
g_assert(!opts);
qemu_opts_reset(&opts_list_01);
}
| 1threat
|
static inline void downmix_2f_1r_to_mono(float *samples)
{
int i;
for (i = 0; i < 256; i++) {
samples[i] += (samples[i + 256] + samples[i + 512]);
samples[i + 256] = samples[i + 512] = 0;
}
}
| 1threat
|
How can I stop pgadmin 4 process? : <p>How can I stop pgadmin 4 process?
I ran pgadmin 4 next method:</p>
<p><code>python3 /usr/local/pgAdmin4.py</code></p>
<p>My idea using Ctrl-c.</p>
| 0debug
|
How to store items of a list in class1 on another list in class2 : <p>I have two classes: Tache2new.java and Luncher.java.
In Tache2new, I use a list named "rules" to store items.</p>
<pre><code>public static void execute(String concept) {
List<Rule> rules = new ArrayList<>();
…
}
</code></pre>
<p>I would like to call this list in the class Luncher and store its items in ALLrules which is a list in Luncher.</p>
<p>To do this, I added getList() method in Tache2new (line 239). And I added in Luncher the lines ending with the comment //$$ (see the capture). But this triggered an error (highlighted in yellow in Luncher): "the local variable rules may not have been initialized".
How to fix this please?
<a href="https://i.stack.imgur.com/nJYT4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nJYT4.png" alt="enter image description here"></a></p>
<hr>
<p><a href="https://i.stack.imgur.com/T1HrI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T1HrI.png" alt="enter image description here"></a></p>
| 0debug
|
target_ulong helper_rdhwr_cc(CPUMIPSState *env)
{
check_hwrena(env, 2);
#ifdef CONFIG_USER_ONLY
return env->CP0_Count;
#else
return (int32_t)cpu_mips_get_count(env);
#endif
}
| 1threat
|
How to send data from android to server after 3-5 sec? : <p>I want to know If I send HttpClient request from android repeatedly after 5 sec using async task would it create any problem. If it creates any problem then how should I send data to my server in a repeated manner? </p>
| 0debug
|
values from dictionary in list : I have list containing dictionaries like this
[{"abc":"da123-tap","efg":"xyzf","acd":"123-brf"}, {"abc":"ab234-tap","efg":"yuvi","acd":"345-brf"}]
I want all the values of "abc" in one list1, values of "efg" in list 2
| 0debug
|
static uint32_t sh_serial_ioport_read(void *opaque, uint32_t offs)
{
sh_serial_state *s = opaque;
uint32_t ret = ~0;
#if 0
switch(offs) {
case 0x00:
ret = s->smr;
break;
case 0x04:
ret = s->brr;
break;
case 0x08:
ret = s->scr;
break;
case 0x14:
ret = 0;
break;
}
#endif
if (s->feat & SH_SERIAL_FEAT_SCIF) {
switch(offs) {
case 0x00:
ret = s->smr;
break;
case 0x08:
ret = s->scr;
break;
case 0x10:
ret = 0;
if (s->flags & SH_SERIAL_FLAG_TEND)
ret |= (1 << 6);
if (s->flags & SH_SERIAL_FLAG_TDE)
ret |= (1 << 5);
if (s->flags & SH_SERIAL_FLAG_BRK)
ret |= (1 << 4);
if (s->flags & SH_SERIAL_FLAG_RDF)
ret |= (1 << 1);
if (s->flags & SH_SERIAL_FLAG_DR)
ret |= (1 << 0);
if (s->scr & (1 << 5))
s->flags |= SH_SERIAL_FLAG_TDE | SH_SERIAL_FLAG_TEND;
break;
case 0x14:
if (s->rx_cnt > 0) {
ret = s->rx_fifo[s->rx_tail++];
s->rx_cnt--;
if (s->rx_tail == SH_RX_FIFO_LENGTH)
s->rx_tail = 0;
if (s->rx_cnt < s->rtrg)
s->flags &= ~SH_SERIAL_FLAG_RDF;
}
break;
#if 0
case 0x18:
ret = s->fcr;
break;
#endif
case 0x1c:
ret = s->rx_cnt;
break;
case 0x20:
ret = s->sptr;
break;
case 0x24:
ret = 0;
break;
}
}
else {
#if 0
switch(offs) {
case 0x0c:
ret = s->dr;
break;
case 0x10:
ret = 0;
break;
case 0x14:
ret = s->rx_fifo[0];
break;
case 0x1c:
ret = s->sptr;
break;
}
#endif
}
#ifdef DEBUG_SERIAL
printf("sh_serial: read offs=0x%02x val=0x%x\n",
offs, ret);
#endif
if (ret & ~((1 << 16) - 1)) {
fprintf(stderr, "sh_serial: unsupported read from 0x%02x\n", offs);
assert(0);
}
return ret;
}
| 1threat
|
why c accept a string in a int variable : <p>This is my first question here, sorry if I did something wrong.
I have to make a program that identify the classification of a swimmer. The program does this, but when i write a string, it accept like a int variable.
why this happens and how I fix this.
thanks </p>
<pre><code>printf("Write the age of the swimmer\n");
scanf("%d", &age);
if(age < 5)
printf("minimum age is five years old\n");
else if(age >= 5 && age <= 7)
printf("Category: child A\n");
else if(age >= 8 && age <= 11)
printf("Category: child B\n");
else if(age >= 12 && age <= 13)
printf("Category: Juvenile A\n");
else if(age >= 14 && age <= 17)
printf("Category: Juvenile A\n");
else if(age >= 18)
printf("Category: Adult\n");
else
printf("Write only numbers\n");
system("PAUSE");
return 0;
</code></pre>
| 0debug
|
Can I clone only the metadata/version tracking folder from github : <p>My project is in many GBs. All I need is <code>git log</code> . Ideally it should suffice for me if I can just fetch the <code>.git</code> folder which tracks the versions.</p>
| 0debug
|
NPM warn message about deprecated package : <p>I am installing a module globally</p>
<pre><code>$ npm install -g X
</code></pre>
<p>and NPM says</p>
<blockquote>
<p>"npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer
maintained. Upgrade to lodash@^4.0.0"</p>
</blockquote>
<p>how can I find out which module has an dependency on this old version of lodash?</p>
<p>The warning message from NPM doesn't seem to give me any clue which module references this old version (I believe that the module X does not have a direct dependency on this old version of lodash.).</p>
| 0debug
|
static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
{
int i;
for(i=0; i<dstW; i++)
{
int val=1<<18;
int j;
for(j=0; j<lumFilterSize; j++)
val += lumSrc[j][i] * lumFilter[j];
dest[i]= av_clip_uint8(val>>19);
}
if(uDest == NULL)
return;
if(dstFormat == PIX_FMT_NV12)
for(i=0; i<chrDstW; i++)
{
int u=1<<18;
int v=1<<18;
int j;
for(j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
v += chrSrc[j][i + 2048] * chrFilter[j];
}
uDest[2*i]= av_clip_uint8(u>>19);
uDest[2*i+1]= av_clip_uint8(v>>19);
}
else
for(i=0; i<chrDstW; i++)
{
int u=1<<18;
int v=1<<18;
int j;
for(j=0; j<chrFilterSize; j++)
{
u += chrSrc[j][i] * chrFilter[j];
v += chrSrc[j][i + 2048] * chrFilter[j];
}
uDest[2*i]= av_clip_uint8(v>>19);
uDest[2*i+1]= av_clip_uint8(u>>19);
}
}
| 1threat
|
Hyperledger Java SDK working example : <p>I am currently digging into Hyperledger Fabric and I can't get stuff started with the Java SDK (talking about 1.0.0-beta here). Is there a working example starting from connecting to the Fabric node, doing queries, etc? All I found so far through extensive googling are "let's-write-some-chaincode" examples.</p>
| 0debug
|
static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
AC3DecodeContext *s = avctx->priv_data;
int16_t *out_samples = (int16_t *)data;
int i, blk, ch, err;
if (s->input_buffer) {
memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_MAX_FRAME_SIZE));
init_get_bits(&s->gbc, s->input_buffer, buf_size * 8);
} else {
init_get_bits(&s->gbc, buf, buf_size * 8);
}
err = ac3_parse_header(s);
if(err) {
switch(err) {
case AC3_PARSE_ERROR_SYNC:
av_log(avctx, AV_LOG_ERROR, "frame sync error : cannot use error concealment\n");
return -1;
case AC3_PARSE_ERROR_BSID:
av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
break;
case AC3_PARSE_ERROR_SAMPLE_RATE:
av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
break;
case AC3_PARSE_ERROR_FRAME_SIZE:
av_log(avctx, AV_LOG_ERROR, "invalid frame size\n");
break;
case AC3_PARSE_ERROR_FRAME_TYPE:
av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid header\n");
break;
}
}
if(s->frame_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
return -1;
}
if(!err && avctx->error_resilience >= FF_ER_CAREFUL) {
if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
err = 1;
}
}
if (!err) {
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
s->out_channels = s->channels;
s->output_mode = s->channel_mode;
if(s->lfe_on)
s->output_mode |= AC3_OUTPUT_LFEON;
if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&
avctx->request_channels < s->channels) {
s->out_channels = avctx->request_channels;
s->output_mode = avctx->request_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
}
avctx->channels = s->out_channels;
if(s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) &&
s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s);
}
} else if (!s->out_channels) {
s->out_channels = avctx->channels;
if(s->out_channels < s->channels)
s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
}
for (blk = 0; blk < NB_BLOCKS; blk++) {
if (!err && ac3_parse_audio_block(s, blk)) {
av_log(avctx, AV_LOG_ERROR, "error parsing the audio block\n");
}
for (i = 0; i < 256; i++)
for (ch = 0; ch < s->out_channels; ch++)
*(out_samples++) = s->int_output[ch][i];
}
*data_size = NB_BLOCKS * 256 * avctx->channels * sizeof (int16_t);
return s->frame_size;
}
| 1threat
|
Chromedriver error "Chrome version must be >= 52" using Nightwatch : <p>I'm trying to setup <a href="http://nightwatchjs.org/guide#guide" rel="noreferrer">Nightwatch</a>, and am using the <strong>latest chromedriver</strong> which says it <a href="http://chromedriver.storage.googleapis.com/2.24/notes.txt" rel="noreferrer">supports chrome v52-54</a>. BUT, when I try to run the tests, it says <strong><code>'Error: Chrome version must be >=52.0.2743.'</code></strong> Here's everything that I'm using:</p>
<ul>
<li><a href="https://sites.google.com/a/chromium.org/chromedriver/downloads" rel="noreferrer">ChromeDriver 2.24</a></li>
<li><a href="http://selenium-release.storage.googleapis.com/index.html" rel="noreferrer">Selenium 2.53.1</a></li>
<li><a href="http://nightwatchjs.org/guide#installation" rel="noreferrer">Nightwatch v0.9.8</a></li>
<li><a href="https://nodejs.org/en/" rel="noreferrer">Node v6.5.0</a></li>
<li><a href="http://openjdk.java.net/install/" rel="noreferrer">Java v1.7.0_111</a></li>
</ul>
<p><strong>Project Structure</strong></p>
<pre><code>|-- nightwatch.json
|-- bin/
| |-- chromedriver
| |-- selenium-server-standalone-2.53.1.jar
|-- tests/
| |-- sample.js
|-- results/
|-- screens/
|-- node_modules/
| |-- (lots of modules here)
</code></pre>
<p>And here is my <a href="http://nightwatchjs.org/guide#settings-file" rel="noreferrer">configuration file</a> for nightwatch:</p>
<p><strong>./nightwatch.json</strong></p>
<pre><code>{
"src_folders" : ["tests"],
"output_folder" : "results",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "bin/selenium-server-standalone-2.53.1.jar",
"log_path" : "results",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "bin/chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : true,
"path" : "screens/"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
</code></pre>
<p><strong>Running Tests</strong></p>
<p>I run the tests like this:</p>
<pre><code>nightwatch tests/
</code></pre>
<p><strong>Error</strong></p>
<p>And I get the following output:</p>
<pre><code>Starting selenium server... started - PID: 3500
[Sample] Test Suite
=======================
Running: Demo test Google
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ sessionId: null,
status: 13,
state: 'unhandled error',
value:
{ message: 'unknown error: Chrome version must be >= 52.0.2743.0\n (Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 3.2.0-56-generic x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 1.42 seconds\nBuild info: version: \'2.53.1\', revision: \'a36b8b1\', time: \'2016-06-30 17:37:03\'\nSystem info: host: \'N/A\', ip: \'N/A\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'3.2.0-56-generic\', java.version: \'1.7.0_111\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver',
suppressed: [],
localizedMessage: 'unknown error: Chrome version must be >= 52.0.2743.0\n (Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 3.2.0-56-generic x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 1.42 seconds\nBuild info: version: \'2.53.1\', revision: \'a36b8b1\', time: \'2016-06-30 17:37:03\'\nSystem info: host: \'N/A\', ip: \'N/A\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'3.2.0-56-generic\', java.version: \'1.7.0_111\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver',
buildInformation:
{ releaseLabel: '2.53.1',
buildTime: '2016-06-30 17:37:03',
class: 'org.openqa.selenium.internal.BuildInfo',
buildRevision: 'a36b8b1',
hCode: 1900167016 },
cause: null,
systemInformation: 'System info: host: \'N/A\', ip: \'N/A\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'3.2.0-56-generic\', java.version: \'1.7.0_111\'',
supportUrl: null,
class: 'org.openqa.selenium.WebDriverException',
additionalInformation: '\nDriver info: org.openqa.selenium.chrome.ChromeDriver',
hCode: 1299270263,
screen: null },
class: 'org.openqa.selenium.remote.Response',
hCode: 1144687147 }
</code></pre>
<p>Anyone know how to resolve this error?</p>
<p><strong><code>Chrome version must be >= 52.0.2743.0</code></strong></p>
<p>Does chromedriver use my local copy of chrome? Do I need to update my actual chrome?</p>
| 0debug
|
Responsive replacement for Semantic UI's navigation menu : <p>Semantic UI has some problems when it comes to it's menu collection. In short, <strong>it's not responsive at all</strong>, and the closest thing to it is their "stackable" implementation to simply show the menu as a stack.</p>
<p>Can anyone here recommend a good navigation menu that integrates well with semantic ui?</p>
<p>Thanks for any input.</p>
| 0debug
|
Azure Service Fabric Explorer returns always 403 : <p>I just deployed an secured Service Fabric Cluster (EncryptAndSign) with a LoadBalancer to an Azure Subscription. Deployment took some time but it worked as expected. Also I can connect to the cluster via PowerShell:</p>
<pre><code>$connectionEndpoint = ("{0}.{1}.cloudapp.azure.com:19000" -f
"mycluster", "somewhere")
Connect-serviceFabricCluster -ConnectionEndpoint $connectionEndpoint `
-KeepAliveIntervalInSec 10 `
-X509Credential `
-ServerCertThumbprint "..." `
-FindType FindByThumbprint `
-FindValue $clusterCertificate.Thumbprint `
-StoreLocation CurrentUser -StoreName My
</code></pre>
<p>It is also possible for me to deploy an application to the Cluster via Port 19000 using VisualStudio. Within in the Azure Portal everything looks good, no warning, no errors. </p>
<p>Unforunately I am not able to connect via Port 19080 to the Explorer. As I try to connect via the LoadBalancer I receive a Connection-Timeout. So established a RDP-Connection to one of the Nodes in the Cluster and tried to access the Explorer locally via </p>
<pre><code>localhost:19080/Explorer
</code></pre>
<p>But here I receive a Http-Error 403 (Forbidden) which might be the reason for the Connection timeout via Load-Balancer (as the probe is always receiving 403). Accroding to the <a href="https://azure.microsoft.com/en-us/documentation/articles/service-fabric-visualizing-your-cluster/#connect-to-a-remote-service-fabric-cluster">Azure Documentation</a>: </p>
<blockquote>
<p>"If you attempt to connect to Service Fabric Explorer on a secure
cluster, your browser will ask you to present a certificate in order
to gain access."</p>
</blockquote>
<p>Well, I was not prompted to present any certificate. Did I miss something? Is there anything special to configure? Thanks in advance.</p>
| 0debug
|
how to change the opacity of the snackbar in flutter? : <p>I wish to change the opacity of the SnackBar. It has only the background property. Can it be customized or I have to create the custom widget for snack bar? </p>
| 0debug
|
Why do we need products like Pusher and Socket.io to establish a websocket connection? : <p>I've been reading about websockets and SaaS like Pusher and Socket.io recently, while working on my Laravel chat practice application. What I don't understand is, why do we need external software to establish a websocket connection? Can't the server code like Laravel just directly establish the connection with the front-end like Vue.js? Why does it have to go through the middleman like Pusher and Socket.io? Sorry for the noob question.</p>
| 0debug
|
static void process_incoming_migration_co(void *opaque)
{
QEMUFile *f = opaque;
Error *local_err = NULL;
int ret;
migration_incoming_state_new(f);
migrate_generate_event(MIGRATION_STATUS_ACTIVE);
ret = qemu_loadvm_state(f);
qemu_fclose(f);
free_xbzrle_decoded_buf();
migration_incoming_state_destroy();
if (ret < 0) {
migrate_generate_event(MIGRATION_STATUS_FAILED);
error_report("load of migration failed: %s", strerror(-ret));
migrate_decompress_threads_join();
exit(EXIT_FAILURE);
}
migrate_generate_event(MIGRATION_STATUS_COMPLETED);
qemu_announce_self();
bdrv_invalidate_cache_all(&local_err);
if (local_err) {
error_report_err(local_err);
migrate_decompress_threads_join();
exit(EXIT_FAILURE);
}
if (!global_state_received() ||
global_state_get_runstate() == RUN_STATE_RUNNING) {
if (autostart) {
vm_start();
} else {
runstate_set(RUN_STATE_PAUSED);
}
} else {
runstate_set(global_state_get_runstate());
}
migrate_decompress_threads_join();
}
| 1threat
|
how to define array in python : I have written a program in python and when I debug my code I have some output like:
A = [[ 0.49184191 0.49216545 0.49045572 0.49120336 0.49162126 0.49127175
0.4918312 0.49146007 0.49217111 0.49105725 0.49188209 0.49131341
0.4915551 0.4916877 0.49176704 0.49107439 0.49179349 0.49113405
0.49181949 0.49114229 0.49080868 0.49212299 0.49132733 0.49130678
0.49243294 0.49138045 0.49142812 0.49110904 0.49057333 0.49152252
0.49156431 0.49158843 0.49213234 0.49119104 0.49058275 0.49160299
0.49096081 0.49144198 0.4920761 0.49149983 0.49164554 0.49108083
0.49207692 0.49160705 0.49198164 0.49135187 0.49185721 0.49189228
0.49173232 0.49141264 0.49135901 0.49203396 0.49211383 0.49157355
0.49164756 0.4910949 0.49197874 0.49131 0.4915147 0.4912441
0.49158387 0.49133532 0.49115916 0.49170297 0.49213771 0.49130702
0.49181432 0.4913136 0.49129868 0.49137166 0.49195617 0.4911638
0.4919901 0.49131729 0.49183565 0.49135328 0.49133418 0.49114096
0.49153416 0.49129274 0.4915175 0.49140146 0.49147821 0.4923465
0.49138114 0.49110974 0.49204106 0.49100999 0.49227227 0.49124463
0.49178075 0.49126929 0.49129691 0.4916742 0.49099519 0.491607
0.49153693 0.49128967 0.49183968 0.49183926 0.49191762 0.49191687
0.49191334]]
and
Y = [[0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]
And it seems no problem to execute some actions with those variables like eg:
dA = - (np.divide(Y, A) - np.divide(1 - Y, 1 - A))
But when I define in a ceparated cel some arrays for my own use:
import numpy as np
m = [[4 5 6]]
n = [[1 2 3]]
Then as output I have:
File "<ipython-input-61-52c19e46fafb>", line 3
m = [[4 5 6]]
^
SyntaxError: invalid syntax
So why is it not possible to define m and n as I have some output like that in my other Code?
| 0debug
|
Are there any sealed classes alternatives in Dart 2.0? : <p>I have Android development background and I'm learning Flutter.</p>
<p>In Android it's a common practice to use Kotlin sealed classes to return a state from ViewModel e.g.</p>
<pre><code>sealed class MyState {
data class Success(val data: List<MyObject>) : MyState()
data class Error(val error: String) : MyState()
}
</code></pre>
<p>I want to use similar patter in Flutter and return a State object from the BLOC class. What is the best way to achieve the same in Flutter?</p>
| 0debug
|
Array List action listener : <p>Hello I was trying to add action listener to array of string so
Is it possible to add <code>onclicklistener</code> to an ArrayList of Strings? If possible can you tell me how please.
Thank you</p>
| 0debug
|
projectFilesBackup folder in android studio project for latest version : <p>If we update the android studio with the latest version and update the plugin as well. A folder named <code>projectFilesBackup</code> created when we open our old android studio project in the latest android studio version.</p>
<p>My Question is why this folder created, why this is for and how long we should keep this folder in our project folder?</p>
| 0debug
|
Django REST: Uploading and serializing multiple images : <p>I have 2 models <code>Task</code> and <code>TaskImage</code> which is a collection of images belonging to <code>Task</code> object.</p>
<p>What I want is to be able to add multiple images to my <code>Task</code> object, but I can only do it using 2 models. Currently, when I add images, it doesn't let me upload them and save new objects.</p>
<p><strong>settings.py</strong></p>
<pre><code>MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
</code></pre>
<p><strong>serializers.py</strong> </p>
<pre><code>class TaskImageSerializer(serializers.ModelSerializer):
class Meta:
model = TaskImage
fields = ('image',)
class TaskSerializer(serializers.HyperlinkedModelSerializer):
user = serializers.ReadOnlyField(source='user.username')
images = TaskImageSerializer(source='image_set', many=True, read_only=True)
class Meta:
model = Task
fields = '__all__'
def create(self, validated_data):
images_data = validated_data.pop('images')
task = Task.objects.create(**validated_data)
for image_data in images_data:
TaskImage.objects.create(task=task, **image_data)
return task
</code></pre>
<p><strong>models.py</strong></p>
<pre><code>class Task(models.Model):
title = models.CharField(max_length=100, blank=False)
user = models.ForeignKey(User)
def save(self, *args, **kwargs):
super(Task, self).save(*args, **kwargs)
class TaskImage(models.Model):
task = models.ForeignKey(Task, on_delete=models.CASCADE)
image = models.FileField(blank=True)
</code></pre>
<p>However, when I do a post request:</p>
<p><a href="https://i.stack.imgur.com/NndxK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NndxK.png" alt="enter image description here"></a></p>
<p>I get the following traceback:</p>
<blockquote>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/django/core/handlers/exception.py"
in inner
41. response = get_response(request)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/django/core/handlers/base.py"
in _get_response
187. response = self.process_exception_by_middleware(e, request)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/django/core/handlers/base.py"
in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/django/views/decorators/csrf.py"
in wrapped_view
58. return view_func(*args, **kwargs)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/rest_framework/viewsets.py"
in view
95. return self.dispatch(request, *args, **kwargs)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/rest_framework/views.py"
in dispatch
494. response = self.handle_exception(exc)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/rest_framework/views.py"
in handle_exception
454. self.raise_uncaught_exception(exc)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/rest_framework/views.py"
in dispatch
491. response = handler(request, *args, **kwargs)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/rest_framework/mixins.py"
in create
21. self.perform_create(serializer)</p>
<p>File "/Users/gr/Desktop/PycharmProjects/godo/api/views.py" in
perform_create
152. serializer.save(user=self.request.user)</p>
<p>File
"/Applications/Anaconda/anaconda/envs/godo/lib/python3.6/site-packages/rest_framework/serializers.py"
in save
214. self.instance = self.create(validated_data)</p>
<p>File "/Users/gr/Desktop/PycharmProjects/godo/api/serializers.py" in
create
67. images_data = validated_data.pop('images')</p>
<p>Exception Type: KeyError at /api/tasks/ Exception Value: 'images'</p>
</blockquote>
| 0debug
|
int ff_h264_decode_mb_cavlc(H264Context *h){
MpegEncContext * const s = &h->s;
int mb_xy;
int partition_count;
unsigned int mb_type, cbp;
int dct8x8_allowed= h->pps.transform_8x8_mode;
int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2;
const int pixel_shift = h->pixel_shift;
mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y);
cbp = 0;
if(h->slice_type_nos != AV_PICTURE_TYPE_I){
if(s->mb_skip_run==-1)
s->mb_skip_run= get_ue_golomb(&s->gb);
if (s->mb_skip_run--) {
if(FRAME_MBAFF && (s->mb_y&1) == 0){
if(s->mb_skip_run==0)
h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
}
decode_mb_skip(h);
return 0;
}
}
if(FRAME_MBAFF){
if( (s->mb_y&1) == 0 )
h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb);
}
h->prev_mb_skipped= 0;
mb_type= get_ue_golomb(&s->gb);
if(h->slice_type_nos == AV_PICTURE_TYPE_B){
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_nos == AV_PICTURE_TYPE_P){
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_nos == AV_PICTURE_TYPE_I);
if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type)
mb_type--;
decode_intra_mb:
if(mb_type > 25){
av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_picture_type_char(h->slice_type), s->mb_x, s->mb_y);
return -1;
}
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)){
unsigned int x;
static const uint16_t mb_sizes[4] = {256,384,512,768};
const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3;
align_get_bits(&s->gb);
for(x=0; x < mb_size; x++){
((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8);
}
s->current_picture.f.qscale_table[mb_xy] = 0;
memset(h->non_zero_count[mb_xy], 16, 48);
s->current_picture.f.mb_type[mb_xy] = mb_type;
return 0;
}
if(MB_MBAFF){
h->ref_count[0] <<= 1;
h->ref_count[1] <<= 1;
}
fill_decode_neighbors(h, mb_type);
fill_decode_caches(h, mb_type);
if(IS_INTRA(mb_type)){
int pred_mode;
if(IS_INTRA4x4(mb_type)){
int i;
int di = 1;
if(dct8x8_allowed && get_bits1(&s->gb)){
mb_type |= MB_TYPE_8x8DCT;
di = 4;
}
for(i=0; i<16; i+=di){
int mode= pred_intra_mode(h, i);
if(!get_bits1(&s->gb)){
const int rem_mode= get_bits(&s->gb, 3);
mode = rem_mode + (rem_mode >= mode);
}
if(di==4)
fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 );
else
h->intra4x4_pred_mode_cache[ scan8[i] ] = mode;
}
write_back_intra_pred_mode(h);
if( ff_h264_check_intra4x4_pred_mode(h) < 0)
return -1;
}else{
h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode);
if(h->intra16x16_pred_mode < 0)
return -1;
}
if(decode_chroma){
pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb));
if(pred_mode < 0)
return -1;
h->chroma_pred_mode= pred_mode;
} else {
h->chroma_pred_mode = DC_128_PRED8x8;
}
}else if(partition_count==4){
int i, j, sub_partition_count[4], list, ref[2][4];
if(h->slice_type_nos == AV_PICTURE_TYPE_B){
for(i=0; i<4; i++){
h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
if(h->sub_mb_type[i] >=13){
av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
return -1;
}
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])) {
ff_h264_pred_direct_motion(h, &mb_type);
h->ref_cache[0][scan8[4]] =
h->ref_cache[1][scan8[4]] =
h->ref_cache[0][scan8[12]] =
h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;
}
}else{
assert(h->slice_type_nos == AV_PICTURE_TYPE_P);
for(i=0; i<4; i++){
h->sub_mb_type[i]= get_ue_golomb_31(&s->gb);
if(h->sub_mb_type[i] >=4){
av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y);
return -1;
}
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++){
int ref_count= IS_REF0(mb_type) ? 1 : h->ref_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)){
unsigned int tmp;
if(ref_count == 1){
tmp= 0;
}else if(ref_count == 2){
tmp= get_bits1(&s->gb)^1;
}else{
tmp= get_ue_golomb_31(&s->gb);
if(tmp>=ref_count){
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp);
return -1;
}
}
ref[list][i]= tmp;
}else{
ref[list][i] = -1;
}
}
}
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])) {
h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ];
continue;
}
h->ref_cache[list][ scan8[4*i] ]=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(IS_DIR(h->sub_mb_type[i], 0, list)){
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 mx, my;
const int index= 4*i + block_width*j;
int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ];
pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
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;
}else if(IS_SUB_8X4(sub_mb_type)){
mv_cache[ 1 ][0]= mx;
mv_cache[ 1 ][1]= my;
}else if(IS_SUB_4X8(sub_mb_type)){
mv_cache[ 8 ][0]= mx;
mv_cache[ 8 ][1]= my;
}
mv_cache[ 0 ][0]= mx;
mv_cache[ 0 ][1]= my;
}
}else{
uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0];
p[0] = p[1]=
p[8] = p[9]= 0;
}
}
}
}else if(IS_DIRECT(mb_type)){
ff_h264_pred_direct_motion(h, &mb_type);
dct8x8_allowed &= h->sps.direct_8x8_inference_flag;
}else{
int list, mx, my, i;
we should set ref_idx_l? to 0 if we use that later ...
if(IS_16X16(mb_type)){
for(list=0; list<h->list_count; list++){
unsigned int val;
if(IS_DIR(mb_type, 0, list)){
if(h->ref_count[list]==1){
val= 0;
}else if(h->ref_count[list]==2){
val= get_bits1(&s->gb)^1;
}else{
val= get_ue_golomb_31(&s->gb);
if(val >= h->ref_count[list]){
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1;
}
}
fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 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] ], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4);
}
}
}
else if(IS_16X8(mb_type)){
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
unsigned int val;
if(IS_DIR(mb_type, i, list)){
if(h->ref_count[list] == 1){
val= 0;
}else if(h->ref_count[list] == 2){
val= get_bits1(&s->gb)^1;
}else{
val= get_ue_golomb_31(&s->gb);
if(val >= h->ref_count[list]){
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1;
}
}
}else
val= LIST_NOT_USED&0xFF;
fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1);
}
}
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
unsigned int val;
if(IS_DIR(mb_type, i, list)){
pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
val= pack16to32(mx,my);
}else
val=0;
fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4);
}
}
}else{
assert(IS_8X16(mb_type));
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
unsigned int val;
if(IS_DIR(mb_type, i, list)){ optimize
if(h->ref_count[list]==1){
val= 0;
}else if(h->ref_count[list]==2){
val= get_bits1(&s->gb)^1;
}else{
val= get_ue_golomb_31(&s->gb);
if(val >= h->ref_count[list]){
av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val);
return -1;
}
}
}else
val= LIST_NOT_USED&0xFF;
fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1);
}
}
for(list=0; list<h->list_count; list++){
for(i=0; i<2; i++){
unsigned int val;
if(IS_DIR(mb_type, i, list)){
pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my);
mx += get_se_golomb(&s->gb);
my += get_se_golomb(&s->gb);
tprintf(s->avctx, "final mv:%d %d\n", mx, my);
val= pack16to32(mx,my);
}else
val=0;
fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4);
}
}
}
}
if(IS_INTER(mb_type))
write_back_motion(h, mb_type);
if(!IS_INTRA16x16(mb_type)){
cbp= get_ue_golomb(&s->gb);
if(decode_chroma){
if(cbp > 47){
av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp];
else cbp= golomb_to_inter_cbp [cbp];
}else{
if(cbp > 15){
av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y);
return -1;
}
if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp];
else cbp= golomb_to_inter_cbp_gray[cbp];
}
}
if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){
mb_type |= MB_TYPE_8x8DCT*get_bits1(&s->gb);
}
h->cbp=
h->cbp_table[mb_xy]= cbp;
s->current_picture.f.mb_type[mb_xy] = mb_type;
if(cbp || IS_INTRA16x16(mb_type)){
int i4x4, i8x8, chroma_idx;
int dquant;
int ret;
GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr;
const uint8_t *scan, *scan8x8;
const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
if(IS_INTERLACED(mb_type)){
scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0;
scan= s->qscale ? h->field_scan : h->field_scan_q0;
}else{
scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0;
scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0;
}
dquant= get_se_golomb(&s->gb);
s->qscale += dquant;
if(((unsigned)s->qscale) > max_qp){
if(s->qscale<0) s->qscale+= max_qp+1;
else s->qscale-= max_qp+1;
if(((unsigned)s->qscale) > max_qp){
av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y);
return -1;
}
}
h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale);
h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale);
if( (ret = decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ){
return -1;
}
h->cbp_table[mb_xy] |= ret << 12;
if(CHROMA444){
if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ){
return -1;
}
if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ){
return -1;
}
} else if (CHROMA422) {
if(cbp&0x30){
for(chroma_idx=0; chroma_idx<2; chroma_idx++)
if (decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift),
CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma422_dc_scan,
NULL, 8) < 0) {
return -1;
}
}
if(cbp&0x20){
for(chroma_idx=0; chroma_idx<2; chroma_idx++){
const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
DCTELEM *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift);
for (i8x8 = 0; i8x8 < 2; i8x8++) {
for (i4x4 = 0; i4x4 < 4; i4x4++) {
const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4;
if (decode_residual(h, gb, mb, index, scan + 1, qmul, 15) < 0)
return -1;
mb += 16 << pixel_shift;
}
}
}
}else{
fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
}
} else {
if(cbp&0x30){
for(chroma_idx=0; chroma_idx<2; chroma_idx++)
if( decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){
return -1;
}
}
if(cbp&0x20){
for(chroma_idx=0; chroma_idx<2; chroma_idx++){
const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]];
for(i4x4=0; i4x4<4; i4x4++){
const int index= 16 + 16*chroma_idx + i4x4;
if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){
return -1;
}
}
}
}else{
fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
}
}
}else{
fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);
fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);
fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);
}
s->current_picture.f.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
|
When device ble connects to mobile ble how many milliseconds it will take to show the services : Embedded device will send data through ble. I developed android application to receive data, but my problem is 1. When device connects to mobile ble immediately it will send data but I am not able to read data, if I give delay app starts reading characteristics but not collecting data. 2. so When device ble connects to mobile ble how many milliseconds it will take to show the services. so I can match delay and receive data.
| 0debug
|
Json Parser using Url : <p><a href="http://flightia.co.uk/flight_json.json" rel="nofollow">My json file</a></p>
<p>I want to get the name of city,airport,carrier in android but it gives error that no value for city or airport as i use in the code given below</p>
<pre><code> // get json string from url
JSONObject json = jParser.getJSONFromUrl(yourJsonStringUrl);
//get the array of users
dataJsonArr = json.getJSONArray("data")
</code></pre>
| 0debug
|
Chrome extension not responding to javascript : <p>I am building a chrome extension using javascript the tags are working correctly in browser while adding the same html ,javascript code to chrome extension not responding.
Json file:</p>
<pre><code>{
"name": "SOB",
"version": "1.0",
"manifest_version":2,
"permissions": ["storage",
"activeTab" ],
"icons" : {
"16" : "16.png" ,
"48" : "48.png"
},
"browser_action": {
"default_icon": "Skype Orange.png",
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"],
"persistent": true
}
}
</code></pre>
<p>Popup.html:</p>
<pre><code> <!doctype html>
<html>
<head>
<title>Getting Started Extension's Popup</title>
<style>
body {
font-family: "Segoe UI", "Lucida Grande", Tahoma, sans-serif;
font-size: 100%;
}
</style>
<script src="background" type="text/javascript"></script>
</head>
<body>
<input type="text" name="value" id="fillIn" />
<input type="submit" value="Submit" onClick="response()"/>
<p id="answer"></p>
<input type="text" name="value" id="input" placeholder="SOB Check" />
<button id="form" onClick="demo()"> Submit</button>
<p id="output"> </p>
<!----------
<div id="status"></div>
<img id="image-result" hidden>
------------>
</body>
</html>
</code></pre>
<p>background.js:</p>
<pre><code>function demo()
{
var arra = [] , i = 1, rem ;
var Input =document.getElementById('input').value;
var x = 1;
while(Input > 0)
{
rem = Input%2;
Input = (parseInt(Input/ 2));
arra[i] = rem ;
i++;
}
while ( x < 35 )
{
if(arra[x] == 1)
{
output.innerHTML +=("SOB "+ x +" Found" +"<br />" );
x = x +1 ;
}
else
{
x = x +1 ;
}
}
}
function response() {
var box = document.getElementById("fillIn");
switch (box.value)
{
case '0' : document.getElementById("answer").innerHTML="Successful";
break ;
case '999' : document.getElementById("answer").innerHTML="Other Error No Retry";
break ;
}
}
</code></pre>
| 0debug
|
static void channel_out_run(struct fs_dma_ctrl *ctrl, int c)
{
uint32_t len;
uint32_t saved_data_buf;
unsigned char buf[2 * 1024];
if (ctrl->channels[c].eol == 1)
return;
saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF);
D(fprintf(logfile, "ch=%d buf=%x after=%x saved_data_buf=%x\n",
c,
(uint32_t)ctrl->channels[c].current_d.buf,
(uint32_t)ctrl->channels[c].current_d.after,
saved_data_buf));
len = (uint32_t)(unsigned long) ctrl->channels[c].current_d.after;
len -= saved_data_buf;
if (len > sizeof buf)
len = sizeof buf;
cpu_physical_memory_read (saved_data_buf, buf, len);
D(printf("channel %d pushes %x %u bytes\n", c,
saved_data_buf, len));
if (ctrl->channels[c].client->client.push)
ctrl->channels[c].client->client.push(
ctrl->channels[c].client->client.opaque, buf, len);
else
printf("WARNING: DMA ch%d dataloss, no attached client.\n", c);
saved_data_buf += len;
if (saved_data_buf ==
(uint32_t)(unsigned long)ctrl->channels[c].current_d.after) {
if (ctrl->channels[c].current_d.out_eop) {
D(printf("signal eop\n"));
}
if (ctrl->channels[c].current_d.intr) {
D(printf("signal intr\n"));
ctrl->channels[c].regs[R_INTR] |= (1 << 2);
channel_update_irq(ctrl, c);
}
if (ctrl->channels[c].current_d.eol) {
D(printf("channel %d EOL\n", c));
ctrl->channels[c].eol = 1;
ctrl->channels[c].current_c.dis = 1;
channel_store_c(ctrl, c);
channel_stop(ctrl, c);
} else {
ctrl->channels[c].regs[RW_SAVED_DATA] =
(uint32_t)(unsigned long) ctrl->channels[c].current_d.next;
channel_load_d(ctrl, c);
saved_data_buf = (uint32_t)(unsigned long)
ctrl->channels[c].current_d.buf;
}
channel_store_d(ctrl, c);
ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf;
D(dump_d(c, &ctrl->channels[c].current_d));
}
ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf;
}
| 1threat
|
n or nvm for managing node versions - is keeping global modules for each version a good idea? : <p>I've been using docker containers for node, unfortunatly on OSX <code>gulp watch</code> is super slow and buggy. So I'm back to installing tools on host machine :( unfortunatly.</p>
<p>Choosing between <code>n</code> and <code>nvm</code></p>
<p>One major difference I see between these is the global packages, <code>n</code> keeps single global repo for all versions, and <code>nvm</code> keeps em separate.</p>
<p>Not having worked on many node.js projects, I have a feeling this is an important distinction, but I'm not sure if it really matters in real life.</p>
<p>any ideas?</p>
| 0debug
|
Migrate from angular 1 to angular 7 : I have to upgrade my *AngularJS* (v1) app to latest *Angular 7*.
Upto now I haven't done it and scary about breaking the things.
Can you please guide me how do I need to proceed further and what are all the things need to be taken care?
I've gone through the following article as well, but still wants specific guidance:
https://angular.io/guide/upgrade
Thanks in advanc.
| 0debug
|
Getting the value of a DataFrame column in Spark : <p>I am trying to retrieve the value of a DataFrame column and store it in a variable. I tried this :</p>
<pre><code>val name=df.select("name")
val name1=name.collect()
</code></pre>
<p>But none of the above is returning the value of column "name".</p>
<p>Spark version :2.2.0
Scala version :2.11.11</p>
| 0debug
|
static void qemu_file_set_if_error(QEMUFile *f, int ret)
{
if (ret < 0 && !f->last_error) {
qemu_file_set_error(f, ret);
}
}
| 1threat
|
static void decode_band_structure(GetBitContext *gbc, int blk, int eac3,
int ecpl, int start_subband, int end_subband,
const uint8_t *default_band_struct,
uint8_t *band_struct, int *num_subbands,
int *num_bands, int *band_sizes)
{
int subbnd, bnd, n_subbands, n_bands, bnd_sz[22];
n_subbands = end_subband - start_subband;
if (!eac3 || get_bits1(gbc)) {
for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) {
band_struct[subbnd] = get_bits1(gbc);
}
} else if (!blk) {
memcpy(band_struct,
&default_band_struct[start_subband+1],
n_subbands-1);
}
band_struct[n_subbands-1] = 0;
if (num_bands || band_sizes ) {
n_bands = n_subbands;
bnd_sz[0] = ecpl ? 6 : 12;
for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) {
int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12;
if (band_struct[subbnd-1]) {
n_bands--;
bnd_sz[bnd] += subbnd_size;
} else {
bnd_sz[++bnd] = subbnd_size;
}
}
}
if (num_subbands)
*num_subbands = n_subbands;
if (num_bands)
*num_bands = n_bands;
if (band_sizes)
memcpy(band_sizes, bnd_sz, sizeof(int)*n_bands);
}
| 1threat
|
Can I access to my union using arrow operator(->) in C? : I would like to know whether or not I can use the arrow operator in my union, so let's say that I have the following union
union max30205_raw_data {
struct {
uint8_t lsb;
uint8_t msb;
};
struct {
uint16_t magnitude_bits:15;
uint16_t sign_bit:1;
};
uint16_t uwrd;
int16_t swrd;
};
I will fill the content of the union in the following way, but I was wondering whether the access to the union member `msb` and `lsb` is correct?
int32_t max30205_read_reg16_WithDefUnion(char reg, max30205_raw_data *p_unionRawData) {
char aux[] = {0,0}
int32_t error;
if (reg == MAX30205_REG_TEMPERATURE || reg == MAX30205_REG_THYST_LOW_TRIP || reg == MAX30205_REG_TOS_HIGH_TRIP) {
error = twi_max30205_read(&myMax30205Instance,max30205Address,reg,&aux,sizeof(aux));
if(error == 0){
p_unionRawData->msb = aux[0];//IS THIS RIGHT IN C?
p_unionRawData->lsb = aux[1];//IS THIS RIGHT IN C?
}
}
return error;
}
I will call `max30205_read_reg16_WithDefUnion()`as
int16_t max30205MeasureTemperatureWithDefUnion(void) {
char regT = MAX30205_REG_TEMPERATURE;
max30205_raw_data rawTemp;
int16_t temperatureValue = 0;
if (max30205_read_reg16_WithDefUnion(regT,&rawTemp) ==0)
temperatureValue = rawTemp.swrd;
return temperatureValue;
}
| 0debug
|
How can I configure Visual Studio Code to run/debug .NET (dotnet) Core from the Windows Subsystem for Linux (WSL)? : <p>I've installed dotnet core 2.2 in the Windows Subsystem for Linux (WSL) and created a new project. I've also installed the C# extension for Visual Studio Code and the syntax highlighting and IntelliSense seems to be working.</p>
<p>However, when I try to use the debugger things stop working. Here's a step by step of what I've tried to do to configure it.</p>
<p>Here's my launch.json:</p>
<pre><code>{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/CodeCore.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/CodeCore.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
</code></pre>
<p>And my tasks.json:</p>
<pre><code>{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet build",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}
</code></pre>
<p>My directory structure:</p>
<p><a href="https://i.stack.imgur.com/4RMa7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4RMa7.png" alt="enter image description here"></a></p>
<p>But when I click the "Start Debugging" button I get the following error:</p>
<pre><code>launch: program " does not exist
</code></pre>
| 0debug
|
static int asf_build_simple_index(AVFormatContext *s, int stream_index)
{
ff_asf_guid g;
ASFContext *asf = s->priv_data;
int64_t current_pos = avio_tell(s->pb);
int64_t ret;
if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) {
return ret;
if ((ret = ff_get_guid(s->pb, &g)) < 0)
while (ff_guidcmp(&g, &ff_asf_simple_index_header)) {
int64_t gsize = avio_rl64(s->pb);
if (gsize < 24 || avio_feof(s->pb)) {
avio_skip(s->pb, gsize - 24);
if ((ret = ff_get_guid(s->pb, &g)) < 0)
{
int64_t itime, last_pos = -1;
int pct, ict;
int i;
int64_t av_unused gsize = avio_rl64(s->pb);
if ((ret = ff_get_guid(s->pb, &g)) < 0)
itime = avio_rl64(s->pb);
pct = avio_rl32(s->pb);
ict = avio_rl32(s->pb);
av_log(s, AV_LOG_DEBUG,
"itime:0x%"PRIx64", pct:%d, ict:%d\n", itime, pct, ict);
for (i = 0; i < ict; i++) {
int pktnum = avio_rl32(s->pb);
int pktct = avio_rl16(s->pb);
int64_t pos = s->internal->data_offset + s->packet_size * (int64_t)pktnum;
int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0);
if (pos != last_pos) {
av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n",
pktnum, pktct, index_pts);
av_add_index_entry(s->streams[stream_index], pos, index_pts,
s->packet_size, 0, AVINDEX_KEYFRAME);
last_pos = pos;
asf->index_read = ict > 1;
end:
avio_seek(s->pb, current_pos, SEEK_SET);
return ret;
| 1threat
|
Regex query - targeting two different parts of a URL, but not the others. : I am trying to figure out the best regex to simply match two different parts of a URL. This is so I can run an A/B test on a particular area of the site (events) on a particular product page template that has multiple pages (go-).
For instance with https://chillisauce.com/events/in-london/do-cocktail-making/go-d66d20fa2f3025289433 I just want to match 'events' and 'go-'
'go-' is the part of the URL that allows us to isolate our product pages and 'events' is our corporate business unit.
Thanks in advance,
Charlie
| 0debug
|
Is there an Azure Dev Ops pipeline variable for current pull request number? : <p>I want to use the current pull request number in my web.config file when I publish my website. Is there a variable that I can access that stores that value?</p>
| 0debug
|
how to obtain a given array in C# : <p>Given <code>R = (R_1, R_2,..., R_n)</code>
how to obtain such <code>n*(2n+2)</code> array in <code>C#</code>, note that is array not List, and n is very large.</p>
<p><a href="https://i.stack.imgur.com/jtzNJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jtzNJ.png" alt="enter image description here"></a></p>
| 0debug
|
iTerm2 swap panes keyboard shortcut : <p>The option for swapping between panes is only available through the menu button but I can't see any action to bind to this action. Is there and in built command that allows to swap panes?</p>
| 0debug
|
How can I execute the code line by line in jupyter-notebook? : <p>I'm reading the book, <code>Python Machine Learning</code>, and tried to analyze the code. But it offers only <code>*.ipynb</code> file and it makes me very bothersome.</p>
<p>For example, </p>
<p><a href="https://i.stack.imgur.com/VVzTb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VVzTb.png" alt="enter image description here"></a></p>
<p>In this code, I don't want to run whole <code>In[9]</code> but want to run line by line so that I can check each value of variable and know what each library function do. </p>
<p>Do I have to comment everytime I want to execute part of codes? I just want something like <code>Execute the block part</code> like in <code>MATLAB</code></p>
<p>And also, let say I comment some part of code and execute line by line. How can I check each variable's value without using <code>print()</code> or <code>display()</code>? As you know, I don't have to use <code>print()</code> to check the value in <code>python interactive shell</code> in terminal. Is there a similar way in <code>Jupyter</code>?</p>
| 0debug
|
Disappearing fab icon on navigation fragment change : <p>I have a bottom navigation view with 3 items which navigate to 3 different fragments (fragments are created only once and their instances are saved in mainactivity's onSavedInstanceState()) and on top of it a floating action button.</p>
<p>We want to change the icon drawable for the fab when each fragment is visited we tried both <code>setImageResource()</code> and <code>.setImageDrawable()</code> on the fab in a switch case when each bottom navigation icon is picked.</p>
<pre><code>/**
* used to handle switching between fragments when a new navigation item is selected
*/
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_tasks:
.........
loadFragment(tasksFragment);
mFab.setOnClickListener(mFabClickListenerTasks);
mFab.setImageDrawable(getResources().getDrawable(R.drawable.ic_add_task));
//2 tabs in 1 fragment
if (mTabLayout.getSelectedTabPosition() == 1)
mFab.hide();
else mFab.show();
break;
case R.id.nav_employees:
.......
loadFragment(employeesFragment);
mFab.setOnClickListener(mFabClickListenerEmployees);
mFab.setImageDrawable(getResources().getDrawable(R.drawable.ic_add_employee2));
mFab.show();
break;
case R.id.nav_departments:
.......
loadFragment(departmentsFragment);
mFab.setOnClickListener(mFabClickListenerDepartments);
mFab.setImageDrawable(getResources().getDrawable(R.drawable.ic_add_department));
mFab.show();
break;
}
item.setChecked(true);
return true;
}
void loadFragment(Fragment fragment) {
if (activeFragment == fragment)
return;
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.hide(activeFragment).show(fragment);
activeFragment = fragment;
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
if (activeFragment instanceof TasksFragment)
mFab.setImageResource(R.drawable.ic_add_task);
else if(activeFragment instanceof DepartmentsFragment)
mFab.setImageResource(R.drawable.ic_add_department);
else if(activeFragment instanceof EmployeesFragment)
mFab.setImageResource(R.drawable.ic_add_employee2);
transaction.commit();
}
</code></pre>
<p>The 3 fragments are mainly 3 recycler views, we also hide the fab when recyclerview scrolls.</p>
<p>The fab drawable will be set correctly when traversing the fragments from the bottom navigation , but in any fragment when we scroll it saves this state to return to it afterwards.</p>
<p>This removes the fab drawable when going to another fragment and leaves the fab empty with no icon drawable.
How can we solve this ?</p>
| 0debug
|
Delete node_modules folder recursively from a specified path using command line : <p>I have multiple npm projects saved in a local directory. Now I want to take backup of my projects without the <code>node_modules</code> folder, as it is taking a lot of space and can also be retrieved any time using <code>npm install</code>.</p>
<p>So, I need a solution to delete all node_modules folders recursively from a specified path using the command line interface.
Any suggestions/ help is highly appreciable.</p>
| 0debug
|
Step by step on how to create a prod version of app in android studio : I'm a new Android developer and I just finished my first app and I want to create the prod version of it. I search in google of course but I still fail to understand the explanation. Please give a easy/understanding steps on how I will create a prod version. Thank You.
| 0debug
|
AngularJS + jQuery: jQuery returns only native dom objects : I have a huge problem. I want to select a DOM-Element using jQuery. This happens inside an AngularJS http-request. It works when runtime has past but when I call the function immediately aufer the page load, jQuery returns only a nativ JS DOM-Object.
The code is nothing special. It's only:
$http({ "methode" : "GET", "url" : <URL>, "cache" : true })
.success(function(data){
...
var jQueryElement = jQuery("#" + params.elemId);
jQueryElement[0].previousElementSibling.children[1].classList.add("active");
...
});
This request is inside a function of an angularjs controller.
How I said before, when it's called directly after the pageload jQuery( ... ) only returns a nativ DOM-object.
Does someone know how to fix this?
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.