problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Create a log file in PHP : <p><br>
So, I have an application in PHP that register users and items and then I can "give" an item to a user, and what I want it to create a log file that register the 'life cycle' of an item.
eg:<br>
I create an item and give that item to the user 'Mike', a few weeks later the user 'Mike' give back that item bc the item broked, and I want all that to be on a log file.
<br>Any tips? Thanks!</p>
| 0debug
|
static void parse_type_str(Visitor *v, const char *name, char **obj,
Error **errp)
{
StringInputVisitor *siv = to_siv(v);
if (siv->string) {
*obj = g_strdup(siv->string);
} else {
*obj = NULL;
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
"string");
}
}
| 1threat
|
How to overlap SliverList on a SliverAppBar : <p>I'm trying to overlap a <code>SliverList</code> a few pixels over the <code>SliverAppBar</code>. Similar to <a href="https://stackoverflow.com/questions/53709575/allow-gridview-to-overlap-sliverappbar">this post</a>. I'd like the image in the <code>FlexibleSpaceBar</code> to go under the radius of my <code>SliverList</code>.
I'm attempting to achieve the below.</p>
<p><a href="https://i.stack.imgur.com/q045W.png" rel="noreferrer"><img src="https://i.stack.imgur.com/q045W.png" alt="enter image description here"></a> </p>
<p>I can only get the radius like so. Without the ability to overlap the <code>SliverList</code> onto he <code>SliverAppBar</code>.
<a href="https://i.stack.imgur.com/fNPT7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fNPT7.png" alt="enter image description here"></a></p>
<pre><code> @override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
floating: false,
expandedHeight: MediaQuery.of(context).size.height * 0.50,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(pet.photos.first)
),
),
SliverList(
delegate: SliverChildListDelegate([
Container(
height: 40,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
topRight: Radius.circular(30),
),
),
),
]),
)
],
),
);
}
</code></pre>
<p>Any direction would be appreciated, thanks!</p>
| 0debug
|
javac not showing the output windows 10. : C:\Users>java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
C:\Users>echo %path% C:\Program Files\Java\jdk1.8.0_101\bin;C:\ProgramData\Oracle\Java\javapath
C:\Users>javac -version
| 0debug
|
C# Entity-Framework Code-First Migration error with SmallDateTime Data-type : I am using the following C# code in my Entity class:
[Column( TypeName = "SmallDateTime")]
public string LoginTime { get; set; }
But I get an error during code-first migration:
`Schema specified is not valid. Errors:
(161,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]' of member 'LoginTime' in type 'standardvba.DAL.HitMaster' is not compatible with 'SqlServer.smalldatetime[Nullable=True,DefaultValue=,Precision=0]' of member 'LoginTime' in type 'CodeFirstDatabaseSchema.HitMaster'.`
I am using **SQL Server 2012** as my database
| 0debug
|
Python 3.6.7 is not found 'winreg' module : 'winreg' module is not found python 3.6.7. When I am not facing when I am using Python 3.4.
Is any third-party app in 'winreg' that I can use same code or how can I solve this.
`from winreg import *`
<b>ModuleNotFoundError: No module named 'winreg'</b>
| 0debug
|
void ff_h264_direct_dist_scale_factor(H264Context * const h){
const int poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD];
const int poc1 = h->ref_list[1][0].poc;
int i, field;
if (FRAME_MBAFF(h))
for (field = 0; field < 2; field++){
const int poc = h->cur_pic_ptr->field_poc[field];
const int poc1 = h->ref_list[1][0].field_poc[field];
for (i = 0; i < 2 * h->ref_count[0]; i++)
h->dist_scale_factor_field[field][i^field] =
get_scale_factor(h, poc, poc1, i+16);
}
for (i = 0; i < h->ref_count[0]; i++){
h->dist_scale_factor[i] = get_scale_factor(h, poc, poc1, i);
}
}
| 1threat
|
int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx,
HEVCParamSets *ps)
{
HEVCSPS *sps = NULL;
int i, ret = 0;
unsigned int pps_id = 0;
ptrdiff_t nal_size;
AVBufferRef *pps_buf;
HEVCPPS *pps = av_mallocz(sizeof(*pps));
if (!pps)
return AVERROR(ENOMEM);
pps_buf = av_buffer_create((uint8_t *)pps, sizeof(*pps),
hevc_pps_free, NULL, 0);
if (!pps_buf) {
av_freep(&pps);
return AVERROR(ENOMEM);
}
av_log(avctx, AV_LOG_DEBUG, "Decoding PPS\n");
nal_size = gb->buffer_end - gb->buffer;
if (nal_size > sizeof(pps->data)) {
av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized PPS "
"(%"PTRDIFF_SPECIFIER" > %"SIZE_SPECIFIER")\n",
nal_size, sizeof(pps->data));
pps->data_size = sizeof(pps->data);
} else {
pps->data_size = nal_size;
}
memcpy(pps->data, gb->buffer, pps->data_size);
pps->loop_filter_across_tiles_enabled_flag = 1;
pps->num_tile_columns = 1;
pps->num_tile_rows = 1;
pps->uniform_spacing_flag = 1;
pps->disable_dbf = 0;
pps->beta_offset = 0;
pps->tc_offset = 0;
pps->log2_max_transform_skip_block_size = 2;
pps_id = get_ue_golomb_long(gb);
if (pps_id >= HEVC_MAX_PPS_COUNT) {
av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->sps_id = get_ue_golomb_long(gb);
if (pps->sps_id >= HEVC_MAX_SPS_COUNT) {
av_log(avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", pps->sps_id);
ret = AVERROR_INVALIDDATA;
goto err;
}
if (!ps->sps_list[pps->sps_id]) {
av_log(avctx, AV_LOG_ERROR, "SPS %u does not exist.\n", pps->sps_id);
ret = AVERROR_INVALIDDATA;
goto err;
}
sps = (HEVCSPS *)ps->sps_list[pps->sps_id]->data;
pps->dependent_slice_segments_enabled_flag = get_bits1(gb);
pps->output_flag_present_flag = get_bits1(gb);
pps->num_extra_slice_header_bits = get_bits(gb, 3);
pps->sign_data_hiding_flag = get_bits1(gb);
pps->cabac_init_present_flag = get_bits1(gb);
pps->num_ref_idx_l0_default_active = get_ue_golomb_long(gb) + 1;
pps->num_ref_idx_l1_default_active = get_ue_golomb_long(gb) + 1;
pps->pic_init_qp_minus26 = get_se_golomb(gb);
pps->constrained_intra_pred_flag = get_bits1(gb);
pps->transform_skip_enabled_flag = get_bits1(gb);
pps->cu_qp_delta_enabled_flag = get_bits1(gb);
pps->diff_cu_qp_delta_depth = 0;
if (pps->cu_qp_delta_enabled_flag)
pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb);
if (pps->diff_cu_qp_delta_depth < 0 ||
pps->diff_cu_qp_delta_depth > sps->log2_diff_max_min_coding_block_size) {
av_log(avctx, AV_LOG_ERROR, "diff_cu_qp_delta_depth %d is invalid\n",
pps->diff_cu_qp_delta_depth);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->cb_qp_offset = get_se_golomb(gb);
if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) {
av_log(avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n",
pps->cb_qp_offset);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->cr_qp_offset = get_se_golomb(gb);
if (pps->cr_qp_offset < -12 || pps->cr_qp_offset > 12) {
av_log(avctx, AV_LOG_ERROR, "pps_cr_qp_offset out of range: %d\n",
pps->cr_qp_offset);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->pic_slice_level_chroma_qp_offsets_present_flag = get_bits1(gb);
pps->weighted_pred_flag = get_bits1(gb);
pps->weighted_bipred_flag = get_bits1(gb);
pps->transquant_bypass_enable_flag = get_bits1(gb);
pps->tiles_enabled_flag = get_bits1(gb);
pps->entropy_coding_sync_enabled_flag = get_bits1(gb);
if (pps->tiles_enabled_flag) {
pps->num_tile_columns = get_ue_golomb_long(gb) + 1;
pps->num_tile_rows = get_ue_golomb_long(gb) + 1;
if (pps->num_tile_columns <= 0 ||
pps->num_tile_columns >= sps->width) {
av_log(avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n",
pps->num_tile_columns - 1);
ret = AVERROR_INVALIDDATA;
goto err;
}
if (pps->num_tile_rows <= 0 ||
pps->num_tile_rows >= sps->height) {
av_log(avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n",
pps->num_tile_rows - 1);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width));
pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height));
if (!pps->column_width || !pps->row_height) {
ret = AVERROR(ENOMEM);
goto err;
}
pps->uniform_spacing_flag = get_bits1(gb);
if (!pps->uniform_spacing_flag) {
uint64_t sum = 0;
for (i = 0; i < pps->num_tile_columns - 1; i++) {
pps->column_width[i] = get_ue_golomb_long(gb) + 1;
sum += pps->column_width[i];
}
if (sum >= sps->ctb_width) {
av_log(avctx, AV_LOG_ERROR, "Invalid tile widths.\n");
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->column_width[pps->num_tile_columns - 1] = sps->ctb_width - sum;
sum = 0;
for (i = 0; i < pps->num_tile_rows - 1; i++) {
pps->row_height[i] = get_ue_golomb_long(gb) + 1;
sum += pps->row_height[i];
}
if (sum >= sps->ctb_height) {
av_log(avctx, AV_LOG_ERROR, "Invalid tile heights.\n");
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->row_height[pps->num_tile_rows - 1] = sps->ctb_height - sum;
}
pps->loop_filter_across_tiles_enabled_flag = get_bits1(gb);
}
pps->seq_loop_filter_across_slices_enabled_flag = get_bits1(gb);
pps->deblocking_filter_control_present_flag = get_bits1(gb);
if (pps->deblocking_filter_control_present_flag) {
pps->deblocking_filter_override_enabled_flag = get_bits1(gb);
pps->disable_dbf = get_bits1(gb);
if (!pps->disable_dbf) {
int beta_offset_div2 = get_se_golomb(gb);
int tc_offset_div2 = get_se_golomb(gb) ;
if (beta_offset_div2 < -6 || beta_offset_div2 > 6) {
av_log(avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n",
beta_offset_div2);
ret = AVERROR_INVALIDDATA;
goto err;
}
if (tc_offset_div2 < -6 || tc_offset_div2 > 6) {
av_log(avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n",
tc_offset_div2);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->beta_offset = 2 * beta_offset_div2;
pps->tc_offset = 2 * tc_offset_div2;
}
}
pps->scaling_list_data_present_flag = get_bits1(gb);
if (pps->scaling_list_data_present_flag) {
set_default_scaling_list_data(&pps->scaling_list);
ret = scaling_list_data(gb, avctx, &pps->scaling_list, sps);
if (ret < 0)
goto err;
}
pps->lists_modification_present_flag = get_bits1(gb);
pps->log2_parallel_merge_level = get_ue_golomb_long(gb) + 2;
if (pps->log2_parallel_merge_level > sps->log2_ctb_size) {
av_log(avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n",
pps->log2_parallel_merge_level - 2);
ret = AVERROR_INVALIDDATA;
goto err;
}
pps->slice_header_extension_present_flag = get_bits1(gb);
if (get_bits1(gb)) {
int pps_range_extensions_flag = get_bits1(gb);
get_bits(gb, 7);
if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) {
if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0)
goto err;
}
}
ret = setup_pps(avctx, gb, pps, sps);
if (ret < 0)
goto err;
if (get_bits_left(gb) < 0) {
av_log(avctx, AV_LOG_ERROR,
"Overread PPS by %d bits\n", -get_bits_left(gb));
goto err;
}
remove_pps(ps, pps_id);
ps->pps_list[pps_id] = pps_buf;
return 0;
err:
av_buffer_unref(&pps_buf);
return ret;
}
| 1threat
|
plz help me in finding the error in this query : tell me whether the query is correct or contains any error
select cname from company where id IN (select company_id,count(*) from medication group by(company_id) having count(*)>1) order by cname;
| 0debug
|
How to order types at compile-time? : <p>Consider the following program:</p>
<pre><code>#include <tuple>
#include <vector>
#include <iostream>
#include <type_traits>
template <class T>
struct ordered {};
template <class... T>
struct ordered<std::tuple<T...>>
{
using type = /* a reordered tuple */;
};
template <class T>
using ordered_t = typename ordered<T>::type;
int main(int argc, char* argv[])
{
using type1 = std::tuple<char, std::vector<int>, double>;
using type2 = std::tuple<std::vector<int>, double, char>;
std::cout << std::is_same_v<type1, type2> << "\n"; // 0
std::cout << std::is_same_v<ordered_t<type1>, ordered_t<type2>> << "\n"; // 1
return 0;
}
</code></pre>
<p>The <code>ordered</code> helper has to reorder types in a tuple, such that two tuples with the sames types, but ordered differently lead to the same tuple type: which can be the first one, the second one, or even another one: it just has to have the same size, and the same elements but in a unique order (regardless of this order).</p>
<p>Is it possible to do this at compile-time using template metaprogramming techniques?</p>
| 0debug
|
Finding and removing consonants in a word: my program does not deliver the consonants :
here is my program
import time
print('hello, i am the consonants finder and i am going to find he consonants in your word')
consonants = 'b' 'c' 'd' 'f' 'g' 'h' 'j' 'k' 'l' 'm' 'n' 'p' 'q' 'r' 's' 't' 'v' 'w' 'x' 'y' 'z'
word = input('what is your word: ').lower()
time.sleep(1)
print('here is your word/s only in consonants')
time.sleep(1)
print('Calculating')
time.sleep(1)
for i in word:
if i == consonants:
print((i), ' is a consonant')
here Is the output:
hello, i am the consonants finder and i am going to find he consonants in your word
what is your word: hello
here is your word/s only in consonants
Calculating
>>>
how come the output does not give the consonants
this is what the output should be:
hello, i am the consonants finder and i am going to find he consonants in your word
what is your word: hello
here is your word/s only in consonants
Calculating
hll
| 0debug
|
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
Error **errp)
{
Error *local_err = NULL;
MigrationState *s = migrate_get_current();
MigrationParams params;
const char *p;
params.blk = has_blk && blk;
params.shared = has_inc && inc;
if (migration_is_setup_or_active(s->state) ||
s->state == MIGRATION_STATUS_CANCELLING) {
error_setg(errp, QERR_MIGRATION_ACTIVE);
return;
}
if (runstate_check(RUN_STATE_INMIGRATE)) {
error_setg(errp, "Guest is waiting for an incoming migration");
return;
}
if (qemu_savevm_state_blocked(errp)) {
return;
}
if (migration_blockers) {
*errp = error_copy(migration_blockers->data);
return;
}
s = migrate_init(¶ms);
if (strstart(uri, "tcp:", &p)) {
tcp_start_outgoing_migration(s, p, &local_err);
#ifdef CONFIG_RDMA
} else if (strstart(uri, "rdma:", &p)) {
rdma_start_outgoing_migration(s, p, &local_err);
#endif
#if !defined(WIN32)
} else if (strstart(uri, "exec:", &p)) {
exec_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "unix:", &p)) {
unix_start_outgoing_migration(s, p, &local_err);
} else if (strstart(uri, "fd:", &p)) {
fd_start_outgoing_migration(s, p, &local_err);
#endif
} else {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
"a valid migration protocol");
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
MIGRATION_STATUS_FAILED);
return;
}
if (local_err) {
migrate_fd_error(s);
error_propagate(errp, local_err);
return;
}
}
| 1threat
|
static bool qemu_co_queue_do_restart(CoQueue *queue, bool single)
{
Coroutine *next;
CoQueueNextData *data;
if (QTAILQ_EMPTY(&queue->entries)) {
return false;
}
data = g_slice_new(CoQueueNextData);
data->bh = aio_bh_new(queue->ctx, qemu_co_queue_next_bh, data);
QTAILQ_INIT(&data->entries);
qemu_bh_schedule(data->bh);
while ((next = QTAILQ_FIRST(&queue->entries)) != NULL) {
QTAILQ_REMOVE(&queue->entries, next, co_queue_next);
QTAILQ_INSERT_TAIL(&data->entries, next, co_queue_next);
trace_qemu_co_queue_next(next);
if (single) {
break;
}
}
return true;
}
| 1threat
|
Extract list from text : I've got Code
(2843, '', 0, '', '', '', '', 'mail@yahoo.gr', '', ''),
(2844, '', 0, '', '', '', '', 'mail1@washpost.com', '', ''),
(2845, '', 0, '', '', '', '', 'someMail@gmail.com', '', ''),
(2846, '', 0, '', '', '', '', 'else@gmail.gov', '', ''),
& How to Extract them via
> .gov'
& put like
> else@gmail.gov,nextElse@gmail.gov
?
| 0debug
|
Unit Testing Strategy, Ideal Code Coverage Baseline : <p>There's still not much information out there on the XCode7 and Swift 2.0 real-world experiences from a unit testing and code coverage perspective. </p>
<p>While there're plenty of tutorials and basic how-to guides available, I wonder what is the experience and typical coverage stats on different iOS teams that actually tried to achieve a reasonable coverage for their released iOS/Swift apps. I specifically wonder about this:</p>
<p>1) while code coverage percentage doesn't represent the overall quality of the code base, is this being used as an essential metric on your team? If not, what is the other measurable way to assess the quality of your code base?</p>
<p>2) For a bit more robust app, what is your current code coverage percentage? (just fyi, we have hard time getting over 50% for our current code base)</p>
<p>3) How do you test things like:</p>
<ul>
<li>App life-cycle, AppDelegate methods</li>
<li>Any code related to push/local notifications, deep linking</li>
<li>Defensive programming practices, various piece-of-mind (hardly reproducible) safe guards, exception handling etc.</li>
<li>Animations, transitions, rendering of custom controls (CG) etc.</li>
<li>Popups or Alerts that may include any additional logic</li>
</ul>
<p>I understand some of the above is more of a subject for actual UI tests, but it makes me wonder:</p>
<ul>
<li>Is there a reasonable way to get the above tested from the UTs perspective? Should we be even trying to satisfy an arbitrary minimal code coverage percentage with UTs for the whole code base or should we define that percentage off a reasonably achievable coverage given the app's code base?</li>
<li>Is it reasonable to make the code base more inflexible in order to achieve higher coverage? (I'm not talking about a medical app where life would be in stake here)</li>
<li>are there any good practices on testing all the things mentioned above, other than with UI tests?</li>
</ul>
<p>Looking forward to a fruitful discussion.</p>
| 0debug
|
All dependencies are not downloaded with "pip download" : <p>I'm trying to setup a local directory with packages that can be reused for installation on a machine without an internet connection but I'm having problems with some of the packages.</p>
<p>I first download the packages with </p>
<pre><code>pip download -r requirements.txt -d my_packages --no-binary :all:
</code></pre>
<p>And then I try to install them with</p>
<pre><code>pip install -r requirements.txt --no-index -f my_packages
</code></pre>
<p>One of the packages I'm having trouble installing is <code>elasticsearch-dsl==6.1.0</code>:</p>
<pre><code>pip install -r requirements --no-index -f my_packages
Looking in links: my_packages
Collecting elasticsearch-dsl==6.1.0
Collecting six (from elasticsearch-dsl==6.1.0)
Collecting python-dateutil (from elasticsearch-dsl==6.1.0)
Installing build dependencies ... error
Complete output from command /Users/Oskar/.pyenv/versions/2.7.15/envs/no_internet/bin/python2.7 -m pip install --ignore-installed --no-user --prefix /private/var/folders/36/t0_t6_td2f560t2j0149vjmw0000gn/T/pip-build-env-moib0N --no-warn-script-location --no-binary :none: --only-binary :none: --no-index --find-links my_packages -- setuptools wheel:
Looking in links: my_packages
Collecting setuptools
Could not find a version that satisfies the requirement setuptools (from versions: )
No matching distribution found for setuptools
</code></pre>
<p>Sure, <code>setuptools</code> I can manually install but there is more packages than that which is required for all the other packages. <code>django-guardian==1.4.9</code> is another example which requires <code>pytest-runner</code> which for some reason is not downloaded with <code>pip download</code></p>
| 0debug
|
Remove text before the slash by replace () Method : <p>I have an input of this type, for example:</p>
<pre><code>Guerre Stellari / Star Wars (1977)
</code></pre>
<p>the output should be:</p>
<pre><code>Star Wars (1977)
</code></pre>
<p>how do I get it using the replace() method?</p>
| 0debug
|
checked radio button after tr onclick in pure javascript :
> I've been searching many times on how to checked radiobutton
> in tr onclick in pure javascript but I only see Jquery. Can
> someone convert this jquery code to pure javascript or any solution
> will do.
$('tr').click(
function() {
$('input[type=radio]',this).attr('checked','checked');
}
);
| 0debug
|
static void cs_mem_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
CSState *s = opaque;
uint32_t saddr;
saddr = addr >> 2;
trace_cs4231_mem_writel_reg(saddr, s->regs[saddr], val);
switch (saddr) {
case 1:
trace_cs4231_mem_writel_dreg(CS_RAP(s), s->dregs[CS_RAP(s)], val);
switch(CS_RAP(s)) {
case 11:
case 25:
break;
case 12:
val &= 0x40;
val |= CS_CDC_VER;
s->dregs[CS_RAP(s)] = val;
break;
default:
s->dregs[CS_RAP(s)] = val;
break;
}
break;
case 2:
break;
case 4:
if (val & 1) {
cs_reset(&s->busdev.qdev);
}
val &= 0x7f;
s->regs[saddr] = val;
break;
default:
s->regs[saddr] = val;
break;
}
}
| 1threat
|
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
{
int64_t r = 0;
av_assert2(c > 0);
av_assert2(b >=0);
av_assert2((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4);
if (c <= 0 || b < 0 || !((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4))
return INT64_MIN;
if (rnd & AV_ROUND_PASS_MINMAX) {
if (a == INT64_MIN || a == INT64_MAX)
return a;
rnd -= AV_ROUND_PASS_MINMAX;
}
if (a < 0)
return -(uint64_t)av_rescale_rnd(-FFMAX(a, -INT64_MAX), b, c, rnd ^ ((rnd >> 1) & 1));
if (rnd == AV_ROUND_NEAR_INF)
r = c / 2;
else if (rnd & 1)
r = c - 1;
if (b <= INT_MAX && c <= INT_MAX) {
if (a <= INT_MAX)
return (a * b + r) / c;
else {
int64_t ad = a / c;
int64_t a2 = (a % c * b + r) / c;
if (ad >= INT32_MAX && ad > (INT64_MAX - a2) / b)
return INT64_MIN;
return ad * b + a2;
}
} else {
#if 1
uint64_t a0 = a & 0xFFFFFFFF;
uint64_t a1 = a >> 32;
uint64_t b0 = b & 0xFFFFFFFF;
uint64_t b1 = b >> 32;
uint64_t t1 = a0 * b1 + a1 * b0;
uint64_t t1a = t1 << 32;
int i;
a0 = a0 * b0 + t1a;
a1 = a1 * b1 + (t1 >> 32) + (a0 < t1a);
a0 += r;
a1 += a0 < r;
for (i = 63; i >= 0; i--) {
a1 += a1 + ((a0 >> i) & 1);
t1 += t1;
if (c <= a1) {
a1 -= c;
t1++;
}
}
if (t1 > INT64_MAX)
return INT64_MIN;
return t1;
}
#else
AVInteger ai;
ai = av_mul_i(av_int2i(a), av_int2i(b));
ai = av_add_i(ai, av_int2i(r));
return av_i2int(av_div_i(ai, av_int2i(c)));
}
#endif
}
| 1threat
|
Rails 5.2 encrypted credentials not saving : <p>When I do <code>bin/rails credentials:edit</code> my editor opens a file like <code>credentials.yml.enc.1234</code> with default content. After I'm done editing, I hit save, and the console reads <code>New credentials encrypted and saved.</code> </p>
<p>After I run <code>bin/rails credentials:edit</code> again, another temp file gets opened (<code>credentials.yml.enc.4321</code>) and the contents are back to default. </p>
<p>How can I make the credentials persist?</p>
| 0debug
|
how to count different kaeys and related different values in php arrays : iam trying to count the number of absenties and number of presenties per section in below example.but it is not easy to me how count number of absenties and presenties per section can u help me any one....thanks in advance
Array
(
[0] => Array
(
[Section] => Attendance
)
[1] => Array
(
[CSE-A] => PRESENT
)
[2] => Array
(
[CSE-G] => ABSENT
)
[3] => Array
(
[CSE-A] => ABSENT
)
[4] => Array
(
[CSE-C] => PRESENT
)
[5] => Array
(
[CSE-C] => PRESENT
)
[6] => Array
(
[CSE-C] => PRESENT
)
[7] => Array
(
[CSE-C] => PRESENT
)
[8] => Array
(
[IT] => PRESENT
)
[9] => Array
(
[CSE-D] => ABSENT
)
[10] => Array
(
[CSE-G] => ABSENT
)
[11] => Array
(
[CSE-B] => PRESENT
)
[12] => Array
(
[CSE-A] => ABSENT
)
[13] => Array
(
[CSE-C] => PRESENT
)
[14] => Array
(
[CSE-E] => ABSENT
)
[15] => Array
(
[CSE-B] => ABSENT
)
[16] => Array
(
[CSE-E] => ABSENT
)
[17] => Array
(
[CSE-F] => ABSENT
)
[18] => Array
(
[CSE-G] => ABSENT
)
)
| 0debug
|
How do I properly create custom text codecs? : <p>I'm digging through some old binaries that contain (among other things) text. Their text frequently uses custom character encodings for Reasons, and I want to be able to read and rewrite them.</p>
<p>It seems to me that the appropriate way to do this is to create a custom codec using the <a href="https://docs.python.org/3.5/library/codecs.html" rel="noreferrer">standard codecs library</a>. Unfortunately its documentation is both colossal and entirely bereft of examples. Google turns up a few, but only for python2, and I'm using 3.</p>
<p>I'm looking for a minimal example of how to use the codecs library to implement a custom character encoding.</p>
| 0debug
|
Static class for shared variables across multiple Windows : <p>I am developing a software in WPF c#. My software has multiple windows. I need to share a same instance of on object across multiple windows (I am using legacy code, so I can not make that object static). Is it a good practice to have a static class which will have variables that I need to share across multiple windows, so I can avoid passing them through a constructor. Thank you</p>
| 0debug
|
void qerror_report_internal(const char *file, int linenr, const char *func,
const char *fmt, ...)
{
va_list va;
QError *qerror;
va_start(va, fmt);
qerror = qerror_from_info(file, linenr, func, fmt, &va);
va_end(va);
if (cur_mon) {
monitor_set_error(cur_mon, qerror);
} else {
qerror_print(qerror);
QDECREF(qerror);
}
}
| 1threat
|
How do I read Class paths in Java's API documentation? : I was attempting to use a method I found in Java's documentation and I ran into some trouble. I have some confusion on what class path to use from the documentation.
If I want to use the method getLength(Object name) from the Array class the compiler accepts java.lang.reflect.Array.getLength(nameOfArray) but not java.lang.Object.getLength(nameOfArray). Though the picture of the API documentation linked below seems to imply to me that both class paths are linked to the Array classes method.
Also I feel like I might be using the wrong jargon when wording my question, how might you have reworded my question. I ask because It seems like to me I could find this information online but I did a search on google for "How to read Java Documentation" and coundn't find this piece of information.
My guess was maybe one of these class paths are extended and one is an implementation, but I'm also confused on which is which or why that would make a difference.
[Java API documentation example][1]
[1]: http://i.stack.imgur.com/nqMJs.png
Thank you
| 0debug
|
av_cold void ff_sws_init_swscale_x86(SwsContext *c)
{
int cpu_flags = av_get_cpu_flags();
#if HAVE_MMX_INLINE
if (INLINE_MMX(cpu_flags))
sws_init_swscale_mmx(c);
#endif
#if HAVE_MMXEXT_INLINE
if (INLINE_MMXEXT(cpu_flags))
sws_init_swscale_mmxext(c);
#endif
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
if (c->srcBpc == 8) { \
hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
ff_hscale8to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 9) { \
hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
ff_hscale9to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 10) { \
hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
ff_hscale10to19_ ## filtersize ## _ ## opt1; \
} else { \
hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
ff_hscale16to19_ ## filtersize ## _ ## opt1; \
} \
} while (0)
#define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
switch (filtersize) { \
case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
}
#define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case, condition_8bit) \
switch(c->dstBpc){ \
case 16: do_16_case; break; \
case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
}
#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
switch(c->dstBpc){ \
case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
}
#define case_rgb(x, X, opt) \
case AV_PIX_FMT_ ## X: \
c->lumToYV12 = ff_ ## x ## ToY_ ## opt; \
if (!c->chrSrcHSubSample) \
c->chrToYV12 = ff_ ## x ## ToUV_ ## opt; \
break
#if ARCH_X86_32
if (EXTERNAL_MMX(cpu_flags)) {
ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmxext, cpu_flags & AV_CPU_FLAG_MMXEXT);
switch (c->srcFormat) {
case AV_PIX_FMT_YA8:
c->lumToYV12 = ff_yuyvToY_mmx;
if (c->alpPixBuf)
c->alpToYV12 = ff_uyvyToY_mmx;
break;
case AV_PIX_FMT_YUYV422:
c->lumToYV12 = ff_yuyvToY_mmx;
c->chrToYV12 = ff_yuyvToUV_mmx;
break;
case AV_PIX_FMT_UYVY422:
c->lumToYV12 = ff_uyvyToY_mmx;
c->chrToYV12 = ff_uyvyToUV_mmx;
break;
case AV_PIX_FMT_NV12:
c->chrToYV12 = ff_nv12ToUV_mmx;
break;
case AV_PIX_FMT_NV21:
c->chrToYV12 = ff_nv21ToUV_mmx;
break;
case_rgb(rgb24, RGB24, mmx);
case_rgb(bgr24, BGR24, mmx);
case_rgb(bgra, BGRA, mmx);
case_rgb(rgba, RGBA, mmx);
case_rgb(abgr, ABGR, mmx);
case_rgb(argb, ARGB, mmx);
default:
break;
}
}
if (EXTERNAL_MMXEXT(cpu_flags)) {
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmxext, , 1);
}
#endif
#define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
switch (filtersize) { \
case 4: ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
case 8: ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
else ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
break; \
}
if (EXTERNAL_SSE2(cpu_flags)) {
ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
HAVE_ALIGNED_STACK || ARCH_X86_64);
ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
switch (c->srcFormat) {
case AV_PIX_FMT_YA8:
c->lumToYV12 = ff_yuyvToY_sse2;
if (c->alpPixBuf)
c->alpToYV12 = ff_uyvyToY_sse2;
break;
case AV_PIX_FMT_YUYV422:
c->lumToYV12 = ff_yuyvToY_sse2;
c->chrToYV12 = ff_yuyvToUV_sse2;
break;
case AV_PIX_FMT_UYVY422:
c->lumToYV12 = ff_uyvyToY_sse2;
c->chrToYV12 = ff_uyvyToUV_sse2;
break;
case AV_PIX_FMT_NV12:
c->chrToYV12 = ff_nv12ToUV_sse2;
break;
case AV_PIX_FMT_NV21:
c->chrToYV12 = ff_nv21ToUV_sse2;
break;
case_rgb(rgb24, RGB24, sse2);
case_rgb(bgr24, BGR24, sse2);
case_rgb(bgra, BGRA, sse2);
case_rgb(rgba, RGBA, sse2);
case_rgb(abgr, ABGR, sse2);
case_rgb(argb, ARGB, sse2);
default:
break;
}
}
if (EXTERNAL_SSSE3(cpu_flags)) {
ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
switch (c->srcFormat) {
case_rgb(rgb24, RGB24, ssse3);
case_rgb(bgr24, BGR24, ssse3);
default:
break;
}
}
if (EXTERNAL_SSE4(cpu_flags)) {
ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4,
HAVE_ALIGNED_STACK || ARCH_X86_64);
if (c->dstBpc == 16 && !isBE(c->dstFormat))
c->yuv2plane1 = ff_yuv2plane1_16_sse4;
}
if (EXTERNAL_AVX(cpu_flags)) {
ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
HAVE_ALIGNED_STACK || ARCH_X86_64);
ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
switch (c->srcFormat) {
case AV_PIX_FMT_YUYV422:
c->chrToYV12 = ff_yuyvToUV_avx;
break;
case AV_PIX_FMT_UYVY422:
c->chrToYV12 = ff_uyvyToUV_avx;
break;
case AV_PIX_FMT_NV12:
c->chrToYV12 = ff_nv12ToUV_avx;
break;
case AV_PIX_FMT_NV21:
c->chrToYV12 = ff_nv21ToUV_avx;
break;
case_rgb(rgb24, RGB24, avx);
case_rgb(bgr24, BGR24, avx);
case_rgb(bgra, BGRA, avx);
case_rgb(rgba, RGBA, avx);
case_rgb(abgr, ABGR, avx);
case_rgb(argb, ARGB, avx);
default:
break;
}
}
}
| 1threat
|
AWS Step Function - Wait until an event : <p>I have a use case where I have a AWS Step function that is triggered when a file is uploaded to S3, from there the first step runs an ffprobe to get the duration of the file from an external service such as transloadit where the output is written back to S3.</p>
<p>I can create a new step function from that event, but I was wandering if it is possible to have an Await promise inside the original step function and then continue to the next - taking into account that it could take longer for the ffprobe to comeback.</p>
<p>Any advice is much appreciated on how to tackle this.</p>
| 0debug
|
How to forEach in Elixir : <p>How do you forEach in Elixir? In JavaScript (and most languages have an equivalent), I can iterate through the various items in a list and do something with side effects like outputting to the console.</p>
<pre><code>[1,2,3].forEach(function(num) {
console.log(num);
});
//=> 1
//=> 2
//=> 3
</code></pre>
<p>Is there an equivalent in elixir?</p>
| 0debug
|
how to see my tables in sqlite database manager? : **I wrote code for database sqlite in android studio but I dont know how to see my tables in sqlite Manger.**
| 0debug
|
React Hooks with React Router v4 - how do I redirect to another route? : <p>I have a simple react hooks application - a list of Todos - with react router v4</p>
<p>On the List of Todos, when a Todo is clicked I need to:</p>
<ol>
<li>Dispatch the current todo in context</li>
<li>Redirect to another route (from /todos to /todos/:id)</li>
</ol>
<p>In the previous React Class based implementation I could use this.context.history.push to redirect to another route. </p>
<p>How would I handle that using React Hooks in combination of React Router v4 (in code below see my comment in function editRow())?</p>
<p>Code below:</p>
<p>=====index.js=====</p>
<pre><code>import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter} from "react-router-dom"
import App from './App';
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>, document.getElementById('root'));
</code></pre>
<p>=====main.js=====</p>
<pre><code>import React from 'react'
import { Switch, Route } from 'react-router-dom'
import TodosList from './todoslist'
import TodosEdit from './todosedit'
const Main = () => (
<main>
<Switch>
<Route exact path="/todos" component={TodosList}/>
<Route exact path="/todos/:id" component={TodosEdit} />
</Switch>
</main>
)
export default Main
</code></pre>
<p>=====app.js=====</p>
<pre><code>import React, {useContext, useReducer} from 'react';
import Main from './main'
import TodosContext from './context'
import todosReducer from './reducer'
const App = () => {
const initialState = useContext(TodosContext);
const [state, dispatch] = useReducer(todosReducer, initialState);
return (
<div>
<TodosContext.Provider value={{state, dispatch}}>
<Main/>
</TodosContext.Provider>
</div>
)
}
export default App;
</code></pre>
<p>=====TodosContext.js=====</p>
<pre><code>import React from 'react'
const TodosContext = React.createContext({
todos: [
{id:1, text:'Get Grocery', complete:false},
{id:2, text:'Excercise', complete:false},
{id:3, text:'Drink Water', complete:true},
],
currentTodo: {}
})
export default TodosContext
</code></pre>
<p>=====reducer.js=====</p>
<pre><code>import React from 'react'
export default function reducer(state, action){
switch(action.type){
case "GET_TODOS":
return {
...state,
todos: action.payload
}
case "SET_CURRENT_TODO":
return {
...state,
currentTodo: action.payload
}
default:
return state
}
}
</code></pre>
<p>=====Todos.js=====</p>
<pre><code>import React, {useState, useContext, useEffect} from 'react';
import TodosContext from './context'
function Todos(){
const [todo, setTodo] = useState("")
const {state, dispatch} = useContext(TodosContext)
useEffect(()=>{
if(state.currentTodo.text){
setTodo(state.currentTodo.text)
} else {
setTodo("")
}
dispatch({
type: "GET_TODOS",
payload: state.todos
})
}, [state.currentTodo.id])
const editRow = event =>{
let destUrlEdit = `/todos/${event.id}`
let obj = {}
obj.id = event.id
obj.text = event.text
dispatch({type:"SET_CURRENT_TODO", payload: obj})
//after dispatch I would like to redirect to another route to do the actual edit
//destUrlEdit
}
return(
<div>
<h1>List of ToDos</h1>
<h4>{title}</h4>
<ul>
{state.todos.map(todo => (
<li key={todo.id}>{todo.text} &nbsp;
<button onClick={()=>{
editRow(todo)}}>
</button>
</li>
))}
</ul>
</div>
)
}
export default Todos;
</code></pre>
| 0debug
|
How to load assemblies located in a folder in .net core console app : <p>I'm making a console app on .Net Core platform and was wondering, how does one load assemblies (.dll files) and instantiate classes using C# dynamic features? It seems so much different than .Net 4.X and it's not really documented...</p>
<p>For example let's say I have a class library (.Net Core) and it has only one class:</p>
<pre><code>namespace MyClassLib.SampleClasses
{
public class Sample
{
public string SayHello(string name)
{
return $"Hello {name}";
}
public DateTime SayDateTime()
{
return DateTime.Now;
}
}
}
</code></pre>
<p>So the name of the dll file would be <code>MyClassLib.dll</code> and its located in <code>/dlls/MyClassLib.dll</code>.</p>
<p>Now I want to load this in a simple console app (.Net Core) and instantiate the <code>Sample</code> class and call the methods using dynamic features of C# in the following console app:</p>
<pre><code>namespace AssemblyLoadingDynamic
{
public class Program
{
public static void Main(string[] args)
{
// load the assembly and use the classes
}
}
}
</code></pre>
<p><strong>Note:</strong>
By .Net Core I mean RC2 version.</p>
| 0debug
|
How to detect real click using mouse or using .click() on tag button , a? : <p>I want to detect if some of my users really click on vote button or using click() function. My vote button is in button tag or a tag. </p>
| 0debug
|
I need to know, is it possible to change some product's IP address using python scripts? If possible then how ? Includes Printer and other devices : i am currently on some project. I just want to know if we have more than one products and need to assign IP address to them **automatically** using python , is this possible. If yes please help me .
| 0debug
|
How to run TensorFlow on an AWS cluster? : <p>I'm trying to run distributed tensorflow on an EMR/EC2 cluster but I don't know how to specify different instances in the cluster to run parts of the code. </p>
<p>In the documentation, they've used <code>tf.device("/gpu:0")</code> to specify a gpu. But what if I have a master CPU and 5 different slave GPU instances running in an EMR cluster and I want to specify those GPUs to run some code? I can't input <code>tf.device()</code> with the public DNS names of the instances because it throws an error saying the name cannot be resolved.</p>
| 0debug
|
static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
{
ebml_master cues_element;
int64_t currentpos;
int i, j;
currentpos = avio_tell(pb);
cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0);
for (i = 0; i < cues->num_entries; i++) {
ebml_master cuepoint, track_positions;
mkv_cuepoint *entry = &cues->entries[i];
uint64_t pts = entry->pts;
cuepoint = start_ebml_master(pb, MATROSKA_ID_POINTENTRY, MAX_CUEPOINT_SIZE(num_tracks));
put_ebml_uint(pb, MATROSKA_ID_CUETIME, pts);
for (j = 0; j < cues->num_entries - i && entry[j].pts == pts; j++) {
track_positions = start_ebml_master(pb, MATROSKA_ID_CUETRACKPOSITION, MAX_CUETRACKPOS_SIZE);
put_ebml_uint(pb, MATROSKA_ID_CUETRACK , entry[j].tracknum );
put_ebml_uint(pb, MATROSKA_ID_CUECLUSTERPOSITION, entry[j].cluster_pos);
end_ebml_master(pb, track_positions);
}
i += j - 1;
end_ebml_master(pb, cuepoint);
}
end_ebml_master(pb, cues_element);
av_free(cues->entries);
av_free(cues);
return currentpos;
}
| 1threat
|
How to execute a * .PY file from a * .IPYNB file on the Jupyter notebook? : <p>I am working on a Python Notebook and I would like that <strong>large input code [input]</strong> <strong>pack into a [* .PY] files and call this files from the notebook</strong>. </p>
<p>The action of running a [<em>.PY] file from the Notebook is known to me and the command varies between Linux or Windows. <strong>But when I do this action and execute the [.PY] file from the notebook, it does not recognize any existing library or variable loaded in the notebook (it's like the [</em>.PY] file start from zero...)</strong>. </p>
<p>Is there any way to fix this?</p>
<p>A possible simplified example of the problem would be the following:</p>
<pre><code>In[1]:
import numpy as np
import matplotlib.pyplot as plt
In[2]:
def f(x):
return np.exp(-x ** 2)
In[3]:
x = np.linspace(-1, 3, 100)
In[4]:
%run script.py
</code></pre>
<p>Where "<strong>script.py</strong>" has the following content:</p>
<pre><code>plt.plot(x, f(x))
plt.xlabel("Eje $x$",fontsize=16)
plt.ylabel("$f(x)$",fontsize=16)
plt.title("Funcion $f(x)$")
</code></pre>
<ul>
<li>In the real problem, the file [* .PY] does not have 4 lines of code, it has enough more.</li>
</ul>
| 0debug
|
How to share a very specific android application : I’m currently working on an android application.
I’m developing this application for a small company of cleaning, they need the application to coordinates in a better way the work.
I was wondering which one is the best way to let the final user install the application, like for example:
-Publish it on the play store
-Send to each user the .apk
Also keep in mind that the app will be updated in the future so must be easy to apply the updates.
In the end I’d like to know which kind of approach can suit my situation and which one is the best way to proceed, thanks to everyone.
| 0debug
|
why assemble before creating binary file? : <p>I don't know much about the compilation steps. As I understand it, when I click on the compile buton of my IDE, the is a phase of preprocessing, compiling (creating assembly code), creating binary code (object files) and then linking.
But why isn't the compiler directly going from the preprocessing to a binary file? (since basicaly this is just a translation into 1s and 0s without choosing how things are going to be handled by the processor->which was done in the compilation step).</p>
| 0debug
|
Select row from a DataFrame based on the type of the object(i.e. str) : <p>So there's a DataFrame say:</p>
<pre><code>>>> df = pd.DataFrame({
... 'A':[1,2,'Three',4],
... 'B':[1,'Two',3,4]})
>>> df
A B
0 1 1
1 2 Two
2 Three 3
3 4 4
</code></pre>
<p>I want to select the rows whose datatype of particular row of a particular column is of type <code>str</code>.</p>
<p>For example I want to select the row where <code>type</code> of data in the column <code>A</code> is a <code>str</code>.
so it should print something like:</p>
<pre><code> A B
2 Three 3
</code></pre>
<p>Whose intuitive code would be like:</p>
<pre><code>df[type(df.A) == str]
</code></pre>
<p>Which obviously doesn't works!</p>
<p>Thanks please help!</p>
| 0debug
|
Python Pandas: Check if string in one column is contained in string of another column in the same row : <p>I have a dataframe like this:</p>
<pre><code>RecID| A |B
----------------
1 |a | abc
2 |b | cba
3 |c | bca
4 |d | bac
5 |e | abc
</code></pre>
<p>And want to create another column, C, out of A and B such that for the same row, if the string in column A is contained in the string of column B, then C = True and if not then C = False.</p>
<p>The example output I am looking for is this:</p>
<pre><code>RecID| A |B |C
--------------------
1 |a | abc |True
2 |b | cba |True
3 |c | bca |True
4 |d | bac |False
5 |e | abc |False
</code></pre>
<p>Is there a way to do this in pandas quickly and without using a loop? Thanks</p>
| 0debug
|
def cube_Sum(n):
sum = 0
for i in range(1,n + 1):
sum += (2*i)*(2*i)*(2*i)
return sum
| 0debug
|
static void fdt_add_gic_node(const VirtBoardInfo *vbi)
{
uint32_t gic_phandle;
gic_phandle = qemu_fdt_alloc_phandle(vbi->fdt);
qemu_fdt_setprop_cell(vbi->fdt, "/", "interrupt-parent", gic_phandle);
qemu_fdt_add_subnode(vbi->fdt, "/intc");
qemu_fdt_setprop_string(vbi->fdt, "/intc", "compatible",
"arm,cortex-a15-gic");
qemu_fdt_setprop_cell(vbi->fdt, "/intc", "#interrupt-cells", 3);
qemu_fdt_setprop(vbi->fdt, "/intc", "interrupt-controller", NULL, 0);
qemu_fdt_setprop_sized_cells(vbi->fdt, "/intc", "reg",
2, vbi->memmap[VIRT_GIC_DIST].base,
2, vbi->memmap[VIRT_GIC_DIST].size,
2, vbi->memmap[VIRT_GIC_CPU].base,
2, vbi->memmap[VIRT_GIC_CPU].size);
qemu_fdt_setprop_cell(vbi->fdt, "/intc", "phandle", gic_phandle);
}
| 1threat
|
Im having issues in running my code , css please help me :
<style>
*{ z-index: 1; }
body
{ margin: 0;}
#product
{
height: 35em;
background: #000;
color: #fff;
}
#product ul
{ padding: 0; }
#product ul li
{
height: 35em;
width: 25%;
float:left;
background-color: red;
position: relative;
}
#product p
{
position: relative;
top: 40%;
z-index: 15;
}
#product h1
{ text-align: center;}
#pos
{
position: absolute;
z-index: 3;
background-color:rgba(0, 0, 0,1);
}
#ovrl
{
background: rgba(0, 0, 0, .5);
height: 35em;
width: 100%;
position: absolute;
z-index: 2;
}
</style>
</head>
<body>
<div id="product">
<div id = "pos">
<h1>Why Choose Us</h1>
<hr>
</div>
<ul>
<li ><p>Customized<br>Software</p></li>
<li><p>Workshop</p></li>
<li><p>Digital<br>Advertising</p></li>
<li><p>E-learning</p</li>
</ul>
<div id="ovrl"></div>
</div>
</body>
when i remove the code
#product ul li{
position : realtive;
}
then text is fully white but when it;s present in the code text is not white.
And another problem when i ONLY remove
*{
z-index :1;
}
then also it works fine.
But i cannot understand why.
i need help please anyone solve my problem .
| 0debug
|
what is the function of {% include filename %} and {{ content }}in this code?i do not find such a syntax : <!doctype html>
<html>`enter code here`
{% include head.html %}
<body>
<div class="container jumbotron">
<h1 class="text-center"><i class="fa fa-paper-plane float shadow"></i> Flyaway<a href="">.css</a></h1>
<p class="lead text-right">~ created by <small><a href="http://takentech.com/about.html"><i class="glyphicon glyphicon-fire"></i> 進擊的燊</a></small> ~</p>
<ul class="list-inline text-center">
<li>
<iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=lushen&repo=flyaway&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="100px" height="20px"></iframe>
</li>
<li>
<iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=lushen&repo=flyaway&type=fork&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="102px" height="20px"></iframe>
</li>
</ul>
{{ content }}
{% include footer.html %}
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="http://apps.bdimg.com/libs/jquery/2.0.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/back-to-top.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="js/prefixfree.js"></script>
<script type="text/javascript" src="js/shake.js"></script>
<script type="text/javascript" src="js/flyaway.js"></script>
</body>
</html>
This is a opensource on github. I just want to understand this code.There
are head.html and footer.html files ,but when i open the default.html file on my computer,the head and footer file do not load on the web page.But on the other hand , when i use the 'check' button on the chrome to see the source code of http://takentech.com/flyaway/ , the head and footer are actually loaded. The same time , i search the internet to find what {{}} and {% include filename%} really are. there is no such a syntax.
finally.Thanks for all the answers.
| 0debug
|
static uint16_t roundToInt16(int64_t f){
int r= (f + (1<<15))>>16;
if(r<-0x7FFF) return 0x8000;
else if(r> 0x7FFF) return 0x7FFF;
else return r;
}
| 1threat
|
select the option with the highest data-sale attribute : <p>kind a new to jquery and cant get my head around on this one. any help would be much appreciate.</p>
<p>add checked attribute to the radio input with the highest data-attribute. </p>
<p><strong>But</strong> :</p>
<p><strong>A</strong>. if the radio input in the bottom of the list has an attribute disabled="disabled" select the second highest option.</p>
<p>e.g.</p>
<pre><code><ul class="sales">
<li><input type="radio" data-sale="20"/></li>
<li><input type="radio" data-sale="50"/></li>
<li><input type="radio" data-sale="55"/></li>
<li><input type="radio" checked="checked" data-sale="60"/></li><!--add checked attribute-->
<li><input type="radio" disabled="disabled" data-sale="90"/></li>
</code></pre>
<p> </p>
<p><strong>B</strong>. if the disabled attribute is not in the bottom of the list, still checked the highest radio.</p>
<p>e.g.</p>
<pre><code><ul class="sales">
<li><input type="radio" data-sale="20"/></li>
<li><input type="radio" data-sale="50"/></li>
<li><input type="radio" disabled="disabled" data-sale="55"/></li>
<li><input type="radio" data-sale="60"/></li>
<li><input type="radio" checked="checked" data-sale="90"/></li><!--add checked attribute-->
</code></pre>
<p> </p>
<p>naturally the html apply the checked in the very first radio in the list. in this case the data-sale = 20</p>
<p>i have to append that data-sale attribute to a container span.</p>
<p>thanks appreciate your help.</p>
| 0debug
|
static size_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...)
{
size_t old_offset = offset;
va_list ap;
int i;
va_start(ap, fmt);
for (i = 0; fmt[i]; i++) {
switch (fmt[i]) {
case 'b': {
uint8_t *valp = va_arg(ap, uint8_t *);
offset += pdu_unpack(valp, pdu, offset, sizeof(*valp));
break;
}
case 'w': {
uint16_t val, *valp;
valp = va_arg(ap, uint16_t *);
offset += pdu_unpack(&val, pdu, offset, sizeof(val));
*valp = le16_to_cpu(val);
break;
}
case 'd': {
uint32_t val, *valp;
valp = va_arg(ap, uint32_t *);
offset += pdu_unpack(&val, pdu, offset, sizeof(val));
*valp = le32_to_cpu(val);
break;
}
case 'q': {
uint64_t val, *valp;
valp = va_arg(ap, uint64_t *);
offset += pdu_unpack(&val, pdu, offset, sizeof(val));
*valp = le64_to_cpu(val);
break;
}
case 'v': {
struct iovec *iov = va_arg(ap, struct iovec *);
int *iovcnt = va_arg(ap, int *);
*iovcnt = pdu_copy_sg(pdu, offset, 0, iov);
break;
}
case 's': {
V9fsString *str = va_arg(ap, V9fsString *);
offset += pdu_unmarshal(pdu, offset, "w", &str->size);
str->data = g_malloc(str->size + 1);
offset += pdu_unpack(str->data, pdu, offset, str->size);
str->data[str->size] = 0;
break;
}
case 'Q': {
V9fsQID *qidp = va_arg(ap, V9fsQID *);
offset += pdu_unmarshal(pdu, offset, "bdq",
&qidp->type, &qidp->version, &qidp->path);
break;
}
case 'S': {
V9fsStat *statp = va_arg(ap, V9fsStat *);
offset += pdu_unmarshal(pdu, offset, "wwdQdddqsssssddd",
&statp->size, &statp->type, &statp->dev,
&statp->qid, &statp->mode, &statp->atime,
&statp->mtime, &statp->length,
&statp->name, &statp->uid, &statp->gid,
&statp->muid, &statp->extension,
&statp->n_uid, &statp->n_gid,
&statp->n_muid);
break;
}
case 'I': {
V9fsIattr *iattr = va_arg(ap, V9fsIattr *);
offset += pdu_unmarshal(pdu, offset, "ddddqqqqq",
&iattr->valid, &iattr->mode,
&iattr->uid, &iattr->gid, &iattr->size,
&iattr->atime_sec, &iattr->atime_nsec,
&iattr->mtime_sec, &iattr->mtime_nsec);
break;
}
default:
break;
}
}
va_end(ap);
return offset - old_offset;
}
| 1threat
|
Iterate through an array with multiple dictinaries : I have an array that contains multiple dictionaries.I want to iterate through every dictionary in the array in order to get only the "File_name" .Once i get the "file_name", i will add those values in another array of type [[String:Anyobject]] that i will hold the images .How can i proceed ?
Here is my code
import UIKit
import Alamofire
import SwiftyJSON
import MapKit
import CoreLocation
class DetailsViewController: UIViewController , MKMapViewDelegate , CLLocationManagerDelegate {
@IBOutlet weak var Price: UILabel!
@IBOutlet weak var Floor: UILabel!
@IBOutlet weak var scrollerpage: UIScrollView!
@IBOutlet weak var mapview: MKMapView!
@IBOutlet weak var bath: UILabel!
@IBOutlet weak var bed_number: UILabel!
@IBOutlet var PhotoDetailsView: UIImageView!
@IBOutlet var label1: UILabel!
@IBOutlet var label2: UILabel!
@IBOutlet var label3: UILabel!
@IBOutlet var label4: UILabel!
@IBOutlet var label5: UILabel!
@IBOutlet var label6: UILabel!
@IBOutlet var label7: UILabel!
@IBOutlet var label8: UILabel!
@IBOutlet var label9: UILabel!
@IBOutlet var label10: UILabel!
@IBOutlet var label11: UILabel!
@IBOutlet var label12: UILabel!
@IBOutlet var label13: UILabel!
@IBOutlet var label14: UILabel!
@IBOutlet var label15: UILabel!
@IBOutlet var label16: UILabel!
@IBOutlet var label17: UILabel!
@IBOutlet var descritpionlabel: UILabel!
var CondoIndivi2 = [[String:AnyObject]]()
var imageArray = [[String:AnyObject]]()
var test = [[String :AnyObject]]()
let adress : String = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
scrollerpage.contentSize.height = 15000
test = [
[
"id": 744736,
"pic_count": 6,
"mls_unique_id": 342947084,
"list_price": 1480000,
"property_type": "RE2",
"city": "Miami",
"bedrooms": 3,
"bath": 3,
"status": "A",
"entry_date": "2016-02-11 00:11:52",
"mls_number": "A10032455",
"street_number": 1060,
"street_directional": "",
"street_name": "Brickell",
"city_id": 65,
"zipcode": 33131,
"address": "1060 Brickell # 4505",
"primary_listing_pid": 3039955,
"secondary_listing_pid": "",
"municipal_code": 31,
"township_number": 22,
"section_number": 11,
"subdivision_number": "",
"area": 41,
"parcel_number": 1250,
"year_built": 2009,
"virtual_tour_link": "",
"half_bath": 1,
"living_area": 1933,
"garage_spaces": 1,
"waterfront": "Y",
"total_area": "",
"pool": "",
"maintenance_fee": 1662,
"pets_allowed": "Yes",
"unit_number": 4505,
"lot_area": "",
"listing_broker_code": "ZZON01",
"listing_broker_office": "Zona",
"latitude": 25.764026271539,
"longitude": -80.191569328308,
"original_list_price": 1780000,
"main_photo_url": "http://s3.amazonaws.com/sefpic/large/342947084-1.jpg",
"sale_price": 0,
"days_on_market": 73,
"close_date": "",
"selling_broker_code": "",
"expiration_date": "",
"condo_id": 444,
"complex": "Avenue 1060 Brickell",
"subdivision": "",
"community_name": "",
"lot_dimensions": "",
"hoa_fees": "",
"taxes": 32337,
"tax_year": 2015,
"rental_type": "",
"rental_occupancy": "Tenant Occupied",
"rental_furnished": "U",
"commercial_type": "",
"commercial_lease_sale": "",
"commercial_style": "",
"commercial_building": "",
"commercial_building_alt": "",
"county_id": "DADE",
"selling_public_id": "",
"second_selling_public_id": "",
"agent_name": "Eduardo Diez",
"broker_office_phone": "305-397-8192",
"agent_phone": "305-753-1113",
"second_agent_phone": "",
"second_agent_name": "", "parking_restrictions": "",
"condo_waterfront_view": [
"No Fixed Bridges"
],
"foreclosure": "",
"short_status": "",
"home_design": "",
"home_view": "Ocean View,Water View",
"short_sale": "N",
"reo": "N",
"internet_address_ok": "",
"modified_date": "2016-02-11 00:44:48",
"image_modified_date": "2016-02-11 00:23:16",
"directions": "",
"property_style": "Condo 5+ Stories",
"building_amenities": [
"Elevator",
"Exercise Room"
],
"equipment": [
"Automatic Garage Door Opener",
"Circuit Breaker",
"Dishwasher",
"Dryer",
"ELEVATOR",
"Fire Alarm",
"Microwave",
"Refrigerator",
"Self Cleaning Oven",
"Smoke Detector"
],
"exterior_features": [
"High Impact Doors",
"Open Balcony",
"Other"
],
"interior_features": [
"Closets Cabinetry",
"Cooking Island",
"Handicap Equipped",
"Other Interior Features",
"Split Bedroom",
"Vaulted Ceilings"
],
"construction_type": [
"Concrete Block Construction"
],
"floors": "",
"roof_type": "",
"home_heating": "",
"pet_restriction": "Restrictions Or Possible Restrictions",
"home_cooling": [
"Central Cooling",
"Electric Cooling",
"Other"
],
"home_design_2": "", "bedroom_2_size": "",
"bedroom_3_size": "",
"bedroom_4_size": "",
"bedroom_master_size": "",
"kitchen_size": "",
"living_room_size": "",
"rental_includes": "",
"description": "Unique duplex apartment on brickell avenue. Amazing views. Building with all amenities. Walking distance to restaurants, bars, markets, convenient stores.",
"rooms": "",
"sewer": "",
"water": "",
"subdv": "",
"dinner": "",
"floor_location": "45<sup>th</sup>",
"property_type_db": "RE2",
"pets_icon": "Yes",
"furnished_icon": "",
"price_sqft": 765.64924987067,
"price_sq_meters": 8241.6496218586,
"living_area_meters": 179.5757,
"price_change_days": 23,
"price_change_type": -1,
"price_change_diff": 300000,
"price_change_percent": 20.27,
"price_change_arrow": "down",
"days_on_market_str": "2 months",
"days_on_market_unix": 1455167512,
"listing_images": [
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-1.jpg",
"comments": "",
"photo_id": 1
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-2.jpg",
"comments": "",
"photo_id": 2
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-3.jpg",
"comments": "",
"photo_id": 3
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-4.jpg",
"comments": "",
"photo_id": 4
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-5.jpg",
"comments": "",
"photo_id": 5
],
[
"file_name": "http://s3.amazonaws.com/sefpic/large/342947084-6.jpg",
"comments": "",
"photo_id": 6
]
],
"permalink_url": "/property-view/1060-brickell---4505/miami/342947084/"
]
]
let longtitude_map = test[0]["longitude"] as! Double
let latitude_map = test[0]["latitude"] as! Double
let adress = test[0]["address"] as! String
if let image = test[0]["listing_images"]{
// image will be an array of dictionary holding the file names
[![this is how image looks like][1]][1]
//loop through image and get only the filename so that i can add it in var imageArray = [[String:AnyObject]]()
}
let latDelta:CLLocationDegrees = 0.05
let lonDelta:CLLocationDegrees = 0.05
let span:MKCoordinateSpan = MKCoordinateSpanMake(latDelta, lonDelta)
let location:CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude_map, longtitude_map)
let region:MKCoordinateRegion = MKCoordinateRegionMake(location, span)
mapview.setRegion(region, animated: false)
let annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = adress
mapview.addAnnotation(annotation)
let uilpgr = UILongPressGestureRecognizer(target: self, action: Selector("action:"))
uilpgr.minimumPressDuration = 2
mapview.addGestureRecognizer(uilpgr)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
[1]: http://i.stack.imgur.com/1wpHH.png
| 0debug
|
android studio ...support different screen sizes : <p>my project contains some activities as well as some fragments ..what shall i do to support my app..for all screen sizes?? app should look same in all different screen sizes and phones</p>
<p>i have used match parent and wrap content evrywhere for layouts as well as for each and every control like textview,image etc</p>
<pre><code><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</code></pre>
| 0debug
|
create an inverted triangle depending from input 1 - 9 : import java.util.*;
public class NestedFor
{
public static void main (String [] args)
{
Scanner console = new Scanner (System.in);
int n;
System.out.print("Enter any positive Integer: ");
n = console.nextInt();
for(int r = n - 1; r>=0; r--)
{
for (int c = 0; c<=r; c++)
System.out.print(c+1);
System.out.println();
}
}
}
I want to output an inverted perfect triangle from my inverted right triangle, im having a hardtime with this. anyone can help me? thanks!!
| 0debug
|
Can I automate Google Cloud SDK gcloud init - interactive command : <p>Documentation on Google Cloud SDK <a href="https://cloud.google.com/sdk/docs/" rel="noreferrer">https://cloud.google.com/sdk/docs/</a> directs one to run <code>gcloud init</code> after installing it.</p>
<p>Is there a way to automate this step given that <code>gcloud init</code> is an interactive command?</p>
| 0debug
|
How can I embed SVG into HTML in an email, so that it's visible in most/all email browsers? : <p>I want to generate graphs in SVG, and email an HTML page with those graphs embedded in it (not stored on a server and shown with linked images). </p>
<p>I've tried directly embedding the SVG, using the Object element, and serializing and URI encoding the SVG and specifying the whole string as a background image on a div. Nothing seems to display in Outlook 2013. Any ideas?</p>
| 0debug
|
What can compiler error `Expected ')'` mean? : <p>What can the compiler error <code>Expected ')'</code> mean when generated on a line with a function call?</p>
| 0debug
|
Can anyone show me what I am doing wrong here please? : I am trying to scrape tweets from twitter for a side project.
Having difficulty with outputs.
Using latest version of pycharm.
import urllib
import urllib.request
from bs4 import BeautifulSoup
theurl = "https://twitter.com/search?q=ghana%20and%20jollof&src=typed_query"
thepage = urllib.request.urlopen(theurl)
soup = BeautifulSoup(thepage, "html.parser")
i = 1
for tweets in soup.findAll('div', {"class":"css-901oao css-16my406 r-1qd0xha
r-ad9z0x r-bcqeeo r-qvutc0"}):
print (i)
print (tweets.find('span').text)
i = i+1
print(tweets)
I do not receive any errors at all but there no outputs for the tweets.
| 0debug
|
Where to download previous version of .net core sdk? : <p>We have a project that uses <code>.net core sdk 1.0.0-preview2-003121</code>.</p>
<p>Currently, I'm setting up a CI server to do automatic builds. In the server, I'm getting this error because the .net core sdk that is installed is not the same as the one in the project.</p>
<p><strong>ERROR</strong></p>
<p><code>preview2-003121 which is not installed or cannot be found under the path C:\Program Files\dotnet.</code></p>
<p>I did a command line check <code>dotnet --version</code> and it gave me <code>1.0.0-preview2-003131</code></p>
<p>Where can I download older versions of the .net core sdk? I have tried the following links and they give me the latest version for the download</p>
<ul>
<li><a href="https://github.com/dotnet/cli" rel="noreferrer">https://github.com/dotnet/cli</a></li>
<li><a href="https://www.microsoft.com/net/core#windows" rel="noreferrer">https://www.microsoft.com/net/core#windows</a></li>
</ul>
| 0debug
|
static void intra_predict_vert_dc_8x8_msa(uint8_t *src, int32_t stride)
{
uint8_t lp_cnt;
uint32_t out0 = 0, out1 = 0;
v16u8 src_top;
v8u16 add;
v4u32 sum;
v4i32 res0, res1;
src_top = LD_UB(src - stride);
add = __msa_hadd_u_h(src_top, src_top);
sum = __msa_hadd_u_w(add, add);
sum = (v4u32) __msa_srari_w((v4i32) sum, 2);
res0 = (v4i32) __msa_splati_b((v16i8) sum, 0);
res1 = (v4i32) __msa_splati_b((v16i8) sum, 4);
out0 = __msa_copy_u_w(res0, 0);
out1 = __msa_copy_u_w(res1, 0);
for (lp_cnt = 8; lp_cnt--;) {
SW(out0, src);
SW(out1, src + 4);
src += stride;
}
}
| 1threat
|
Packet Tracer GUI : <p>Is there a way to go to the previous packet tracer GUI. Mu current version is 7.2. I want to go back to 6.0 or something because I'm taking a class everything is based on the previous GUI. </p>
| 0debug
|
How to resize all cells of a QTableView to a fit size - PyQt5 : <p>I am trying to make each cell of a PyQt5 Table View to fit so no ... at the end of the text</p>
<p>I tried:</p>
<pre><code>MyTable.resizeColumnsToContents()
</code></pre>
<p>But it didn't work</p>
<p>My final Question is How to make the cells' text fit into the cell, so can see the whole text </p>
| 0debug
|
NullReferenceException: Object reference not set to an instance of an object Error when i reach my enemy : <p>NullReferenceException: Object reference not set to an instance of an object Error show when im near to capsule
my code </p>
<pre><code>using System.Collections.Generic;
</code></pre>
<p>using UnityEngine;</p>
<p>using UnityEngine.AI;</p>
<p>public class EnemyControl : MonoBehaviour {</p>
<pre><code>Transform PlayerTransform;
NavMeshAgent nma;
// Use this for initialization
void awake () {
PlayerTransform = GameObject.FindGameObjectWithTag ("Player").transform;
nma = GetComponent <NavMeshAgent>();
}
void Update () {
nma.SetDestination (PlayerTransform.position);
}
</code></pre>
<p>}</p>
<p><a href="https://i.stack.imgur.com/WyFPl.png" rel="nofollow noreferrer">enter image description here</a></p>
| 0debug
|
Separate form validation with Meteor : <p>I'm using <a href="https://github.com/aldeed/meteor-collection2">collection2</a> and I'm trying to get it to handle validation is a specific way. I have a profile schema which looks kind of like this:</p>
<pre><code>Schema.UserProfile = new SimpleSchema({
name: {
type: String,
optional: false
}
location: {
type: String,
optional: true
}
gender: {
type: String,
optional: false
}
});
Schema.User = new SimpleSchema({
username: {
type: String,
optional: true
},
emails: {
type: Array,
optional: true
},
"emails.$": {
type: Object
},
"emails.$.address": {
type: String,
regEx: SimpleSchema.RegEx.Email
},
"emails.$.verified": {
type: Boolean
},
createdAt: {
type: Date
},
profile: {
type: Schema.UserProfile,
optional: true
},
services: {
type: Object,
optional: true,
blackbox: true
},
roles: {
type: [String],
optional: true
},
heartbeat: {
type: Date,
optional: true
}
});
Meteor.users.attachSchema(Schema.User);
</code></pre>
<p>Now, on my registration form I'm requiring the user to select their gender and then later once they log in, users are presented with a separate form asking for their name and location. Here's the problem:</p>
<p>The registration form works and everything goes through with saving. When they try to save the internal form with location and name though I get an error:</p>
<pre><code>Error invoking Method 'updateProfile': Gender is required [400]
</code></pre>
<p>I know it's happening because it's required in the schema but I've already obtained this information. How do I not require that? Or do I set up validation per form?</p>
| 0debug
|
SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext,
SchroFrameFormat schro_frame_fmt)
{
AVPicture *p_pic;
SchroFrame *p_frame;
int y_width, uv_width;
int y_height, uv_height;
int i;
y_width = avccontext->width;
y_height = avccontext->height;
uv_width = y_width >> (SCHRO_FRAME_FORMAT_H_SHIFT(schro_frame_fmt));
uv_height = y_height >> (SCHRO_FRAME_FORMAT_V_SHIFT(schro_frame_fmt));
p_pic = av_mallocz(sizeof(AVPicture));
avpicture_alloc(p_pic, avccontext->pix_fmt, y_width, y_height);
p_frame = schro_frame_new();
p_frame->format = schro_frame_fmt;
p_frame->width = y_width;
p_frame->height = y_height;
schro_frame_set_free_callback(p_frame, free_schro_frame, (void *)p_pic);
for (i = 0; i < 3; ++i) {
p_frame->components[i].width = i ? uv_width : y_width;
p_frame->components[i].stride = p_pic->linesize[i];
p_frame->components[i].height = i ? uv_height : y_height;
p_frame->components[i].length =
p_frame->components[i].stride * p_frame->components[i].height;
p_frame->components[i].data = p_pic->data[i];
if (i) {
p_frame->components[i].v_shift =
SCHRO_FRAME_FORMAT_V_SHIFT(p_frame->format);
p_frame->components[i].h_shift =
SCHRO_FRAME_FORMAT_H_SHIFT(p_frame->format);
}
}
return p_frame;
}
| 1threat
|
av_cold void ff_vc2enc_free_transforms(VC2TransformContext *s)
{
av_freep(&s->buffer);
}
| 1threat
|
static long do_rt_sigreturn_v2(CPUARMState *env)
{
abi_ulong frame_addr;
struct rt_sigframe_v2 *frame = NULL;
frame_addr = env->regs[13];
trace_user_do_rt_sigreturn(env, frame_addr);
if (frame_addr & 7) {
goto badframe;
}
if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) {
goto badframe;
}
if (do_sigframe_return_v2(env, frame_addr, &frame->uc)) {
goto badframe;
}
unlock_user_struct(frame, frame_addr, 0);
return -TARGET_QEMU_ESIGRETURN;
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV );
return 0;
}
| 1threat
|
static int vdi_co_write(BlockDriverState *bs,
int64_t sector_num, const uint8_t *buf, int nb_sectors)
{
BDRVVdiState *s = bs->opaque;
uint32_t bmap_entry;
uint32_t block_index;
uint32_t sector_in_block;
uint32_t n_sectors;
uint32_t bmap_first = VDI_UNALLOCATED;
uint32_t bmap_last = VDI_UNALLOCATED;
uint8_t *block = NULL;
int ret;
logout("\n");
restart:
block_index = sector_num / s->block_sectors;
sector_in_block = sector_num % s->block_sectors;
n_sectors = s->block_sectors - sector_in_block;
if (n_sectors > nb_sectors) {
n_sectors = nb_sectors;
}
logout("will write %u sectors starting at sector %" PRIu64 "\n",
n_sectors, sector_num);
bmap_entry = le32_to_cpu(s->bmap[block_index]);
if (!VDI_IS_ALLOCATED(bmap_entry)) {
uint64_t offset;
bmap_entry = s->header.blocks_allocated;
s->bmap[block_index] = cpu_to_le32(bmap_entry);
s->header.blocks_allocated++;
offset = s->header.offset_data / SECTOR_SIZE +
(uint64_t)bmap_entry * s->block_sectors;
if (block == NULL) {
block = g_malloc(s->block_size);
bmap_first = block_index;
}
bmap_last = block_index;
memset(block, 0, sector_in_block * SECTOR_SIZE);
memcpy(block + sector_in_block * SECTOR_SIZE,
buf, n_sectors * SECTOR_SIZE);
memset(block + (sector_in_block + n_sectors) * SECTOR_SIZE, 0,
(s->block_sectors - n_sectors - sector_in_block) * SECTOR_SIZE);
ret = bdrv_write(bs->file, offset, block, s->block_sectors);
} else {
uint64_t offset = s->header.offset_data / SECTOR_SIZE +
(uint64_t)bmap_entry * s->block_sectors +
sector_in_block;
ret = bdrv_write(bs->file, offset, buf, n_sectors);
}
nb_sectors -= n_sectors;
sector_num += n_sectors;
buf += n_sectors * SECTOR_SIZE;
logout("%u sectors written\n", n_sectors);
if (ret >= 0 && nb_sectors > 0) {
goto restart;
}
logout("finished data write\n");
if (ret < 0) {
return ret;
}
if (block) {
VdiHeader *header = (VdiHeader *) block;
uint8_t *base;
uint64_t offset;
logout("now writing modified header\n");
assert(VDI_IS_ALLOCATED(bmap_first));
*header = s->header;
vdi_header_to_le(header);
ret = bdrv_write(bs->file, 0, block, 1);
g_free(block);
block = NULL;
if (ret < 0) {
return ret;
}
logout("now writing modified block map entry %u...%u\n",
bmap_first, bmap_last);
bmap_first /= (SECTOR_SIZE / sizeof(uint32_t));
bmap_last /= (SECTOR_SIZE / sizeof(uint32_t));
n_sectors = bmap_last - bmap_first + 1;
offset = s->bmap_sector + bmap_first;
base = ((uint8_t *)&s->bmap[0]) + bmap_first * SECTOR_SIZE;
logout("will write %u block map sectors starting from entry %u\n",
n_sectors, bmap_first);
ret = bdrv_write(bs->file, offset, base, n_sectors);
}
return ret;
}
| 1threat
|
How to delete struct object in go? : <p>Let's say I have the following struct:</p>
<pre><code>type Person struct {
name string
age int
}
</code></pre>
<p>If I make an object of that struct</p>
<pre><code>person1 := Person{name: "Name", age: 69}
</code></pre>
<p>If I set this object to nil </p>
<pre><code>person1 = nil
</code></pre>
<p>it doesn't work, in fact it's a type assignment error, but it works for maps and slices. So, how otherwise would I remove the object i.e deallocate? I looked at the documentation for delete builtin but it removes an entry from a given map. Thanks.</p>
| 0debug
|
static void pc_init_pci_no_kvmclock(MachineState *machine)
{
has_pci_info = false;
has_acpi_build = false;
smbios_defaults = false;
x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
enable_compat_apic_id_mode();
pc_init1(machine, 1, 0);
}
| 1threat
|
Sort Javascript Array by Json object in array : I have an array
var a=[['test':'1','test1':'2','test2':{'test3':'3','test4':'4'}],['test':'2','test1':'2','test2':{'test3':'1','test4':'2'}]];
I can sort array using test and test 1 fields. But I have no idea to sort using test3 or test4. How can this array be sorted.
| 0debug
|
Want to select last floating point value in the string : I have a string such as
> "Hello i dont want to select 123.12 but 890.12 how do i do it "
----------
Say in this string i want to select 890.12 , i have already tried **$** this but for this 890.12 should be in the last, i have some words after 890.12.
| 0debug
|
dma_winvalid (void *opaque, target_phys_addr_t addr, uint32_t value)
{
hw_error("Unsupported short waccess. reg=" TARGET_FMT_plx "\n", addr);
}
| 1threat
|
static void vdadec_flush(AVCodecContext *avctx)
{
return ff_h264_decoder.flush(avctx);
}
| 1threat
|
Using a different class in Android Studio : <p>HOw do you use a method in a different class from the one you're calling it from in Android Studio? I have the following main class:</p>
<pre><code>package com.example.bluebus;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import static java.util.concurrent.TimeUnit.SECONDS;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BeeperControl test = new BeeperControl();
//test.test();
//test.test();*/
}
}
</code></pre>
<p>and in the same folder I have the following BeeperControl class:</p>
<pre><code>import java.util.concurrent.ScheduledFuture;
import static java.util.concurrent.TimeUnit.SECONDS;
/**
* Created by Arthur on 1/7/2017.
*/
public class BeeperControl extends AppCompatActivity {
/*private final ScheduledExecutorService scheduler =
Executors.newScheduledThreadPool(1);*/
final TextView text = (TextView) findViewById(R.id.text);
/*
public void beepForAnHour() {
final Runnable beeper = new Runnable() {
public void run() {
text.setText("Hello!");
}
};
final ScheduledFuture<?> beeperHandle =
scheduler.scheduleAtFixedRate(beeper, 0, 1, SECONDS);
scheduler.schedule(new Runnable() {
public void run() { beeperHandle.cancel(true); }
}, 60 * 60, SECONDS);
}*/
public void test(){
text.setText("Who are you?");
}
}
</code></pre>
<p>When written as is, the app works fine. However, when I uncomment test.test(), the app keeps closing when I try to run it in an emulator. From what I've seen, it may be a problem with updating the manifest, but I'm not sure how to fix it. Any help will be appreciated!</p>
| 0debug
|
Use group in ConstraintLayout to listen for click events on multiple views : <p>Basically I'd like to attach a single OnClickListener to multiple views inside a ConstraintLayout.</p>
<p>Before migrating to the ConstraintLayout the views where inside one layout onto which I could add a listener. Now they are on the same layer with other views right under the ConstraintLayout.</p>
<p>I tried adding the views to a <code>android.support.constraint.Group</code> and added a OnClickListener to it programmatically.</p>
<pre><code>group.setOnClickListener {
Log.d("OnClick", "groupClickListener triggered")
}
</code></pre>
<p>However this does not seem to work as of the ConstraintLayout version <code>1.1.0-beta2</code></p>
<p>Have I done something wrong, is there a way to achieve this behaviour or do I need to attach the listener to each of the single views? </p>
| 0debug
|
static inline void transpose4x4(uint8_t *dst, uint8_t *src, x86_reg dst_stride, x86_reg src_stride){
__asm__ volatile(
"movd (%1), %%mm0 \n\t"
"add %3, %1 \n\t"
"movd (%1), %%mm1 \n\t"
"movd (%1,%3,1), %%mm2 \n\t"
"movd (%1,%3,2), %%mm3 \n\t"
"punpcklbw %%mm1, %%mm0 \n\t"
"punpcklbw %%mm3, %%mm2 \n\t"
"movq %%mm0, %%mm1 \n\t"
"punpcklwd %%mm2, %%mm0 \n\t"
"punpckhwd %%mm2, %%mm1 \n\t"
"movd %%mm0, (%0) \n\t"
"add %2, %0 \n\t"
"punpckhdq %%mm0, %%mm0 \n\t"
"movd %%mm0, (%0) \n\t"
"movd %%mm1, (%0,%2,1) \n\t"
"punpckhdq %%mm1, %%mm1 \n\t"
"movd %%mm1, (%0,%2,2) \n\t"
: "+&r" (dst),
"+&r" (src)
: "r" (dst_stride),
"r" (src_stride)
: "memory"
);
}
| 1threat
|
static void intel_hda_update_irq(IntelHDAState *d)
{
bool msi = msi_enabled(&d->pci);
int level;
intel_hda_update_int_sts(d);
if (d->int_sts & (1U << 31) && d->int_ctl & (1U << 31)) {
level = 1;
} else {
level = 0;
}
dprint(d, 2, "%s: level %d [%s]\n", __FUNCTION__,
level, msi ? "msi" : "intx");
if (msi) {
if (level) {
msi_notify(&d->pci, 0);
}
} else {
pci_set_irq(&d->pci, level);
}
}
| 1threat
|
C++ vector emplace_back calls copy constructor : <p>This is a demo class. I do not want my class to be copied, so I delete the copy constructor. I want vector.emplace_back to use this constructor 'MyClass(Type type)'. But these codes won't compile. Why?</p>
<pre><code>class MyClass
{
public:
typedef enum
{
e1,
e2
} Type;
private:
Type _type;
MyClass(const MyClass& other) = delete; // no copy
public:
MyClass(): _type(e1) {};
MyClass(Type type): _type(type) { /* the constructor I wanted. */ };
};
std::vector<MyClass> list;
list.emplace_back(MyClass::e1);
list.emplace_back(MyClass::e2);
</code></pre>
| 0debug
|
static void intra_predict_dc_4blk_8x8_msa(uint8_t *src, int32_t stride)
{
uint8_t lp_cnt;
uint32_t src0, src1, src3, src2 = 0;
uint32_t out0, out1, out2, out3;
v16u8 src_top;
v8u16 add;
v4u32 sum;
src_top = LD_UB(src - stride);
add = __msa_hadd_u_h((v16u8) src_top, (v16u8) src_top);
sum = __msa_hadd_u_w(add, add);
src0 = __msa_copy_u_w((v4i32) sum, 0);
src1 = __msa_copy_u_w((v4i32) sum, 1);
for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
src0 += src[lp_cnt * stride - 1];
src2 += src[(4 + lp_cnt) * stride - 1];
}
src0 = (src0 + 4) >> 3;
src3 = (src1 + src2 + 4) >> 3;
src1 = (src1 + 2) >> 2;
src2 = (src2 + 2) >> 2;
out0 = src0 * 0x01010101;
out1 = src1 * 0x01010101;
out2 = src2 * 0x01010101;
out3 = src3 * 0x01010101;
for (lp_cnt = 4; lp_cnt--;) {
SW(out0, src);
SW(out1, (src + 4));
SW(out2, (src + 4 * stride));
SW(out3, (src + 4 * stride + 4));
src += stride;
}
}
| 1threat
|
static void vmxnet3_update_pm_state(VMXNET3State *s)
{
struct Vmxnet3_VariableLenConfDesc pm_descr;
pm_descr.confLen =
VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confLen);
pm_descr.confVer =
VMXNET3_READ_DRV_SHARED32(s->drv_shmem, devRead.pmConfDesc.confVer);
pm_descr.confPA =
VMXNET3_READ_DRV_SHARED64(s->drv_shmem, devRead.pmConfDesc.confPA);
vmxnet3_dump_conf_descr("PM State", &pm_descr);
}
| 1threat
|
Tools/Solutions :Remote push notifications iOS for users : <p>I've got a database who store the device Token, country Code and language of my users and I need to send remote notifications for all the user.
What kind of tool can I used to send all notifications by country with a batch?</p>
<p>Thanks,</p>
| 0debug
|
static coroutine_fn int sd_co_readv(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, QEMUIOVector *qiov)
{
SheepdogAIOCB acb;
BDRVSheepdogState *s = bs->opaque;
sd_aio_setup(&acb, s, qiov, sector_num, nb_sectors, AIOCB_READ_UDATA);
retry:
if (check_overlapping_aiocb(s, &acb)) {
qemu_co_queue_wait(&s->overlapping_queue);
goto retry;
}
sd_co_rw_vector(&acb);
QLIST_REMOVE(&acb, aiocb_siblings);
qemu_co_queue_restart_all(&s->overlapping_queue);
return acb.ret;
}
| 1threat
|
Python and OpenCV - How can I make a slider window in which I can use to change the value of parameters set? : <p>For example, a simple threshold code in Python and OpenCV would be:</p>
<pre><code>ret, thresh = threshold(img,127,255,cv2.THRESH_BINARY)
</code></pre>
<p>The second argument, that is the value of 127 would determine the kind of output of the thresholded image. It is kinda hard to change the value every time manually by replacing the value of 127 with other values (because I want to find the most optimum value that I needed to get the best result). Is it possible to make some kind of slider (or anything else similar) in which I can use to change the value of the second argument on the spot (while the program is running)?</p>
| 0debug
|
static int mig_save_device_bulk(Monitor *mon, QEMUFile *f,
BlkMigDevState *bmds)
{
int64_t total_sectors = bmds->total_sectors;
int64_t cur_sector = bmds->cur_sector;
BlockDriverState *bs = bmds->bs;
BlkMigBlock *blk;
int nr_sectors;
if (bmds->shared_base) {
while (cur_sector < total_sectors &&
!bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH,
&nr_sectors)) {
cur_sector += nr_sectors;
}
}
if (cur_sector >= total_sectors) {
bmds->cur_sector = bmds->completed_sectors = total_sectors;
return 1;
}
bmds->completed_sectors = cur_sector;
cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1);
nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) {
nr_sectors = total_sectors - cur_sector;
}
blk = g_malloc(sizeof(BlkMigBlock));
blk->buf = g_malloc(BLOCK_SIZE);
blk->bmds = bmds;
blk->sector = cur_sector;
blk->nr_sectors = nr_sectors;
blk->iov.iov_base = blk->buf;
blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE;
qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);
if (block_mig_state.submitted == 0) {
block_mig_state.prev_time_offset = qemu_get_clock_ns(rt_clock);
}
blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov,
nr_sectors, blk_mig_read_cb, blk);
block_mig_state.submitted++;
bdrv_reset_dirty(bs, cur_sector, nr_sectors);
bmds->cur_sector = cur_sector + nr_sectors;
return (bmds->cur_sector >= total_sectors);
}
| 1threat
|
How can I find a solution for the "FileNotFoundError" : <p>I'm currently working on an image classifier project. During the testing of the predict function, I receive the error: FileNotFoundError: [Errno 2] No such file or directory: 'flowers/test/1/image_06760'</p>
<p>the path of the file is correct.
You can find the whole notebook here:
<a href="https://github.com/MartinTschendel/image-classifier-1/blob/master/190829-0510-Image%20Classifier%20Project.ipynb" rel="nofollow noreferrer">https://github.com/MartinTschendel/image-classifier-1/blob/master/190829-0510-Image%20Classifier%20Project.ipynb</a></p>
<p>Here is the respective predict function and the test of this function:</p>
<pre><code>def predict(image_path, model, topk=5):
''' Predict the class (or classes) of an image using a trained deep learning model.
'''
#loading model
loaded_model = load_checkpoint(model)
# implement the code to predict the class from an image file
img = Image.open(image_name)
img = process_image(img)
# convert 2D image to 1D vector
img = np.expand_dims(img, 0)
img = torch.from_numpy(img)
#set model to evaluation mode and turn off gradients
loaded_model.eval()
with torch.no_grad():
#run image through network
output = loaded_model.forward(img)
#calculate probabilities
probs = torch.exp(output)
probs_top = probs.topk(topk)[0]
index_top = probs.topk(topk)[1]
# Convert probabilities and outputs to lists
probs_top_list = np.array(probs_top)[0]
index_top_list = np.array(index_top[0])
#load index and class mapping
loaded_model.class_to_idx = train_data.class_to_idx
#invert index-class dictionary
idx_to_class = {x: y for y, x in class_to_idx.items()}
#convert index list to class list
classes_top_list = []
for index in index_top_list:
classes_top_list += [idx_to_class[index]]
return probs_top_list, classes_top_list
</code></pre>
<pre><code># test predict function
# inputs equal paths to saved model and test image
model_path = '190824_checkpoint.pth'
image_name = data_dir + '/test' + '/1/' + 'image_06760'
probs, classes = predict(image_name, model_path, topk=5)
print(probs)
print(classes)
</code></pre>
<p>This is the error I receive: </p>
<pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'flowers/test/1/image_06760'
</code></pre>
| 0debug
|
static int read_huffman_tables(HYuvContext *s, uint8_t *src, int length){
GetBitContext gb;
int i;
init_get_bits(&gb, src, length);
for(i=0; i<3; i++){
read_len_table(s->len[i], &gb);
if(generate_bits_table(s->bits[i], s->len[i])<0){
return -1;
}
#if 0
for(j=0; j<256; j++){
printf("%6X, %2d, %3d\n", s->bits[i][j], s->len[i][j], j);
}
#endif
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4);
}
return 0;
}
| 1threat
|
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. : <p>I am new to Android App Development. When I tried to create a new project,Android Project...the following message popped up..</p>
<p>Error:Execution failed for task ':app:preDebugAndroidTestBuild'.</p>
<blockquote>
<p>Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See <a href="https://d.android.com/r/tools/test-apk-dependency-conflicts.html" rel="noreferrer">https://d.android.com/r/tools/test-apk-dependency-conflicts.html</a> for details.
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]</p>
</blockquote>
<p>This is the screenshot of my project
<a href="https://i.stack.imgur.com/JrhHw.png" rel="noreferrer">click here to see screenshot of the error i got</a></p>
<p>i also tried adding this code to my dependency..
androidTestCompile 'com.android.support:support-annotations:23.3.0'
this didn't work out. I also tried 27.1.1 and 26.1.0..
that didn't work out either.</p>
| 0debug
|
How to display or hide the errors in browser? : <p>My question is about php. I want to know how to display or hide the errors in browser? I am just a begginer of php so i need a help in this problem.</p>
| 0debug
|
Efficiently Finding Closest Word In TensorFlow Embedding : <p>Recently, I've been trying to find the closest word to an embedding. The two most notable ways of doing this is by cosine distance or euclidean distance.</p>
<p>I'm trying to find how to efficiently compute the cosine distance for a tensor of shape <code>[batch_size x embedding_size]</code></p>
<p>One approach is to unpack the tensor and the compute the cosine distance</p>
<pre><code> #embedding is shape [vocab_size x embedding size]
array_list = tf.unpack(batch_array)
word_class_list = tf.unpack(embedding)
index_list_of_closest_word = []
for eacharray in array_list:
list_of_distances = []
for eachwordclass in word_class_list:
list_of_distances.append(cosine_distance(eacharray, eachwordclass))
index_list_of_closest_word.append(tf.argmax(tf.pack(list_of_distances)))
</code></pre>
<p>However, this approach is terribly inefficient. Is there perhaps a more efficient manner to do this? I know word2vec does this pretty fast and tensorflow, with the power of a gpu, should be able to do these batch calculations in parallel. </p>
<p>Thanks!</p>
| 0debug
|
static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length)
{
if(length > 32) {
av_log(NULL, AV_LOG_ERROR, "length too long\n");
return AVERROR_INVALIDDATA;
}
if(!get_bits1(gb)){
if(hc->current >= 256){
av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");
return AVERROR_INVALIDDATA;
}
if(length){
hc->bits[hc->current] = prefix;
hc->lengths[hc->current] = length;
} else {
hc->bits[hc->current] = 0;
hc->lengths[hc->current] = 0;
}
hc->values[hc->current] = get_bits(gb, 8);
hc->current++;
if(hc->maxlength < length)
hc->maxlength = length;
return 0;
} else {
int r;
length++;
r = smacker_decode_tree(gb, hc, prefix, length);
if(r)
return r;
return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length);
}
}
| 1threat
|
In Material-ui when do we use Input vs. Textfield for building a form? : <p>Maybe this is just a basic question, but so far have not found any reasonable explanation. I am a beginner in react and using material-ui very recently. I am not very clear on when to use an Input vs. Textfield for building a form?</p>
<p>Looking at documentation, it feels like TextField is a superset of what Input can do, but not sure. Material-ui site uses examples for text field and input both, without stating benefits of one over the other and any use cases.</p>
<p>Please suggest.</p>
| 0debug
|
property forEach does not exist on type NodeListOf : <p>Angular 2.4.4, TypeScript 2.1.5, PhpStorm 2017.2.1
I write this code:</p>
<pre><code>const list = document.querySelectorAll('path.frame-zone');
list.forEach(() => {
</code></pre>
<p>But the second line is underlined with a red line and TsLint reports that "property forEach does not exist on type NodeListOf"
But when I ctrl+click the <code>forEach</code> it gets me to <code>lib.es6.d.ts</code> where <code>forEach</code> is declared for <code>interface NodeListOf<TNode extends Node></code></p>
<p>Why it won't let me use it? What is wrong?</p>
| 0debug
|
int net_init_tap(const NetClientOptions *opts, const char *name,
NetClientState *peer)
{
const NetdevTapOptions *tap;
int fd, vnet_hdr = 0, i = 0, queues;
const char *script = NULL;
const char *downscript = NULL;
const char *vhostfdname;
char ifname[128];
assert(opts->kind == NET_CLIENT_OPTIONS_KIND_TAP);
tap = opts->tap;
queues = tap->has_queues ? tap->queues : 1;
vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) {
error_report("Multiqueue tap cannot be used with QEMU vlans");
return -1;
}
if (tap->has_fd) {
if (tap->has_ifname || tap->has_script || tap->has_downscript ||
tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
tap->has_fds) {
error_report("ifname=, script=, downscript=, vnet_hdr=, "
"helper=, queues=, and fds= are invalid with fd=");
return -1;
}
fd = monitor_handle_fd_param(cur_mon, tap->fd);
if (fd == -1) {
return -1;
}
fcntl(fd, F_SETFL, O_NONBLOCK);
vnet_hdr = tap_probe_vnet_hdr(fd);
if (net_init_tap_one(tap, peer, "tap", name, NULL,
script, downscript,
vhostfdname, vnet_hdr, fd)) {
return -1;
}
} else if (tap->has_fds) {
char *fds[MAX_TAP_QUEUES];
char *vhost_fds[MAX_TAP_QUEUES];
int nfds, nvhosts;
if (tap->has_ifname || tap->has_script || tap->has_downscript ||
tap->has_vnet_hdr || tap->has_helper || tap->has_queues ||
tap->has_fd) {
error_report("ifname=, script=, downscript=, vnet_hdr=, "
"helper=, queues=, and fd= are invalid with fds=");
return -1;
}
nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES);
if (tap->has_vhostfds) {
nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES);
if (nfds != nvhosts) {
error_report("The number of fds passed does not match the "
"number of vhostfds passed");
return -1;
}
}
for (i = 0; i < nfds; i++) {
fd = monitor_handle_fd_param(cur_mon, fds[i]);
if (fd == -1) {
return -1;
}
fcntl(fd, F_SETFL, O_NONBLOCK);
if (i == 0) {
vnet_hdr = tap_probe_vnet_hdr(fd);
} else if (vnet_hdr != tap_probe_vnet_hdr(fd)) {
error_report("vnet_hdr not consistent across given tap fds");
return -1;
}
if (net_init_tap_one(tap, peer, "tap", name, ifname,
script, downscript,
tap->has_vhostfds ? vhost_fds[i] : NULL,
vnet_hdr, fd)) {
return -1;
}
}
} else if (tap->has_helper) {
if (tap->has_ifname || tap->has_script || tap->has_downscript ||
tap->has_vnet_hdr || tap->has_queues || tap->has_fds) {
error_report("ifname=, script=, downscript=, and vnet_hdr= "
"queues=, and fds= are invalid with helper=");
return -1;
}
fd = net_bridge_run_helper(tap->helper, DEFAULT_BRIDGE_INTERFACE);
if (fd == -1) {
return -1;
}
fcntl(fd, F_SETFL, O_NONBLOCK);
vnet_hdr = tap_probe_vnet_hdr(fd);
if (net_init_tap_one(tap, peer, "bridge", name, ifname,
script, downscript, vhostfdname,
vnet_hdr, fd)) {
return -1;
}
} else {
script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT;
downscript = tap->has_downscript ? tap->downscript :
DEFAULT_NETWORK_DOWN_SCRIPT;
if (tap->has_ifname) {
pstrcpy(ifname, sizeof ifname, tap->ifname);
} else {
ifname[0] = '\0';
}
for (i = 0; i < queues; i++) {
fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script,
ifname, sizeof ifname, queues > 1);
if (fd == -1) {
return -1;
}
if (queues > 1 && i == 0 && !tap->has_ifname) {
if (tap_fd_get_ifname(fd, ifname)) {
error_report("Fail to get ifname");
return -1;
}
}
if (net_init_tap_one(tap, peer, "tap", name, ifname,
i >= 1 ? "no" : script,
i >= 1 ? "no" : downscript,
vhostfdname, vnet_hdr, fd)) {
return -1;
}
}
}
return 0;
}
| 1threat
|
Hi all, I am having an issue in mysql query : I am having an issue in MySQL query that i have to pull some record from a view with the order by clause from attended_date, but even there might be some data without attended_date filled so how can i get it done
example :
SELECT * FROM vw_getengineerreview WHERE reference_number ='xxs/xxx/00256' ORDER BY attended_date ASC;
this gives the record what is available (thats correct) but the null recorded value print in top, but i want to have in the bottom (when the attended_date is null)
Output is below
**Technician Name** **Start Date / Time** **End Date / Time** **Technician Remarks**
Kasun Chathuranga 2016-10-04 - 10:49:13 -
Kasun Chathuranga 2016-09-06 - 17:17:02 2016-09-22-02:16:23 not powerning
| 0debug
|
pvscsi_ring_pop_req_descr(PVSCSIRingInfo *mgr)
{
uint32_t ready_ptr = RS_GET_FIELD(mgr, reqProdIdx);
if (ready_ptr != mgr->consumed_ptr) {
uint32_t next_ready_ptr =
mgr->consumed_ptr++ & mgr->txr_len_mask;
uint32_t next_ready_page =
next_ready_ptr / PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
uint32_t inpage_idx =
next_ready_ptr % PVSCSI_MAX_NUM_REQ_ENTRIES_PER_PAGE;
return mgr->req_ring_pages_pa[next_ready_page] +
inpage_idx * sizeof(PVSCSIRingReqDesc);
} else {
return 0;
}
}
| 1threat
|
glibc specific functions for gcc : <p>I have read that the Windows C library msvcrt has functions(and other things) that can only be compiled by Microsoft's own compiler. <br>
Is there anything equivalent to "Microsoft extensions to c and c++" in linux/glibc? Thank you.</p>
| 0debug
|
Flutter : Target file "lib/main.dart" not found : <p>When I perform a <strong>flutter run</strong> I get an error</p>
<p>Target file "lib/main.dart" not found.</p>
<p>Why is this happening and how can I fix this ?</p>
| 0debug
|
static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth,
const int chroma_format_idc)
{
#if HAVE_NEON
if (bit_depth == 8) {
c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon;
c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon;
if(chroma_format_idc == 1){
c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon;
c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon;
}
c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon;
c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon;
c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon;
c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon;
c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon;
c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon;
c->h264_idct_add = ff_h264_idct_add_neon;
c->h264_idct_dc_add = ff_h264_idct_dc_add_neon;
c->h264_idct_add16 = ff_h264_idct_add16_neon;
c->h264_idct_add16intra = ff_h264_idct_add16intra_neon;
if (chroma_format_idc <= 1)
c->h264_idct_add8 = ff_h264_idct_add8_neon;
c->h264_idct8_add = ff_h264_idct8_add_neon;
c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon;
c->h264_idct8_add4 = ff_h264_idct8_add4_neon;
}
#endif
}
| 1threat
|
Can't pass 'const pointer const' to const ref : <p>Suppose you have a set of pointers (yeah...) :</p>
<pre><code>std::set<SomeType*> myTypeContainer;
</code></pre>
<p>Then suppose that you want to search this set from a const method of SomeType:</p>
<pre><code>bool SomeType::IsContainered() const
{
return myTypeContainer.find(this) != myTypeContainer.end();
}
</code></pre>
<p>This doesn't work. The <code>this</code> ptr in the method is a <code>const SomeType *const</code>, which I can't put into the <code>find</code>. The issue being that <code>find</code> takes a const-ref, which in this case would mean that the passed pointer is treated as const, but not the thing it points to.</p>
<p>Is there a way to resolve this smoothly (without changing the set template type)?</p>
| 0debug
|
static void cloop_close(BlockDriverState *bs)
{
BDRVCloopState *s = bs->opaque;
if (s->n_blocks > 0) {
g_free(s->offsets);
}
g_free(s->compressed_block);
g_free(s->uncompressed_block);
inflateEnd(&s->zstream);
}
| 1threat
|
window.location.href = 'http://attack.com?user=' + user_input;
| 1threat
|
Oracle graphics: How to change Paint settings? : Nearly a month ago I was testing JavaFX graphics API, however I was worried about performance. The performance problem is that I had to pass a `Paint` object for colorizing shapes.
---
### Issue: it's impossible to change settings of an existing `Paint`
I just need to update a `Paint`, for example, `Color`, but there are no methods like `Color#setRed`, `Color#setGreen`, `Color#setBlue` and `Color#setOpacity`. There are no fields, too ([javafx.scene.paint.Color][1]).
---
### Performance
The unique way I can try to change settings of a `Paint` is to construct another `Paint` instead, however this will involve on running the garbage collector. Is that correct?
I think it's possible to optimize these objects automatically depending on how they're entirely used. But Idk. if the Oracle's compiler optimizes them.
---
So is it a good solution to re-construct a `Paint`? Do you guys also know of JavaFX alternatives that handle what I want?
[1]: https://docs.oracle.com/javafx/2/api/javafx/scene/paint/Color.html
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.