problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Push notification icon in Cordova Android : <p>I'm using <a href="https://github.com/phonegap/phonegap-plugin-push/" rel="noreferrer">Phonegap Push Plugin</a> and when a push notification is shown in the notification area, the icon is just a white square. I would like it to show <code>star.png</code> instead. I tried following <a href="https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#images" rel="noreferrer">the documentation</a> as follows:</p>
<p>I put <code>star.png</code> in <code>www/images</code>, and added the following lines to <code>config.xml</code></p>
<pre><code><platform name="android">
<resource-file src="www/images/star.png" target="res/drawable-xhdpi/star.png" />
<resource-file src="www/images/star.png" target="res/drawable-hdpi/star.png" />
<resource-file src="www/images/star.png" target="res/drawable-mdpi/star.png" />
<resource-file src="www/images/star.png" target="res/drawable-ldpi/star.png" />
</platform>
</code></pre>
<p>(I understand that I should use different resolutions, but I'm just trying to get it working now.)</p>
<p>Then when I initialize the plugin, I use:</p>
<pre><code>let push = PushNotification.init({
android: { senderID: globalData.firebaseSenderID, icon: 'star.png', iconColor: 'blue' },
ios: {}
});
</code></pre>
<p>I also tried <code>icon: 'star'</code>.
However the white square persists. How can I get this to work?</p>
<p>Using cordova@8.0.0 & cordova-android@6.4.0.</p>
| 0debug
|
How do i add two rows in a single cell using html : This is the code i have written.I have used rowspan to increase the cell
`<tr>
<th rowspan="2">Questions</th>
<th>sub1</th>
<th>sub2</th>
<th>sub3</th>
<th>sub4</th>
<th>sub5</th>
<th>sub6</th>
</tr>`
| 0debug
|
Passing variables to BAT file usig Python subprocess.call : When I pass a variable to a BAT file using
from subprocess import call
# Prompt for UID
UID = raw_input('Enter UID: ')
# Prompt for password
PSWD= raw_input('Enter your password: ')
dir = r"f:\_Python"
cmdline = "setENVvariables.bat UID, PSWD"
rc=call("start cmd /K " + cmdline, cwd=dir, shell=True)
.. the values are not passed. When I echo the input in the BAT file, I get the Python variable name
BAT file
echo %1
echo %2
BAT File output
f:\_Python>echo UID
UID
f:\_Python>echo PSWD
PSWD
f:\_Python>
| 0debug
|
gitkraken - How to compare 2 branches : <p>Is there any way to compare 2 branches (branch1 and branch2) with gitkraken?</p>
<p>I want a list of files that have changes</p>
| 0debug
|
AWS Cognito: Restrict users to a single domain : <p>I'm using cognito federated login with google as identity provider. The requirement is to only allow the users of my company (with domain as xxx@mycompany.com). </p>
<p>Any ideas on how and where to configure such rules would be much appreciated. Or kindly point me to the right documentation. </p>
<p>Thank you, </p>
| 0debug
|
static void virtio_pci_reset(DeviceState *qdev)
{
VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev);
VirtioBusState *bus = VIRTIO_BUS(&proxy->bus);
int i;
virtio_pci_stop_ioeventfd(proxy);
virtio_bus_reset(bus);
msix_unuse_all_vectors(&proxy->pci_dev);
for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
proxy->vqs[i].enabled = 0;
}
}
| 1threat
|
static inline int decode_residual_inter(AVSContext *h)
{
int block;
int cbp = get_ue_golomb(&h->gb);
if (cbp > 63) {
av_log(h->avctx, AV_LOG_ERROR, "illegal inter cbp\n");
return AVERROR_INVALIDDATA;
}
h->cbp = cbp_tab[cbp][1];
if (h->cbp && !h->qp_fixed)
h->qp = (h->qp + get_se_golomb(&h->gb)) & 63;
for (block = 0; block < 4; block++)
if (h->cbp & (1 << block))
decode_residual_block(h, &h->gb, inter_dec, 0, h->qp,
h->cy + h->luma_scan[block], h->l_stride);
decode_residual_chroma(h);
return 0;
}
| 1threat
|
How to calculate math operations in textBox? : <p><a href="https://i.stack.imgur.com/beWnP.jpg" rel="nofollow noreferrer">App image</a></p>
<p>Hi guys, I'm a beginner in programming and I'm trying to make a math game. I don't know how to make a program calculate whats inside of the textbox. When player clicks a button with number or operator, app writes that in a textBox under the buttons. After clicking 'OK' app should compare number on the top(303) with players calculation. Any ideas how to make this work?</p>
| 0debug
|
static void nfs_process_write(void *arg)
{
NFSClient *client = arg;
aio_context_acquire(client->aio_context);
nfs_service(client->context, POLLOUT);
nfs_set_events(client);
aio_context_release(client->aio_context);
}
| 1threat
|
static int vdi_create(const char *filename, QemuOpts *opts, Error **errp)
{
int fd;
int result = 0;
uint64_t bytes = 0;
uint32_t blocks;
size_t block_size = DEFAULT_CLUSTER_SIZE;
uint32_t image_type = VDI_TYPE_DYNAMIC;
VdiHeader header;
size_t i;
size_t bmap_size;
bool nocow = false;
logout("\n");
bytes = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0);
#if defined(CONFIG_VDI_BLOCK_SIZE)
block_size = qemu_opt_get_size_del(opts,
BLOCK_OPT_CLUSTER_SIZE,
DEFAULT_CLUSTER_SIZE);
#endif
#if defined(CONFIG_VDI_STATIC_IMAGE)
if (qemu_opt_get_bool_del(opts, BLOCK_OPT_STATIC, false)) {
image_type = VDI_TYPE_STATIC;
}
#endif
nocow = qemu_opt_get_bool_del(opts, BLOCK_OPT_NOCOW, false);
if (bytes > VDI_DISK_SIZE_MAX) {
result = -ENOTSUP;
error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64
", max supported is 0x%" PRIx64 ")",
bytes, VDI_DISK_SIZE_MAX);
goto exit;
}
fd = qemu_open(filename,
O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE,
0644);
if (fd < 0) {
result = -errno;
goto exit;
}
if (nocow) {
#ifdef __linux__
int attr;
if (ioctl(fd, FS_IOC_GETFLAGS, &attr) == 0) {
attr |= FS_NOCOW_FL;
ioctl(fd, FS_IOC_SETFLAGS, &attr);
}
#endif
}
blocks = (bytes + block_size - 1) / block_size;
bmap_size = blocks * sizeof(uint32_t);
bmap_size = ((bmap_size + SECTOR_SIZE - 1) & ~(SECTOR_SIZE -1));
memset(&header, 0, sizeof(header));
pstrcpy(header.text, sizeof(header.text), VDI_TEXT);
header.signature = VDI_SIGNATURE;
header.version = VDI_VERSION_1_1;
header.header_size = 0x180;
header.image_type = image_type;
header.offset_bmap = 0x200;
header.offset_data = 0x200 + bmap_size;
header.sector_size = SECTOR_SIZE;
header.disk_size = bytes;
header.block_size = block_size;
header.blocks_in_image = blocks;
if (image_type == VDI_TYPE_STATIC) {
header.blocks_allocated = blocks;
}
uuid_generate(header.uuid_image);
uuid_generate(header.uuid_last_snap);
#if defined(CONFIG_VDI_DEBUG)
vdi_header_print(&header);
#endif
vdi_header_to_le(&header);
if (write(fd, &header, sizeof(header)) < 0) {
result = -errno;
goto close_and_exit;
}
if (bmap_size > 0) {
uint32_t *bmap = g_malloc0(bmap_size);
for (i = 0; i < blocks; i++) {
if (image_type == VDI_TYPE_STATIC) {
bmap[i] = i;
} else {
bmap[i] = VDI_UNALLOCATED;
}
}
if (write(fd, bmap, bmap_size) < 0) {
result = -errno;
g_free(bmap);
goto close_and_exit;
}
g_free(bmap);
}
if (image_type == VDI_TYPE_STATIC) {
if (ftruncate(fd, sizeof(header) + bmap_size + blocks * block_size)) {
result = -errno;
goto close_and_exit;
}
}
close_and_exit:
if ((close(fd) < 0) && !result) {
result = -errno;
}
exit:
return result;
}
| 1threat
|
static uint64_t pl050_read(void *opaque, hwaddr offset,
unsigned size)
{
pl050_state *s = (pl050_state *)opaque;
if (offset >= 0xfe0 && offset < 0x1000)
return pl050_id[(offset - 0xfe0) >> 2];
switch (offset >> 2) {
case 0:
return s->cr;
case 1:
{
uint8_t val;
uint32_t stat;
val = s->last;
val = val ^ (val >> 4);
val = val ^ (val >> 2);
val = (val ^ (val >> 1)) & 1;
stat = PL050_TXEMPTY;
if (val)
stat |= PL050_RXPARITY;
if (s->pending)
stat |= PL050_RXFULL;
return stat;
}
case 2:
if (s->pending)
s->last = ps2_read_data(s->dev);
return s->last;
case 3:
return s->clk;
case 4:
return s->pending | 2;
default:
hw_error("pl050_read: Bad offset %x\n", (int)offset);
return 0;
}
}
| 1threat
|
WCSession has not been activated : <p>I get the WCSession has not been activated error when I try to sent something. And I don't know what I'm doing wrong. I have tested serval pre-made solutions what "must" work. But it doesn't work at my simulator and physical devices.</p>
<p>Some code:</p>
<p>My app delegate:</p>
<pre><code>import UIKit
import CoreData
import WatchConnectivity
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, WCSessionDelegate {
var window: UIWindow?
func session(session: WCSession, didReceiveMessage message: [String : AnyObject], replyHandler: ([String : String]) -> Void) {
replyHandler(["message": "Hello Watch!"])
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
}
func sessionDidBecomeInactive(_ session: WCSession) {
}
func sessionDidDeactivate(_ session: WCSession) {
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if WCSession.isSupported() {
let session = WCSession.default()
session.delegate = self
session.activate()
}
return true
}
........
}
</code></pre>
<p>My interfaceController:</p>
<pre><code>import WatchKit
import Foundation
import WatchConnectivity
class InterfaceController: WKInterfaceController {
override func awake(withContext context: Any?) {
super.awake(withContext: context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
if WCSession.default().isReachable {
let messageDict = ["message": "hello iPhone!"]
WCSession.default().sendMessage(messageDict, replyHandler: { (replyDict) -> Void in
//print(replyDict)
}, errorHandler: { (error) -> Void in
// print(error)
})
}
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
}
func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}
</code></pre>
<p>The extensionDelegate:</p>
<pre><code> import WatchKit
import WatchConnectivity
class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate {
func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
if WCSession.isSupported() {
let session = WCSession.default()
session.delegate = self
session.activate()
}
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
}
func session(_ session: WCSession, didReceiveMessage message: [String : Any]) {
}
....
</code></pre>
<p>Is there any wrong code or implementations? Because nothing works for me.</p>
| 0debug
|
Reduce the size of Flash memory embedded cpp : <p>After a lot of research i could not find any solution to my question (if i did i woudln't be here ...)
I'm looking for solutions that permits me to reduce the flash memory used by my program.</p>
<p>I'm programming an embedded c++ programm and when i Flash my electronic card in release mode everything is fine cause it doesn't overflow the space of the flash memory, but that is not the case when i do it in Debug mode... I want to know if it is possible to find functions (my goal is to do it without reducing the code) that could reduce Flash memory.I already thought about defragmentation but I don't find how to do it in embedded even though i don't even know if i can ... I also tried the -Os cmd from gcc but without any big success</p>
<p>So I'm taking any advices or support and i'll be there at any question about my issue ;) </p>
<p>Thanks !</p>
| 0debug
|
static int thp_probe(AVProbeData *p)
{
if (AV_RL32(p->buf) == MKTAG('T', 'H', 'P', '\0'))
return AVPROBE_SCORE_MAX;
else
return 0;
}
| 1threat
|
Multi-Step Form when resizing on mobile devices : So, I'm trying to create a mobile responsive web app, I've already managed to fit it properly on mobile devices, but I don't want the "second form" to go above the first one, but to create a multi-step form when viewing on mobile devices.
Here's my code so far:
<div class="container">
<form action="/action_page.php">
<div class="row">
<div class="col-25">
<label for="fname">First Name</label>
</div>
<div class="col-75">
<input type="text" id="fname" name="firstname" placeholder="Your name..">
</div>
</div>
<div class="row">
<div class="col-25">
<label for="lname">Last Name</label>
</div>
<div class="col-75">
<input type="text" id="lname" name="lastname" placeholder="Your last name..">
</div>
</div>
</form>
</div>
(I have two forms like this one)
| 0debug
|
should i use `return` in Promise? : <pre><code>function saveToTheDb(value) {
return new Promise(function(resolve, reject) {
db.values.insert(value, function(err, user) { // remember error first ;)
if (err) {
return reject(err); // don't forget to return here
}
resolve(user);
})
}
}
</code></pre>
<p>Here is the code which i see from <a href="https://blog.risingstack.com/asynchronous-javascript/" rel="noreferrer">here</a>.
i am confused about <code>return</code> keyword.</p>
<p>For <code>resolve(user);</code>, do i need <code>return</code>?</p>
<p>For <code>reject(user);</code>, do i need <code>return</code>?</p>
| 0debug
|
static int http_open_cnx_internal(URLContext *h, AVDictionary **options)
{
const char *path, *proxy_path, *lower_proto = "tcp", *local_path;
char hostname[1024], hoststr[1024], proto[10];
char auth[1024], proxyauth[1024] = "";
char path1[MAX_URL_SIZE];
char buf[1024], urlbuf[MAX_URL_SIZE];
int port, use_proxy, err, location_changed = 0;
HTTPContext *s = h->priv_data;
av_url_split(proto, sizeof(proto), auth, sizeof(auth),
hostname, sizeof(hostname), &port,
path1, sizeof(path1), s->location);
ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
proxy_path = getenv("http_proxy");
use_proxy = !ff_http_match_no_proxy(getenv("no_proxy"), hostname) &&
proxy_path != NULL && av_strstart(proxy_path, "http:
if (!strcmp(proto, "https")) {
lower_proto = "tls";
use_proxy = 0;
if (port < 0)
port = 443;
}
if (port < 0)
port = 80;
if (path1[0] == '\0')
path = "/";
else
path = path1;
local_path = path;
if (use_proxy) {
ff_url_join(urlbuf, sizeof(urlbuf), proto, NULL, hostname, port, "%s",
path1);
path = urlbuf;
av_url_split(NULL, 0, proxyauth, sizeof(proxyauth),
hostname, sizeof(hostname), &port, NULL, 0, proxy_path);
}
ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
if (!s->hd) {
err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE,
&h->interrupt_callback, options);
if (err < 0)
return err;
}
err = http_connect(h, path, local_path, hoststr,
auth, proxyauth, &location_changed);
if (err < 0)
return err;
return location_changed;
}
| 1threat
|
static int qcow2_cache_do_get(BlockDriverState *bs, Qcow2Cache *c,
uint64_t offset, void **table, bool read_from_disk)
{
BDRVQcowState *s = bs->opaque;
int i;
int ret;
int lookup_index;
uint64_t min_lru_counter = UINT64_MAX;
int min_lru_index = -1;
trace_qcow2_cache_get(qemu_coroutine_self(), c == s->l2_table_cache,
offset, read_from_disk);
i = lookup_index = (offset / s->cluster_size * 4) % c->size;
do {
const Qcow2CachedTable *t = &c->entries[i];
if (t->offset == offset) {
goto found;
}
if (t->ref == 0 && t->lru_counter < min_lru_counter) {
min_lru_counter = t->lru_counter;
min_lru_index = i;
}
if (++i == c->size) {
i = 0;
}
} while (i != lookup_index);
if (min_lru_index == -1) {
abort();
}
i = min_lru_index;
trace_qcow2_cache_get_replace_entry(qemu_coroutine_self(),
c == s->l2_table_cache, i);
if (i < 0) {
return i;
}
ret = qcow2_cache_entry_flush(bs, c, i);
if (ret < 0) {
return ret;
}
trace_qcow2_cache_get_read(qemu_coroutine_self(),
c == s->l2_table_cache, i);
c->entries[i].offset = 0;
if (read_from_disk) {
if (c == s->l2_table_cache) {
BLKDBG_EVENT(bs->file, BLKDBG_L2_LOAD);
}
ret = bdrv_pread(bs->file, offset, qcow2_cache_get_table_addr(bs, c, i),
s->cluster_size);
if (ret < 0) {
return ret;
}
}
c->entries[i].offset = offset;
found:
c->entries[i].ref++;
*table = qcow2_cache_get_table_addr(bs, c, i);
trace_qcow2_cache_get_done(qemu_coroutine_self(),
c == s->l2_table_cache, i);
return 0;
}
| 1threat
|
select the rows with custom date format in MySQLi? : <h1>select the rows with custom date format in MySQLi ???</h1>
[enter image description here][1]
[1]: https://i.stack.imgur.com/V8Rs7.png
<br><h1>This is an image from my database how i solve this query?</h1>
<h2>PLEASE HELP ME!</h2>
<p>if the <b> `publish_date`</b> is like <i>1540182298,1540182469,1540183281</i></p>
<span>
`$sql="SELECT * FROM new_enquery WHERE date_format(publish_date, '%Y')='2018'";`
</span>
| 0debug
|
Get the current date and time in PHP with '2016-07-04 00:00:00.000' format : <p>I am using mssql db with php. Which PHP function can return the current datetime. (i.e.) I want the current date and time to be saved in the following format say for example,</p>
<pre><code>2016-07-04 11:10:05.000
</code></pre>
<p>Thanks!</p>
| 0debug
|
Update origin point with transformations? : I want to be able to update a point (center of object) with the transformations applied to the object. I already have the transformations working perfectly fine but what I need to do update my object center point with the transformations so that I can do some others stuff with them. The problem is that if you multiply the model matrix with the vector(0, 0, 0) (origin of object) it produces a vector(0, 0, 0). That is where I am stuck.
| 0debug
|
Do threads share local variables? : <p>I'm reading Operating System Concepts by Silberschatz 7th ed, and it says that threads of the same process share the code section, data section, and other O.S. resources, but have separate sets of stacks and registers. However, the problem set I'm working on states that threads share local variables, but aren't local variables stored on the stack, so individual threads should have their own copies? </p>
| 0debug
|
Merge jquery selector [javascipt string concat] : I'm trying to make a jquery-selector generator for my two filters - the aim is just hidding some elements in a calendar -
If I filter on the group DB_ID 2 and on the personn DB_ID 1 I would like to generate the following selector :
`#mod_calendar .gid_2.pid_1`
If I filter on the group DB_ID 2 I would like to generate the following selector : `#mod_calendar .gid_2`
If I filter on the personn DB_ID 1 I would like to generate the following selector : `#mod_calendar .pid_1`
If I filter on the group DB_ID 2,5,6,8 and on the personn DB_ID 1 I would like to generate the following selector :
`#mod_calendar .gid_2.pid_1,#mod_calendar .gid_5.pid_1,#mod_calendar .gid_6.pid_1,#mod_calendar .gid_8.pid_1`
If I filter on the group DB_ID 2,5,6,8 and on the personn DB_ID 1,2 I would like to generate the following selector :
`#mod_calendar .gid_2.pid_1,#mod_calendar .gid_5.pid_1,#mod_calendar .gid_6.pid_1,#mod_calendar .gid_8.pid_1#mod_calendar .gid_2.pid_2,#mod_calendar .gid_5.pid_2,#mod_calendar .gid_6.pid_2,#mod_calendar .gid_8.pid_2`
And so one, I think you get the point...
this https://jsfiddle.net/5mr60f6p/ is what I tried so far but I'm kind of stuck at the moment.
| 0debug
|
void helper_fsqrtq(CPUSPARCState *env)
{
clear_float_exceptions(env);
QT0 = float128_sqrt(QT1, &env->fp_status);
check_ieee_exceptions(env);
}
| 1threat
|
static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
const char *replaces,
int64_t speed, int64_t granularity,
int64_t buf_size,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockCompletionFunc *cb,
void *opaque, Error **errp,
const BlockJobDriver *driver,
bool is_none_mode, BlockDriverState *base)
{
MirrorBlockJob *s;
if (granularity == 0) {
BlockDriverInfo bdi;
if (bdrv_get_info(target, &bdi) >= 0 && bdi.cluster_size != 0) {
granularity = MAX(4096, bdi.cluster_size);
granularity = MIN(65536, granularity);
} else {
granularity = 65536;
}
}
assert ((granularity & (granularity - 1)) == 0);
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
!bdrv_iostatus_is_enabled(bs)) {
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
return;
}
s = block_job_create(driver, bs, speed, cb, opaque, errp);
if (!s) {
return;
}
s->replaces = g_strdup(replaces);
s->on_source_error = on_source_error;
s->on_target_error = on_target_error;
s->target = target;
s->is_none_mode = is_none_mode;
s->base = base;
s->granularity = granularity;
s->buf_size = MAX(buf_size, granularity);
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, errp);
if (!s->dirty_bitmap) {
return;
}
bdrv_set_enable_write_cache(s->target, true);
bdrv_set_on_error(s->target, on_target_error, on_target_error);
bdrv_iostatus_enable(s->target);
s->common.co = qemu_coroutine_create(mirror_run);
trace_mirror_start(bs, s, s->common.co, opaque);
qemu_coroutine_enter(s->common.co, s);
}
| 1threat
|
how to use GROUP_CONCAT in laravel : <pre><code>$assignment = assignment::find(Crypt::decrypt($id));
$assignment_details = $assignment->raw_plan()->groupBy('flag')->get();
</code></pre>
<p>I want to following result of this query in laravel</p>
<pre><code>SELECT GROUP_CONCAT(name) AS 'names' FROM `raw_plans` where `assignment_id` = 1 GROUP BY`flag`
</code></pre>
<p>Please suggest me how to use GROUP_CONCAT in laravel</p>
| 0debug
|
C# passing objects to different methods : <p>I have a quick question. I have an object that I am trying to pass to a different method in a different class. </p>
<pre><code> public virtual void Geocode(ICustomer customer)
{
RouteObjects.Customer roCustomer = customer as RouteObjects.Customer;
if (customer != null)
{
RouteObjectsRepository.Geocode(roCustomer);
GeoCodeUpdateEventPublisher.UpdateGeoCustomer(roCustomer);
}
}
</code></pre>
<p>I am trying to pass the roCustomer object to GeoCodueUpdateEventPublisher in method updategeocustomer. my updateGeoCustomer looks like this </p>
<pre><code> public virtual void UpdateGeoCustomer(object roCustomer)
{
Publish(roCustomer);
}
</code></pre>
<p>I wanted to know if this is the proper way to pass this object? I am then going to call method publish and it will look something like this.</p>
<pre><code> protected virtual void Publish(object roCustomer)
{
PublishMessage publishMessage = CreatePublishMessage(roCustomer);
if (publishMessage != null)
{
Subscribers.AsParallel().ForAll(s => s.Send(publishMessage));
}
}
</code></pre>
<p>I am just trying to verify if I am passing this object around correctly</p>
| 0debug
|
python syntax error although syntax is correct : <p>For the following python function: </p>
<pre><code> def startElement(self, tag, attributes):
if tag == "artikel":
print("<tr><td>{}</td> <td>".format(attributes["id"])
if tag == "preis":
print("</td> <td>")
if tag == "lieferant":
print("</td> <td>")
</code></pre>
<p>I get the following syntax error:</p>
<pre><code> if tag == "preis":
^
SyntaxError: invalid syntax
</code></pre>
<p>I have no idea at all what's supposed to be wrong with the syntax here.
Does anybody else know what's up here?</p>
| 0debug
|
What will be the C# Class for my xml and how to deserialize it : <p>Below is the my source xml. i want to write c# class for it and then deserialize it. so i can use c# object and save this to database.
History- : i was doing json deserialize that works great but am running into issue in my xml 'LastChangeId' node can be part of this xml , sometime may not be there at all or sometime there are multiple nodes for it. this issue messing with my json parsing. and i have to switch back to xml. any help will appreciable. </p>
<pre><code><FundingSource >
<ClientAccountPaySourceId>16</ClientAccountPaySourceId>
<ClientAccountId>67</ClientAccountId>
<ClientAccountName>Default Account</ClientAccountName>
<PrimaryPartyId>62</PrimaryPartyId>
<PrimaryRoleId>1290</PrimaryRoleId>
<TenderTypeId>3</TenderTypeId>
<TenderTypeName>Credit Card</TenderTypeName>
<TenderInterfaceName>Credit Card</TenderInterfaceName>
<CreditCareTypeName>Visa</CreditCareTypeName>
<ChargeAccountMask>1111</ChargeAccountMask>
<ExpirationDate>04/20</ExpirationDate>
<BillingAccountName>Joe Montana</BillingAccountName>
<BillingStreet>1235 Main St</BillingStreet>
<BillingCity>Pleasanton</BillingCity>
<BillingPostalCode>94588</BillingPostalCode>
<BillingCountry>US</BillingCountry>
<BillingTelephone>1231234567</BillingTelephone>
<DisplayOrder>1</DisplayOrder>
<UseForRecurring>true</UseForRecurring>
<UseForNonRecurring>true</UseForNonRecurring>
<IsActive>true</IsActive>
<Invalid>false</Invalid>
<ChargeAccountToken>VC84632147254611111111</ChargeAccountToken>
<IsExternal>false</IsExternal>
<LastChangeId >
<ClientAccountPaySourceId>16</ClientAccountPaySourceId>
<TimeUtc>2016-02-02 01:04:16</TimeUtc>
<TimeLocal>2016-02-01 17:04:16</TimeLocal>
<UserName>Josh.Lyon</UserName>
<PartyId>20</PartyId>
<RoleId>1160</RoleId>
<BusinessUnitCode>2</BusinessUnitCode>
<EndpointKey>default</EndpointKey>
</LastChangeId>
</FundingSource>
</code></pre>
| 0debug
|
static int webm_dash_manifest_cues(AVFormatContext *s)
{
MatroskaDemuxContext *matroska = s->priv_data;
EbmlList *seekhead_list = &matroska->seekhead;
MatroskaSeekhead *seekhead = seekhead_list->elem;
char *buf;
int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth;
int i;
for (i = 0; i < seekhead_list->nb_elem; i++)
if (seekhead[i].id == MATROSKA_ID_CUES)
break;
if (i >= seekhead_list->nb_elem) return -1;
before_pos = avio_tell(matroska->ctx->pb);
cues_start = seekhead[i].pos + matroska->segment_start;
if (avio_seek(matroska->ctx->pb, cues_start, SEEK_SET) == cues_start) {
uint64_t cues_length = 0, cues_id = 0, bytes_read = 0;
bytes_read += ebml_read_num(matroska, matroska->ctx->pb, 4, &cues_id);
bytes_read += ebml_read_length(matroska, matroska->ctx->pb, &cues_length);
cues_end = cues_start + cues_length + bytes_read - 1;
}
avio_seek(matroska->ctx->pb, before_pos, SEEK_SET);
if (cues_start == -1 || cues_end == -1) return -1;
matroska_parse_cues(matroska);
av_dict_set_int(&s->streams[0]->metadata, CUES_START, cues_start, 0);
av_dict_set_int(&s->streams[0]->metadata, CUES_END, cues_end, 0);
bandwidth = webm_dash_manifest_compute_bandwidth(s, cues_start);
if (bandwidth < 0) return -1;
av_dict_set_int(&s->streams[0]->metadata, BANDWIDTH, bandwidth, 0);
av_dict_set_int(&s->streams[0]->metadata, CLUSTER_KEYFRAME, webm_clusters_start_with_keyframe(s), 0);
buf = av_malloc_array(s->streams[0]->nb_index_entries, 20 * sizeof(char));
if (!buf) return -1;
strcpy(buf, "");
for (i = 0; i < s->streams[0]->nb_index_entries; i++) {
snprintf(buf, (i + 1) * 20 * sizeof(char),
"%s%" PRId64, buf, s->streams[0]->index_entries[i].timestamp);
if (i != s->streams[0]->nb_index_entries - 1)
strncat(buf, ",", sizeof(char));
}
av_dict_set(&s->streams[0]->metadata, CUE_TIMESTAMPS, buf, 0);
av_free(buf);
return 0;
}
| 1threat
|
how to create the tab bar without app bar in flutter? : <p>I wish to add the tab app instead of app bar on my home screen. How to create it. Currently, my tab bar added at the bottom of app bar and I have removed the title and elevation. At the same time, I can't say <code>appBar: null</code> as I need some space on the top of the tab bar. </p>
<pre><code>Widget HomeTap = new Scaffold(
appBar: new AppBar(
bottom: new TabBar(
indicatorColor: Colors.pinkAccent[100],
labelColor: Colors.pinkAccent[100],
indicatorWeight: 0.5,
unselectedLabelColor: Colors.grey[400],
tabs: [
new Tab(text: 'Album',),
new Tab(text: 'Artist'),
new Tab(text: 'Playlist'),
new Tab(text: 'Songs'),
new Tab(icon: new Icon(Icons.search))
]),
title: null,
elevation: 0.0,
),
body: new TabBarView(
children: [
new Center(
child: new AlbumWidget(),
),
new Container(),
new Container(),
new Container(),
new Container(),
],
),
);
</code></pre>
| 0debug
|
how to write code in java script in button(for example) that download .exe/.bat file from web server and execute it into client? : **hi, I want to write js code to download and execute .exe/bat file automatically from my web server when a person clicks on the Download button. this will help my customers who don't have knowledge about run programs.
thanks on advanced.**
| 0debug
|
R - XGBoost: Error building DMatrix : <p>I am having trouble using the XGBoost in R.
I am reading a CSV file with my data:</p>
<pre><code>get_data = function()
{
#Loading Data
path = "dados_eye.csv"
data = read.csv(path)
#Dividing into two groups
train_porcentage = 0.05
train_lines = nrow(data)*train_porcentage
train = data[1:train_lines,]
test = data[train_lines:nrow(data),]
rownames(train) = c(1:nrow(train))
rownames(test) = c(1:nrow(test))
return (list("test" = test, "train" = train))
}
</code></pre>
<p>This function is Called my the main.R</p>
<pre><code>lista_dados = get_data()
#machine = train_svm(lista_dados$train)
#machine = train_rf(lista_dados$train)
machine = train_xgt(lista_dados$train)
</code></pre>
<p>The problem is here in the train_xgt</p>
<pre><code>train_xgt = function(train_data)
{
data_train = data.frame(train_data[,1:14])
label_train = data.frame(factor(train_data[,15]))
print(is.data.frame(data_train))
print(is.data.frame(label_train))
dtrain = xgb.DMatrix(data_train, label=label_train)
machine = xgboost(dtrain, num_class = 4 ,max.depth = 2,
eta = 1, nround = 2,nthread = 2,
objective = "binary:logistic")
return (machine)
}
</code></pre>
<p>This is the Error:</p>
<blockquote>
<p>becchi@ubuntu:~/Documents/EEG_DATA/Dados_Eye$ Rscript main.R</p>
<p>[1] TRUE</p>
<p>[1] TRUE </p>
<p>Error in xgb.DMatrix(data_train, label = label_train) :<br>
xgb.DMatrix: does not support to construct from list Calls: train_xgt
-> xgb.DMatrix Execution halted becchi@ubuntu:~/Documents/EEG_DATA/Dados_Eye$</p>
</blockquote>
<p>As you can see, they are both DataFrames.</p>
<p>I dont know what I am doing wrong, please help!</p>
| 0debug
|
Why doesn't the if statement recognise that the int = 0? : I'm creating a text based adventure game, and this is meant to be a small fight. The int userhits or deputy hits should be set to 0 at somepoint, but the code is stuck in a loop that goes passed 0.
`def deputyfight(deputyawake):
print("You do not have any weapons, you will have to fight him.")
userhits = 5
deputyhits = 5
print("You run at the guard and throw a punch at him")
print("He dodges it, the fight has begun")
loop = True
while loop:
if loop:
userdmg = int(random.randint(5, 10))
deputydmg = int(random.randint(1, 10))
if userdmg >= deputydmg:
print("You punch the deputy")
userhits -= 1
print(userhits)
elif userhits == 0:
print("You knock out the deputy and drag him into the cell")
print("He is out cold, he most likely won't remember this or
you")
deputyawake = False
sheriffsoffice(deputyawake)
elif deputydmg < userdmg:
print("The deputy punches you")
usershealth(5)
deputyhits -= 1
print(deputyhits)
elif deputyhits == 0:
print("The deputy puts up a good fight, but you catch him with a
lucky punch")
print("You win the fight, but have taken a lot of damage")
print("Your health is at: ", health)
deputyawake = False
sheriffsoffice(deputyawake)`
| 0debug
|
Could not determine the class-path for interface com.android.builder.model.AndroidProject : <p>When I import an Eclipse project into Android Studio, I got this problem:
<code>
Gradle 'XNote' project refresh failed
Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
</code>
Anyone knows why it happened? Thanks!</p>
<p><a href="https://i.stack.imgur.com/N7X23.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N7X23.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/jSIsV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jSIsV.png" alt="enter image description here"></a></p>
| 0debug
|
setup_return(CPUARMState *env, struct target_sigaction *ka,
abi_ulong *rc, abi_ulong frame_addr, int usig, abi_ulong rc_addr)
{
abi_ulong handler = ka->_sa_handler;
abi_ulong retcode;
int thumb = handler & 1;
uint32_t cpsr = cpsr_read(env);
cpsr &= ~CPSR_IT;
if (thumb) {
cpsr |= CPSR_T;
} else {
cpsr &= ~CPSR_T;
}
if (ka->sa_flags & TARGET_SA_RESTORER) {
retcode = ka->sa_restorer;
} else {
unsigned int idx = thumb;
if (ka->sa_flags & TARGET_SA_SIGINFO)
idx += 2;
if (__put_user(retcodes[idx], rc))
return 1;
retcode = rc_addr + thumb;
}
env->regs[0] = usig;
env->regs[13] = frame_addr;
env->regs[14] = retcode;
env->regs[15] = handler & (thumb ? ~1 : ~3);
cpsr_write(env, cpsr, 0xffffffff);
return 0;
}
| 1threat
|
Elegant way to convert "YYYY-MM" to Date object in Java : <p>What is the best way to convert date in String format "YYYY-MM" to Date object in Java apart from String parsing.</p>
<p>What I tried is below.</p>
<pre><code> String expirationDateArr[] = dateStr.split("-");
</code></pre>
<p>Then extract month and year to create the Date object.</p>
| 0debug
|
static int select_frame(AVFilterContext *ctx, AVFilterBufferRef *picref)
{
SelectContext *select = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
double res;
if (isnan(select->var_values[VAR_START_PTS]))
select->var_values[VAR_START_PTS] = TS2D(picref->pts);
if (isnan(select->var_values[VAR_START_T]))
select->var_values[VAR_START_T] = TS2D(picref->pts) * av_q2d(inlink->time_base);
select->var_values[VAR_PTS] = TS2D(picref->pts);
select->var_values[VAR_T ] = picref->pts * av_q2d(inlink->time_base);
select->var_values[VAR_POS] = picref->pos == -1 ? NAN : picref->pos;
select->var_values[VAR_PREV_PTS] = TS2D(picref ->pts);
select->var_values[VAR_INTERLACE_TYPE] =
!picref->video->interlaced ? INTERLACE_TYPE_P :
picref->video->top_field_first ? INTERLACE_TYPE_T : INTERLACE_TYPE_B;
select->var_values[VAR_PICT_TYPE] = picref->video->pict_type;
res = av_expr_eval(select->expr, select->var_values, NULL);
av_log(inlink->dst, AV_LOG_DEBUG,
"n:%d pts:%d t:%f pos:%d interlace_type:%c key:%d pict_type:%c "
"-> select:%f\n",
(int)select->var_values[VAR_N],
(int)select->var_values[VAR_PTS],
select->var_values[VAR_T],
(int)select->var_values[VAR_POS],
select->var_values[VAR_INTERLACE_TYPE] == INTERLACE_TYPE_P ? 'P' :
select->var_values[VAR_INTERLACE_TYPE] == INTERLACE_TYPE_T ? 'T' :
select->var_values[VAR_INTERLACE_TYPE] == INTERLACE_TYPE_B ? 'B' : '?',
(int)select->var_values[VAR_KEY],
av_get_picture_type_char(select->var_values[VAR_PICT_TYPE]),
res);
select->var_values[VAR_N] += 1.0;
if (res) {
select->var_values[VAR_PREV_SELECTED_N] = select->var_values[VAR_N];
select->var_values[VAR_PREV_SELECTED_PTS] = select->var_values[VAR_PTS];
select->var_values[VAR_PREV_SELECTED_T] = select->var_values[VAR_T];
select->var_values[VAR_SELECTED_N] += 1.0;
}
return res;
}
| 1threat
|
Python pandas: remove everything after a delimiter in a string : <p>I have data frames which contain e.g.:</p>
<pre><code>"vendor a::ProductA"
"vendor b::ProductA
"vendor a::Productb"
</code></pre>
<p>I need to remove everything (and including) the two :: so that I end up with:</p>
<pre><code>"vendor a"
"vendor b"
"vendor a"
</code></pre>
<p>I tried str.trim (which seems to not exist) and str.split without success.
what would be the easiest way to accomplish this?</p>
| 0debug
|
void bdrv_enable_copy_on_read(BlockDriverState *bs)
{
bs->copy_on_read++;
}
| 1threat
|
How to get oracle 6 jar from maven to my local repository to use in my hibernate application : How to add oracle to my Hibernate through dependencies from maven
| 0debug
|
static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
int dstWidth, const uint8_t *src1,
const uint8_t *src2, int srcW, int xInc)
{
#if ARCH_X86
#if COMPILE_TEMPLATE_MMX2
int32_t *filterPos = c->hChrFilterPos;
int16_t *filter = c->hChrFilter;
int canMMX2BeUsed = c->canMMX2BeUsed;
void *mmx2FilterCode= c->chrMmx2FilterCode;
int i;
#if defined(PIC)
DECLARE_ALIGNED(8, uint64_t, ebxsave);
#endif
if (canMMX2BeUsed) {
__asm__ volatile(
#if defined(PIC)
"mov %%"REG_b", %6 \n\t"
#endif
"pxor %%mm7, %%mm7 \n\t"
"mov %0, %%"REG_c" \n\t"
"mov %1, %%"REG_D" \n\t"
"mov %2, %%"REG_d" \n\t"
"mov %3, %%"REG_b" \n\t"
"xor %%"REG_a", %%"REG_a" \n\t"
PREFETCH" (%%"REG_c") \n\t"
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
"xor %%"REG_a", %%"REG_a" \n\t"
"mov %5, %%"REG_c" \n\t"
"mov %1, %%"REG_D" \n\t"
"add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t"
PREFETCH" (%%"REG_c") \n\t"
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
#if defined(PIC)
"mov %6, %%"REG_b" \n\t"
#endif
:: "m" (src1), "m" (dst), "m" (filter), "m" (filterPos),
"m" (mmx2FilterCode), "m" (src2)
#if defined(PIC)
,"m" (ebxsave)
#endif
: "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
#if !defined(PIC)
,"%"REG_b
#endif
);
for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) {
dst[i] = src1[srcW-1]*128;
dst[i+VOFW] = src2[srcW-1]*128;
}
} else {
#endif
x86_reg dstWidth_reg = dstWidth;
x86_reg xInc_shr16 = (x86_reg) (xInc >> 16);
uint16_t xInc_mask = xInc & 0xffff;
__asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
"xor %%"REG_d", %%"REG_d" \n\t"
"xorl %%ecx, %%ecx \n\t"
ASMALIGN(4)
"1: \n\t"
"mov %0, %%"REG_S" \n\t"
"movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t"
"movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t"
FAST_BILINEAR_X86
"movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t"
"movzbl (%5, %%"REG_d"), %%edi \n\t"
"movzbl 1(%5, %%"REG_d"), %%esi \n\t"
FAST_BILINEAR_X86
"movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t"
"addw %4, %%cx \n\t"
"adc %3, %%"REG_d" \n\t"
"add $1, %%"REG_a" \n\t"
"cmp %2, %%"REG_a" \n\t"
" jb 1b \n\t"
#if ARCH_X86_64 && AV_GCC_VERSION_AT_LEAST(3,4)
:: "m" (src1), "m" (dst), "g" (dstWidth_reg), "m" (xInc_shr16), "m" (xInc_mask),
#else
:: "m" (src1), "m" (dst), "m" (dstWidth_reg), "m" (xInc_shr16), "m" (xInc_mask),
#endif
"r" (src2)
: "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
);
#if COMPILE_TEMPLATE_MMX2
}
#endif
#else
int i;
unsigned int xpos=0;
for (i=0;i<dstWidth;i++) {
register unsigned int xx=xpos>>16;
register unsigned int xalpha=(xpos&0xFFFF)>>9;
dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
xpos+=xInc;
}
#endif
}
| 1threat
|
Using Template in friend class : <p>First of all, my teacher asked mу to do something like that. </p>
<p>I have a class of two-dimensional array: </p>
<pre><code> #pragma once
#include <iostream>
#include "MyMaskedMassiv.h"
template<typename T>
class MyMaskedMassiv;
template <typename T>
class My2dMassiv{
private:
T* mas;
int col;
int str;
public:
........
friend class MyMaskedMassiv<T>;
MyMaskedMassiv<T>& operator()(My2dMassiv<bool>& mask){
MyMaskedMassiv<T> *maskMas = new MyMaskedMassiv<T>();
maskMas->masiv = this;
maskMas->mask = &mask;
return *maskMas;
}
}
</code></pre>
<p>And as you can see another class "MyMaskedMassiv" that have links to the first one:</p>
<pre><code> #pragma once
#include "My2dMassiv.h"
template <typename U>
class My2dMassiv;
template <typename T>
class MyMaskedMassiv{
private:
My2dMassiv<T> *masiv;
My2dMassiv<bool> *mask;
public:
friend class My2dMassiv<T>;
friend class My2dMassiv<bool>;
MyMaskedMassiv(){
masiv = nullptr;
mask = nullptr;
}
MyMaskedMassiv& operator=(const T& el){
int s = masiv->str;
int c = masiv->col;
for(int i=0; i<c; i++)
for( int j=0; j<s; j++)
if( this->mask->mas[i*s + j] == true)
this->masiv->mas[i*s + j] = el;
return *this;
}
}
</code></pre>
<p>So then I try to build I got an error: </p>
<pre><code> My2dMassiv.h:11:8: error: ‘bool* My2dMassiv<bool>::mas’ is private
../src/myproject/MyMaskedMassiv.h:27:36: error: within this context
if( this->mask->mas[i*s + j] == true)
</code></pre>
<p>So.. what am I doing wrong?</p>
<p>If you want to see full code, check here: <a href="https://github.com/Yarik2308/SystemProg/tree/master/Zadanie4/src/myproject" rel="nofollow noreferrer">GIT</a></p>
| 0debug
|
static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel,
const float *coefs, const FFPsyWindowInfo *wi)
{
AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data;
AacPsyChannel *pch = &pctx->ch[channel];
int start = 0;
int i, w, g;
float desired_bits, desired_pe, delta_pe, reduction, spread_en[128] = {0};
float a = 0.0f, active_lines = 0.0f, norm_fac = 0.0f;
float pe = pctx->chan_bitrate > 32000 ? 0.0f : FFMAX(50.0f, 100.0f - pctx->chan_bitrate * 100.0f / 32000.0f);
const int num_bands = ctx->num_bands[wi->num_windows == 8];
const uint8_t *band_sizes = ctx->bands[wi->num_windows == 8];
AacPsyCoeffs *coeffs = pctx->psy_coef[wi->num_windows == 8];
const float avoid_hole_thr = wi->num_windows == 8 ? PSY_3GPP_AH_THR_SHORT : PSY_3GPP_AH_THR_LONG;
for (w = 0; w < wi->num_windows*16; w += 16) {
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &pch->band[w+g];
float form_factor = 0.0f;
band->energy = 0.0f;
for (i = 0; i < band_sizes[g]; i++) {
band->energy += coefs[start+i] * coefs[start+i];
form_factor += sqrtf(fabs(coefs[start+i]));
}
band->thr = band->energy * 0.001258925f;
band->nz_lines = form_factor / powf(band->energy / band_sizes[g], 0.25f);
start += band_sizes[g];
}
}
for (w = 0; w < wi->num_windows*16; w += 16) {
AacPsyBand *bands = &pch->band[w];
spread_en[0] = bands[0].energy;
for (g = 1; g < num_bands; g++) {
bands[g].thr = FFMAX(bands[g].thr, bands[g-1].thr * coeffs[g].spread_hi[0]);
spread_en[w+g] = FFMAX(bands[g].energy, spread_en[w+g-1] * coeffs[g].spread_hi[1]);
}
for (g = num_bands - 2; g >= 0; g--) {
bands[g].thr = FFMAX(bands[g].thr, bands[g+1].thr * coeffs[g].spread_low[0]);
spread_en[w+g] = FFMAX(spread_en[w+g], spread_en[w+g+1] * coeffs[g].spread_low[1]);
}
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &bands[g];
band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath);
if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w)))
band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr,
PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet));
pe += calc_pe_3gpp(band);
a += band->pe_const;
active_lines += band->active_lines;
if (spread_en[w+g] * avoid_hole_thr > band->energy || coeffs[g].min_snr > 1.0f)
band->avoid_holes = PSY_3GPP_AH_NONE;
else
band->avoid_holes = PSY_3GPP_AH_INACTIVE;
}
}
ctx->ch[channel].entropy = pe;
desired_bits = calc_bit_demand(pctx, pe, ctx->bitres.bits, ctx->bitres.size, wi->num_windows == 8);
desired_pe = PSY_3GPP_BITS_TO_PE(desired_bits);
if (ctx->bitres.bits > 0)
desired_pe *= av_clipf(pctx->pe.previous / PSY_3GPP_BITS_TO_PE(ctx->bitres.bits),
0.85f, 1.15f);
pctx->pe.previous = PSY_3GPP_BITS_TO_PE(desired_bits);
if (desired_pe < pe) {
for (w = 0; w < wi->num_windows*16; w += 16) {
reduction = calc_reduction_3gpp(a, desired_pe, pe, active_lines);
pe = 0.0f;
a = 0.0f;
active_lines = 0.0f;
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &pch->band[w+g];
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
pe += calc_pe_3gpp(band);
a += band->pe_const;
active_lines += band->active_lines;
}
}
for (i = 0; i < 2; i++) {
float pe_no_ah = 0.0f, desired_pe_no_ah;
active_lines = a = 0.0f;
for (w = 0; w < wi->num_windows*16; w += 16) {
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &pch->band[w+g];
if (band->avoid_holes != PSY_3GPP_AH_ACTIVE) {
pe_no_ah += band->pe;
a += band->pe_const;
active_lines += band->active_lines;
}
}
}
desired_pe_no_ah = FFMAX(desired_pe - (pe - pe_no_ah), 0.0f);
if (active_lines > 0.0f)
reduction += calc_reduction_3gpp(a, desired_pe_no_ah, pe_no_ah, active_lines);
pe = 0.0f;
for (w = 0; w < wi->num_windows*16; w += 16) {
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &pch->band[w+g];
if (active_lines > 0.0f)
band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction);
pe += calc_pe_3gpp(band);
band->norm_fac = band->active_lines / band->thr;
norm_fac += band->norm_fac;
}
}
delta_pe = desired_pe - pe;
if (fabs(delta_pe) > 0.05f * desired_pe)
break;
}
if (pe < 1.15f * desired_pe) {
norm_fac = 1.0f / norm_fac;
for (w = 0; w < wi->num_windows*16; w += 16) {
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &pch->band[w+g];
if (band->active_lines > 0.5f) {
float delta_sfb_pe = band->norm_fac * norm_fac * delta_pe;
float thr = band->thr;
thr *= powf(2.0f, delta_sfb_pe / band->active_lines);
if (thr > coeffs[g].min_snr * band->energy && band->avoid_holes == PSY_3GPP_AH_INACTIVE)
thr = FFMAX(band->thr, coeffs[g].min_snr * band->energy);
band->thr = thr;
}
}
}
} else {
g = num_bands;
while (pe > desired_pe && g--) {
for (w = 0; w < wi->num_windows*16; w+= 16) {
AacPsyBand *band = &pch->band[w+g];
if (band->avoid_holes != PSY_3GPP_AH_NONE && coeffs[g].min_snr < PSY_SNR_1DB) {
coeffs[g].min_snr = PSY_SNR_1DB;
band->thr = band->energy * PSY_SNR_1DB;
pe += band->active_lines * 1.5f - band->pe;
}
}
}
}
}
for (w = 0; w < wi->num_windows*16; w += 16) {
for (g = 0; g < num_bands; g++) {
AacPsyBand *band = &pch->band[w+g];
FFPsyBand *psy_band = &ctx->ch[channel].psy_bands[w+g];
psy_band->threshold = band->thr;
psy_band->energy = band->energy;
}
}
memcpy(pch->prev_band, pch->band, sizeof(pch->band));
}
| 1threat
|
memory for a member array in C# : I have been programming for a while today and I think I need a break because I can't seem to figure this very simple thing. A help will be greatly appreciated.
I have a class (actually Form1) and there a member array `int[,]f`.
Now I don't manage memory for it there and then (maybe I should?).
Instead in another method, I call a function say:
myFunction(f,.....);
this function is like
void myFunction(int[,] f, ...some other arguments)
{//....
f= new int[NX,NY];
//....
}
As you can see, I separate memory for the array f inside the function.
Now my question is... is this memory going to be garbage collected when I leave myFunction?
| 0debug
|
Permission denied when installing npm module : <p>I'm getting a strange permission error when I try to install an npm module. I'm starting it with <code>sudo</code> so I'm sure I do have access, but for some reason it keeps complaining with an error:</p>
<blockquote>
<p>stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/joplin/node_modules/sqlite3/build'</p>
</blockquote>
<p>I've tried restarting my computer, and creating a directory <code>/usr/lib/node_modules/joplin</code> with chmod 777, but it still doesn't work.</p>
<pre><code>$ sudo npm install -g joplin
/usr/bin/joplin -> /usr/lib/node_modules/joplin/main.js
> sqlite3@3.1.9 install /usr/lib/node_modules/joplin/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.9/node-v48-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.9 and node@6.11.2 (node-v48 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/joplin/node_modules/sqlite3/build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 4.4.0-43-Microsoft
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/lib/node_modules/joplin/node_modules/sqlite3/lib/binding/node-v48-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/usr/lib/node_modules/joplin/node_modules/sqlite3/lib/binding/node-v48-linux-x64"
gyp ERR! cwd /usr/lib/node_modules/joplin/node_modules/sqlite3
gyp ERR! node -v v6.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/lib/node_modules/joplin/node_modules/sqlite3/lib/binding/node-v48-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/lib/node_modules/joplin/node_modules/sqlite3/lib/binding/node-v48-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/joplin/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:891:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-43-Microsoft
node-pre-gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/joplin/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/joplin/node_modules/sqlite3
node-pre-gyp ERR! node -v v6.11.2
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
</code></pre>
<p><strong>Edit</strong></p>
<p>I've also tried <code>sudo npm i sqlite3 -g --build-from-source</code> but getting the same error <code>Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/sqlite3/build'</code> so it seems to be something to do with sqlite3. </p>
| 0debug
|
static void find_peaks(DCAEncContext *c)
{
int band, ch;
for (band = 0; band < 32; band++)
for (ch = 0; ch < c->fullband_channels; ch++) {
int sample;
int32_t m = 0;
for (sample = 0; sample < SUBBAND_SAMPLES; sample++) {
int32_t s = abs(c->subband[sample][band][ch]);
if (m < s)
m = s;
}
c->peak_cb[band][ch] = get_cb(m);
}
if (c->lfe_channel) {
int sample;
int32_t m = 0;
for (sample = 0; sample < DCA_LFE_SAMPLES; sample++)
if (m < abs(c->downsampled_lfe[sample]))
m = abs(c->downsampled_lfe[sample]);
c->lfe_peak_cb = get_cb(m);
}
}
| 1threat
|
HTTP fetching Url, Status=429 : <p>Org.jsoup.HttpStatusException : HTTP error fetching URL . Status =429 that shows when i parsed 900 urls at once...and the message stays for a while like 1 hour or more ..is there any solution to this problem ? Or a way to detect the error before hapening ? </p>
| 0debug
|
How to capture packets for single docker container : <p>There have many container running on the host. And I want to capture packets for the one container of these. Is there any way to do this?</p>
| 0debug
|
Laravel s3 multiple buckets : <p>My Laravel application needs to manipulate files present in multiple buckets simultaneously into a single session. So, I couldn't find a way to change several times the current bucket, since my <code>.env</code> file is like this:</p>
<pre><code>S3_KEY='MY-KEY'
S3_SECRET='MySeCret'
S3_REGION='us-east-1'
S3_BUCKET='my-first-used-bucket'
</code></pre>
<p>I found somewhere that I could do this:</p>
<pre><code>Config::set('filesystems.disks.s3.bucket', 'another-bucket');
</code></pre>
<p>but It works only once. What I need is something like:</p>
<pre><code>Storage::disk('s3')->put('/bucket-name/path/filename.jpg', $file, 'public');
</code></pre>
<p>Where <code>/bucket-name/</code> could be any bucket that I already create. What can I do? Thanks a lot!</p>
| 0debug
|
document.getElementById('input').innerHTML = user_input;
| 1threat
|
int ff_alloc_packet(AVPacket *avpkt, int size)
{
if (size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE)
return AVERROR(EINVAL);
if (avpkt->data) {
void *destruct = avpkt->destruct;
if (avpkt->size < size)
return AVERROR(EINVAL);
av_init_packet(avpkt);
avpkt->destruct = destruct;
avpkt->size = size;
return 0;
} else {
return av_new_packet(avpkt, size);
}
}
| 1threat
|
SQlite Database VS Room persistence library : <p>I need help for my exam project to find differences and benefit of ROOM database:
I tried to search in android development documentation to understand the difference between these two databases, but i couldn't clearly understand.
I did not find any answer in stack overflow either.
I also want to know the benefit of using Room persistence compared to SQLite database. </p>
<p>Hope someone can give me clear answer. </p>
| 0debug
|
How to access LayoutManager from RecyclerView.Adapter to get scrollToPosition? : <p>I customized <code>RecyclerView</code> by adding separate layouts for header and footer. I created constants to determine the property of header, footer and list item in the adapter class. I also created a ViewHolder pattern and assign the layouts to be shown based on the view type. I fixed the header at zeroth position and footer at last position of the array by override <code>getItemViewType</code> method.</p>
<p>I want to make the footer element clickable, so I assign a <code>setOnClickListener(new View.OnClickListener())</code> and overwrote <code>onClick(view: View)</code></p>
<p>My goal is to click on the footer and <code>scrollToPosition</code> 0 or 1 (0 = Header, 1 = first item element). </p>
<p>That's MyAdapter definition:</p>
<pre><code>class MyAdapter(context: Context, data: Array[String]) extends RecyclerView.Adapter[RecyclerView.ViewHolder]
...
override def onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int): Unit = holder match {
...
case holder:FooterViewHolder =>
holder.backToTop.setOnClickListener(new View.OnClickListener() {
override def onClick (view: View) {
backToTop(???)
Toast.makeText (context, "Clicked Footer", Toast.LENGTH_SHORT).show()
}
})
...
}
...
</code></pre>
<p>I read I just need to do this: <code>recyclerView.getLayoutManager().scrollToPosition(position)</code></p>
<p>Unfortunately I can't access the LayoutManager from my Adapter class. Any ideas what I can do?</p>
| 0debug
|
Where are Visual Studio Code log files? : <p>My VS Code frequently shows an error, something like "Error: cannot read property 'name' of undefined". The 'ESLint' tag in the status bar also shows up in red with an exclamation mark. </p>
<p>I suspect my team's custom ESLint plugin. I'd like to see the stack trace of the failure, which would probably confirm or refute my theory.</p>
<p>Does VS Code keep logs for this kind of error? If so, where are they?</p>
<p>(I'm running it on a Mac.)</p>
| 0debug
|
static int h264_slice_header_init(H264Context *h)
{
int nb_slices = (HAVE_THREADS &&
h->avctx->active_thread_type & FF_THREAD_SLICE) ?
h->avctx->thread_count : 1;
int i, ret;
ff_set_sar(h->avctx, h->sps.sar);
av_pix_fmt_get_chroma_sub_sample(h->avctx->pix_fmt,
&h->chroma_x_shift, &h->chroma_y_shift);
if (h->sps.timing_info_present_flag) {
int64_t den = h->sps.time_scale;
if (h->x264_build < 44U)
den *= 2;
av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num,
h->sps.num_units_in_tick, den, 1 << 30);
}
ff_h264_free_tables(h);
h->first_field = 0;
h->prev_interlaced_frame = 1;
init_scan_tables(h);
ret = ff_h264_alloc_tables(h);
if (ret < 0) {
av_log(h->avctx, AV_LOG_ERROR, "Could not allocate memory\n");
return ret;
}
if (h->sps.bit_depth_luma < 8 || h->sps.bit_depth_luma > 10) {
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
h->sps.bit_depth_luma);
return AVERROR_INVALIDDATA;
}
h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
h->pixel_shift = h->sps.bit_depth_luma > 8;
h->chroma_format_idc = h->sps.chroma_format_idc;
h->bit_depth_luma = h->sps.bit_depth_luma;
ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma);
ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
if (nb_slices > H264_MAX_THREADS || (nb_slices > h->mb_height && h->mb_height)) {
int max_slices;
if (h->mb_height)
max_slices = FFMIN(H264_MAX_THREADS, h->mb_height);
else
max_slices = H264_MAX_THREADS;
av_log(h->avctx, AV_LOG_WARNING, "too many threads/slices %d,"
" reducing to %d\n", nb_slices, max_slices);
nb_slices = max_slices;
}
h->slice_context_count = nb_slices;
if (!HAVE_THREADS || !(h->avctx->active_thread_type & FF_THREAD_SLICE)) {
ret = ff_h264_slice_context_init(h, &h->slice_ctx[0]);
if (ret < 0) {
av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n");
return ret;
}
} else {
for (i = 0; i < h->slice_context_count; i++) {
H264SliceContext *sl = &h->slice_ctx[i];
sl->h264 = h;
sl->intra4x4_pred_mode = h->intra4x4_pred_mode + i * 8 * 2 * h->mb_stride;
sl->mvd_table[0] = h->mvd_table[0] + i * 8 * 2 * h->mb_stride;
sl->mvd_table[1] = h->mvd_table[1] + i * 8 * 2 * h->mb_stride;
if ((ret = ff_h264_slice_context_init(h, sl)) < 0) {
av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n");
return ret;
}
}
}
h->context_initialized = 1;
return 0;
}
| 1threat
|
Code work when debugging, but when it running the code crashed : <p>This code need to save friends in some array of array(pointer to pointer) and by the length of the names do realloc (build exactly dynamic place for the strings of each of them) and than prints the string and the length and free everything.
So the code work when i debugging but when I running it with CTR+f5 it's crashed after the fgets of the first string. also all the free loops and the free function doesn't work me here, but if remove it the debugging still work and the CTR+f5 still don't work. help someone?</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LENGTH 20
int main(void)
{
int i = 0, j = 0,friends=0;
char str[LENGTH];
printf("Hello bro,how U doin'?\nTell me how many friends do you have?\n");
scanf("%d",&friends);
char** friendBook = (char**)malloc(sizeof(char)*friends);
if (friendBook)
{
getchar();
for (i = 0; i < friends; i++)
{
*(friendBook+ i) = malloc(LENGTH*sizeof(char));
}
for (i = 0; i < friends; i++)
{
printf("Enter friend number: %d\n", i + 1);
fgets(str, LENGTH, stdin);
str[strcspn(str, "\n")] = 0;
*(friendBook + i) = (char*)realloc(*(friendBook+i),(sizeof(char)*strlen(str))); // dynamic memory for every string(name)
if (*(friendBook + i))
{
strcpy(*(friendBook+i),str);
}
}
for (i = 0; i < friends; i++)
{
printf("Friend: %s\tLength of friend name %d\n", *(friendBook + i), strlen(*(friendBook + i)));
}
}
for (i = 0; i <friends; i++)
{
free(*(friendBook+i));
}
free(friendBook);
system("PAUSE");
return 0;
}
</code></pre>
| 0debug
|
Power supply for raspberry and arduino : <p>I have a question regarding the power supply. i have a raspberry pi 3 and arduino uno. Also with powerbank output of 5v 2200mah. whether my powerbank is enough power for both board ? </p>
| 0debug
|
static void rtas_read_pci_config(sPAPREnvironment *spapr,
uint32_t token, uint32_t nargs,
target_ulong args,
uint32_t nret, target_ulong rets)
{
uint32_t val, size, addr;
PCIDevice *dev = find_dev(spapr, 0, rtas_ld(args, 0));
if (!dev) {
rtas_st(rets, 0, -1);
return;
}
size = rtas_ld(args, 1);
addr = rtas_pci_cfgaddr(rtas_ld(args, 0));
val = pci_default_read_config(dev, addr, size);
rtas_st(rets, 0, 0);
rtas_st(rets, 1, val);
}
| 1threat
|
static inline int tcg_global_reg_new_internal(TCGType type, int reg,
const char *name)
{
TCGContext *s = &tcg_ctx;
TCGTemp *ts;
int idx;
#if TCG_TARGET_REG_BITS == 32
if (type != TCG_TYPE_I32)
tcg_abort();
#endif
if (tcg_regset_test_reg(s->reserved_regs, reg))
tcg_abort();
idx = s->nb_globals;
tcg_temp_alloc(s, s->nb_globals + 1);
ts = &s->temps[s->nb_globals];
ts->base_type = type;
ts->type = type;
ts->fixed_reg = 1;
ts->reg = reg;
ts->name = name;
s->nb_globals++;
tcg_regset_set_reg(s->reserved_regs, reg);
return idx;
}
| 1threat
|
Export json from Firestore : <p>As we can download json file at Firebase RTDB console, are there any way to export json file of Firestore collection/document data?</p>
<p>One of my main objectives is to compare data before/after updating document.</p>
| 0debug
|
static void tlb_info_32(Monitor *mon, CPUState *env)
{
int l1, l2;
uint32_t pgd, pde, pte;
pgd = env->cr[3] & ~0xfff;
for(l1 = 0; l1 < 1024; l1++) {
cpu_physical_memory_read(pgd + l1 * 4, &pde, 4);
pde = le32_to_cpu(pde);
if (pde & PG_PRESENT_MASK) {
if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
print_pte(mon, (l1 << 22), pde, ~((1 << 21) - 1));
} else {
for(l2 = 0; l2 < 1024; l2++) {
cpu_physical_memory_read((pde & ~0xfff) + l2 * 4, &pte, 4);
pte = le32_to_cpu(pte);
if (pte & PG_PRESENT_MASK) {
print_pte(mon, (l1 << 22) + (l2 << 12),
pte & ~PG_PSE_MASK,
~0xfff);
}
}
}
}
}
}
| 1threat
|
Starting jstatd in Java 9+ : <p>In the past, I have started jstatd via a security policy file, as suggested here:
<a href="https://stackoverflow.com/a/14930180/1294116">https://stackoverflow.com/a/14930180/1294116</a></p>
<p>However, in Java 9+, they have removed the <code>tools.jar</code> file, which means that this solution no longer works. Does anyone know how to get around this? (Currently I am back to getting the error <code>java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") ...</code>)</p>
| 0debug
|
how to calculate the exponent from a power a law fitting of the data in python : <p>how to calculate the exponent from a power a law fitting of the data. I want to fit my data with y=x^a now I want to know the value of a (where x and y is given).I am using python.</p>
| 0debug
|
def ngcd(x,y):
i=1
while(i<=x and i<=y):
if(x%i==0 and y%i == 0):
gcd=i;
i+=1
return gcd;
def num_comm_div(x,y):
n = ngcd(x,y)
result = 0
z = int(n**0.5)
i = 1
while(i <= z):
if(n % i == 0):
result += 2
if(i == n/i):
result-=1
i+=1
return result
| 0debug
|
static void spapr_reset_htab(sPAPRMachineState *spapr)
{
long shift;
int index;
shift = kvmppc_reset_htab(spapr->htab_shift);
if (shift > 0) {
if (shift != spapr->htab_shift) {
error_setg(&error_abort, "Requested HTAB allocation failed during reset");
}
if (spapr->htab_fd >= 0) {
spapr->htab_fd_stale = true;
}
} else {
memset(spapr->htab, 0, HTAB_SIZE(spapr));
for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) {
DIRTY_HPTE(HPTE(spapr->htab, index));
}
}
if (spapr->vrma_adjust) {
spapr->rma_size = kvmppc_rma_size(spapr_node0_size(),
spapr->htab_shift);
}
}
| 1threat
|
No genera el refresh_token en txt python-O365 : <p>Me encuentro utilizando la librería o365 de python y cuando genero el txt por medio de account.con.request_token(result_url) no me genera el refresh.token simplemente me genera el access_token, este es mi código </p>
<pre><code>from O365 import Account
scopes_graph = protocols.get_scopes_for('message_send')
credential = ('client_id', 'client_secret')
account = Account(credentials=credential, scopes=scopes_graph)
account.con.get_authorization_url()
result_url = input('Paste the result url here...')
#'aqui crea el txt pero no genera el
account.con.request_token(result_url)
m = account.new_message()
m.to.add('examples@example.com')
m.subject = 'Testing!'
m.body = "George Best quote: I've stopped drinking, but only while I'm asleep."
m.send()
</code></pre>
<p>necesito el "refresh_token":"...." gracias</p>
| 0debug
|
static void FUNC(transquant_bypass4x4)(uint8_t *_dst, int16_t *coeffs,
ptrdiff_t stride)
{
int x, y;
pixel *dst = (pixel *)_dst;
stride /= sizeof(pixel);
for (y = 0; y < 4; y++) {
for (x = 0; x < 4; x++) {
dst[x] += *coeffs;
coeffs++;
}
dst += stride;
}
}
| 1threat
|
Uber Wheelchair option hide request : <p>I have integrated uber api in one of my application as per specify in uber documentation.But client has open that application in US region they saw uber wheelchair as default ride and they won't be able to change it.I want to know is there any option where we can remove those option from that region or i have to write any code for that?</p>
<p>Your help will be really appreciate.</p>
| 0debug
|
static int qemu_rdma_drain_cq(QEMUFile *f, RDMAContext *rdma)
{
int ret;
if (qemu_rdma_write_flush(f, rdma) < 0) {
return -EIO;
}
while (rdma->nb_sent) {
ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_RDMA_WRITE);
if (ret < 0) {
fprintf(stderr, "rdma migration: complete polling error!\n");
return -EIO;
}
}
qemu_rdma_unregister_waiting(rdma);
return 0;
}
| 1threat
|
How to make a Type 5 UUID in Java? : <p>In python, to make a Type 5 UUID we can simply do:</p>
<pre><code>import uuid
print uuid.uuid5(uuid.NAMESPACE_URL, 'my string')
</code></pre>
<p>Looking through the <a href="https://docs.oracle.com/javase/7/docs/api/java/util/UUID.html" rel="noreferrer">java documentation for java.util.UUID</a>, I don't see how to do it. First off, type 5 isn't mentioned. They do have a Type 3, but the signature is:</p>
<pre><code> nameUUIDFromBytes(byte[] name)
Static factory to retrieve a type 3 (name based) UUID based on the specified byte array.
</code></pre>
<p><strong>How can we make a Type 5 UUID in Java?</strong></p>
| 0debug
|
Hello.I can't understand why when I call function in if statement is not the same as without if.Thanks in adavnce : Why when I call function inside of the if statement the result is like " please enter phone number: please enter your name: in the same line" but I need like the first "please enter your phone number: 4545 in the next line please enter your name: dddf
#include <iostream>
using namespace std;
void insert_data ()
{
string phone_number[10] = {};
string name[10] = {};
int count = 0;
for(int i = 0; i < 10; i++ ){
if(name[i] != "" ){
count++;
}
}
cout<< "please enter phone number: ";
string new_phone_number;
getline (cin, new_phone_number);
phone_number[count] = new_phone_number;
cout<< "please enter your name: ";
string new_name;
getline (cin, new_name);
name[count] = new_name;
count++;
}
int main()
{
string a;
cin>> a;
if(a == 1){
insert_data();
}
}
| 0debug
|
search text in a website programmatically : <p>i want my app to search a specific website(from an url) for a specific text and give me the 3 chars after that text or to search for a pattern with a placeholder and give me the first matching string. Is that possible? There is no need to display the website.</p>
| 0debug
|
Page crashes with no clue why : <p>I have a webpage weblup(dot)net/templates/template3 (replace (dot) with a '.') and it just crashes when I run it. It was working fine not long ago but I have no clue why it's crashing all of a sudden. The biggest change before this happened was that I changed a picture.</p>
| 0debug
|
What is difference between application server and backend server : <p>I'm new in IT operations, and I want to ask what is the difference between application server and backend server?</p>
| 0debug
|
Const Auto/Identifier Errors : <p>I having trouble understanding why it won't identify this.
Any help is greatly appreciated. </p>
<p><a href="https://i.stack.imgur.com/2cIiV.png" rel="nofollow noreferrer">Errors</a></p>
<p><a href="https://i.stack.imgur.com/9FeKR.png" rel="nofollow noreferrer">Rest of the Code</a></p>
| 0debug
|
Python pandas unique value ignoring NaN : <p>I want to use <code>unique</code> in <code>groupby</code> aggregation, but I don't want <code>nan</code> in the <code>unique</code> result.</p>
<p>An example dataframe:</p>
<pre><code>df = pd.DataFrame({'a': [1, 2, 1, 1, pd.np.nan, 3, 3], 'b': [0,0,1,1,1,1,1],
'c': ['foo', pd.np.nan, 'bar', 'foo', 'baz', 'foo', 'bar']})
a b c
0 1.0000 0 foo
1 2.0000 0 NaN
2 1.0000 1 bar
3 1.0000 1 foo
4 nan 1 baz
5 3.0000 1 foo
6 3.0000 1 bar
</code></pre>
<p>And the <code>groupby</code>:</p>
<pre><code>df.groupby('b').agg({'a': ['min', 'max', 'unique'], 'c': ['first', 'last', 'unique']})
</code></pre>
<p>It's result is:</p>
<pre><code> a c
min max unique first last unique
b
0 1.0000 2.0000 [1.0, 2.0] foo foo [foo, nan]
1 1.0000 3.0000 [1.0, nan, 3.0] bar bar [bar, foo, baz]
</code></pre>
<p>But I want it without <code>nan</code>:</p>
<pre><code> a c
min max unique first last unique
b
0 1.0000 2.0000 [1.0, 2.0] foo foo [foo]
1 1.0000 3.0000 [1.0, 3.0] bar bar [bar, foo, baz]
</code></pre>
<p>How can I do that? Of course I have several columns to aggregate and every column needs different aggregation functions, so I don't want to do the <code>unique</code> aggregations one-by-one and separately from other aggregations.</p>
<p>Thank you!</p>
| 0debug
|
static int ljpeg_decode_yuv_scan(MJpegDecodeContext *s, int predictor,
int point_transform)
{
int i, mb_x, mb_y;
const int nb_components=s->nb_components;
int bits= (s->bits+7)&~7;
int resync_mb_y = 0;
int resync_mb_x = 0;
point_transform += bits - s->bits;
av_assert0(nb_components>=1 && nb_components<=3);
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
if (s->restart_interval && !s->restart_count){
s->restart_count = s->restart_interval;
resync_mb_x = mb_x;
resync_mb_y = mb_y;
}
if(!mb_x || mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x || s->interlaced){
int toprow = mb_y == resync_mb_y || mb_y == resync_mb_y+1 && mb_x < resync_mb_x;
int leftcol = !mb_x || mb_y == resync_mb_y && mb_x == resync_mb_x;
for (i = 0; i < nb_components; i++) {
uint8_t *ptr;
uint16_t *ptr16;
int n, h, v, x, y, c, j, linesize;
n = s->nb_blocks[i];
c = s->comp_index[i];
h = s->h_scount[i];
v = s->v_scount[i];
x = 0;
y = 0;
linesize= s->linesize[c];
if(bits>8) linesize /= 2;
for(j=0; j<n; j++) {
int pred, dc;
dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFF)
return -1;
if(bits<=8){
ptr = s->picture.data[c] + (linesize * (v * mb_y + y)) + (h * mb_x + x);
if(y==0 && toprow){
if(x==0 && leftcol){
pred= 1 << (bits - 1);
}else{
pred= ptr[-1];
}
}else{
if(x==0 && leftcol){
pred= ptr[-linesize];
}else{
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
}
}
if (s->interlaced && s->bottom_field)
ptr += linesize >> 1;
pred &= (-1)<<(8-s->bits);
*ptr= pred + (dc << point_transform);
}else{
ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x));
if(y==0 && toprow){
if(x==0 && leftcol){
pred= 1 << (bits - 1);
}else{
pred= ptr16[-1];
}
}else{
if(x==0 && leftcol){
pred= ptr16[-linesize];
}else{
PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor);
}
}
if (s->interlaced && s->bottom_field)
ptr16 += linesize >> 1;
pred &= (-1)<<(16-s->bits);
*ptr16= pred + (dc << point_transform);
}
if (++x == h) {
x = 0;
y++;
}
}
}
} else {
for (i = 0; i < nb_components; i++) {
uint8_t *ptr;
uint16_t *ptr16;
int n, h, v, x, y, c, j, linesize, dc;
n = s->nb_blocks[i];
c = s->comp_index[i];
h = s->h_scount[i];
v = s->v_scount[i];
x = 0;
y = 0;
linesize = s->linesize[c];
if(bits>8) linesize /= 2;
for (j = 0; j < n; j++) {
int pred;
dc = mjpeg_decode_dc(s, s->dc_index[i]);
if(dc == 0xFFFF)
return -1;
if(bits<=8){
ptr = s->picture.data[c] +
(linesize * (v * mb_y + y)) +
(h * mb_x + x);
PREDICT(pred, ptr[-linesize-1], ptr[-linesize], ptr[-1], predictor);
pred &= (-1)<<(8-s->bits);
*ptr = pred + (dc << point_transform);
}else{
ptr16 = (uint16_t*)(s->picture.data[c] + 2*(linesize * (v * mb_y + y)) + 2*(h * mb_x + x));
PREDICT(pred, ptr16[-linesize-1], ptr16[-linesize], ptr16[-1], predictor);
pred &= (-1)<<(16-s->bits);
*ptr16= pred + (dc << point_transform);
}
if (++x == h) {
x = 0;
y++;
}
}
}
}
if (s->restart_interval && !--s->restart_count) {
align_get_bits(&s->gb);
skip_bits(&s->gb, 16);
}
}
}
return 0;
}
| 1threat
|
Moving from typings to @types using Visual Studio & Typescript 2.0.3 : <p>I've tried to remove typings from my web project (Visual Studio 2015 Community) and install d.ts files via new NPM @types (typescript 2.0.3) in package.json:</p>
<pre><code> "dependencies": {
"@types/angular": "^1.5.8",
"@types/angular-cookies": "^1.4.2",
"@types/angular-local-storage": "^0.1.33",
"@types/angular-material": "^1.1.37",
"@types/angular-translate": "^2.4.33",
"@types/lodash": "^4.14.36"
}
</code></pre>
<p>Visual Studio's IntelliSense worked nicely with typings before because I included typings folder in my VS project. NPM installs types into <code>node_modules/@types</code> folder. Now here is my problem. I don't really want to include anything from <code>node_modules</code> in VS project.
<code>node_modules</code> folder should be fine to get deleted and recreated again by npm at will.
Visual Studio does not recognize the typings installed without them being included in the project!
I guess I could create a file with ///reference tags in it but then I would have to maintain this file manually when installing/removing typings.</p>
<p>Is there any recommended way to make VS IntelliSense work?</p>
| 0debug
|
How to send e-mail with excel when date in column equal or smaller than today's date? : I have 3 columns : A) Enterprises B) Email adress matching the enterprise C) Date of reminder
When the date of reminder is smaller or equal than today'S date, I want to automaticaly send a message to the email adress corresponding.
Thank you for advices.
I havn't wrote any code yet cause i'm new to VBA.
| 0debug
|
void bios_linker_loader_add_pointer(BIOSLinker *linker,
const char *dest_file,
const char *src_file,
void *pointer,
uint8_t pointer_size)
{
BiosLinkerLoaderEntry entry;
const BiosLinkerFileEntry *file = bios_linker_find_file(linker, dest_file);
ptrdiff_t offset = (gchar *)pointer - file->blob->data;
assert(offset >= 0);
assert(offset + pointer_size <= file->blob->len);
memset(&entry, 0, sizeof entry);
strncpy(entry.pointer.dest_file, dest_file,
sizeof entry.pointer.dest_file - 1);
strncpy(entry.pointer.src_file, src_file,
sizeof entry.pointer.src_file - 1);
entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_POINTER);
entry.pointer.offset = cpu_to_le32(offset);
entry.pointer.size = pointer_size;
assert(pointer_size == 1 || pointer_size == 2 ||
pointer_size == 4 || pointer_size == 8);
g_array_append_vals(linker->cmd_blob, &entry, sizeof entry);
}
| 1threat
|
static int estimate_motion_b(MpegEncContext *s, int mb_x, int mb_y,
int16_t (*mv_table)[2], int ref_index, int f_code)
{
MotionEstContext * const c= &s->me;
int mx = 0, my = 0, dmin = 0;
int P[10][2];
const int shift= 1+s->quarter_sample;
const int mot_stride = s->mb_stride;
const int mot_xy = mb_y*mot_stride + mb_x;
uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV;
int mv_scale;
c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp);
c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp);
c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp);
c->current_mv_penalty= mv_penalty;
get_limits(s, 16*mb_x, 16*mb_y);
if (s->motion_est != FF_ME_ZERO) {
P_LEFT[0] = mv_table[mot_xy - 1][0];
P_LEFT[1] = mv_table[mot_xy - 1][1];
if (P_LEFT[0] > (c->xmax << shift)) P_LEFT[0] = (c->xmax << shift);
if (!s->first_slice_line) {
P_TOP[0] = mv_table[mot_xy - mot_stride ][0];
P_TOP[1] = mv_table[mot_xy - mot_stride ][1];
P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1][0];
P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1][1];
if (P_TOP[1] > (c->ymax << shift)) P_TOP[1] = (c->ymax << shift);
if (P_TOPRIGHT[0] < (c->xmin << shift)) P_TOPRIGHT[0] = (c->xmin << shift);
if (P_TOPRIGHT[1] > (c->ymax << shift)) P_TOPRIGHT[1] = (c->ymax << shift);
P_MEDIAN[0] = mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
P_MEDIAN[1] = mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);
}
c->pred_x = P_LEFT[0];
c->pred_y = P_LEFT[1];
if(mv_table == s->b_forw_mv_table){
mv_scale= (s->pb_time<<16) / (s->pp_time<<shift);
}else{
mv_scale= ((s->pb_time - s->pp_time)<<16) / (s->pp_time<<shift);
}
dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16);
}
dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16);
if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip)
dmin= get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1);
mv_table[mot_xy][0]= mx;
mv_table[mot_xy][1]= my;
return dmin;
}
| 1threat
|
How to install Cuda in a Vagrant box, for optimus enabled laptops? : <p>I have performed a pci pass through on the vagrant config, enabled 3D acceleration. Installed Cuda, and tried to run the deviceQuery Cuda example, but unfortunately it tells me it can't pick up a device.</p>
<pre><code>./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 38
-> no CUDA-capable device is detected
Result = FAIL
</code></pre>
<p>The card is a GF 740M, the driver is nvidia-352, I am using Ubuntu 14.04 in the Vagrant box. In vagrant:</p>
<p>lspci shows:</p>
<pre><code>$ lspci -nn | grep '\[030[02]\]'
00:02.0 VGA compatible controller [0300]: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter [80ee:beef]
01:00.0 3D controller [0302]: NVIDIA Corporation GK107M [GeForce GT 740M] [10de:0fdf] (rev a1)
</code></pre>
<p>bumblebeed:</p>
<pre><code>$ bumblebeed
[ 137.087712] [ERROR]No integrated video card found, quitting.
</code></pre>
<p>What could I be doing wrong? I can't believe how difficult it is to get nvidia drivers/cards working in a virtualization environment.</p>
| 0debug
|
How safe are Golang maps for concurrent Read/Write operations? : <p>According to the Go blog,</p>
<blockquote>
<p>Maps are not safe for concurrent use: it's not defined what happens when you read and write to them simultaneously. If you need to read from and write to a map from concurrently executing goroutines, the accesses must be mediated by some kind of synchronization mechanism.
(source: <a href="https://blog.golang.org/go-maps-in-action" rel="noreferrer">https://blog.golang.org/go-maps-in-action</a>)</p>
</blockquote>
<p>Can anyone elaborate on this? Concurrent read operations seem permissible across routines, but concurrent read/write operations may generate a race condition if one attempts to read from and write to the same key.</p>
<p>Can this last risk be reduced in some cases? For example: </p>
<ul>
<li>Function A generates k and sets m[k]=0. This is the only time A writes to map m. k is known to not be in m.</li>
<li>A passes k to function B running concurrently</li>
<li>A then reads m[k]. If m[k]==0, it waits, continuing only when m[k]!=0</li>
<li>B looks for k in the map. If it finds it, B sets m[k] to some positive integer. If it doesn't it waits until k is in m.</li>
</ul>
<p>This isn't code (obviously) but I think it shows the outlines of a case where even if A and B both try to access m there won't be a race condition, or if there is it won't matter because of the additional constraints.</p>
| 0debug
|
static void migrate_set_state(MigrationState *s, int old_state, int new_state)
{
if (atomic_cmpxchg(&s->state, old_state, new_state) == new_state) {
trace_migrate_set_state(new_state);
}
}
| 1threat
|
Am I Understanding this correctly(pushing to arrays) : Hey I know this is a newb question so I pre-appologize but im not quite sure why my code is not working here. It is supposed to filter out odd and even numbers and put them into an array but I think my (lack of)understanding is off on getting the numbers into the array how I want. thanks in advance.
function oddAndEven(numbers){
var odd = [];
var even = [];
for(num = 0; num < numbers.length; numbers++){
if(numbers[num] % 2 == 0){
even.push(numbers[num]);
}else if(numbers[num] % 2 == 1){
odd.push(numbers[num]);
}
}
console.log(odd + "is odd and " + even + " is even");
}
iqTest(11221122);
| 0debug
|
I want to concatinate two values into a single string : i have two different values systolic and diastolic blood pressure readings in string, i just want when those two values come from front-end i'll just store them into a single string E.g if systolic ='120' and diastolic='80' i want it to be bp='120/80'
# frozen_string_literal: true
module Api
module V1
module CheckinMachine
class BpsController < ApplicationController
include MachineError
before_action :authenticate_user!
def create
raise BatteryNotFunctionalError if battery_functional?
# user = User.find_by!(bp_machine_imei: params[:imei])
health_reading = current.health_readings.create!(key: :blood_pressure, value: bp_value)
Solera::PostActivityApi.call(user,
bp,
health_reading.solera_activities.new)
head :ok
rescue ActiveRecord::RecordNotFound => _e
render_machine_error and return
end
def show
puts params
end
private
def bp
{
systolic_blood_pressure: params[:systolic],
diastolic_blood_pressure: params[:diastolic]
}
end
end
end
end
end
That's what i have tried, what do i do to make it exactly like i want it to be
like bp = '120/80'
| 0debug
|
Declare member variables from variadic template parameter : <p>Obviously the code below doesn't compile in C++. But I have a case where I'd like to parameterize a class with zero or more data items based on template parameters.</p>
<p>Is there any way I can declare a class whose data members depend on variadic template parameters so I can access each of them? or some other way to achieve what I'd like?</p>
<p>This came up in a real program which I've solved an entirely different way but now I'm interested in the more abstract problem of how I might have done this.</p>
<pre><code>template <typename... Types> class Data
{
// Declare a variable of each type in the parameter pack
// This is NOT valid C++ and won't compile...
Types... items;
};
struct Item1
{
int a;
};
struct Item2
{
float x, y, z;
};
struct Item3
{
std::string name;
}
int main()
{
Data<Item1, Item2> data1;
Data<Item3> data2;
}
</code></pre>
| 0debug
|
How to disable VS Code minimap in Windowed mode? : <p>I did the following in Visual Studio Code:</p>
<ol>
<li>settings.json => "editor.minimap.enabled": true</li>
<li>Open 2ed files side by side (windowed mode)</li>
<li>Minimap exists in both windows</li>
</ol>
<p>This takes up too much room, but I still want to use the Minimap when I'm editing a single file in a single window. Is there a way to have the Minimap enabled for a single file, but disabled in side-by-side "Windowed" mode?</p>
| 0debug
|
Which part of this is a non-negative integer? (factorial error) : <p>This is the script:</p>
<pre><code>n=input('Enter the number of rows: ')
PT=zeros(n);
row=1;
col=1;
while row~=n+1
for col=1:1:n
PT(row, col)=(factorial(row-1)/(factorial(col-1)*factorial(row-col)));
end
row=row+1;
col=1;
end
PT
</code></pre>
<p>When I run it, it says to enter the number of rows, so I enter '4'. Then it says </p>
<pre><code>error: factorial: all N must be real non-negative integers
error: called from
factorial at line 40 column 5
hw6p2 at line 7 column 17
</code></pre>
<p>I don't understand what's wrong.</p>
| 0debug
|
Sorting of object of objects property not working in Angular 7 : I am trying to sort and object of an object based on a property field in angular 7 application. I have implemented the sort function but the sort doesn't seem applying. So I basically need to sort LegalFundClassCommercialViewModel on property name RedsFrqncyName.
Following is the code that i have tried
if(this.LegalFundClasses.AllTerms) {
this.LegalFundClasses.AllTerms.LegalFundClassCommercialViewModel = this.LegalFundClasses.AllTerms.sort(function(a, b) { return a.LegalFundClassCommercialViewModel.RedsFrqncyName - b.LegalFundClassCommercialViewModel.RedsFrqncyName; });
The values of the property are
Daily
Weekly
Semi-Monthly
Monthly
Quarterly
Semi-Annually
Yearly
Illiquid
Anniversary
2nd Anniversary
3rd Anniversary
4th Anniversary
5th Anniversary
JSON
[{"LegalFundClassCommercialViewModel":{"Description":"Class A (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10651,"FundId":3640,"FundName":"Cevian Capital II Ltd.","FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":"Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class B (Soft-Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10656,"FundId":3640,"FundName":"Cevian Capital II Ltd.","FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":10,"RedsFrqncyName":"2nd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":7,"SoftDurationMonthsName":"24","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":4,"WebfolioRedsFee":null,"LockupComments":"Class B Shares may first be redeemed on redemption day falling in the month of the two-year anniversary of the issue of Class B Shares. In the event that a shareholder requests redemption of Class B Shares on the first redemption day falling on the expiration of the initial Class B Shares, the Fund will charge a redemption fee of 4.00% of the redemption proceeds. Following the expiration of Class B lock-up, absent a redemption or exchange of such Class B Shares, such Shares will be subject to a new Class B lock up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the two year anniversary of the commencement of such Class B lock-up. Class B may be redeemed on the redemption day failing on the expiration of each New Class B lock-up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.75,"IncentiveFeeRate":20,"RealizationFrequencyId":21,"RealizationFrequencyName":"Every second anniversary ","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"","ChildRecordExist":true,"Id":10658,"FundId":3640,"FundName":"Cevian Capital II Ltd.","FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"Class C Shares may first be redeemed on the redemption day falling in the month of the one-year anniversary of the issue of such shares. In the event the shareholder requests redemption of Class C Shares falling on the expiration of the initial Class C lock-up, the Fund will charge a redemption fee of 6% of the redemption proceeds. Following the expiration of the initial Class C lock-up, absent a redemption or exchange of such Class C Shares, such shares will be subject to a new Class C lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the anniversary of the commencement of such Class C lock-up. If Class C Shares are redeemed on the redemption day falling on the expiration of the first new Class C lock-up, the Fund will charge a redemption fee of 4% of the redemption proceeds. If Class C Shares are redeemed on the first redemption day falling on the expiration of the second new Class C Shares lock-up or any subsequent new Class C lock-up such Shares may be redeemed without a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up.","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C Interests (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":11812,"FundId":7069,"FundName":"Cevian Capital II LP","FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"In the event that a Limited Partner requests withdrawal of a Class C Capital Account on the Withdrawal Date falling on the expiration of the Initial Class C Lock-Up, the Partnership will retain an amount equal to 6 per cent of the withdrawal proceeds. Following the expiry of the Initial Class C Lock-Up, absent a withdrawal or exchange of such Class C Capital Account, such Class C Capital Account will be subject to a new Class C Lock-Up which will immediately commence on a rolling basis ending on the Withdrawal Date falling in the month of the anniversary of the commencement of such Initial Class C Lock-Up (each, a \"New Class C Lock-Up\"). If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the first New Class C Lock-Up, the Partnership will retain an amount equal to 4 per cent of the withdrawal proceeds. If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the second New Class C Lock-Up or any subsequent New Class C Lock-Up, such Capital Account may be withdrawn without being subject to a withdrawal charge.","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class A Interests (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":11815,"FundId":7069,"FundName":"Cevian Capital II LP","FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":" Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":100,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null}]
| 0debug
|
Can´t get Javascript to remove css property : I'm trying to make a loading screen for my project. I need the javascript to remove the CSS property "Display: none" from (page) I can't figure out why my code doesn't work. I'm very new to javascript so don't get mad if this is a simple question.
hope you can
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
window.onload(loader)
function loader(){
document.getElementById("page").style.removeProperty("display");
}
<!-- language: lang-css -->
#page{
display: none;
}
/* Loading */
#loading{
width: 100%;
height:100vh;
background-color: #428BCA;
}
.loading_container{
margin: 0;
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
#spin {
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 120px;
height: 120px;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#loading h1{
color: #FFF;
margin-left:10px;
}
<!-- language: lang-html -->
<div id="page">
Content!
</div>
<div id="loading">
<div class="loading_container">
<div id="spin"></div>
<h1>Loading...</h1>
</div>
</div>
<!-- end snippet -->
help.
| 0debug
|
RealmList of String Type in Android : <p>I'm using Realm for Local storage in Android. I'm getting following response form server.</p>
<pre><code>[{
"ListId": 10,
"Names": ["Name1", "Name2", "Name3", "Name4"]
}]
</code></pre>
<p>Here is my Model</p>
<pre><code> public class Model extends RealmObject {
private int ListId;
private RealmList<String> Names = new RealmList<String>()
public int getListId() {
return ListId;
}
public void setListId(int listId) {
ListId = listId;
}
public RealmList<String> getNames() {
return Names;
}
public void setNames(RealmList<String> names) {
Names = names;
}
}
</code></pre>
<p>And I'm getting this for ArrayList</p>
<p>Type parameter 'java.lang.String' is not within its bound; should extend 'io.realm.RealmObject'.</p>
<p>Thanks.</p>
| 0debug
|
void helper_booke206_tlbwe(void)
{
uint32_t tlbncfg, tlbn;
ppcmas_tlb_t *tlb;
uint32_t size_tlb, size_ps;
switch (env->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
case MAS0_WQ_ALWAYS:
break;
case MAS0_WQ_COND:
if (0) {
return;
break;
case MAS0_WQ_CLR_RSRV:
return;
default:
return;
if (((env->spr[SPR_BOOKE_MAS0] & MAS0_ATSEL) == MAS0_ATSEL_LRAT) &&
!msr_gs) {
fprintf(stderr, "cpu: don't support LRAT setting yet\n");
return;
tlbn = (env->spr[SPR_BOOKE_MAS0] & MAS0_TLBSEL_MASK) >> MAS0_TLBSEL_SHIFT;
tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn];
tlb = booke206_cur_tlb(env);
if (msr_gs) {
cpu_abort(env, "missing HV implementation\n");
tlb->mas7_3 = ((uint64_t)env->spr[SPR_BOOKE_MAS7] << 32) |
env->spr[SPR_BOOKE_MAS3];
tlb->mas1 = env->spr[SPR_BOOKE_MAS1];
tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & 0xffffffff;
if (!(tlbncfg & TLBnCFG_IPROT)) {
tlb->mas1 &= ~MAS1_IPROT;
if (booke206_tlb_to_page_size(env, tlb) == TARGET_PAGE_SIZE) {
tlb_flush_page(env, tlb->mas2 & MAS2_EPN_MASK);
} else {
tlb_flush(env, 1);
| 1threat
|
static int colo_packet_compare_udp(Packet *spkt, Packet *ppkt)
{
int ret;
int network_header_length = ppkt->ip->ip_hl * 4;
trace_colo_compare_main("compare udp");
ret = colo_packet_compare_common(ppkt, spkt,
network_header_length + ETH_HLEN);
if (ret) {
trace_colo_compare_udp_miscompare("primary pkt size", ppkt->size);
trace_colo_compare_udp_miscompare("Secondary pkt size", spkt->size);
if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) {
qemu_hexdump((char *)ppkt->data, stderr, "colo-compare pri pkt",
ppkt->size);
qemu_hexdump((char *)spkt->data, stderr, "colo-compare sec pkt",
spkt->size);
}
}
return ret;
}
| 1threat
|
Is there a good VueJs native mobile platform? : <p>So I want to build a small native mobile app using Vuejs.
I understand that there are two platforms on which you can develop native mobile apps using VueJs; Weex and Nativescript.
Here are my questions:</p>
<p>1- Have you worked with any of the platforms? If yes, are they any good? (I've heard bad reviews so far)</p>
<p>2-According to my research React Native is way better than both platforms so I was curios to know if anyone here has worked with '<em>Vuejs to ReactJs converter</em>'?
React-Vue: <a href="https://github.com/SmallComfort/react-vue" rel="nofollow noreferrer">https://github.com/SmallComfort/react-vue</a></p>
<p>3- Should I abandon my VueJs background and go for Reactjs and React Native?</p>
<p>Thanks</p>
| 0debug
|
hii friends, when i am fetch a data using json in web services its show me following data i want only id and agenda_temp data :
{
"0": "1",
"1": "Travel Plan",
"id": "1",
"agenda_temp": "Travel Plan"
},
{
"0": "2",
"1": "New Purchase",
"id": "2",
"agenda_temp": "New Purchase"
},
{
"0": "3",
"1": "Get together",
"id": "3",
"agenda_temp": "Get together"
},
| 0debug
|
Converting variable name into a string then printing it? Python : <p>Im wondering if there is a way to take a variable's name and convert it into a string to print it?</p>
<p>for example:</p>
<pre><code>myVariable = 1
</code></pre>
<p>i want to convert "myVariable" like the name of the variable itself not the value of it into a string and then print that string to a console, is this possible?</p>
| 0debug
|
How can I display specific posts content in a single page in wordpress? : I want to know if it's possible to display specific posts when I click on a link from a specific page to the (ex: gallery page).<br/>
Ex: Let's say I have 3 posts with 3 different galleries.(post 1=wedding pictures/ post 2=food pictures/ post 3=dogs pictures) and I also have 3 pages.<br/>
When I am on the Page 1 and I click on the gallery page link I want to only show post 1 content(only wedding pictures).<br>
Also when I am on the Page 2 and click on the gallery page link I want to display only the post 2 content.<br>If It's possible what would be the most simple sollution?<br/>
Thank you!
| 0debug
|
iOS/Swift: Dynamically size UIStackView when one of its items gets larger : <p>I have two items in a vertical <code>UIStackView</code>: a <code>UILabel</code> and a <code>UITableView</code>. When a dynamic amount of <code>UITableViewCell</code>s get added to the <code>UITableView</code> at runtime, the <code>UIStackView</code> does not get larger. </p>
<p>Is there a general way to increase the size of the <code>UIStackView</code>?</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.