problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
FATAL EXCEPTION: AsyncTask #1 ,java.lang.RuntimeException: An error occurred while executing doInBackground() : I am getting this error after i am try to updated my compileSdkVersion andTargetSdkversion greater than 22. Seems like I am doing any GUI task in my doInBackground method but i am unable to figure it out. I would be much thankful for a solution.
This is my stack trace:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: xy.abc.xyz.xy, PID: 15246
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at android.net.wifi.IWifiManager$Stub$Proxy.getScanResults(IWifiManager.java:1066) at android.net.wifi.WifiManager.getScanResults(WifiManager.java:1311)
at xy.abc.xyz.xy.config.WlanInfoAdapter.getNewItems(WlanInfoAdapter.java:72)
at xy.abc.xyz.xy.android.data.ChangeableArrayAdapter$1.doInBackground(ChangeableArrayAdapter.java:78)
at xy.abc.xyz.xy.android.data.ChangeableArrayAdapter$1.doInBackground(ChangeableArrayAdapter.java:74)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Method in class WlanInfoAdapter.java:72 is here:
@Override
protected List<WlanInfo> getNewItems() {
WifiManager wifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE);
List<ScanResult> scanResults = wifiManager.getScanResults();
List<WlanInfo> infoList = new ArrayList<>(scanResults.size());
WifiInfo connectionInfo = wifiManager.getConnectionInfo();
try {
List<WifiConfiguration> configuredNetworks = wifiManager.getConfiguredNetworks();
Map<String, WifiConfiguration> configuredNetworkIds = new HashMap<>();
for (WifiConfiguration configuredNetwork : configuredNetworks) {
if (configuredNetwork.SSID != null) {
configuredNetworkIds.put(WlanInfo.cleanSSID(configuredNetwork.SSID), configuredNetwork);
} else {
wifiManager.removeNetwork(configuredNetwork.networkId);
}
}
for (ScanResult scanResult : scanResults) {
WlanInfo wlanInfo = new WlanInfo(scanResult);
WifiConfiguration configuration = configuredNetworkIds.get(wlanInfo.getSSID());
wlanInfo.setConfiguration(configuration);
wlanInfo.setIsActive(configuration != null && configuration.networkId == connectionInfo.getNetworkId());
if (showUnknown || wlanInfo.isConfigured() || wlanInfo.isOpen()) {
infoList.add(wlanInfo);
}
}
}
catch (Exception e) { e.printStackTrace(); return null; }
return infoList;
}
Method in changeableArrayAdapter.java class showing error is given below. its where getNewItems() method is called:
ChangeableArrayAdapter.java:78
ChangeableArrayAdapter.java:74
public void triggerRefresh() {
AsyncTask<Void, Void, List<T>> asyncTask = new AsyncTask<Void, Void, List<T>>() {
@Override
protected List<T> doInBackground(Void... objects) {
return getNewItems();
//return null;
}
| 0debug
|
Recursive HTML Divs : I'm trying to figure out how to create recursive units strictly out of divs.
The root template would be (1). The (2) diagram is the expansion of the red rectangle in (1), and it is also the recursive template.
How would it be possible to accomplish this using html/css and no bootstrap? Thanks.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/3eqSN.png
| 0debug
|
Daily fire Job Schedule a task using Android Job Scheduler? : I am new to Android Job Scheduler, I want to run a task every day morning 9AM without using Alarm manager.
| 0debug
|
static void do_drive_backup(const char *job_id, const char *device,
const char *target, bool has_format,
const char *format, enum MirrorSyncMode sync,
bool has_mode, enum NewImageMode mode,
bool has_speed, int64_t speed,
bool has_bitmap, const char *bitmap,
bool has_on_source_error,
BlockdevOnError on_source_error,
bool has_on_target_error,
BlockdevOnError on_target_error,
BlockJobTxn *txn, Error **errp)
{
BlockBackend *blk;
BlockDriverState *bs;
BlockDriverState *target_bs;
BlockDriverState *source = NULL;
BdrvDirtyBitmap *bmap = NULL;
AioContext *aio_context;
QDict *options = NULL;
Error *local_err = NULL;
int flags;
int64_t size;
if (!has_speed) {
speed = 0;
}
if (!has_on_source_error) {
on_source_error = BLOCKDEV_ON_ERROR_REPORT;
}
if (!has_on_target_error) {
on_target_error = BLOCKDEV_ON_ERROR_REPORT;
}
if (!has_mode) {
mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
}
blk = blk_by_name(device);
if (!blk) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
"Device '%s' not found", device);
return;
}
aio_context = blk_get_aio_context(blk);
aio_context_acquire(aio_context);
if (!blk_is_available(blk)) {
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
goto out;
}
bs = blk_bs(blk);
if (!has_format) {
format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
goto out;
}
flags = bs->open_flags | BDRV_O_RDWR;
if (sync == MIRROR_SYNC_MODE_TOP) {
source = backing_bs(bs);
if (!source) {
sync = MIRROR_SYNC_MODE_FULL;
}
}
if (sync == MIRROR_SYNC_MODE_NONE) {
source = bs;
}
size = bdrv_getlength(bs);
if (size < 0) {
error_setg_errno(errp, -size, "bdrv_getlength failed");
goto out;
}
if (mode != NEW_IMAGE_MODE_EXISTING) {
assert(format);
if (source) {
bdrv_img_create(target, format, source->filename,
source->drv->format_name, NULL,
size, flags, &local_err, false);
} else {
bdrv_img_create(target, format, NULL, NULL, NULL,
size, flags, &local_err, false);
}
}
if (local_err) {
error_propagate(errp, local_err);
goto out;
}
if (format) {
options = qdict_new();
qdict_put(options, "driver", qstring_from_str(format));
}
target_bs = bdrv_open(target, NULL, options, flags, errp);
if (!target_bs) {
goto out;
}
bdrv_set_aio_context(target_bs, aio_context);
if (has_bitmap) {
bmap = bdrv_find_dirty_bitmap(bs, bitmap);
if (!bmap) {
error_setg(errp, "Bitmap '%s' could not be found", bitmap);
bdrv_unref(target_bs);
goto out;
}
}
backup_start(job_id, bs, target_bs, speed, sync, bmap,
on_source_error, on_target_error,
block_job_cb, bs, txn, &local_err);
bdrv_unref(target_bs);
if (local_err != NULL) {
error_propagate(errp, local_err);
goto out;
}
out:
aio_context_release(aio_context);
}
| 1threat
|
document.write('<script src="evil.js"></script>');
| 1threat
|
drop down value is not appearing in the drop downlist : I have a php code the add delete new row to the html table. Once column has text field and second column has a drop down. Its value is coming from mysql database.
First row is coming correctly. But the value in second record dropdown list is misssing.
please help
code is:
<html>
<head>
<title></title>
<style type="text/css">
input {
display: block; /* makes one <input> per line */
}
</style>
</head>
<?php
include 'dbconnection\dbconnection.php'; // Database connection
$count=1;
if(isset($_POST['btnadd']) == "ADD NEW ITEM") {
// add 1 to the row counter
if (isset($_POST['count'])) $count = $_POST['count'] + 1;
// set value for first load
else $count = 1;
}
if(isset($_POST['btnremove']) == "DELTE ITEM") {
// decrement the row counter
$count = $_POST['count'] - 1;
// set minimum row number
if ($count < 1) $count = 1;
}
?>
<body>
<!-- call same file on submit -->
<form name="form1" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<?php
$cdquery="select cmc_id,cmc_name from cat_main_category";
$result2=mysqli_query($conn,$cdquery) or die(mysqli_error());
echo ' <table>';
// print $count rows
for ($i=1; $i<=$count; $i++) {
echo ' <tr> <td> <input type="text" name="text'.$i.'" align="center"> </td>';
echo '<td> <select id="basicgroup'.$i.'" name="basicgroup'.$i.'" onchange=reload(this.form)>';
echo '<option value=0>Select</option>';
while ($row=mysqli_fetch_array($result2)) {
$cdTitle=$row["cmc_name"];
$id=$row["cmc_id"];
//if($id==@$basicgroup){
echo "<option selected value=$id>
$cdTitle
</option>";
/*}
else{echo "<option value=$id>
$cdTitle
</option>""."<BR>";;*/}
echo '</select></td></tr> ';
}
?>
</table>
<!-- you only need one set of buttons and only one counter for this script
because every button would do the same -->
<input type="submit" name="btnadd" id="btnadd" value="ADD NEW ITEM" >
<input type="submit" name="btnremove" id="btnremove" value="DELETE ITEM">
<input type="hidden" name="count" value="<?php echo $count; ?>">
</form>
</body>
</html>
| 0debug
|
please Help Me (PHP CLASS) : Class RUNcookieDescutes Extends DF_CookiesDescutes
{
function RUNcookieDescutes($Cookietype)
{
// parent the faiamal father object
parent::$this->EachDescute = array("fsr" => array(0,1), // order by date
"prf" => array(0,1,5,10,15), // refrech page url
"ths" => array(0,1), // type of signature
"tps" => array(10,30,50,70), // size of reply pages
"por" => array(0,1), // order by reply or not
"psa" => array(0,1,2), // find the display fined
"pfr" => array("absulot")); // selected forums posts
// parent the faiamal father object
if ($Cookietype == 0)
{
parent::findElementsDescuteCookie();
}
else
{
parent::findElementsDescuteSession();
}
}
}
**Fatal error: Access to undeclared static property: DF_CookiesDescutes::$this in C:\xampp\htdocs\cp_inc\class_object.php on line 441**
| 0debug
|
Extract and Replace unknown string between pattern by variable : I have an expression that looks like this :
**when v(xsram.xgio0_right.xgio_bit2.xldp.xprech_wd.m0_1_1.d) ='v(xsram.xgio0_right.xgio_bit2.xldp.xprech_wd.m1_1_1.d)+5.0'**
I want to extract the text between v() and save it in a variable and replace this text with the variable name in the expression. So the final output will be:
**when v($VAR1) ='v($VAR2)+5.0'**
while $VAR1=xsram.xgio0_right.xgio_bit2.xldp.xprech_wd.m0_1_1.d
and $VAR2=xsram.xgio0_right.xgio_bit2.xldp.xprech_wd.m1_1_1.d
Any ideas how to get this done ? I basically need to do this because i need to undergo some text processing on the text saved in the variables and then put it back in place in the original expression. So the final expression will look like this :
**when v(xsram.xgio0_right^xgio_bit2^xldp^xprech_wd^m0_1_1:d) ='v(xsram.xgio0_right^xgio_bit2^xldp.xprech_wd^m1_1_1:d)+5.0'**
Thanks in advance!
| 0debug
|
How to upload and list directories at firefox and chrome/chromium using change and drop events : <p>Both mozilla and webkit browsers now allow directory upload. When directory or directories are selected at <code><input type="file"></code> element or dropped at an element, how to list all directories and files in the order which they appear in actual directory at both firefox and chrome/chromium, and perform tasks on files when all uploaded directories have been iterated?</p>
| 0debug
|
static av_cold void nvenc_setup_rate_control(AVCodecContext *avctx)
{
NvencContext *ctx = avctx->priv_data;
if (avctx->bit_rate > 0) {
ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate;
} else if (ctx->encode_config.rcParams.averageBitRate > 0) {
ctx->encode_config.rcParams.maxBitRate = ctx->encode_config.rcParams.averageBitRate;
}
if (avctx->rc_max_rate > 0)
ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate;
if (ctx->rc < 0) {
if (ctx->flags & NVENC_ONE_PASS)
ctx->twopass = 0;
if (ctx->flags & NVENC_TWO_PASSES)
ctx->twopass = 1;
if (ctx->twopass < 0)
ctx->twopass = (ctx->flags & NVENC_LOWLATENCY) != 0;
if (ctx->cbr) {
if (ctx->twopass) {
ctx->rc = NV_ENC_PARAMS_RC_2_PASS_QUALITY;
} else {
ctx->rc = NV_ENC_PARAMS_RC_CBR;
}
} else if (avctx->global_quality > 0) {
ctx->rc = NV_ENC_PARAMS_RC_CONSTQP;
} else if (ctx->twopass) {
ctx->rc = NV_ENC_PARAMS_RC_2_PASS_VBR;
} else if (avctx->qmin >= 0 && avctx->qmax >= 0) {
ctx->rc = NV_ENC_PARAMS_RC_VBR_MINQP;
}
}
if (ctx->flags & NVENC_LOSSLESS) {
set_lossless(avctx);
} else if (ctx->rc >= 0) {
nvenc_override_rate_control(avctx);
} else {
ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR;
set_vbr(avctx);
}
if (avctx->rc_buffer_size > 0) {
ctx->encode_config.rcParams.vbvBufferSize = avctx->rc_buffer_size;
} else if (ctx->encode_config.rcParams.averageBitRate > 0) {
ctx->encode_config.rcParams.vbvBufferSize = 2 * ctx->encode_config.rcParams.averageBitRate;
}
if (ctx->aq) {
ctx->encode_config.rcParams.enableAQ = 1;
ctx->encode_config.rcParams.aqStrength = ctx->aq_strength;
av_log(avctx, AV_LOG_VERBOSE, "AQ enabled.\n");
}
if (ctx->temporal_aq) {
ctx->encode_config.rcParams.enableTemporalAQ = 1;
av_log(avctx, AV_LOG_VERBOSE, "Temporal AQ enabled.\n");
}
if (ctx->rc_lookahead) {
int lkd_bound = FFMIN(ctx->nb_surfaces, ctx->async_depth) -
ctx->encode_config.frameIntervalP - 4;
if (lkd_bound < 0) {
av_log(avctx, AV_LOG_WARNING,
"Lookahead not enabled. Increase buffer delay (-delay).\n");
} else {
ctx->encode_config.rcParams.enableLookahead = 1;
ctx->encode_config.rcParams.lookaheadDepth = av_clip(ctx->rc_lookahead, 0, lkd_bound);
ctx->encode_config.rcParams.disableIadapt = ctx->no_scenecut;
ctx->encode_config.rcParams.disableBadapt = !ctx->b_adapt;
av_log(avctx, AV_LOG_VERBOSE,
"Lookahead enabled: depth %d, scenecut %s, B-adapt %s.\n",
ctx->encode_config.rcParams.lookaheadDepth,
ctx->encode_config.rcParams.disableIadapt ? "disabled" : "enabled",
ctx->encode_config.rcParams.disableBadapt ? "disabled" : "enabled");
}
}
if (ctx->strict_gop) {
ctx->encode_config.rcParams.strictGOPTarget = 1;
av_log(avctx, AV_LOG_VERBOSE, "Strict GOP target enabled.\n");
}
if (ctx->nonref_p)
ctx->encode_config.rcParams.enableNonRefP = 1;
if (ctx->zerolatency)
ctx->encode_config.rcParams.zeroReorderDelay = 1;
if (ctx->quality)
ctx->encode_config.rcParams.targetQuality = ctx->quality;
}
| 1threat
|
void qtest_quit(QTestState *s)
{
int status;
pid_t pid = qtest_qemu_pid(s);
if (pid != -1) {
kill(pid, SIGTERM);
waitpid(pid, &status, 0);
}
unlink(s->pid_file);
unlink(s->socket_path);
unlink(s->qmp_socket_path);
g_free(s->pid_file);
g_free(s->socket_path);
g_free(s->qmp_socket_path);
}
| 1threat
|
python if-condition based on int intput : <p>I want to print out a message if user input is != 0 or 1. </p>
<pre><code>entering = int(input('enter 0 or 1: '))
</code></pre>
<p>I can get it to work for either 0 or 1, but when I try to combine both in one if-condition, it doesn't work. Following 2 options I tried:</p>
<pre><code>if entering != 0 or entering != 1:
print('invalid input')
if entering != 0 or 1:
print('invalid input')
</code></pre>
<p>If I then enter 0 or 1, it still prints 'invalid input'. What am I missing?</p>
| 0debug
|
static int coroutine_fn blkreplay_co_pdiscard(BlockDriverState *bs,
int64_t offset, int count)
{
uint64_t reqid = request_id++;
int ret = bdrv_co_pdiscard(bs->file->bs, offset, count);
block_request_create(reqid, bs, qemu_coroutine_self());
qemu_coroutine_yield();
return ret;
}
| 1threat
|
static int ehci_register_companion(USBBus *bus, USBPort *ports[],
uint32_t portcount, uint32_t firstport)
{
EHCIState *s = container_of(bus, EHCIState, bus);
uint32_t i;
if (firstport + portcount > NB_PORTS) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "firstport",
"firstport on masterbus");
error_printf_unless_qmp(
"firstport value of %u makes companion take ports %u - %u, which "
"is outside of the valid range of 0 - %u\n", firstport, firstport,
firstport + portcount - 1, NB_PORTS - 1);
return -1;
}
for (i = 0; i < portcount; i++) {
if (s->companion_ports[firstport + i]) {
qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus",
"an USB masterbus");
error_printf_unless_qmp(
"port %u on masterbus %s already has a companion assigned\n",
firstport + i, bus->qbus.name);
return -1;
}
}
for (i = 0; i < portcount; i++) {
s->companion_ports[firstport + i] = ports[i];
s->ports[firstport + i].speedmask |=
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL;
s->portsc[firstport + i] = PORTSC_POWNER;
}
s->companion_count++;
s->mmio[0x05] = (s->companion_count << 4) | portcount;
return 0;
}
| 1threat
|
static void migrate_params_apply(MigrateSetParameters *params)
{
MigrationState *s = migrate_get_current();
if (params->has_compress_level) {
s->parameters.compress_level = params->compress_level;
}
if (params->has_compress_threads) {
s->parameters.compress_threads = params->compress_threads;
}
if (params->has_decompress_threads) {
s->parameters.decompress_threads = params->decompress_threads;
}
if (params->has_cpu_throttle_initial) {
s->parameters.cpu_throttle_initial = params->cpu_throttle_initial;
}
if (params->has_cpu_throttle_increment) {
s->parameters.cpu_throttle_increment = params->cpu_throttle_increment;
}
if (params->has_tls_creds) {
g_free(s->parameters.tls_creds);
s->parameters.tls_creds = g_strdup(params->tls_creds);
}
if (params->has_tls_hostname) {
g_free(s->parameters.tls_hostname);
s->parameters.tls_hostname = g_strdup(params->tls_hostname);
}
if (params->has_max_bandwidth) {
s->parameters.max_bandwidth = params->max_bandwidth;
if (s->to_dst_file) {
qemu_file_set_rate_limit(s->to_dst_file,
s->parameters.max_bandwidth / XFER_LIMIT_RATIO);
}
}
if (params->has_downtime_limit) {
s->parameters.downtime_limit = params->downtime_limit;
}
if (params->has_x_checkpoint_delay) {
s->parameters.x_checkpoint_delay = params->x_checkpoint_delay;
if (migration_in_colo_state()) {
colo_checkpoint_notify(s);
}
}
if (params->has_block_incremental) {
s->parameters.block_incremental = params->block_incremental;
}
}
| 1threat
|
Pandas - dataframe groupby - how to get sum of multiple columns : <p>This should be an easy one, but somehow I couldn't find a solution that works.</p>
<p>I have a pandas dataframe which looks like this:</p>
<pre><code>index col1 col2 col3 col4 col5
0 a c 1 2 f
1 a c 1 2 f
2 a d 1 2 f
3 b d 1 2 g
4 b e 1 2 g
5 b e 1 2 g
</code></pre>
<p><strong>I want to group by col1 and col2 and get the <code>sum()</code> of col3 and col4.</strong> <code>Col5</code> can be dropped, since the data can not be aggregated.</p>
<p>Here is how the output should look like. I am interested in having both <code>col3</code> and <code>col4</code> in the resulting dataframe. It doesn't really matter if <code>col1</code> and <code>col2</code> are part of the index or not.</p>
<pre><code>index col1 col2 col3 col4
0 a c 2 4
1 a d 1 2
2 b d 1 2
3 b e 2 4
</code></pre>
<p>Here is what I tried:</p>
<pre><code>df_new = df.groupby(['col1', 'col2'])["col3", "col4"].sum()
</code></pre>
<p>That however only returns the aggregated results of <code>col4</code>.</p>
<p>I am lost here. Every example I found only aggregates one column, where the issue obviously doesn't occur.</p>
| 0debug
|
static void monitor_handle_command1(void *opaque, const char *cmdline)
{
monitor_handle_command(cmdline);
if (!monitor_suspended)
monitor_start_input();
else
monitor_suspended = 2;
}
| 1threat
|
How to remove characters from a list. : <p>I have a list output:</p>
<blockquote>
<p>['Go497f9te(40RAAC34)\n','G0THDU433(40RAAC33)\n']</p>
</blockquote>
<p>and I want to clean it up in order to output:</p>
<blockquote>
<p>[40RAAC34,40RAAC33]</p>
</blockquote>
| 0debug
|
How return a value from an async/await function : <p>I am trying to write a reusable function that doesn't return until it has resolved promise from a mongodb query.
I can nearly achieve this using a IIFE function but seem unable to access the resolved value before I return from the function. In the snippet below i can print variable d to the console but i cant make it accessible outside the iffe and thus cannot return the result. </p>
<p>In the example below the first console.log returns the correct result but the second returns a pending promise.
Any suggestions as to how to make this work or alternative methods will be much appreciated.</p>
<pre><code>function getDNInfo (party){
var result;
result= (async () => { result = await mongo.findOne({DN:party.user_Number}, "BWUsers")
.then(
(d)=>{
console.log(d)
result=d;
}"
)}
)();
console.log(result)
return result;
}
</code></pre>
| 0debug
|
static void omap_id_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
if (size != 4) {
return omap_badwidth_write32(opaque, addr, value);
}
OMAP_BAD_REG(addr);
}
| 1threat
|
How can omit a column that comparing two columns attributes of two different csv files? : Hej stack overflow coders
I am looking for a solution for this case: expecting a solution from coders of python, Mysql and MongoDB.
Case :To extend a column (col_F) in file2 values comparing file 1 and file, by line to line and column to column !!
- We have one relationship between two files(file1 and file2), which is col_A
Final results_ extended **file2** with **col_F**
col_A col_B col_C col_D **col_F**
A1 B C D **F1**
A2 B C D **F2**
A5 B C D **F5**
AZ B C D **FZ**
AX B C D **FX**
A# B C D **F#**
A2 B C D **F2**
**File1**
col_A **col_F**
A1 **F1**
A2 **F2**
A5 **F5**
AZ **FZ**
AX **FX**
A# **F#**
A2 **F2**
**File2** before extension
col_A col_B col_C col_D
A1 B C D
A2 B C D
A5 B C D
AZ B C D
AX B C D
A# B C D
A2 B C D
| 0debug
|
Apple Mach -O Linker (Id) Error? : <p>I am trying to build this xcode workspace which was built from Unity. And after modifying the project a little bit when I getting to the very end of building the project (linking) I get the Apple Mach -O Linker (Id) Error. I can't open the error tab to see what exactly is causing the error. All it says is "Linker command failed with exit code 1 (use -v to see invocation). There are also two Apple Mach -O Linker (Id) Errors which occur but I have no idea how to solve them.</p>
<p>Any help is greatly appreciated!</p>
<p><a href="https://i.stack.imgur.com/dE8b7.png" rel="noreferrer">I can't expand these tabs.. this is all I get told</a>
<a href="https://i.stack.imgur.com/ROHtp.png" rel="noreferrer">This is the warning tab expanded, the two Apple Mach -O Linker (Id) warnings are the same</a></p>
| 0debug
|
How to set Keyboard type of TextField in SwiftUI? : <p>I can't seem to find any information or figure out how to set the keyboard type on a TextField for SwiftUI.
It would also be nice to be able to enable the secure text property, to hide passwords etc.</p>
<p>This post shows how to "wrap" a UITextField, but I'd rather not use any UI-controls if I don't have to.
<a href="https://stackoverflow.com/questions/56507839/how-to-make-textfield-become-first-responder">How to make TextField become first responder?</a></p>
<p>Anyone have any ideas how this can be done without wrapping an old school UI control?</p>
| 0debug
|
AID ME How do I add up Score in Tk() Files? It is hard : This is my code, I need help with adding the score up in this multiple choice quiz I am making. Can anyone please help me?
from tkinter import *
import time, os, random
global questions
questions = []
questions = ['''
What does ? equal to:
43+(5x(6)**8)/8-8+8 = ?
1) 10356
2) 1049803
3) 202367
4) 12742130
5) 343321
''',
'''
Find the range, the median, the mode and the mean:
>>> 232, 4343, 434, 232.4, 43, 5453, 434, 232, 645, 23.3, 53453.3, 434 <<<
1) 53410.3, 2943.5, 434, 5496.58
2) 53410.3, 5956, 434, 5453.28
3) 232, 43, 3452, 421, 642
4) 232, 43, 43, 434
5) 232, 5453, 645, 53453.3
''',
'''
In 2004, the minimum wage in Ontario was $7.15.
In 2008, it was $8.15. What is the rate of change?
1) $0.90
2) $3.98
3) $1.54
4) $0.40
5) $1.80
''',
'''
Find the value of n:
--------------------------------------
43n/2n x (99.99/9)x7 = 99.99n
--------------------------------------
1) n = 99.92
2) n = 12.43
3) n = 16.73
4) n = 104.4
5) n = 3.98
''',
'''
Which one is NOT a linear equation?
1) y = 54x*3
2) y = 23x*7
3) y = -x
4) All of the Above
5) None of the Above
''',
'''
What is the formula for finding the surface area for a sphere?
1) 4/3πr**3
2) πr**2
3) 2πrh + 2πr**2
4) πd
5) 4πr**2
''',
'''
Which variable represents the slope?
y = mx + c
1) y
2) m
3) x
4) c
5) None of the above
''',
'''
An isosceles triangle has the top angle of 6x
and a supplementary angle of a base angle is 21x. What are the
measures of the angles of isosceles triangle?
1) 22.5, 78.75, 78.75
2) 108.97, 35.52, 35.52
3) 76.8, 51.6, 51.6
4) 20, 20, 140
5) 43.6, 5.5, 98.53
''',
'''
A sphere fits inside a rectangular box of 6cm by 6cm by 7cm.
What is the greatest possible volume of the sphere?
1) 113.04 cm*2
2) 110.46 cm*3
3) 113.04 cm*3
4) 110.46 cm*2
5) 142.9 cm*3
''',
'''
If the area of an isosceles triangle is 196 cm**2
and the height is 19.6 cm, what would it's perimeter be?
1) 53.9 cm
2) 64 cm
3) 76 cm
4) 32.43 cm
5) 32.32 cm
'''
]
global answers
global picked
global userans
global ansRandOrder
global score
answers = ['2', '1', '4', '3', '5', '5', '2', '1', '3', '2']
picked = []
userans = []
ansRandOrder = []
score = 0
def nexT():
global userans
userans.append(e1.get())
print(userans)
print(ansRandOrder)
global score
global i
i = 0
if userans[i] == ansRandOrder[i]:
score += 1
i += 1
print(score)
self.destroy()
ques()
def ques():
global self
global e1
global ansRandOrder
global picked
self = Tk()
w = 500
h = 375
ws = self.winfo_screenwidth()
hs = self.winfo_screenheight()
x = (ws/2) - (w/2)
y = (hs/2) - (h/2)
self.geometry('%dx%d+%d+%d' % (w, h, x, y))
x = random.randint(0, 9)
while x in picked:
x = random.randint(0, 9)
picked.append(x)
ansRandOrder.append(answers[x])
Label(self, text = '\n').pack()
Label(self, text = questions[x]).pack()
e1 = Entry(self)
e1.pack()
Label(self, text = '\n').pack()
nex = Button(self, text = 'Next Question', command = nexT).pack()
self.mainloop()
ques()
The problem that I get is that this always comes up as score = 0, even when I get it right! PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!PLEASE, PLEASE, Please help me!
Thanks!
| 0debug
|
int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run)
{
int ret;
switch (run->exit_reason) {
case KVM_EXIT_DCR:
if (run->dcr.is_write) {
dprintf("handle dcr write\n");
ret = kvmppc_handle_dcr_write(env, run->dcr.dcrn, run->dcr.data);
} else {
dprintf("handle dcr read\n");
ret = kvmppc_handle_dcr_read(env, run->dcr.dcrn, &run->dcr.data);
}
break;
case KVM_EXIT_HLT:
dprintf("handle halt\n");
ret = kvmppc_handle_halt(env);
break;
#ifdef CONFIG_PSERIES
case KVM_EXIT_PAPR_HCALL:
dprintf("handle PAPR hypercall\n");
run->papr_hcall.ret = spapr_hypercall(env, run->papr_hcall.nr,
run->papr_hcall.args);
ret = 1;
break;
#endif
default:
fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
ret = -1;
break;
}
return ret;
}
| 1threat
|
Mail send error in bluehost with phpmailer : <p>I am using php-mailer in bluehost server.
The mail->send does not give error but mail is not received at recipient's end.
I have no clue how can I debug.</p>
| 0debug
|
static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
uint32_t length)
{
if (length != 13)
return AVERROR_INVALIDDATA;
if (s->state & PNG_IDAT) {
av_log(avctx, AV_LOG_ERROR, "IHDR after IDAT\n");
return AVERROR_INVALIDDATA;
if (s->state & PNG_IHDR) {
av_log(avctx, AV_LOG_ERROR, "Multiple IHDR\n");
return AVERROR_INVALIDDATA;
s->width = s->cur_w = bytestream2_get_be32(&s->gb);
s->height = s->cur_h = bytestream2_get_be32(&s->gb);
if (av_image_check_size(s->width, s->height, 0, avctx)) {
s->cur_w = s->cur_h = s->width = s->height = 0;
av_log(avctx, AV_LOG_ERROR, "Invalid image size\n");
return AVERROR_INVALIDDATA;
s->bit_depth = bytestream2_get_byte(&s->gb);
s->color_type = bytestream2_get_byte(&s->gb);
s->compression_type = bytestream2_get_byte(&s->gb);
s->filter_type = bytestream2_get_byte(&s->gb);
s->interlace_type = bytestream2_get_byte(&s->gb);
bytestream2_skip(&s->gb, 4);
s->state |= PNG_IHDR;
if (avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_DEBUG, "width=%d height=%d depth=%d color_type=%d "
"compression_type=%d filter_type=%d interlace_type=%d\n",
s->width, s->height, s->bit_depth, s->color_type,
s->compression_type, s->filter_type, s->interlace_type);
return 0;
error:
s->cur_w = s->cur_h = s->width = s->height = 0;
s->bit_depth = 8;
return AVERROR_INVALIDDATA;
| 1threat
|
def product_Equal(n):
if n < 10:
return False
prodOdd = 1; prodEven = 1
while n > 0:
digit = n % 10
prodOdd *= digit
n = n//10
if n == 0:
break;
digit = n % 10
prodEven *= digit
n = n//10
if prodOdd == prodEven:
return True
return False
| 0debug
|
int qemu_input_key_value_to_number(const KeyValue *value)
{
if (value->kind == KEY_VALUE_KIND_QCODE) {
return qcode_to_number[value->qcode];
} else {
assert(value->kind == KEY_VALUE_KIND_NUMBER);
return value->number;
}
}
| 1threat
|
Best way to displaying image in Android app from server? : Which better to send the image url to the app to display it, or to send the content of the image file to the app (if that supported)?
Thanks,
| 0debug
|
How to show value in table from query in postgresql by date : <blockquote>
<p>I have 2 tables. order_product_table and selling_product_table i need
join both table and using date get value if you see final table you
will understand what i want. Any one know how to do this ??</p>
</blockquote>
<p>order_product_table</p>
<pre><code>id | date | Product_id | value
-------------------------------------------
1 | 2017-07-01 | 1 | 10
3 | 2017-10-02 | 2 | 30
4 | 2018-01-20 | 1 | 20
5 | 2018-02-20 | 2 | 40
</code></pre>
<p>selling_product_table</p>
<pre><code>id | date | Product_id | seling_price
------------------------------------------------
1 | 2017-08-01 | 1 | 500
2 | 2017-10-06 | 2 | 100
3 | 2017-12-12 | 1 | 500
4 | 2018-06-25 | 2 | 100
5 | 2018-07-20 | 1 | 500
</code></pre>
<p>Final result</p>
<pre><code>id | date | Product_id | value | selling_price
---------------------------------------------------------
1 | 2017-08-01 | 1 | 10 | 500
2 | 2017-10-06 | 2 | 30 | 100
3 | 2017-12-12 | 1 | 10 | 500
4 | 2018-06-25 | 2 | 40 | 100
5 | 2018-07-20 | 1 | 20 | 500
</code></pre>
| 0debug
|
static void set_acpi_power_state(IPMIBmcSim *ibs,
uint8_t *cmd, unsigned int cmd_len,
uint8_t *rsp, unsigned int *rsp_len,
unsigned int max_rsp_len)
{
IPMI_CHECK_CMD_LEN(4);
ibs->acpi_power_state[0] = cmd[2];
ibs->acpi_power_state[1] = cmd[3];
}
| 1threat
|
Disable logging for one container in Docker-Compose : <p>I have a web application launched using Docker compose that I want to disable all logging for (or at the very least print it out to syslog instead of a file).</p>
<p>When my web application works it can quickly generate an 11GB log file on startup so this eats up my disk space very fast.</p>
<p>I'm aware that normal docker has <a href="https://www.sumologic.com/2015/04/16/new-docker-logging-drivers/" rel="noreferrer">logging options</a> for its run command but in Docker Compose I use </p>
<blockquote>
<p>Docker-compose up</p>
</blockquote>
<p>in the application folder to start my application. How would I enable this functionality in my case? I'm not seeing a specific case anywhere online.</p>
| 0debug
|
how to add datepicker into html code which is written into javascript : $(container).append(
'<lable class="control-label col-md-3">Joine Duration</lable>' +
'<div class="col-md-4">'+
'<input type=text name="joine_duration[]" class="input form-control datepicker" size="11" title="D-MMM-YYYY" id="joine_duration1" placeholder="" /></div></div>' +
'<div class="form-group"> ');
| 0debug
|
static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
{
DisasContext *dc = container_of(dcbase, DisasContext, base);
CPUARMState *env = cpu->env_ptr;
if (dc->ss_active && !dc->pstate_ss) {
assert(dc->base.num_insns == 1);
gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0),
default_exception_el(dc));
dc->base.is_jmp = DISAS_NORETURN;
} else {
disas_a64_insn(env, dc);
}
if (dc->base.is_jmp == DISAS_NEXT) {
if (dc->ss_active || dc->pc >= dc->next_page_start) {
dc->base.is_jmp = DISAS_TOO_MANY;
}
}
dc->base.pc_next = dc->pc;
translator_loop_temp_check(&dc->base);
}
| 1threat
|
static av_cold int libgsm_close(AVCodecContext *avctx) {
av_freep(&avctx->coded_frame);
gsm_destroy(avctx->priv_data);
avctx->priv_data = NULL;
return 0;
}
| 1threat
|
static void read_event_data(SCLPEventFacility *ef, SCCB *sccb)
{
unsigned int sclp_active_selection_mask;
unsigned int sclp_cp_receive_mask;
ReadEventData *red = (ReadEventData *) sccb;
if (be16_to_cpu(sccb->h.length) != SCCB_SIZE) {
sccb->h.response_code = cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);
goto out;
}
sclp_cp_receive_mask = ef->receive_mask;
switch (sccb->h.function_code) {
case SCLP_UNCONDITIONAL_READ:
sclp_active_selection_mask = sclp_cp_receive_mask;
break;
case SCLP_SELECTIVE_READ:
if (!(sclp_cp_receive_mask & be32_to_cpu(red->mask))) {
sccb->h.response_code =
cpu_to_be16(SCLP_RC_INVALID_SELECTION_MASK);
goto out;
}
sclp_active_selection_mask = be32_to_cpu(red->mask);
break;
default:
sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_FUNCTION);
goto out;
}
sccb->h.response_code = cpu_to_be16(
handle_sccb_read_events(ef, sccb, sclp_active_selection_mask));
out:
return;
}
| 1threat
|
Codeigniter, can't recognize $data through controller : <p>I am getting this error:</p>
<pre><code> An uncaught Exception was encountered
Type: ParseError
Message: syntax error, unexpected '$data' (T_VARIABLE), expecting function (T_FUNCTION)
</code></pre>
<p>It says it's at line 32, here is my controller</p>
<pre><code><?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Page extends CI_Controller {
public function index($slug = NULL){
if($slug){
$this->db->where('p_slug', $slug);
}else {
$this->db->where('p_frontpage', 1);
}
$sqlQuery = $this->db->get('pages');
$data = $sqlQuery->row_array();
$data['page_title'] = "Aske's side";
$data['nav'] = $this->db->get('pages')->result_array();
$this->parser->parse('template/header', $data);
$this->parser->parse('template/banner', $data);
$this->parser->parse('template/footer', $data);
$this->parser->parse('view_page', $data);
}
public function create(){
//Test af formular
if ($this->input->post()) {
echo "test";
}
}
//Globale elementer
$data['page_title'] = "Aske's side";
$data['nav'] = $this->db->get('pages')->result_array();
//Templates til admin
$this->parser->parse('template/header', $data);
$this->parser->parse('template/banner', $data);
$this->parser->parse('template/footer', $data);
$this->parser->parse('create_view', $data);
}
}
</code></pre>
<p>So the controller is loading 2 views, view_page.php & create_view.php, but I can't go any further with this error.
I hope someone can help me here.</p>
<p>Thank's in advance.</p>
<p>KR
Aske</p>
| 0debug
|
int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg)
{
ThreadPoolCo tpc = { .co = qemu_coroutine_self(), .ret = -EINPROGRESS };
assert(qemu_in_coroutine());
thread_pool_submit_aio(func, arg, thread_pool_co_cb, &tpc);
qemu_coroutine_yield();
return tpc.ret;
}
| 1threat
|
Get .tsv file from an archive in java without unzipping the archive : <p>I have an archive <code>_2016_08_17.zip</code> that contains 8 .tsv files. I need to extract the file named <code>hit_data.tsv</code> and upload it to bigquery. The files are in a bucket on the google cloud platform.</p>
<p>Can someone give me a simple program that opens the archive, finds the correct file and then prints its rows to screen. I can take it from there. My idea is to replace the path <code>gs://path_name/*hit_data.tsv</code> with the buffer that contains the <code>hit_data.tsv</code> data.</p>
<pre><code> public static void main(String[] args) {
Pipeline p = DataflowUtils.createFromArgs(args);
p
.apply(TextIO.Read.from("gs://path_name/*hit_data.tsv"))
\\.apply(Sample.<String>any(10))
.apply(ParDo.named("ExtractRows").of(new ExtractRows('\t', "InformationDateID")))
.apply(BigQueryIO.Write
.named("BQWrite")
.to(BigQuery.getTableReference("ddm_now_apps", true))
.withSchema(getSchema())
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
.withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED));
p.run();
}
</code></pre>
| 0debug
|
Dynamic Text for a Html Website to customize for client? Php/html? : <p>I am in following situation:</p>
<p>I am Programming a Website for a small local mobile repair shop. So far so good. Problem is, the Client wants to change the text every week because of new Offers. He does not know any coding, but he can use the computer as far as Word or a text document.</p>
<p>My Question: Is it possible to use external Sources of text for this? For example a offer.txt which I include in the page via php?</p>
<p>The question is, If the Text format will be the same for example fonts or stiley applied to it, or will I encounter any problems doing so?</p>
| 0debug
|
static int flac_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
FLACContext *s = avctx->priv_data;
int metadata_last, metadata_type, metadata_size;
int tmp = 0, i, j = 0, input_buf_size;
int16_t *samples = data, *left, *right;
*data_size = 0;
s->avctx = avctx;
if(s->max_framesize == 0){
s->max_framesize= 8192;
s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
}
if(1 && s->max_framesize){
buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size);
input_buf_size= buf_size;
if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){
memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size);
s->bitstream_index=0;
}
memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size);
buf= &s->bitstream[s->bitstream_index];
buf_size += s->bitstream_size;
s->bitstream_size= buf_size;
if(buf_size < s->max_framesize){
return input_buf_size;
}
}
init_get_bits(&s->gb, buf, buf_size*8);
if (show_bits_long(&s->gb, 32) == bswap_32(ff_get_fourcc("fLaC")))
{
skip_bits(&s->gb, 32);
av_log(s->avctx, AV_LOG_DEBUG, "STREAM HEADER\n");
do {
metadata_last = get_bits(&s->gb, 1);
metadata_type = get_bits(&s->gb, 7);
metadata_size = get_bits_long(&s->gb, 24);
av_log(s->avctx, AV_LOG_DEBUG, " metadata block: flag = %d, type = %d, size = %d\n",
metadata_last, metadata_type,
metadata_size);
if(metadata_size){
switch(metadata_type)
{
case METADATA_TYPE_STREAMINFO:
if(metadata_size == 0)
av_log(s->avctx, AV_LOG_DEBUG, "size= 0 WTF!?\n");
metadata_streaminfo(s);
dump_headers(s);
break;
default:
for(i=0; i<metadata_size; i++)
skip_bits(&s->gb, 8);
}
}
} while(!metadata_last);
}
else
{
tmp = show_bits(&s->gb, 16);
if(tmp != 0xFFF8){
av_log(s->avctx, AV_LOG_ERROR, "FRAME HEADER not here\n");
while(get_bits_count(&s->gb)/8+2 < buf_size && show_bits(&s->gb, 16) != 0xFFF8)
skip_bits(&s->gb, 8);
goto end;
}
skip_bits(&s->gb, 16);
if (decode_frame(s) < 0)
return -1;
}
#if 0
if (s->order == MID_SIDE)
{
short *left = samples;
short *right = samples + s->blocksize;
for (i = 0; i < s->blocksize; i += 2)
{
uint32_t x = s->decoded[0][i];
uint32_t y = s->decoded[0][i+1];
right[i] = x - (y / 2);
left[i] = right[i] + y;
}
*data_size = 2 * s->blocksize;
}
else
{
for (i = 0; i < s->channels; i++)
{
switch(s->order)
{
case INDEPENDENT:
for (j = 0; j < s->blocksize; j++)
samples[(s->blocksize*i)+j] = s->decoded[i][j];
break;
case LEFT_SIDE:
case RIGHT_SIDE:
if (i == 0)
for (j = 0; j < s->blocksize; j++)
samples[(s->blocksize*i)+j] = s->decoded[0][j];
else
for (j = 0; j < s->blocksize; j++)
samples[(s->blocksize*i)+j] = s->decoded[0][j] - s->decoded[i][j];
break;
}
*data_size += s->blocksize;
}
}
#else
switch(s->order)
{
case INDEPENDENT:
for (j = 0; j < s->blocksize; j++)
{
for (i = 0; i < s->channels; i++)
*(samples++) = s->decoded[i][j];
}
break;
case LEFT_SIDE:
assert(s->channels == 2);
for (i = 0; i < s->blocksize; i++)
{
*(samples++) = s->decoded[0][i];
*(samples++) = s->decoded[0][i] - s->decoded[1][i];
}
break;
case RIGHT_SIDE:
assert(s->channels == 2);
for (i = 0; i < s->blocksize; i++)
{
*(samples++) = s->decoded[0][i] + s->decoded[1][i];
*(samples++) = s->decoded[1][i];
}
break;
case MID_SIDE:
assert(s->channels == 2);
for (i = 0; i < s->blocksize; i++)
{
int mid, side;
mid = s->decoded[0][i];
side = s->decoded[1][i];
mid <<= 1;
if (side & 1)
mid++;
*(samples++) = (mid + side) >> 1;
*(samples++) = (mid - side) >> 1;
}
break;
}
#endif
*data_size = (int8_t *)samples - (int8_t *)data;
av_log(s->avctx, AV_LOG_DEBUG, "data size: %d\n", *data_size);
end:
i= (get_bits_count(&s->gb)+7)/8;;
if(i > buf_size){
av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size);
return -1;
}
if(s->bitstream_size){
s->bitstream_index += i;
s->bitstream_size -= i;
return input_buf_size;
}else
return i;
}
| 1threat
|
Android Import statements are showing erros in flutter project, but working fine in individual android project : **Am getting the errors (related to android import statement)like below in flutter project. but if i open the same android project separately in android studio it was not showing any errors(import statements not showing any errors). Any fixes??**
[*Flutter Activity import statement is not importing properly means showing with red colored import statement saying that unused import statement*][1]
[enter image description here][2]
[1]: https://i.stack.imgur.com/dFy9A.png
[2]: https://i.stack.imgur.com/LpIF6.png
| 0debug
|
static int gif_read_extension(GifState *s)
{
ByteIOContext *f = s->f;
int ext_code, ext_len, i, gce_flags, gce_transparent_index;
ext_code = get_byte(f);
ext_len = get_byte(f);
#ifdef DEBUG
printf("gif: ext_code=0x%x len=%d\n", ext_code, ext_len);
#endif
switch(ext_code) {
case 0xf9:
if (ext_len != 4)
goto discard_ext;
s->transparent_color_index = -1;
gce_flags = get_byte(f);
s->gce_delay = get_le16(f);
gce_transparent_index = get_byte(f);
if (gce_flags & 0x01)
s->transparent_color_index = gce_transparent_index;
else
s->transparent_color_index = -1;
s->gce_disposal = (gce_flags >> 2) & 0x7;
#ifdef DEBUG
printf("gif: gce_flags=%x delay=%d tcolor=%d disposal=%d\n",
gce_flags, s->gce_delay,
s->transparent_color_index, s->gce_disposal);
#endif
ext_len = get_byte(f);
break;
}
discard_ext:
while (ext_len != 0) {
for (i = 0; i < ext_len; i++)
get_byte(f);
ext_len = get_byte(f);
#ifdef DEBUG
printf("gif: ext_len1=%d\n", ext_len);
#endif
}
return 0;
}
| 1threat
|
document.write('<script src="evil.js"></script>');
| 1threat
|
Merge Sort recurssion : I'm not sure how therecursion works in this method
private void doMergeSort(int lowerIndex, int higherIndex) {
if (lowerIndex < higherIndex) {
int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
// Below step sorts the left side of the array
doMergeSort(lowerIndex, middle);
// Below step sorts the right side of the array
doMergeSort(middle + 1, higherIndex);
// Now merge both sides
mergeParts(lowerIndex, middle, higherIndex);
}
}
lets say we have an array of index 8. The first middle value is set to 4, then the method recurs and the higher index is set to 4?
so it looks like this?
private void doMergeSort(int 0, int 4) {
if (0 < 4) // condition is met {
int middle = 0 + (4 - 0) / 2;
// middle value is set to 2
doMergeSort(lowerIndex, middle);
// Below step sorts the right side of the array
doMergeSort(middle + 1, higherIndex);
// Now merge both sides
mergeParts(lowerIndex, middle, higherIndex);
}
}
| 0debug
|
static void FUNCC(pred8x8l_horizontal)(uint8_t *p_src, int has_topleft, int has_topright, int p_stride)
{
pixel *src = (pixel*)p_src;
int stride = p_stride>>(sizeof(pixel)-1);
PREDICT_8x8_LOAD_LEFT;
#define ROW(y) ((pixel4*)(src+y*stride))[0] =\
((pixel4*)(src+y*stride))[1] = PIXEL_SPLAT_X4(l##y)
ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7);
#undef ROW
}
| 1threat
|
Cypress. Why is my route alias not matching? : <p>My POST request to ocr/receipt is never matched. I've...</p>
<ul>
<li>created a route, matching **/ocr/**, specifying POST, and given it an alias.</li>
<li>called <code>wait()</code> with a long timeout.</li>
</ul>
<p>I can watch the request complete in the network pane while the wait spinner turns happily in the test pane. Why is Cypress not matching this route?</p>
<pre><code>beforeEach(function () {
cy.route('POST','**/ocr/**').as('ocr');
});
it('Création frais depuis le bouton « appareil photo »', function () {
cy.get('.in-progress').first().click()
cy.wait('@ocr', {'timeout':15000});
cy.get('#grpChoices > :nth-child(1)').click();
});
</code></pre>
<p><a href="https://i.stack.imgur.com/4xJ7K.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4xJ7K.png" alt="enter image description here"></a></p>
| 0debug
|
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
{
RMDemuxContext *rm = s->priv_data;
AVStream *st;
int i, len, res, seq = 1;
int64_t timestamp, pos;
int flags;
for (;;) {
if (rm->audio_pkt_cnt) {
st = s->streams[rm->audio_stream_num];
res = ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
if(res < 0)
return res;
flags = 0;
} else {
if (rm->old_format) {
RMStream *ast;
st = s->streams[0];
ast = st->priv_data;
timestamp = AV_NOPTS_VALUE;
len = !ast->audio_framesize ? RAW_PACKET_SIZE :
ast->coded_framesize * ast->sub_packet_h / 2;
flags = (seq++ == 1) ? 2 : 0;
pos = avio_tell(s->pb);
} else {
len=sync(s, ×tamp, &flags, &i, &pos);
if (len > 0)
st = s->streams[i];
}
if(len<0 || url_feof(s->pb))
return AVERROR(EIO);
res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
&seq, flags, timestamp);
if((flags&2) && (seq&0x7F) == 1)
av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
if (res)
continue;
}
if( (st->discard >= AVDISCARD_NONKEY && !(flags&2))
|| st->discard >= AVDISCARD_ALL){
av_free_packet(pkt);
} else
break;
}
return 0;
}
| 1threat
|
Trying to ping linux vm hosted on azure does not work : <p>As title, how can I ping my machine to do some basic network testing? I have created a new VM but pinging it's public address returns request timeout.</p>
| 0debug
|
PIL how to scale image in relation to the text drawn on image : <p>I am trying to dynamically increase image size with respect to font and text given to <code>draw.text()</code>. </p>
<p>Orignal Problem is to create signature image based on name and the font user selects.</p>
<p>Here is my code</p>
<pre><code>from PIL import (Image, ImageDraw, ImageFont,)
width=20
height=20
selected_font='simply_glomrous.ttf'
font_size=30
img = Image.new('RGBA', (width, height), (255, 255, 255, 0))
draw = ImageDraw.Draw(img)
font = ImageFont.truetype(selected_font, font_size)
draw.text((0,0), "Adil Malik", (0,0,0), font)
img.save('signature.png')
</code></pre>
<p>But i am still having same image size defined in width and height. Can we do dynamically resizing of image based on font and its size ? </p>
<p><strong>Note</strong>: This question is opposite to <a href="https://stackoverflow.com/questions/4902198/pil-how-to-scale-text-size-in-relation-to-the-size-of-the-image">this stackoverflow question</a></p>
| 0debug
|
How can I check whether the protocol is implemented? : <p>I wonder if there any way to ask Elixir whether <em>this object implements that protocol</em>, something like <code>obj |> implements(Enumerable)</code>?</p>
<p>Basically, I have to distinguish structs and maps. The solution I currently have is kinda ugly:</p>
<pre><code>try
obj |> Enum.each ...
rescue
e in Protocol.UndefinedError -> obj |> Maps.keys ...
end
</code></pre>
<p>The above works, but I would prefer to use pattern matching like:</p>
<pre><code>cond do
obj |> is_implemented(Enumerable) -> ...
_ -> ...
end
</code></pre>
<p>Am I missing something? <strong>Can one explicitly check whether the desired protocol is implemented by the object?</strong></p>
| 0debug
|
Error in SQL query (SQL update) : <p>The query is :</p>
<pre><code>Update t1
set t1.paper_attempt = 1
from table1 as t1
JOIN table2 as t2
ON t2.user_id = t1.user_id
JOIN table3 as t3
ON t3.id = t2.company_id
where t3.candidate_id = 'CAND024';
</code></pre>
<p>I am using HeidiSQL, on running the query, it is showing a Syntax error. Please help!</p>
| 0debug
|
static const char *local_mapped_attr_path(FsContext *ctx,
const char *path, char *buffer)
{
char *dir_name;
char *tmp_path = g_strdup(path);
char *base_name = basename(tmp_path);
dir_name = tmp_path;
*(base_name - 1) = '\0';
snprintf(buffer, PATH_MAX, "%s/%s/%s/%s",
ctx->fs_root, dir_name, VIRTFS_META_DIR, base_name);
g_free(tmp_path);
return buffer;
}
| 1threat
|
Error one or more parameters is required C# Code : This is C# Code and Giving me a Error that One or More Parameters are required Access Data Base Any One Can Help me...I am Hanged due to this error!
| 0debug
|
Java 8 Optional get() method : <p>Is using get() method in this fashion the recommended approach when using Optional? </p>
<pre><code>Optional<User> loginUser = userService.findUserByEmail(authentication.getName());
if (loginUser.isPresent()) {
User user = loginUser.get();
user.setLastLogin(new Date());
userService.saveUser(user);
}
</code></pre>
| 0debug
|
static void s390_memory_init(ram_addr_t mem_size)
{
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size);
memory_region_add_subregion(sysmem, 0, ram);
s390_skeys_init();
s390_stattrib_init();
}
| 1threat
|
static int disas_neon_data_insn(CPUState * env, DisasContext *s, uint32_t insn)
{
int op;
int q;
int rd, rn, rm;
int size;
int shift;
int pass;
int count;
int pairwise;
int u;
uint32_t imm, mask;
TCGv tmp, tmp2, tmp3, tmp4, tmp5;
TCGv_i64 tmp64;
if (!s->vfp_enabled)
return 1;
q = (insn & (1 << 6)) != 0;
u = (insn >> 24) & 1;
VFP_DREG_D(rd, insn);
VFP_DREG_N(rn, insn);
VFP_DREG_M(rm, insn);
size = (insn >> 20) & 3;
if ((insn & (1 << 23)) == 0) {
op = ((insn >> 7) & 0x1e) | ((insn >> 4) & 1);
if ((neon_3r_sizes[op] & (1 << size)) == 0) {
return 1;
}
if (q && ((rd | rn | rm) & 1)) {
return 1;
}
if (size == 3 && op != NEON_3R_LOGIC) {
for (pass = 0; pass < (q ? 2 : 1); pass++) {
neon_load_reg64(cpu_V0, rn + pass);
neon_load_reg64(cpu_V1, rm + pass);
switch (op) {
case NEON_3R_VQADD:
if (u) {
gen_helper_neon_qadd_u64(cpu_V0, cpu_V0, cpu_V1);
} else {
gen_helper_neon_qadd_s64(cpu_V0, cpu_V0, cpu_V1);
}
break;
case NEON_3R_VQSUB:
if (u) {
gen_helper_neon_qsub_u64(cpu_V0, cpu_V0, cpu_V1);
} else {
gen_helper_neon_qsub_s64(cpu_V0, cpu_V0, cpu_V1);
}
break;
case NEON_3R_VSHL:
if (u) {
gen_helper_neon_shl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_shl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case NEON_3R_VQSHL:
if (u) {
gen_helper_neon_qshl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_qshl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case NEON_3R_VRSHL:
if (u) {
gen_helper_neon_rshl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_rshl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case NEON_3R_VQRSHL:
if (u) {
gen_helper_neon_qrshl_u64(cpu_V0, cpu_V1, cpu_V0);
} else {
gen_helper_neon_qrshl_s64(cpu_V0, cpu_V1, cpu_V0);
}
break;
case NEON_3R_VADD_VSUB:
if (u) {
tcg_gen_sub_i64(CPU_V001);
} else {
tcg_gen_add_i64(CPU_V001);
}
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
}
return 0;
}
pairwise = 0;
switch (op) {
case NEON_3R_VSHL:
case NEON_3R_VQSHL:
case NEON_3R_VRSHL:
case NEON_3R_VQRSHL:
{
int rtmp;
rtmp = rn;
rn = rm;
rm = rtmp;
}
break;
case NEON_3R_VPADD:
if (u) {
return 1;
}
case NEON_3R_VPMAX:
case NEON_3R_VPMIN:
pairwise = 1;
break;
case NEON_3R_FLOAT_ARITH:
pairwise = (u && size < 2);
break;
case NEON_3R_FLOAT_MINMAX:
pairwise = u;
break;
case NEON_3R_FLOAT_CMP:
if (!u && size) {
return 1;
}
break;
case NEON_3R_FLOAT_ACMP:
if (!u) {
return 1;
}
break;
case NEON_3R_VRECPS_VRSQRTS:
if (u) {
return 1;
}
break;
case NEON_3R_VMUL:
if (u && (size != 0)) {
return 1;
}
break;
default:
break;
}
if (pairwise && q) {
return 1;
}
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (pairwise) {
if (pass < 1) {
tmp = neon_load_reg(rn, 0);
tmp2 = neon_load_reg(rn, 1);
} else {
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
}
} else {
tmp = neon_load_reg(rn, pass);
tmp2 = neon_load_reg(rm, pass);
}
switch (op) {
case NEON_3R_VHADD:
GEN_NEON_INTEGER_OP(hadd);
break;
case NEON_3R_VQADD:
GEN_NEON_INTEGER_OP(qadd);
break;
case NEON_3R_VRHADD:
GEN_NEON_INTEGER_OP(rhadd);
break;
case NEON_3R_LOGIC:
switch ((u << 2) | size) {
case 0:
tcg_gen_and_i32(tmp, tmp, tmp2);
break;
case 1:
tcg_gen_andc_i32(tmp, tmp, tmp2);
break;
case 2:
tcg_gen_or_i32(tmp, tmp, tmp2);
break;
case 3:
tcg_gen_orc_i32(tmp, tmp, tmp2);
break;
case 4:
tcg_gen_xor_i32(tmp, tmp, tmp2);
break;
case 5:
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp, tmp2, tmp3);
tcg_temp_free_i32(tmp3);
break;
case 6:
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp, tmp3, tmp2);
tcg_temp_free_i32(tmp3);
break;
case 7:
tmp3 = neon_load_reg(rd, pass);
gen_neon_bsl(tmp, tmp3, tmp, tmp2);
tcg_temp_free_i32(tmp3);
break;
}
break;
case NEON_3R_VHSUB:
GEN_NEON_INTEGER_OP(hsub);
break;
case NEON_3R_VQSUB:
GEN_NEON_INTEGER_OP(qsub);
break;
case NEON_3R_VCGT:
GEN_NEON_INTEGER_OP(cgt);
break;
case NEON_3R_VCGE:
GEN_NEON_INTEGER_OP(cge);
break;
case NEON_3R_VSHL:
GEN_NEON_INTEGER_OP(shl);
break;
case NEON_3R_VQSHL:
GEN_NEON_INTEGER_OP(qshl);
break;
case NEON_3R_VRSHL:
GEN_NEON_INTEGER_OP(rshl);
break;
case NEON_3R_VQRSHL:
GEN_NEON_INTEGER_OP(qrshl);
break;
case NEON_3R_VMAX:
GEN_NEON_INTEGER_OP(max);
break;
case NEON_3R_VMIN:
GEN_NEON_INTEGER_OP(min);
break;
case NEON_3R_VABD:
GEN_NEON_INTEGER_OP(abd);
break;
case NEON_3R_VABA:
GEN_NEON_INTEGER_OP(abd);
tcg_temp_free_i32(tmp2);
tmp2 = neon_load_reg(rd, pass);
gen_neon_add(size, tmp, tmp2);
break;
case NEON_3R_VADD_VSUB:
if (!u) {
gen_neon_add(size, tmp, tmp2);
} else {
switch (size) {
case 0: gen_helper_neon_sub_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_sub_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_sub_i32(tmp, tmp, tmp2); break;
default: abort();
}
}
break;
case NEON_3R_VTST_VCEQ:
if (!u) {
switch (size) {
case 0: gen_helper_neon_tst_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_tst_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_tst_u32(tmp, tmp, tmp2); break;
default: abort();
}
} else {
switch (size) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: abort();
}
}
break;
case NEON_3R_VML:
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: abort();
}
tcg_temp_free_i32(tmp2);
tmp2 = neon_load_reg(rd, pass);
if (u) {
gen_neon_rsb(size, tmp, tmp2);
} else {
gen_neon_add(size, tmp, tmp2);
}
break;
case NEON_3R_VMUL:
if (u) {
gen_helper_neon_mul_p8(tmp, tmp, tmp2);
} else {
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: abort();
}
}
break;
case NEON_3R_VPMAX:
GEN_NEON_INTEGER_OP(pmax);
break;
case NEON_3R_VPMIN:
GEN_NEON_INTEGER_OP(pmin);
break;
case NEON_3R_VQDMULH_VQRDMULH:
if (!u) {
switch (size) {
case 1: gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2); break;
default: abort();
}
} else {
switch (size) {
case 1: gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2); break;
default: abort();
}
}
break;
case NEON_3R_VPADD:
switch (size) {
case 0: gen_helper_neon_padd_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_padd_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_add_i32(tmp, tmp, tmp2); break;
default: abort();
}
break;
case NEON_3R_FLOAT_ARITH:
switch ((u << 2) | size) {
case 0:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 2:
gen_helper_neon_sub_f32(tmp, tmp, tmp2);
break;
case 4:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 6:
gen_helper_neon_abd_f32(tmp, tmp, tmp2);
break;
default:
abort();
}
break;
case NEON_3R_FLOAT_MULTIPLY:
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
if (!u) {
tcg_temp_free_i32(tmp2);
tmp2 = neon_load_reg(rd, pass);
if (size == 0) {
gen_helper_neon_add_f32(tmp, tmp, tmp2);
} else {
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
}
}
break;
case NEON_3R_FLOAT_CMP:
if (!u) {
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
} else {
if (size == 0)
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
}
break;
case NEON_3R_FLOAT_ACMP:
if (size == 0)
gen_helper_neon_acge_f32(tmp, tmp, tmp2);
else
gen_helper_neon_acgt_f32(tmp, tmp, tmp2);
break;
case NEON_3R_FLOAT_MINMAX:
if (size == 0)
gen_helper_neon_max_f32(tmp, tmp, tmp2);
else
gen_helper_neon_min_f32(tmp, tmp, tmp2);
break;
case NEON_3R_VRECPS_VRSQRTS:
if (size == 0)
gen_helper_recps_f32(tmp, tmp, tmp2, cpu_env);
else
gen_helper_rsqrts_f32(tmp, tmp, tmp2, cpu_env);
break;
default:
abort();
}
tcg_temp_free_i32(tmp2);
if (pairwise && rd == rm) {
neon_store_scratch(pass, tmp);
} else {
neon_store_reg(rd, pass, tmp);
}
}
if (pairwise && rd == rm) {
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tmp = neon_load_scratch(pass);
neon_store_reg(rd, pass, tmp);
}
}
} else if (insn & (1 << 4)) {
if ((insn & 0x00380080) != 0) {
op = (insn >> 8) & 0xf;
if (insn & (1 << 7)) {
if (op > 7) {
return 1;
}
size = 3;
} else {
size = 2;
while ((insn & (1 << (size + 19))) == 0)
size--;
}
shift = (insn >> 16) & ((1 << (3 + size)) - 1);
if (op < 8) {
if (q && ((rd | rm) & 1)) {
return 1;
}
if (!u && (op == 4 || op == 6)) {
return 1;
}
if (op <= 4)
shift = shift - (1 << (size + 3));
if (size == 3) {
count = q + 1;
} else {
count = q ? 4: 2;
}
switch (size) {
case 0:
imm = (uint8_t) shift;
imm |= imm << 8;
imm |= imm << 16;
break;
case 1:
imm = (uint16_t) shift;
imm |= imm << 16;
break;
case 2:
case 3:
imm = shift;
break;
default:
abort();
}
for (pass = 0; pass < count; pass++) {
if (size == 3) {
neon_load_reg64(cpu_V0, rm + pass);
tcg_gen_movi_i64(cpu_V1, imm);
switch (op) {
case 0:
case 1:
if (u)
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_shl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 2:
case 3:
if (u)
gen_helper_neon_rshl_u64(cpu_V0, cpu_V0, cpu_V1);
else
gen_helper_neon_rshl_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 4:
case 5:
gen_helper_neon_shl_u64(cpu_V0, cpu_V0, cpu_V1);
break;
case 6:
gen_helper_neon_qshlu_s64(cpu_V0, cpu_V0, cpu_V1);
break;
case 7:
if (u) {
gen_helper_neon_qshl_u64(cpu_V0,
cpu_V0, cpu_V1);
} else {
gen_helper_neon_qshl_s64(cpu_V0,
cpu_V0, cpu_V1);
}
break;
}
if (op == 1 || op == 3) {
neon_load_reg64(cpu_V1, rd + pass);
tcg_gen_add_i64(cpu_V0, cpu_V0, cpu_V1);
} else if (op == 4 || (op == 5 && u)) {
neon_load_reg64(cpu_V1, rd + pass);
uint64_t mask;
if (shift < -63 || shift > 63) {
mask = 0;
} else {
if (op == 4) {
mask = 0xffffffffffffffffull >> -shift;
} else {
mask = 0xffffffffffffffffull << shift;
}
}
tcg_gen_andi_i64(cpu_V1, cpu_V1, ~mask);
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
}
neon_store_reg64(cpu_V0, rd + pass);
} else {
tmp = neon_load_reg(rm, pass);
tmp2 = tcg_temp_new_i32();
tcg_gen_movi_i32(tmp2, imm);
switch (op) {
case 0:
case 1:
GEN_NEON_INTEGER_OP(shl);
break;
case 2:
case 3:
GEN_NEON_INTEGER_OP(rshl);
break;
case 4:
case 5:
switch (size) {
case 0: gen_helper_neon_shl_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_shl_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_shl_u32(tmp, tmp, tmp2); break;
default: abort();
}
break;
case 6:
switch (size) {
case 0:
gen_helper_neon_qshlu_s8(tmp, tmp, tmp2);
break;
case 1:
gen_helper_neon_qshlu_s16(tmp, tmp, tmp2);
break;
case 2:
gen_helper_neon_qshlu_s32(tmp, tmp, tmp2);
break;
default:
abort();
}
break;
case 7:
GEN_NEON_INTEGER_OP(qshl);
break;
}
tcg_temp_free_i32(tmp2);
if (op == 1 || op == 3) {
tmp2 = neon_load_reg(rd, pass);
gen_neon_add(size, tmp, tmp2);
tcg_temp_free_i32(tmp2);
} else if (op == 4 || (op == 5 && u)) {
switch (size) {
case 0:
if (op == 4)
mask = 0xff >> -shift;
else
mask = (uint8_t)(0xff << shift);
mask |= mask << 8;
mask |= mask << 16;
break;
case 1:
if (op == 4)
mask = 0xffff >> -shift;
else
mask = (uint16_t)(0xffff << shift);
mask |= mask << 16;
break;
case 2:
if (shift < -31 || shift > 31) {
mask = 0;
} else {
if (op == 4)
mask = 0xffffffffu >> -shift;
else
mask = 0xffffffffu << shift;
}
break;
default:
abort();
}
tmp2 = neon_load_reg(rd, pass);
tcg_gen_andi_i32(tmp, tmp, mask);
tcg_gen_andi_i32(tmp2, tmp2, ~mask);
tcg_gen_or_i32(tmp, tmp, tmp2);
tcg_temp_free_i32(tmp2);
}
neon_store_reg(rd, pass, tmp);
}
}
} else if (op < 10) {
int input_unsigned = (op == 8) ? !u : u;
if (rm & 1) {
return 1;
}
shift = shift - (1 << (size + 3));
size++;
if (size == 3) {
tmp64 = tcg_const_i64(shift);
neon_load_reg64(cpu_V0, rm);
neon_load_reg64(cpu_V1, rm + 1);
for (pass = 0; pass < 2; pass++) {
TCGv_i64 in;
if (pass == 0) {
in = cpu_V0;
} else {
in = cpu_V1;
}
if (q) {
if (input_unsigned) {
gen_helper_neon_rshl_u64(cpu_V0, in, tmp64);
} else {
gen_helper_neon_rshl_s64(cpu_V0, in, tmp64);
}
} else {
if (input_unsigned) {
gen_helper_neon_shl_u64(cpu_V0, in, tmp64);
} else {
gen_helper_neon_shl_s64(cpu_V0, in, tmp64);
}
}
tmp = tcg_temp_new_i32();
gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0);
neon_store_reg(rd, pass, tmp);
}
tcg_temp_free_i64(tmp64);
} else {
if (size == 1) {
imm = (uint16_t)shift;
imm |= imm << 16;
} else {
imm = (uint32_t)shift;
}
tmp2 = tcg_const_i32(imm);
tmp4 = neon_load_reg(rm + 1, 0);
tmp5 = neon_load_reg(rm + 1, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 0) {
tmp = neon_load_reg(rm, 0);
} else {
tmp = tmp4;
}
gen_neon_shift_narrow(size, tmp, tmp2, q,
input_unsigned);
if (pass == 0) {
tmp3 = neon_load_reg(rm, 1);
} else {
tmp3 = tmp5;
}
gen_neon_shift_narrow(size, tmp3, tmp2, q,
input_unsigned);
tcg_gen_concat_i32_i64(cpu_V0, tmp, tmp3);
tcg_temp_free_i32(tmp);
tcg_temp_free_i32(tmp3);
tmp = tcg_temp_new_i32();
gen_neon_narrow_op(op == 8, u, size - 1, tmp, cpu_V0);
neon_store_reg(rd, pass, tmp);
}
tcg_temp_free_i32(tmp2);
}
} else if (op == 10) {
if (q || (rd & 1)) {
return 1;
}
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, size, u);
if (shift != 0) {
tcg_gen_shli_i64(cpu_V0, cpu_V0, shift);
if (size < 2 || !u) {
uint64_t imm64;
if (size == 0) {
imm = (0xffu >> (8 - shift));
imm |= imm << 16;
} else if (size == 1) {
imm = 0xffff >> (16 - shift);
} else {
imm = 0xffffffff >> (32 - shift);
}
if (size < 2) {
imm64 = imm | (((uint64_t)imm) << 32);
} else {
imm64 = imm;
}
tcg_gen_andi_i64(cpu_V0, cpu_V0, ~imm64);
}
}
neon_store_reg64(cpu_V0, rd + pass);
}
} else if (op >= 14) {
if (!(insn & (1 << 21)) || (q && ((rd | rm) & 1))) {
return 1;
}
shift = 32 - shift;
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, pass));
if (!(op & 1)) {
if (u)
gen_vfp_ulto(0, shift);
else
gen_vfp_slto(0, shift);
} else {
if (u)
gen_vfp_toul(0, shift);
else
gen_vfp_tosl(0, shift);
}
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, pass));
}
} else {
return 1;
}
} else {
int invert;
if (q && (rd & 1)) {
return 1;
}
op = (insn >> 8) & 0xf;
imm = (u << 7) | ((insn >> 12) & 0x70) | (insn & 0xf);
invert = (insn & (1 << 5)) != 0;
switch (op) {
case 0: case 1:
break;
case 2: case 3:
imm <<= 8;
break;
case 4: case 5:
imm <<= 16;
break;
case 6: case 7:
imm <<= 24;
break;
case 8: case 9:
imm |= imm << 16;
break;
case 10: case 11:
imm = (imm << 8) | (imm << 24);
break;
case 12:
imm = (imm << 8) | 0xff;
break;
case 13:
imm = (imm << 16) | 0xffff;
break;
case 14:
imm |= (imm << 8) | (imm << 16) | (imm << 24);
if (invert)
imm = ~imm;
break;
case 15:
if (invert) {
return 1;
}
imm = ((imm & 0x80) << 24) | ((imm & 0x3f) << 19)
| ((imm & 0x40) ? (0x1f << 25) : (1 << 30));
break;
}
if (invert)
imm = ~imm;
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (op & 1 && op < 12) {
tmp = neon_load_reg(rd, pass);
if (invert) {
tcg_gen_andi_i32(tmp, tmp, imm);
} else {
tcg_gen_ori_i32(tmp, tmp, imm);
}
} else {
tmp = tcg_temp_new_i32();
if (op == 14 && invert) {
int n;
uint32_t val;
val = 0;
for (n = 0; n < 4; n++) {
if (imm & (1 << (n + (pass & 1) * 4)))
val |= 0xff << (n * 8);
}
tcg_gen_movi_i32(tmp, val);
} else {
tcg_gen_movi_i32(tmp, imm);
}
}
neon_store_reg(rd, pass, tmp);
}
}
} else {
if (size != 3) {
op = (insn >> 8) & 0xf;
if ((insn & (1 << 6)) == 0) {
int src1_wide;
int src2_wide;
int prewiden;
int undefreq;
static const int neon_3reg_wide[16][4] = {
{1, 0, 0, 0},
{1, 1, 0, 0},
{1, 0, 0, 0},
{1, 1, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0},
{0, 1, 1, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 6},
{0, 0, 0, 0},
{0, 0, 0, 6},
{0, 0, 0, 0},
{0, 0, 0, 2},
{0, 0, 0, 5},
{0, 0, 0, 3},
};
prewiden = neon_3reg_wide[op][0];
src1_wide = neon_3reg_wide[op][1];
src2_wide = neon_3reg_wide[op][2];
undefreq = neon_3reg_wide[op][3];
if (((undefreq & 1) && (size != 0)) ||
((undefreq & 2) && (size == 0)) ||
((undefreq & 4) && u)) {
return 1;
}
if ((src1_wide && (rn & 1)) ||
(src2_wide && (rm & 1)) ||
(!src2_wide && (rd & 1))) {
return 1;
}
if (rd == rm && !src2_wide) {
tmp = neon_load_reg(rm, 1);
neon_store_scratch(2, tmp);
} else if (rd == rn && !src1_wide) {
tmp = neon_load_reg(rn, 1);
neon_store_scratch(2, tmp);
}
TCGV_UNUSED(tmp3);
for (pass = 0; pass < 2; pass++) {
if (src1_wide) {
neon_load_reg64(cpu_V0, rn + pass);
TCGV_UNUSED(tmp);
} else {
if (pass == 1 && rd == rn) {
tmp = neon_load_scratch(2);
} else {
tmp = neon_load_reg(rn, pass);
}
if (prewiden) {
gen_neon_widen(cpu_V0, tmp, size, u);
}
}
if (src2_wide) {
neon_load_reg64(cpu_V1, rm + pass);
TCGV_UNUSED(tmp2);
} else {
if (pass == 1 && rd == rm) {
tmp2 = neon_load_scratch(2);
} else {
tmp2 = neon_load_reg(rm, pass);
}
if (prewiden) {
gen_neon_widen(cpu_V1, tmp2, size, u);
}
}
switch (op) {
case 0: case 1: case 4:
gen_neon_addl(size);
break;
case 2: case 3: case 6:
gen_neon_subl(size);
break;
case 5: case 7:
switch ((size << 1) | u) {
case 0:
gen_helper_neon_abdl_s16(cpu_V0, tmp, tmp2);
break;
case 1:
gen_helper_neon_abdl_u16(cpu_V0, tmp, tmp2);
break;
case 2:
gen_helper_neon_abdl_s32(cpu_V0, tmp, tmp2);
break;
case 3:
gen_helper_neon_abdl_u32(cpu_V0, tmp, tmp2);
break;
case 4:
gen_helper_neon_abdl_s64(cpu_V0, tmp, tmp2);
break;
case 5:
gen_helper_neon_abdl_u64(cpu_V0, tmp, tmp2);
break;
default: abort();
}
tcg_temp_free_i32(tmp2);
tcg_temp_free_i32(tmp);
break;
case 8: case 9: case 10: case 11: case 12: case 13:
gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
break;
case 14:
gen_helper_neon_mull_p8(cpu_V0, tmp, tmp2);
tcg_temp_free_i32(tmp2);
tcg_temp_free_i32(tmp);
break;
default:
abort();
}
if (op == 13) {
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
neon_store_reg64(cpu_V0, rd + pass);
} else if (op == 5 || (op >= 8 && op <= 11)) {
neon_load_reg64(cpu_V1, rd + pass);
switch (op) {
case 10:
gen_neon_negl(cpu_V0, size);
case 5: case 8:
gen_neon_addl(size);
break;
case 9: case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
if (op == 11) {
gen_neon_negl(cpu_V0, size);
}
gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
} else if (op == 4 || op == 6) {
tmp = tcg_temp_new_i32();
if (!u) {
switch (size) {
case 0:
gen_helper_neon_narrow_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
} else {
switch (size) {
case 0:
gen_helper_neon_narrow_round_high_u8(tmp, cpu_V0);
break;
case 1:
gen_helper_neon_narrow_round_high_u16(tmp, cpu_V0);
break;
case 2:
tcg_gen_addi_i64(cpu_V0, cpu_V0, 1u << 31);
tcg_gen_shri_i64(cpu_V0, cpu_V0, 32);
tcg_gen_trunc_i64_i32(tmp, cpu_V0);
break;
default: abort();
}
}
if (pass == 0) {
tmp3 = tmp;
} else {
neon_store_reg(rd, 0, tmp3);
neon_store_reg(rd, 1, tmp);
}
} else {
neon_store_reg64(cpu_V0, rd + pass);
}
}
} else {
if (size == 0) {
return 1;
}
switch (op) {
case 1:
case 5:
case 9:
if (size == 1) {
return 1;
}
case 0:
case 4:
case 8:
case 12:
case 13:
if (u && ((rd | rn) & 1)) {
return 1;
}
tmp = neon_get_scalar(size, rm);
neon_store_scratch(0, tmp);
for (pass = 0; pass < (u ? 4 : 2); pass++) {
tmp = neon_load_scratch(0);
tmp2 = neon_load_reg(rn, pass);
if (op == 12) {
if (size == 1) {
gen_helper_neon_qdmulh_s16(tmp, tmp, tmp2);
} else {
gen_helper_neon_qdmulh_s32(tmp, tmp, tmp2);
}
} else if (op == 13) {
if (size == 1) {
gen_helper_neon_qrdmulh_s16(tmp, tmp, tmp2);
} else {
gen_helper_neon_qrdmulh_s32(tmp, tmp, tmp2);
}
} else if (op & 1) {
gen_helper_neon_mul_f32(tmp, tmp, tmp2);
} else {
switch (size) {
case 0: gen_helper_neon_mul_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_mul_u16(tmp, tmp, tmp2); break;
case 2: tcg_gen_mul_i32(tmp, tmp, tmp2); break;
default: abort();
}
}
tcg_temp_free_i32(tmp2);
if (op < 8) {
tmp2 = neon_load_reg(rd, pass);
switch (op) {
case 0:
gen_neon_add(size, tmp, tmp2);
break;
case 1:
gen_helper_neon_add_f32(tmp, tmp, tmp2);
break;
case 4:
gen_neon_rsb(size, tmp, tmp2);
break;
case 5:
gen_helper_neon_sub_f32(tmp, tmp2, tmp);
break;
default:
abort();
}
tcg_temp_free_i32(tmp2);
}
neon_store_reg(rd, pass, tmp);
}
break;
case 3:
case 7:
case 11:
if (u == 1) {
return 1;
}
case 2:
case 6:
case 10:
if (rd & 1) {
return 1;
}
tmp2 = neon_get_scalar(size, rm);
tmp4 = tcg_temp_new_i32();
tcg_gen_mov_i32(tmp4, tmp2);
tmp3 = neon_load_reg(rn, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 0) {
tmp = neon_load_reg(rn, 0);
} else {
tmp = tmp3;
tmp2 = tmp4;
}
gen_neon_mull(cpu_V0, tmp, tmp2, size, u);
if (op != 11) {
neon_load_reg64(cpu_V1, rd + pass);
}
switch (op) {
case 6:
gen_neon_negl(cpu_V0, size);
case 2:
gen_neon_addl(size);
break;
case 3: case 7:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
if (op == 7) {
gen_neon_negl(cpu_V0, size);
}
gen_neon_addl_saturate(cpu_V0, cpu_V1, size);
break;
case 10:
break;
case 11:
gen_neon_addl_saturate(cpu_V0, cpu_V0, size);
break;
default:
abort();
}
neon_store_reg64(cpu_V0, rd + pass);
}
break;
default:
return 1;
}
}
} else {
if (!u) {
imm = (insn >> 8) & 0xf;
if (imm > 7 && !q)
return 1;
if (q && ((rd | rn | rm) & 1)) {
return 1;
}
if (imm == 0) {
neon_load_reg64(cpu_V0, rn);
if (q) {
neon_load_reg64(cpu_V1, rn + 1);
}
} else if (imm == 8) {
neon_load_reg64(cpu_V0, rn + 1);
if (q) {
neon_load_reg64(cpu_V1, rm);
}
} else if (q) {
tmp64 = tcg_temp_new_i64();
if (imm < 8) {
neon_load_reg64(cpu_V0, rn);
neon_load_reg64(tmp64, rn + 1);
} else {
neon_load_reg64(cpu_V0, rn + 1);
neon_load_reg64(tmp64, rm);
}
tcg_gen_shri_i64(cpu_V0, cpu_V0, (imm & 7) * 8);
tcg_gen_shli_i64(cpu_V1, tmp64, 64 - ((imm & 7) * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
if (imm < 8) {
neon_load_reg64(cpu_V1, rm);
} else {
neon_load_reg64(cpu_V1, rm + 1);
imm -= 8;
}
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_shri_i64(tmp64, tmp64, imm * 8);
tcg_gen_or_i64(cpu_V1, cpu_V1, tmp64);
tcg_temp_free_i64(tmp64);
} else {
neon_load_reg64(cpu_V0, rn);
tcg_gen_shri_i64(cpu_V0, cpu_V0, imm * 8);
neon_load_reg64(cpu_V1, rm);
tcg_gen_shli_i64(cpu_V1, cpu_V1, 64 - (imm * 8));
tcg_gen_or_i64(cpu_V0, cpu_V0, cpu_V1);
}
neon_store_reg64(cpu_V0, rd);
if (q) {
neon_store_reg64(cpu_V1, rd + 1);
}
} else if ((insn & (1 << 11)) == 0) {
op = ((insn >> 12) & 0x30) | ((insn >> 7) & 0xf);
size = (insn >> 18) & 3;
if ((neon_2rm_sizes[op] & (1 << size)) == 0) {
return 1;
}
switch (op) {
case NEON_2RM_VREV64:
for (pass = 0; pass < (q ? 2 : 1); pass++) {
tmp = neon_load_reg(rm, pass * 2);
tmp2 = neon_load_reg(rm, pass * 2 + 1);
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
case 2: break;
default: abort();
}
neon_store_reg(rd, pass * 2 + 1, tmp);
if (size == 2) {
neon_store_reg(rd, pass * 2, tmp2);
} else {
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp2, tmp2); break;
case 1: gen_swap_half(tmp2); break;
default: abort();
}
neon_store_reg(rd, pass * 2, tmp2);
}
}
break;
case NEON_2RM_VPADDL: case NEON_2RM_VPADDL_U:
case NEON_2RM_VPADAL: case NEON_2RM_VPADAL_U:
for (pass = 0; pass < q + 1; pass++) {
tmp = neon_load_reg(rm, pass * 2);
gen_neon_widen(cpu_V0, tmp, size, op & 1);
tmp = neon_load_reg(rm, pass * 2 + 1);
gen_neon_widen(cpu_V1, tmp, size, op & 1);
switch (size) {
case 0: gen_helper_neon_paddl_u16(CPU_V001); break;
case 1: gen_helper_neon_paddl_u32(CPU_V001); break;
case 2: tcg_gen_add_i64(CPU_V001); break;
default: abort();
}
if (op >= NEON_2RM_VPADAL) {
neon_load_reg64(cpu_V1, rd + pass);
gen_neon_addl(size);
}
neon_store_reg64(cpu_V0, rd + pass);
}
break;
case NEON_2RM_VTRN:
if (size == 2) {
int n;
for (n = 0; n < (q ? 4 : 2); n += 2) {
tmp = neon_load_reg(rm, n);
tmp2 = neon_load_reg(rd, n + 1);
neon_store_reg(rm, n, tmp2);
neon_store_reg(rd, n + 1, tmp);
}
} else {
goto elementwise;
}
break;
case NEON_2RM_VUZP:
if (gen_neon_unzip(rd, rm, size, q)) {
return 1;
}
break;
case NEON_2RM_VZIP:
if (gen_neon_zip(rd, rm, size, q)) {
return 1;
}
break;
case NEON_2RM_VMOVN: case NEON_2RM_VQMOVN:
TCGV_UNUSED(tmp2);
for (pass = 0; pass < 2; pass++) {
neon_load_reg64(cpu_V0, rm + pass);
tmp = tcg_temp_new_i32();
gen_neon_narrow_op(op == NEON_2RM_VMOVN, q, size,
tmp, cpu_V0);
if (pass == 0) {
tmp2 = tmp;
} else {
neon_store_reg(rd, 0, tmp2);
neon_store_reg(rd, 1, tmp);
}
}
break;
case NEON_2RM_VSHLL:
if (q) {
return 1;
}
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
for (pass = 0; pass < 2; pass++) {
if (pass == 1)
tmp = tmp2;
gen_neon_widen(cpu_V0, tmp, size, 1);
tcg_gen_shli_i64(cpu_V0, cpu_V0, 8 << size);
neon_store_reg64(cpu_V0, rd + pass);
}
break;
case NEON_2RM_VCVT_F16_F32:
if (!arm_feature(env, ARM_FEATURE_VFP_FP16))
return 1;
tmp = tcg_temp_new_i32();
tmp2 = tcg_temp_new_i32();
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 0));
gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 1));
gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 2));
gen_helper_neon_fcvt_f32_to_f16(tmp, cpu_F0s, cpu_env);
tcg_gen_ld_f32(cpu_F0s, cpu_env, neon_reg_offset(rm, 3));
neon_store_reg(rd, 0, tmp2);
tmp2 = tcg_temp_new_i32();
gen_helper_neon_fcvt_f32_to_f16(tmp2, cpu_F0s, cpu_env);
tcg_gen_shli_i32(tmp2, tmp2, 16);
tcg_gen_or_i32(tmp2, tmp2, tmp);
neon_store_reg(rd, 1, tmp2);
tcg_temp_free_i32(tmp);
break;
case NEON_2RM_VCVT_F32_F16:
if (!arm_feature(env, ARM_FEATURE_VFP_FP16))
return 1;
tmp3 = tcg_temp_new_i32();
tmp = neon_load_reg(rm, 0);
tmp2 = neon_load_reg(rm, 1);
tcg_gen_ext16u_i32(tmp3, tmp);
gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 0));
tcg_gen_shri_i32(tmp3, tmp, 16);
gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 1));
tcg_temp_free_i32(tmp);
tcg_gen_ext16u_i32(tmp3, tmp2);
gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 2));
tcg_gen_shri_i32(tmp3, tmp2, 16);
gen_helper_neon_fcvt_f16_to_f32(cpu_F0s, tmp3, cpu_env);
tcg_gen_st_f32(cpu_F0s, cpu_env, neon_reg_offset(rd, 3));
tcg_temp_free_i32(tmp2);
tcg_temp_free_i32(tmp3);
break;
default:
elementwise:
for (pass = 0; pass < (q ? 4 : 2); pass++) {
if (neon_2rm_is_float_op(op)) {
tcg_gen_ld_f32(cpu_F0s, cpu_env,
neon_reg_offset(rm, pass));
TCGV_UNUSED(tmp);
} else {
tmp = neon_load_reg(rm, pass);
}
switch (op) {
case NEON_2RM_VREV32:
switch (size) {
case 0: tcg_gen_bswap32_i32(tmp, tmp); break;
case 1: gen_swap_half(tmp); break;
default: abort();
}
break;
case NEON_2RM_VREV16:
gen_rev16(tmp);
break;
case NEON_2RM_VCLS:
switch (size) {
case 0: gen_helper_neon_cls_s8(tmp, tmp); break;
case 1: gen_helper_neon_cls_s16(tmp, tmp); break;
case 2: gen_helper_neon_cls_s32(tmp, tmp); break;
default: abort();
}
break;
case NEON_2RM_VCLZ:
switch (size) {
case 0: gen_helper_neon_clz_u8(tmp, tmp); break;
case 1: gen_helper_neon_clz_u16(tmp, tmp); break;
case 2: gen_helper_clz(tmp, tmp); break;
default: abort();
}
break;
case NEON_2RM_VCNT:
gen_helper_neon_cnt_u8(tmp, tmp);
break;
case NEON_2RM_VMVN:
tcg_gen_not_i32(tmp, tmp);
break;
case NEON_2RM_VQABS:
switch (size) {
case 0: gen_helper_neon_qabs_s8(tmp, tmp); break;
case 1: gen_helper_neon_qabs_s16(tmp, tmp); break;
case 2: gen_helper_neon_qabs_s32(tmp, tmp); break;
default: abort();
}
break;
case NEON_2RM_VQNEG:
switch (size) {
case 0: gen_helper_neon_qneg_s8(tmp, tmp); break;
case 1: gen_helper_neon_qneg_s16(tmp, tmp); break;
case 2: gen_helper_neon_qneg_s32(tmp, tmp); break;
default: abort();
}
break;
case NEON_2RM_VCGT0: case NEON_2RM_VCLE0:
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_cgt_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cgt_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cgt_s32(tmp, tmp, tmp2); break;
default: abort();
}
tcg_temp_free(tmp2);
if (op == NEON_2RM_VCLE0) {
tcg_gen_not_i32(tmp, tmp);
}
break;
case NEON_2RM_VCGE0: case NEON_2RM_VCLT0:
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_cge_s8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_cge_s16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_cge_s32(tmp, tmp, tmp2); break;
default: abort();
}
tcg_temp_free(tmp2);
if (op == NEON_2RM_VCLT0) {
tcg_gen_not_i32(tmp, tmp);
}
break;
case NEON_2RM_VCEQ0:
tmp2 = tcg_const_i32(0);
switch(size) {
case 0: gen_helper_neon_ceq_u8(tmp, tmp, tmp2); break;
case 1: gen_helper_neon_ceq_u16(tmp, tmp, tmp2); break;
case 2: gen_helper_neon_ceq_u32(tmp, tmp, tmp2); break;
default: abort();
}
tcg_temp_free(tmp2);
break;
case NEON_2RM_VABS:
switch(size) {
case 0: gen_helper_neon_abs_s8(tmp, tmp); break;
case 1: gen_helper_neon_abs_s16(tmp, tmp); break;
case 2: tcg_gen_abs_i32(tmp, tmp); break;
default: abort();
}
break;
case NEON_2RM_VNEG:
tmp2 = tcg_const_i32(0);
gen_neon_rsb(size, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case NEON_2RM_VCGT0_F:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cgt_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case NEON_2RM_VCGE0_F:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cge_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case NEON_2RM_VCEQ0_F:
tmp2 = tcg_const_i32(0);
gen_helper_neon_ceq_f32(tmp, tmp, tmp2);
tcg_temp_free(tmp2);
break;
case NEON_2RM_VCLE0_F:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cge_f32(tmp, tmp2, tmp);
tcg_temp_free(tmp2);
break;
case NEON_2RM_VCLT0_F:
tmp2 = tcg_const_i32(0);
gen_helper_neon_cgt_f32(tmp, tmp2, tmp);
tcg_temp_free(tmp2);
break;
case NEON_2RM_VABS_F:
gen_vfp_abs(0);
break;
case NEON_2RM_VNEG_F:
gen_vfp_neg(0);
break;
case NEON_2RM_VSWP:
tmp2 = neon_load_reg(rd, pass);
neon_store_reg(rm, pass, tmp2);
break;
case NEON_2RM_VTRN:
tmp2 = neon_load_reg(rd, pass);
switch (size) {
case 0: gen_neon_trn_u8(tmp, tmp2); break;
case 1: gen_neon_trn_u16(tmp, tmp2); break;
default: abort();
}
neon_store_reg(rm, pass, tmp2);
break;
case NEON_2RM_VRECPE:
gen_helper_recpe_u32(tmp, tmp, cpu_env);
break;
case NEON_2RM_VRSQRTE:
gen_helper_rsqrte_u32(tmp, tmp, cpu_env);
break;
case NEON_2RM_VRECPE_F:
gen_helper_recpe_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case NEON_2RM_VRSQRTE_F:
gen_helper_rsqrte_f32(cpu_F0s, cpu_F0s, cpu_env);
break;
case NEON_2RM_VCVT_FS:
gen_vfp_sito(0);
break;
case NEON_2RM_VCVT_FU:
gen_vfp_uito(0);
break;
case NEON_2RM_VCVT_SF:
gen_vfp_tosiz(0);
break;
case NEON_2RM_VCVT_UF:
gen_vfp_touiz(0);
break;
default:
abort();
}
if (neon_2rm_is_float_op(op)) {
tcg_gen_st_f32(cpu_F0s, cpu_env,
neon_reg_offset(rd, pass));
} else {
neon_store_reg(rd, pass, tmp);
}
}
break;
}
} else if ((insn & (1 << 10)) == 0) {
int n = ((insn >> 5) & 0x18) + 8;
if (insn & (1 << 6)) {
tmp = neon_load_reg(rd, 0);
} else {
tmp = tcg_temp_new_i32();
tcg_gen_movi_i32(tmp, 0);
}
tmp2 = neon_load_reg(rm, 0);
tmp4 = tcg_const_i32(rn);
tmp5 = tcg_const_i32(n);
gen_helper_neon_tbl(tmp2, tmp2, tmp, tmp4, tmp5);
tcg_temp_free_i32(tmp);
if (insn & (1 << 6)) {
tmp = neon_load_reg(rd, 1);
} else {
tmp = tcg_temp_new_i32();
tcg_gen_movi_i32(tmp, 0);
}
tmp3 = neon_load_reg(rm, 1);
gen_helper_neon_tbl(tmp3, tmp3, tmp, tmp4, tmp5);
tcg_temp_free_i32(tmp5);
tcg_temp_free_i32(tmp4);
neon_store_reg(rd, 0, tmp2);
neon_store_reg(rd, 1, tmp3);
tcg_temp_free_i32(tmp);
} else if ((insn & 0x380) == 0) {
if (insn & (1 << 19)) {
tmp = neon_load_reg(rm, 1);
} else {
tmp = neon_load_reg(rm, 0);
}
if (insn & (1 << 16)) {
gen_neon_dup_u8(tmp, ((insn >> 17) & 3) * 8);
} else if (insn & (1 << 17)) {
if ((insn >> 18) & 1)
gen_neon_dup_high16(tmp);
else
gen_neon_dup_low16(tmp);
}
for (pass = 0; pass < (q ? 4 : 2); pass++) {
tmp2 = tcg_temp_new_i32();
tcg_gen_mov_i32(tmp2, tmp);
neon_store_reg(rd, pass, tmp2);
}
tcg_temp_free_i32(tmp);
} else {
return 1;
}
}
}
return 0;
}
| 1threat
|
static int ffm_read_header(AVFormatContext *s)
{
FFMContext *ffm = s->priv_data;
AVStream *st;
AVIOContext *pb = s->pb;
AVCodecContext *codec;
const AVCodecDescriptor *codec_desc;
int i, nb_streams;
uint32_t tag;
tag = avio_rl32(pb);
if (tag == MKTAG('F', 'F', 'M', '2'))
return ffm2_read_header(s);
if (tag != MKTAG('F', 'F', 'M', '1'))
ffm->packet_size = avio_rb32(pb);
if (ffm->packet_size != FFM_PACKET_SIZE)
ffm->write_index = avio_rb64(pb);
if (pb->seekable) {
ffm->file_size = avio_size(pb);
if (ffm->write_index && 0)
adjust_write_index(s);
} else {
ffm->file_size = (UINT64_C(1) << 63) - 1;
nb_streams = avio_rb32(pb);
avio_rb32(pb);
for(i=0;i<nb_streams;i++) {
char rc_eq_buf[128];
st = avformat_new_stream(s, NULL);
if (!st)
avpriv_set_pts_info(st, 64, 1, 1000000);
codec = st->codec;
codec->codec_id = avio_rb32(pb);
codec_desc = avcodec_descriptor_get(codec->codec_id);
if (!codec_desc) {
av_log(s, AV_LOG_ERROR, "Invalid codec id: %d\n", codec->codec_id);
codec->codec_id = AV_CODEC_ID_NONE;
codec->codec_type = avio_r8(pb);
if (codec->codec_type != codec_desc->type) {
av_log(s, AV_LOG_ERROR, "Codec type mismatch: expected %d, found %d\n",
codec_desc->type, codec->codec_type);
codec->codec_id = AV_CODEC_ID_NONE;
codec->codec_type = AVMEDIA_TYPE_UNKNOWN;
codec->bit_rate = avio_rb32(pb);
codec->flags = avio_rb32(pb);
codec->flags2 = avio_rb32(pb);
codec->debug = avio_rb32(pb);
switch(codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
codec->time_base.num = avio_rb32(pb);
codec->time_base.den = avio_rb32(pb);
if (codec->time_base.num <= 0 || codec->time_base.den <= 0) {
av_log(s, AV_LOG_ERROR, "Invalid time base %d/%d\n",
codec->time_base.num, codec->time_base.den);
codec->width = avio_rb16(pb);
codec->height = avio_rb16(pb);
codec->gop_size = avio_rb16(pb);
codec->pix_fmt = avio_rb32(pb);
codec->qmin = avio_r8(pb);
codec->qmax = avio_r8(pb);
codec->max_qdiff = avio_r8(pb);
codec->qcompress = avio_rb16(pb) / 10000.0;
codec->qblur = avio_rb16(pb) / 10000.0;
codec->bit_rate_tolerance = avio_rb32(pb);
avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf));
codec->rc_eq = av_strdup(rc_eq_buf);
codec->rc_max_rate = avio_rb32(pb);
codec->rc_min_rate = avio_rb32(pb);
codec->rc_buffer_size = avio_rb32(pb);
codec->i_quant_factor = av_int2double(avio_rb64(pb));
codec->b_quant_factor = av_int2double(avio_rb64(pb));
codec->i_quant_offset = av_int2double(avio_rb64(pb));
codec->b_quant_offset = av_int2double(avio_rb64(pb));
codec->dct_algo = avio_rb32(pb);
codec->strict_std_compliance = avio_rb32(pb);
codec->max_b_frames = avio_rb32(pb);
codec->mpeg_quant = avio_rb32(pb);
codec->intra_dc_precision = avio_rb32(pb);
codec->me_method = avio_rb32(pb);
codec->mb_decision = avio_rb32(pb);
codec->nsse_weight = avio_rb32(pb);
codec->frame_skip_cmp = avio_rb32(pb);
codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb));
codec->codec_tag = avio_rb32(pb);
codec->thread_count = avio_r8(pb);
codec->coder_type = avio_rb32(pb);
codec->me_cmp = avio_rb32(pb);
codec->me_subpel_quality = avio_rb32(pb);
codec->me_range = avio_rb32(pb);
codec->keyint_min = avio_rb32(pb);
codec->scenechange_threshold = avio_rb32(pb);
codec->b_frame_strategy = avio_rb32(pb);
codec->qcompress = av_int2double(avio_rb64(pb));
codec->qblur = av_int2double(avio_rb64(pb));
codec->max_qdiff = avio_rb32(pb);
codec->refs = avio_rb32(pb);
break;
case AVMEDIA_TYPE_AUDIO:
codec->sample_rate = avio_rb32(pb);
codec->channels = avio_rl16(pb);
codec->frame_size = avio_rl16(pb);
break;
default:
if (codec->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
int size = avio_rb32(pb);
codec->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!codec->extradata)
return AVERROR(ENOMEM);
codec->extradata_size = size;
avio_read(pb, codec->extradata, size);
avcodec_parameters_from_context(st->codecpar, codec);
while ((avio_tell(pb) % ffm->packet_size) != 0 && !pb->eof_reached)
avio_r8(pb);
ffm->packet_ptr = ffm->packet;
ffm->packet_end = ffm->packet;
ffm->frame_offset = 0;
ffm->dts = 0;
ffm->read_state = READ_HEADER;
ffm->first_packet = 1;
return 0;
fail:
ffm_close(s);
return -1;
| 1threat
|
Check if a value exits in array (Laravel or Php) : <p>I have this array:</p>
<pre><code>$list_desings_ids = array('hc1wXBL7zCsdfMu','dhdsfHddfD','otheridshere');
</code></pre>
<p>With a die() + var_dumo() this array return me:</p>
<pre><code>array:2 [▼
0 => "hc1wXBL7zCsdfMu"
1 => "dhdsfHddfD"
2 => "otheridshere"
]
</code></pre>
<p>I want check if a design_id exits in $list_desings_ids array.</p>
<p>For example:</p>
<pre><code>foreach($general_list_designs as $key_design=>$design) {
#$desing->desing_id return me for example: hc1wXBL7zCsdfMu
if(array_key_exists($design->design_id, $list_desings_ids))
$final_designs[] = $design;
}
</code></pre>
<p>But this not works to me, what is the correct way?</p>
| 0debug
|
int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
int *frame_size_ptr,
AVPacket *avpkt)
{
AVFrame frame = {0};
int ret, got_frame = 0;
if (avctx->get_buffer != avcodec_default_get_buffer) {
av_log(avctx, AV_LOG_ERROR, "Custom get_buffer() for use with"
"avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n");
av_log(avctx, AV_LOG_ERROR, "Please port your application to "
"avcodec_decode_audio4()\n");
avctx->get_buffer = avcodec_default_get_buffer;
}
ret = avcodec_decode_audio4(avctx, &frame, &got_frame, avpkt);
if (ret >= 0 && got_frame) {
int ch, plane_size;
int planar = av_sample_fmt_is_planar(avctx->sample_fmt);
int data_size = av_samples_get_buffer_size(&plane_size, avctx->channels,
frame.nb_samples,
avctx->sample_fmt, 1);
if (*frame_size_ptr < data_size) {
av_log(avctx, AV_LOG_ERROR, "output buffer size is too small for "
"the current frame (%d < %d)\n", *frame_size_ptr, data_size);
return AVERROR(EINVAL);
}
memcpy(samples, frame.extended_data[0], plane_size);
if (planar && avctx->channels > 1) {
uint8_t *out = ((uint8_t *)samples) + plane_size;
for (ch = 1; ch < avctx->channels; ch++) {
memcpy(out, frame.extended_data[ch], plane_size);
out += plane_size;
}
}
*frame_size_ptr = data_size;
} else {
*frame_size_ptr = 0;
}
return ret;
}
| 1threat
|
Passing values between multiple view controller : I am newbie in Swift so probably asking a dumb question...
I have a UICellViewController in which I have following method
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath)
print("tapped got at index: \(indexPath.row) with tag: \(cell.tag) ")
//var viewController = CalculatorViewController()
//storyboard?.instantiateViewController(withIdentifier: "A")
if indexPath.row == cellLabels.count - 1{
let viewController = VC1()
viewController.selection = cellLabels[indexPath.row]
self.navigationController?.pushViewController(viewController, animated: true)
}
else{
let viewController = VC2()
viewController.selection = cellLabels[indexPath.row]
self.navigationController?.pushViewController(viewController, animated: true)
}
}
Essentially, I have two viewcontroller classes VC1 and VC2 of type ViewController
and based on which cell is clicked, I want to present the right view.
So, that is the intention..
Now in each of these classes VC1 and VC2, I have a UILabel (selection) which I am also trying to set above.
But when I try to run the class.. the code compiles and runs..
it crashes where I am trying to set the label
self.label.text = selection //Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
What am I doing wrong?
What's the right way to achieve this?
Thanks
| 0debug
|
How to verify JWT id_token produced by MS Azure AD? : <p>I have an angularjs SPA web app which uses <a href="https://github.com/AzureAD/azure-activedirectory-library-for-js" rel="noreferrer">ADAL-JS</a> (and adal-angular).
It's set up to authenticate vs our corporate AD in MS Azure. The log-in flow seems to work correctly, and the SPA receives an id_token.</p>
<p>Next, when the user clicks a button, the SPA makes a request to a REST API I am hosting on AWS API Gateway. I am passing the id_token on the <code>Authorization: Bearer <id_token></code> header.
The API Gateway receives the header as intended, and now has to determine if the given token is good or not to either allow or deny access.</p>
<p>I have a sample token, and it parses correctly on <a href="https://jwt.io/" rel="noreferrer">https://jwt.io/</a> but I have so far failed to find the Public Key or Certificate I should use to verify the signature. I have looked in:</p>
<ul>
<li><a href="https://login.microsoftonline.com/" rel="noreferrer">https://login.microsoftonline.com/</a>{tenantid}/federationmetadata/2007-06/federationmetadata.xml</li>
<li><a href="https://login.microsoftonline.com/" rel="noreferrer">https://login.microsoftonline.com/</a>{tenantId}/discovery/keys</li>
<li><a href="https://login.microsoftonline.com/common/.well-known/openid-configuration" rel="noreferrer">https://login.microsoftonline.com/common/.well-known/openid-configuration</a> (to get the jwks_uri)</li>
<li><a href="https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration" rel="noreferrer">https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration</a></li>
<li><a href="https://login.microsoftonline.com/common/discovery/keys" rel="noreferrer">https://login.microsoftonline.com/common/discovery/keys</a></li>
<li><a href="https://login.microsoftonline.com/common/discovery/v2.0/keys" rel="noreferrer">https://login.microsoftonline.com/common/discovery/v2.0/keys</a></li>
</ul>
<p>I <em>think</em> I should use the value of the x5c property of the key in <a href="https://login.microsoftonline.com/common/discovery/keys" rel="noreferrer">https://login.microsoftonline.com/common/discovery/keys</a> matching the kid and x5t properties from the JWT id_token (currently <code>a3QN0BZS7s4nN-BdrjbF0Y_LdMM</code>, which leads to an x5c value starting with "MIIDBTCCAe2gAwIBAgIQY..." ). However, the <a href="https://jwt.io/" rel="noreferrer">https://jwt.io/</a> page reports "Invalid Signature" (I also tried wrapping the key value with "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----").</p>
<p>Also, is there a (possibly python) library that can facilitate the verification of a given id_token as in the case above (so that I won't have to go grab the signing key on the fly myself?)... The best I could find (<a href="https://github.com/AzureAD/azure-activedirectory-library-for-python" rel="noreferrer">ADAL for python</a>) doesn't seem to provide this feature?</p>
| 0debug
|
How do I return uncommitted changes after git checkout : I had some changes on master then created a branch which added all my changes to my code. Then I went back to master to remove my changes that I did. I entered git checkout . on master which removed my changes on master and the branch. Any Ideas?
| 0debug
|
The script which I have ran in windows with strawberry perl is not working in unix machine : <p>The script which I have ran in windows with strawberry perl is working and perfectly giving the results but the same script in unix/Linux machine is not working. Can any one help on this. In windows i am using perl 5.20.1 version and in Ubuntu i have perl 5.22.1 version. </p>
<p>Here is my code </p>
<pre><code>use strict;
use warnings;
my $fname = '/hadoop/user/Kishore/Temp1.txt';
open my $afile, "<", $fname or die "Couldn't open $fname: $!";
my %a_lines;
my %b_lines;
my $count1=0;
while (my $line = <$afile>) {
chop $line;
$a_lines{$line} = undef;
$count1=$count1+1;
}
print"File1 records count : $count1\n";
close $afile;
$fname = '/hadoop/user/Kishore/Temp2.txt';
my $OUTPUT = '/hadoop/user/Kishore/final_result.txt';
open my $bfile, "<", $fname or die "Couldn't open $fname: $!";
open (OUTPUT, ">$OUTPUT") or die "Cannot open $OUTPUT \n";
my $count=0;
my $count2=0;
while (my $line = <$bfile>) {
chop $line;
$b_lines{$line} = undef;
$count2=$count2+1;
next if exists $a_lines{$line};
$count=$count+1;
print OUTPUT "$line \t===> The Line which is selected from file2/arg2 is mismatching/not available in file1\n";
}
print "File2 records count : $count2\n";
print "Total mismatching/unavailable records in file1 : $count\n";
close $bfile;
close OUTPUT;
</code></pre>
| 0debug
|
How to convert string 21/01/2019 (dd/MM/yyyy) to Date object in same format using Java : <p>My input string is "22/12/2019" in "dd/MM/yyyy" format. I need to convert this string into Date object while retaining the format. The output still needs to be in dd/MM/yyyy format but it should be a Date object. Please advise</p>
| 0debug
|
Whats happening here? : <pre><code>z=[0 for i in range(3)]
print(z) # [0,0,0]
x=[z for i in range(3)]
print(x) #[[0,0,0],[0,0,0],[0,0,0]]
x[1][1]=7
print(x) #[[0,7,0],[0,7,0],[0,7,0]]
</code></pre>
<p>Can someone explain what's happening here?</p>
| 0debug
|
int MPV_common_init(MpegEncContext *s)
{
int c_size, i;
UINT8 *pict;
s->dct_unquantize_h263 = dct_unquantize_h263_c;
s->dct_unquantize_mpeg1 = dct_unquantize_mpeg1_c;
s->dct_unquantize_mpeg2 = dct_unquantize_mpeg2_c;
#ifdef HAVE_MMX
MPV_common_init_mmx(s);
#endif
if(s->out_format == FMT_H263)
s->dct_unquantize = s->dct_unquantize_h263;
else
s->dct_unquantize = s->dct_unquantize_mpeg1;
s->mb_width = (s->width + 15) / 16;
s->mb_height = (s->height + 15) / 16;
s->mb_num = s->mb_width * s->mb_height;
s->linesize = s->mb_width * 16 + 2 * EDGE_WIDTH;
for(i=0;i<3;i++) {
int w, h, shift, pict_start;
w = s->linesize;
h = s->mb_height * 16 + 2 * EDGE_WIDTH;
shift = (i == 0) ? 0 : 1;
c_size = (w >> shift) * (h >> shift);
pict_start = (w >> shift) * (EDGE_WIDTH >> shift) + (EDGE_WIDTH >> shift);
pict = av_mallocz(c_size);
if (pict == NULL)
goto fail;
s->last_picture_base[i] = pict;
s->last_picture[i] = pict + pict_start;
pict = av_mallocz(c_size);
if (pict == NULL)
goto fail;
s->next_picture_base[i] = pict;
s->next_picture[i] = pict + pict_start;
if (s->has_b_frames || s->codec_id==CODEC_ID_MPEG4) {
pict = av_mallocz(c_size);
if (pict == NULL)
goto fail;
s->aux_picture_base[i] = pict;
s->aux_picture[i] = pict + pict_start;
}
}
if (s->encoding) {
int j;
int mv_table_size= (s->mb_width+2)*(s->mb_height+2);
s->mb_type = av_mallocz(s->mb_num * sizeof(char));
if (s->mb_type == NULL) {
perror("malloc");
goto fail;
}
s->mb_var = av_mallocz(s->mb_num * sizeof(INT16));
if (s->mb_var == NULL) {
perror("malloc");
goto fail;
}
s->p_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->p_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->last_p_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->last_p_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_forw_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_forw_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_back_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_back_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_bidir_forw_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_bidir_forw_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_bidir_back_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_bidir_back_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_direct_forw_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_direct_forw_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_direct_back_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_direct_back_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->b_direct_mv_table = av_mallocz(mv_table_size * 2 * sizeof(INT16));
if (s->b_direct_mv_table == NULL) {
perror("malloc");
goto fail;
}
s->me_scratchpad = av_mallocz( s->linesize*16*3*sizeof(uint8_t));
if (s->me_scratchpad == NULL) {
perror("malloc");
goto fail;
}
if(s->max_b_frames){
for(j=0; j<REORDER_BUFFER_SIZE; j++){
int i;
for(i=0;i<3;i++) {
int w, h, shift;
w = s->linesize;
h = s->mb_height * 16;
shift = (i == 0) ? 0 : 1;
c_size = (w >> shift) * (h >> shift);
pict = av_mallocz(c_size);
if (pict == NULL)
goto fail;
s->picture_buffer[j][i] = pict;
}
}
}
}
if (s->out_format == FMT_H263 || s->encoding) {
int size;
size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2);
s->motion_val = av_malloc(size * 2 * sizeof(INT16));
if (s->motion_val == NULL)
goto fail;
memset(s->motion_val, 0, size * 2 * sizeof(INT16));
}
if (s->h263_pred || s->h263_plus) {
int y_size, c_size, i, size;
y_size = (2 * s->mb_width + 2) * (2 * s->mb_height + 2);
c_size = (s->mb_width + 2) * (s->mb_height + 2);
size = y_size + 2 * c_size;
s->dc_val[0] = av_malloc(size * sizeof(INT16));
if (s->dc_val[0] == NULL)
goto fail;
s->dc_val[1] = s->dc_val[0] + y_size;
s->dc_val[2] = s->dc_val[1] + c_size;
for(i=0;i<size;i++)
s->dc_val[0][i] = 1024;
s->ac_val[0] = av_mallocz(size * sizeof(INT16) * 16);
if (s->ac_val[0] == NULL)
goto fail;
s->ac_val[1] = s->ac_val[0] + y_size;
s->ac_val[2] = s->ac_val[1] + c_size;
s->coded_block = av_mallocz(y_size);
if (!s->coded_block)
goto fail;
s->mbintra_table = av_mallocz(s->mb_num);
if (!s->mbintra_table)
goto fail;
memset(s->mbintra_table, 1, s->mb_num);
s->bitstream_buffer= av_mallocz(BITSTREAM_BUFFER_SIZE);
if (!s->bitstream_buffer)
goto fail;
}
s->picture_structure = PICT_FRAME;
s->mbskip_table = av_mallocz(s->mb_num);
if (!s->mbskip_table)
goto fail;
s->block= s->blocks[0];
s->context_initialized = 1;
return 0;
fail:
MPV_common_end(s);
return -1;
}
| 1threat
|
i get this error in unity and can anyone help me? : enter code here
public class cameramover : MonoBehaviour {
public GameObject player;
public Vector2 playerpos;
public Vector2 campos;
void Start()
{
playerpos = player.transform.position;
campos = transform.position;
}
void Update ()
{
campos.x + 30 - playerpos.x;
campos.y - playerpos.y;
}
}
and i get this error can you help me?
and tell me what i did wrong
Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
| 0debug
|
static struct glfs *qemu_gluster_init(BlockdevOptionsGluster *gconf,
const char *filename,
QDict *options, Error **errp)
{
int ret;
if (filename) {
ret = qemu_gluster_parse_uri(gconf, filename);
if (ret < 0) {
error_setg(errp, "invalid URI");
error_append_hint(errp, "Usage: file=gluster[+transport]:
"[host[:port]]/volume/path[?socket=...]\n");
errno = -ret;
return NULL;
}
} else {
ret = qemu_gluster_parse_json(gconf, options, errp);
if (ret < 0) {
error_append_hint(errp, "Usage: "
"-drive driver=qcow2,file.driver=gluster,"
"file.volume=testvol,file.path=/path/a.qcow2"
"[,file.debug=9],file.server.0.type=tcp,"
"file.server.0.host=1.2.3.4,"
"file.server.0.port=24007,"
"file.server.1.transport=unix,"
"file.server.1.socket=/var/run/glusterd.socket ..."
"\n");
errno = -ret;
return NULL;
}
}
return qemu_gluster_glfs_init(gconf, errp);
}
| 1threat
|
How to build multiple containers in jenkins file? : I have 3 different docker images. I need to build these images from Jenkins file. I have wildfly, Postgres, virtuoso docker images with individual docker file. As of now, I am using the below command to build these images:
'sh docker build docker docker-compose.yml'
My question is how build these 3 images from Jenkins file?
Thanks in advance.
| 0debug
|
How to split the interger into an array? : I need to split the integer into an array.
For example,
The interger variable a contains 48.
a = 48
I need to split the 48 into an array based on the count of 10.
I need to get the array like,
arr = [ 10, 20, 30, 40, 48]
I know the split method and also I know how to split the string into an array based one the character available in the string. but i don't know how to use the split method splitting the integer into an array based on the count.
Any one please explain me how to do this ?
Thanks in advance!
| 0debug
|
listview.setOnItemSelectedListener not work :
I'm using an string arrayList and a string arrayAdapter to populate a listView
this is my xml file
<LinearLayout
android:id="@+id/llHoursD"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
android:visibility="visible"
android:weightSum="1">
<TextView
android:id="@+id/tvDay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/ivName"
android:background="@null"
android:enabled="false"
android:gravity="center_horizontal"
android:inputType="textPersonName"
android:text="Fecha Seleccionada"
android:textColor="@color/category"
android:textColorHint="@color/category"
android:visibility="visible"
android:textSize="17sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:scaleType="centerCrop"
android:src="@drawable/separator" />
<ListView
android:id="@+id/lvReservationTime"
android:layout_width="match_parent"
android:layout_height="163dp"
android:divider="@null"
android:dividerHeight="8dp"
android:layout_marginTop="8dp"
android:visibility="visible"
android:layout_weight="1.99">
</ListView>
</LinearLayout>
This is the layout where the textview that is in the list is located
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/txtItemAva"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
And this is the code in the fragment
listHourAvali = new ArrayList<>();
adapterListHourAvali = new ArrayAdapter<String>(getActivity(),R.layout.detail_list_reservation,R.id.tvAvailiHours,listHourAvali);
mLvReservationTime.setAdapter(adapterListHourAvali);
mLvReservationTime.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getActivity(),"Prueba",Toast.LENGTH_LONG).show();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
The list is filled in another method, the problem is that pressing an item in the list does not go into `setOnItemSelectedListener`. What will be the problem
| 0debug
|
not able to convert int[] to int?[] : <p>Below is code implementation I am not able to convert int[] to int?[]</p>
<pre><code>days = !string.IsNullOrWhiteSpace(Days) ?
Days.Split("|").Select(x => Convert.ToInt32(x)).ToArray() : null
</code></pre>
<p>How to resolve it in a single line </p>
| 0debug
|
How can i write this powershell cmdlet in perl script : <pre><code> invoke-command HOST01 { cmd /C dir /S /B D:\file1 }
</code></pre>
<p>How can i include this command in a perl script i tried using </p>
<p><code>qx(invoke-command HOST01 { cmd /C dir /S /B D:\file1 })</code> it doesn't work ,the program runs forever.</p>
| 0debug
|
How to replace certain data frame value with it's unknown column name? : <p>I have a large data frame with unknown column names and numeric values 1, 2, 3, or 4.
Now I want to replace all 4 values with it's column name and all 1, 2 and 3's with an empty value. </p>
<p>Ofcourse I can make a loop of some kind, like this:</p>
<pre><code>df <- data.frame(id=1:8,unknownvarname1=c(1:4,1:4),unknownvarname2=c(4:1,4:1))
for (i in 2:length(df)){
df[,i] <- as.character(df[,i])
df[,i] <- mgsub::mgsub(df[,i],c(1,2,3,4),c("","","",names(df)[i]))
}
</code></pre>
<p>This would be the result:</p>
<pre><code> id unknownvarname1 unknownvarname2
1 1 unknownvarname2
2 2
3 3
4 4 unknownvarname1
5 5 unknownvarname2
6 6
7 7
8 8 unknownvarname1 unknownvarname2
</code></pre>
<p>For a data frame this size that's no problem at all. But when I try this loop on large data frames with up to 30k and up to 40 uknown variables, the loop takes ages to complete.</p>
<p>Does anyone know of a faster way to do this? I tried functions like <code>mutate()</code> of <code>dplyr package</code> but I could not manage to make it work.</p>
<p>Many thanks in advance!</p>
| 0debug
|
Getting Text From Fetch Response Object : <p>I'm using <code>fetch</code> to make API calls and everything works but in this particular instance I'm running into an issue because the API simply returns a string -- not an object.</p>
<p>Typically, the API returns an object and I can parse the JSON object and get what I want but in this case, I'm having trouble finding the text I'm getting from the API in the response object.</p>
<p>Here's what the response object looks like.
<a href="https://i.stack.imgur.com/RapuG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RapuG.png" alt="enter image description here"></a></p>
<p>I thought I'd find the text inside the body but I can't seem to find it. Where do I look?</p>
| 0debug
|
static void test_init(TestData *d)
{
QPCIBus *bus;
QTestState *qs;
char *s;
s = g_strdup_printf("-machine q35 %s", !d->args ? "" : d->args);
qs = qtest_start(s);
qtest_irq_intercept_in(qs, "ioapic");
g_free(s);
bus = qpci_init_pc();
d->dev = qpci_device_find(bus, QPCI_DEVFN(0x1f, 0x00));
g_assert(d->dev != NULL);
d->lpc_base = qpci_iomap(d->dev, 0, NULL);
qpci_device_enable(d->dev);
g_assert(d->lpc_base != NULL);
qpci_config_writel(d->dev, (uintptr_t)d->lpc_base + ICH9_LPC_PMBASE,
PM_IO_BASE_ADDR | 0x1);
qpci_config_writeb(d->dev, (uintptr_t)d->lpc_base + ICH9_LPC_ACPI_CTRL,
0x80);
qpci_config_writel(d->dev, (uintptr_t)d->lpc_base + ICH9_LPC_RCBA,
RCBA_BASE_ADDR | 0x1);
d->tco_io_base = (void *)((uintptr_t)PM_IO_BASE_ADDR + 0x60);
}
| 1threat
|
Java array inheritance not recognized by subclass : <p>I am working on a project where several classes have to inherit information. I am currently trying to get a subclass to inherit and work with an array from a superclass. The subclass isn't doing anything when I try to access the array. I can return the array after the information is read from the text file and placed into the array, but if I don't return it the subclass will do nothing with it. </p>
<p>Superclass:</p>
<pre><code>package Objects;
import java.io.*;
import java.util.*;
public abstract class Shape{
public static void main(String[] args) {
String[] shape = new String[12];
int i;
BufferedReader reader;
try {
reader = new BufferedReader(new FileReader(
"src/Data.txt"));
String line = reader.readLine();
while (line != null) {
for (i=0; i < 13; i+=2) {
shape[i] = line.substring(0, line.indexOf(" "));
shape[i+1] = line.substring(line.length() - 1, line.length());
line = reader.readLine();
}
}
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
catch(NullPointerException e)
{
}
}//end main
}//end shape
</code></pre>
<p>Subclass:</p>
<pre><code>package Objects;
import java.io.*;
import java.util.*;
public abstract class TwoDShape extends Shape{
System.out.println(Arrays.toString(shape));
public double getArea() {
return 0.0;
}
}//end 2D
</code></pre>
| 0debug
|
USBDevice *usb_bt_init(HCIInfo *hci)
{
USBDevice *dev;
struct USBBtState *s;
if (!hci)
dev = usb_create_simple(NULL , "usb-bt-dongle");
s = DO_UPCAST(struct USBBtState, dev, dev);
s->dev.opaque = s;
s->hci = hci;
s->hci->opaque = s;
s->hci->evt_recv = usb_bt_out_hci_packet_event;
s->hci->acl_recv = usb_bt_out_hci_packet_acl;
usb_bt_handle_reset(&s->dev);
return dev;
| 1threat
|
getting error for resizing- 1428: error: (-215) ssize.area() > 0 : while True:
ret, frame = cap.read()
frame = cv2.resize(frame, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
| 0debug
|
static int vsink_query_formats(AVFilterContext *ctx)
{
BufferSinkContext *buf = ctx->priv;
AVFilterFormats *formats = NULL;
unsigned i;
int ret;
if (buf->pixel_fmts_size % sizeof(*buf->pixel_fmts)) {
av_log(ctx, AV_LOG_ERROR, "Invalid size for format list\n");
return AVERROR(EINVAL);
}
if (buf->pixel_fmts_size) {
for (i = 0; i < NB_ITEMS(buf->pixel_fmts); i++)
if ((ret = ff_add_format(&formats, buf->pixel_fmts[i])) < 0)
return ret;
ff_set_common_formats(ctx, formats);
} else {
ff_default_query_formats(ctx);
}
return 0;
}
| 1threat
|
static void netfilter_print_info(Monitor *mon, NetFilterState *nf)
{
char *str;
ObjectProperty *prop;
ObjectPropertyIterator iter;
StringOutputVisitor *ov;
object_property_iter_init(&iter, OBJECT(nf));
while ((prop = object_property_iter_next(&iter))) {
if (!strcmp(prop->name, "type")) {
continue;
}
ov = string_output_visitor_new(false);
object_property_get(OBJECT(nf), string_output_get_visitor(ov),
prop->name, NULL);
str = string_output_get_string(ov);
visit_free(string_output_get_visitor(ov));
monitor_printf(mon, ",%s=%s", prop->name, str);
g_free(str);
}
monitor_printf(mon, "\n");
}
| 1threat
|
If number entered > 5 then show message using JQuery : <p>Using Jquery is it possible to show a message "Number should not be more than 5" when number entered more than 5 in input field. Once entered value less than 5 then message should hide.
</p>
| 0debug
|
static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
{
ROQDPCMContext *context = avctx->priv_data;
if (avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "Audio must be mono or stereo\n");
return -1;
}
if (avctx->sample_rate != 22050) {
av_log(avctx, AV_LOG_ERROR, "Audio must be 22050 Hz\n");
return -1;
}
if (avctx->sample_fmt != AV_SAMPLE_FMT_S16) {
av_log(avctx, AV_LOG_ERROR, "Audio must be signed 16-bit\n");
return -1;
}
avctx->frame_size = ROQ_FIRST_FRAME_SIZE;
context->lastSample[0] = context->lastSample[1] = 0;
avctx->coded_frame= avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
return 0;
}
| 1threat
|
how to use CMake file (GLOB SRCS *. ) with a build directory : <p>this is my current CMakeLists.txt file </p>
<pre><code>cmake_minimum_required(VERSION 3.3)
set(CMAKE_C_FLAGS " -Wall -g ")
project( bmi )
file( GLOB SRCS *.cpp *.h )
add_executable( bmi ${SRCS})
</code></pre>
<p>This builds from my source directory, but I have to clean up all the extra files after. My question is how do I build this from a build directory if all my source files are in the same source directory? </p>
<p>thanks </p>
| 0debug
|
static void spr_read_tbu(DisasContext *ctx, int gprn, int sprn)
{
if (ctx->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
gen_helper_load_tbu(cpu_gpr[gprn], cpu_env);
if (ctx->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
gen_stop_exception(ctx);
}
}
| 1threat
|
Can I tell C# nullable references that a method is effectively a null check on a field : <p>Consider the following code:</p>
<pre><code>#nullable enable
class Foo
{
public string? Name { get; set; }
public bool HasName => Name != null;
public void NameToUpperCase()
{
if (HasName)
{
Name = Name.ToUpper();
}
}
}
</code></pre>
<p>On the Name=Name.ToUpper() I get a warning that Name is a possible null reference, which is clearly incorrect. I can cure this warning by inlining HasName so the condition is if (Name != null).</p>
<p>Is there any way I can instruct the compiler that a true response from HasName implies a non-nullability constraint on Name? </p>
<p>This is important because HasName might actually test a lot more things, and I might want to use it in several places, or it might be a public part of the API surface. There are many reasons to want to factor the null check into it's own method, but doing so seems to break the nullable reference checker.</p>
| 0debug
|
const char *drive_get_serial(BlockDriverState *bdrv)
{
DriveInfo *dinfo;
TAILQ_FOREACH(dinfo, &drives, next) {
if (dinfo->bdrv == bdrv)
return dinfo->serial;
}
return "\0";
}
| 1threat
|
int ff_vbv_update(MpegEncContext *s, int frame_size)
{
RateControlContext *rcc = &s->rc_context;
const double fps = get_fps(s->avctx);
const int buffer_size = s->avctx->rc_buffer_size;
const double min_rate = s->avctx->rc_min_rate / fps;
const double max_rate = s->avctx->rc_max_rate / fps;
av_dlog(s, "%d %f %d %f %f\n",
buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate);
if (buffer_size) {
int left;
rcc->buffer_index -= frame_size;
if (rcc->buffer_index < 0) {
av_log(s->avctx, AV_LOG_ERROR, "rc buffer underflow\n");
rcc->buffer_index = 0;
left = buffer_size - rcc->buffer_index - 1;
rcc->buffer_index += av_clip(left, min_rate, max_rate);
if (rcc->buffer_index > buffer_size) {
int stuffing = ceil((rcc->buffer_index - buffer_size) / 8);
if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4)
stuffing = 4;
rcc->buffer_index -= 8 * stuffing;
if (s->avctx->debug & FF_DEBUG_RC)
av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n", stuffing);
return stuffing;
return 0;
| 1threat
|
Python match pattern to rename file : <p>I have couple of files with like this, <code>llm_rc_v3212.xml, llm_ds_v3232.xml</code>.
Names can be anything. however, common parameter would be<code>_v3212</code>. I want to match this number and replace it (ideally renaming the file).</p>
<p>How can i match this pattern with regex? I am trying to use <code>re.sub</code>, but not able to figure yet. </p>
<p>any help would be appreciated.</p>
| 0debug
|
How to add items to ListView in android : <p>Here i am trying to get the values from database and list them in ListView but after the 20 items i want to add some more items to the ListView when the user scrolls to the ListView end,But when the user scrolls to the end the ListView is erased completely and the new items are added. But i need the new items to be added at the end of previous List itself...</p>
<p>Here is my Android Code:</p>
<p>This will be executed at onCreate()</p>
<pre><code> public void getLocalJobs() {
empty.setVisibility(TextView.GONE);
String url = ConfigCuboid.GET_JOBS_LOCAL;
String url1 = Tags;
String URL = url + url1;
StringRequest stringRequest = new StringRequest(URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
showJSONLocal(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
@TargetApi(Build.VERSION_CODES.M)
private void showJSONLocal(String response) {
ParseJSONLocal pj = new ParseJSONLocal(response);
pj.parseJSONLocal();
CustomListLocal c1 = new CustomListLocal(this, ParseJSONLocal.job_local_id, ParseJSONLocal.user_names, ParseJSONOnline.job_typess, ParseJSONLocal.job_titles, ParseJSONLocal.job_works,
ParseJSONLocal.job_dates, ParseJSONLocal.job_months, ParseJSONLocal.job_years,
ParseJSONLocal.job_times, ParseJSONLocal.job_periods, ParseJSONLocal.job_areas, ParseJSONLocal.job_rates,
ParseJSONLocal.user_ids, ParseJSONLocal.job_detailss, ParseJSONLocal.image, ParseJSONLocal.regtoken
, ParseJSONLocal.verify);
listViewWork.setAdapter(c1);
Toast.makeText(getApplicationContext(),"ListNo=="+CustomListLocal.LastLocalJobId,Toast.LENGTH_SHORT).show();
if (c1.isEmpty()) {
empty.setVisibility(TextView.VISIBLE);
pb.setVisibility(ProgressBar.GONE);
}
listViewWork.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int poss, long id) {
Intent is = new Intent(getApplicationContext(), WorkProfileLocal.class);
is.putExtra("Positions", poss);
startActivity(is);
}
});
listViewWork.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view,
int firstVisibleItem, int visibleItemCount, int totalItemCount) {
//Algorithm to check if the last item is visible or not
final int lastItem = firstVisibleItem + visibleItemCount;
if (lastItem == totalItemCount) {
// you have reached end of list, load more data
// Toast.makeText(getApplicationContext(),"ListIsOver",Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(),"ListNo=="+CustomListLocal.LastLocalJobId,Toast.LENGTH_SHORT).show();
LoadLocalList();
}
}
});
}
</code></pre>
<p>At the end of ListView this method is executed:</p>
<pre><code> public void LoadLocalList(){
empty.setVisibility(TextView.GONE);
String url = ConfigCuboid.GET_LOADED_JOBS_LOCAL;
String urll1="last_local_job_id=";
String urll11 = CustomListLocal.LastLocalJobId;
String urll="&job_title[]=";
String url1 = Tags;
String URL = url + urll1+urll11+urll+url1;
StringRequest stringRequest = new StringRequest(URL, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
showJSONLocall(response);
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
@TargetApi(Build.VERSION_CODES.M)
private void showJSONLocall(String response) {
ParseJSONLocal pj = new ParseJSONLocal(response);
pj.parseJSONLocal();
CustomListLocal c2 = new CustomListLocal(this, ParseJSONLocal.job_local_id, ParseJSONLocal.user_names, ParseJSONOnline.job_typess, ParseJSONLocal.job_titles, ParseJSONLocal.job_works,
ParseJSONLocal.job_dates, ParseJSONLocal.job_months, ParseJSONLocal.job_years,
ParseJSONLocal.job_times, ParseJSONLocal.job_periods, ParseJSONLocal.job_areas, ParseJSONLocal.job_rates,
ParseJSONLocal.user_ids, ParseJSONLocal.job_detailss, ParseJSONLocal.image, ParseJSONLocal.regtoken
, ParseJSONLocal.verify);
listViewWork.setAdapter(c2);
Toast.makeText(getApplicationContext(),"ListNo=="+CustomListLocal.LastLocalJobId,Toast.LENGTH_SHORT).show();
if (c2.isEmpty()) {
empty.setVisibility(TextView.VISIBLE);
pb.setVisibility(ProgressBar.GONE);
}
listViewWork.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int poss, long id) {
Intent is = new Intent(getApplicationContext(), WorkProfileLocal.class);
is.putExtra("Positions", poss);
startActivity(is);
}
});
}
</code></pre>
| 0debug
|
How do I fix my docker-compose.yml? - expected <block end>, but found '<block mapping start>' : <pre><code>ERROR: yaml.parser.ParserError: while parsing a block mapping in "./docker-compose.yml", line 1, column 1
expected <block end>, but found '<block mapping start>' in "./docker-compose.yml", line 2, column 3
</code></pre>
<p>It seems there is an indentation issue in my yml file. I read some other questions on here, and tried various indentation schemes. I still cannot get it to work. I purposely removed the env names/pws before posting this question.</p>
<pre><code>version: '2'
ghost:
image: ghost:latest
container_name: ghost-blog #Specify a custom container name, rather than a generated default name.
environment:
- NODE_ENV=production
- MYSQL_DATABASE=db-name # Change {{db-name}}
- MYSQL_USER=user # Change {{username}}
- MYSQL_PASSWORD=pass # Change {{db-password}}
# - "MAILGUN_USER={{mailgun-user}}" # Change {{mailgun-user}}
# - "MAILGUN_PASSWORD={{mailgun-password}}" # Change {{mailgun-password}}
volumes:
- ./ghost:/var/lib/ghost # persist the data
ports:
- 2368:2368
depends_on:
- mysql # ensure that the database will start first
restart: always
mysql:
image: mysql:latest
container_name: ghost-db
environment:
- MYSQL_DATABASE=dbname # Change {{db-name}}
- MYSQL_ROOT_PASSWORD=db-pass # Change {{root-password}}
- MYSQL_USER=user # Change {{username}}
- MYSQL_PASSWORD=sq-pass # Change {{db-password}}
volumes:
- ./db:/var/lib/mysql
restart: always
</code></pre>
| 0debug
|
react-native fetch() cookie persist : <p>I'm new to using react-native and also the <code>fetch</code> api in javascript. I authenticate my app with a backend and after several refreshes in my ios simulator the app checks if it's authenticated with the backend on the initial loading and to my surprise, it is! This begs the question of where and what is persisting inside react-native and the <code>fetch</code> api?</p>
<p>Thanks!</p>
| 0debug
|
int bdrv_pwrite_sync(BlockDriverState *bs, int64_t offset,
const void *buf, int count)
{
int ret;
ret = bdrv_pwrite(bs, offset, buf, count);
if (ret < 0) {
return ret;
}
if (bs->enable_write_cache) {
bdrv_flush(bs);
}
return 0;
}
| 1threat
|
static int protocol_client_auth_sasl_mechname(VncState *vs, uint8_t *data, size_t len)
{
char *mechname = malloc(len + 1);
if (!mechname) {
VNC_DEBUG("Out of memory reading mechname\n");
vnc_client_error(vs);
}
strncpy(mechname, (char*)data, len);
mechname[len] = '\0';
VNC_DEBUG("Got client mechname '%s' check against '%s'\n",
mechname, vs->sasl.mechlist);
if (strncmp(vs->sasl.mechlist, mechname, len) == 0) {
if (vs->sasl.mechlist[len] != '\0' &&
vs->sasl.mechlist[len] != ',') {
VNC_DEBUG("One %d", vs->sasl.mechlist[len]);
vnc_client_error(vs);
return -1;
}
} else {
char *offset = strstr(vs->sasl.mechlist, mechname);
VNC_DEBUG("Two %p\n", offset);
if (!offset) {
vnc_client_error(vs);
return -1;
}
VNC_DEBUG("Two '%s'\n", offset);
if (offset[-1] != ',' ||
(offset[len] != '\0'&&
offset[len] != ',')) {
vnc_client_error(vs);
return -1;
}
}
free(vs->sasl.mechlist);
vs->sasl.mechlist = mechname;
VNC_DEBUG("Validated mechname '%s'\n", mechname);
vnc_read_when(vs, protocol_client_auth_sasl_start_len, 4);
return 0;
}
| 1threat
|
void kvm_inject_x86_mce(CPUState *cenv, int bank, uint64_t status,
uint64_t mcg_status, uint64_t addr, uint64_t misc,
int abort_on_error)
{
#ifdef KVM_CAP_MCE
struct kvm_x86_mce mce = {
.bank = bank,
.status = status,
.mcg_status = mcg_status,
.addr = addr,
.misc = misc,
};
struct kvm_x86_mce_data data = {
.env = cenv,
.mce = &mce,
};
if (!cenv->mcg_cap) {
fprintf(stderr, "MCE support is not enabled!\n");
return;
}
run_on_cpu(cenv, kvm_do_inject_x86_mce, &data);
#else
if (abort_on_error)
abort();
#endif
}
| 1threat
|
static void pred_temp_direct_motion(const H264Context *const h, H264SliceContext *sl,
int *mb_type)
{
int b8_stride = 2;
int b4_stride = h->b_stride;
int mb_xy = sl->mb_xy, mb_y = sl->mb_y;
int mb_type_col[2];
const int16_t (*l1mv0)[2], (*l1mv1)[2];
const int8_t *l1ref0, *l1ref1;
const int is_b8x8 = IS_8X8(*mb_type);
unsigned int sub_mb_type;
int i8, i4;
assert(sl->ref_list[1][0].reference & 3);
await_reference_mb_row(h, sl->ref_list[1][0].parent,
sl->mb_y + !!IS_INTERLACED(*mb_type));
if (IS_INTERLACED(sl->ref_list[1][0].parent->mb_type[mb_xy])) {
if (!IS_INTERLACED(*mb_type)) {
mb_y = (sl->mb_y & ~1) + sl->col_parity;
mb_xy = sl->mb_x +
((sl->mb_y & ~1) + sl->col_parity) * h->mb_stride;
b8_stride = 0;
} else {
mb_y += sl->col_fieldoff;
mb_xy += h->mb_stride * sl->col_fieldoff;
}
goto single_col;
} else {
if (IS_INTERLACED(*mb_type)) {
mb_y = sl->mb_y & ~1;
mb_xy = sl->mb_x + (sl->mb_y & ~1) * h->mb_stride;
mb_type_col[0] = sl->ref_list[1][0].parent->mb_type[mb_xy];
mb_type_col[1] = sl->ref_list[1][0].parent->mb_type[mb_xy + h->mb_stride];
b8_stride = 2 + 4 * h->mb_stride;
b4_stride *= 6;
if (IS_INTERLACED(mb_type_col[0]) !=
IS_INTERLACED(mb_type_col[1])) {
mb_type_col[0] &= ~MB_TYPE_INTERLACED;
mb_type_col[1] &= ~MB_TYPE_INTERLACED;
}
sub_mb_type = MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 |
MB_TYPE_DIRECT2;
if ((mb_type_col[0] & MB_TYPE_16x16_OR_INTRA) &&
(mb_type_col[1] & MB_TYPE_16x16_OR_INTRA) &&
!is_b8x8) {
*mb_type |= MB_TYPE_16x8 | MB_TYPE_L0L1 |
MB_TYPE_DIRECT2;
} else {
*mb_type |= MB_TYPE_8x8 | MB_TYPE_L0L1;
}
} else {
single_col:
mb_type_col[0] =
mb_type_col[1] = sl->ref_list[1][0].parent->mb_type[mb_xy];
sub_mb_type = MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 |
MB_TYPE_DIRECT2;
if (!is_b8x8 && (mb_type_col[0] & MB_TYPE_16x16_OR_INTRA)) {
*mb_type |= MB_TYPE_16x16 | MB_TYPE_P0L0 | MB_TYPE_P0L1 |
MB_TYPE_DIRECT2;
} else if (!is_b8x8 &&
(mb_type_col[0] & (MB_TYPE_16x8 | MB_TYPE_8x16))) {
*mb_type |= MB_TYPE_L0L1 | MB_TYPE_DIRECT2 |
(mb_type_col[0] & (MB_TYPE_16x8 | MB_TYPE_8x16));
} else {
if (!h->sps.direct_8x8_inference_flag) {
sub_mb_type = MB_TYPE_8x8 | MB_TYPE_P0L0 | MB_TYPE_P0L1 |
MB_TYPE_DIRECT2;
}
*mb_type |= MB_TYPE_8x8 | MB_TYPE_L0L1;
}
}
}
await_reference_mb_row(h, sl->ref_list[1][0].parent, mb_y);
l1mv0 = &sl->ref_list[1][0].parent->motion_val[0][h->mb2b_xy[mb_xy]];
l1mv1 = &sl->ref_list[1][0].parent->motion_val[1][h->mb2b_xy[mb_xy]];
l1ref0 = &sl->ref_list[1][0].parent->ref_index[0][4 * mb_xy];
l1ref1 = &sl->ref_list[1][0].parent->ref_index[1][4 * mb_xy];
if (!b8_stride) {
if (sl->mb_y & 1) {
l1ref0 += 2;
l1ref1 += 2;
l1mv0 += 2 * b4_stride;
l1mv1 += 2 * b4_stride;
}
}
{
const int *map_col_to_list0[2] = { sl->map_col_to_list0[0],
sl->map_col_to_list0[1] };
const int *dist_scale_factor = sl->dist_scale_factor;
int ref_offset;
if (FRAME_MBAFF(h) && IS_INTERLACED(*mb_type)) {
map_col_to_list0[0] = sl->map_col_to_list0_field[sl->mb_y & 1][0];
map_col_to_list0[1] = sl->map_col_to_list0_field[sl->mb_y & 1][1];
dist_scale_factor = sl->dist_scale_factor_field[sl->mb_y & 1];
}
ref_offset = (sl->ref_list[1][0].parent->mbaff << 4) & (mb_type_col[0] >> 3);
if (IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col[0])) {
int y_shift = 2 * !IS_INTERLACED(*mb_type);
assert(h->sps.direct_8x8_inference_flag);
for (i8 = 0; i8 < 4; i8++) {
const int x8 = i8 & 1;
const int y8 = i8 >> 1;
int ref0, scale;
const int16_t (*l1mv)[2] = l1mv0;
if (is_b8x8 && !IS_DIRECT(sl->sub_mb_type[i8]))
continue;
sl->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&sl->ref_cache[1][scan8[i8 * 4]], 2, 2, 8, 0, 1);
if (IS_INTRA(mb_type_col[y8])) {
fill_rectangle(&sl->ref_cache[0][scan8[i8 * 4]], 2, 2, 8, 0, 1);
fill_rectangle(&sl->mv_cache[0][scan8[i8 * 4]], 2, 2, 8, 0, 4);
fill_rectangle(&sl->mv_cache[1][scan8[i8 * 4]], 2, 2, 8, 0, 4);
continue;
}
ref0 = l1ref0[x8 + y8 * b8_stride];
if (ref0 >= 0)
ref0 = map_col_to_list0[0][ref0 + ref_offset];
else {
ref0 = map_col_to_list0[1][l1ref1[x8 + y8 * b8_stride] +
ref_offset];
l1mv = l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&sl->ref_cache[0][scan8[i8 * 4]], 2, 2, 8,
ref0, 1);
{
const int16_t *mv_col = l1mv[x8 * 3 + y8 * b4_stride];
int my_col = (mv_col[1] << y_shift) / 2;
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * my_col + 128) >> 8;
fill_rectangle(&sl->mv_cache[0][scan8[i8 * 4]], 2, 2, 8,
pack16to32(mx, my), 4);
fill_rectangle(&sl->mv_cache[1][scan8[i8 * 4]], 2, 2, 8,
pack16to32(mx - mv_col[0], my - my_col), 4);
}
}
return;
}
if (IS_16X16(*mb_type)) {
int ref, mv0, mv1;
fill_rectangle(&sl->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1);
if (IS_INTRA(mb_type_col[0])) {
ref = mv0 = mv1 = 0;
} else {
const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0] + ref_offset]
: map_col_to_list0[1][l1ref1[0] + ref_offset];
const int scale = dist_scale_factor[ref0];
const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0];
int mv_l0[2];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
ref = ref0;
mv0 = pack16to32(mv_l0[0], mv_l0[1]);
mv1 = pack16to32(mv_l0[0] - mv_col[0], mv_l0[1] - mv_col[1]);
}
fill_rectangle(&sl->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
fill_rectangle(&sl->mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4);
fill_rectangle(&sl->mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4);
} else {
for (i8 = 0; i8 < 4; i8++) {
const int x8 = i8 & 1;
const int y8 = i8 >> 1;
int ref0, scale;
const int16_t (*l1mv)[2] = l1mv0;
if (is_b8x8 && !IS_DIRECT(sl->sub_mb_type[i8]))
continue;
sl->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&sl->ref_cache[1][scan8[i8 * 4]], 2, 2, 8, 0, 1);
if (IS_INTRA(mb_type_col[0])) {
fill_rectangle(&sl->ref_cache[0][scan8[i8 * 4]], 2, 2, 8, 0, 1);
fill_rectangle(&sl->mv_cache[0][scan8[i8 * 4]], 2, 2, 8, 0, 4);
fill_rectangle(&sl->mv_cache[1][scan8[i8 * 4]], 2, 2, 8, 0, 4);
continue;
}
assert(b8_stride == 2);
ref0 = l1ref0[i8];
if (ref0 >= 0)
ref0 = map_col_to_list0[0][ref0 + ref_offset];
else {
ref0 = map_col_to_list0[1][l1ref1[i8] + ref_offset];
l1mv = l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&sl->ref_cache[0][scan8[i8 * 4]], 2, 2, 8,
ref0, 1);
if (IS_SUB_8X8(sub_mb_type)) {
const int16_t *mv_col = l1mv[x8 * 3 + y8 * 3 * b4_stride];
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * mv_col[1] + 128) >> 8;
fill_rectangle(&sl->mv_cache[0][scan8[i8 * 4]], 2, 2, 8,
pack16to32(mx, my), 4);
fill_rectangle(&sl->mv_cache[1][scan8[i8 * 4]], 2, 2, 8,
pack16to32(mx - mv_col[0], my - mv_col[1]), 4);
} else {
for (i4 = 0; i4 < 4; i4++) {
const int16_t *mv_col = l1mv[x8 * 2 + (i4 & 1) +
(y8 * 2 + (i4 >> 1)) * b4_stride];
int16_t *mv_l0 = sl->mv_cache[0][scan8[i8 * 4 + i4]];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
AV_WN32A(sl->mv_cache[1][scan8[i8 * 4 + i4]],
pack16to32(mv_l0[0] - mv_col[0],
mv_l0[1] - mv_col[1]));
}
}
}
}
}
}
| 1threat
|
void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
{
uint32_t mask = extract32(maskreg, 8, 4);
uint32_t reg = extract32(maskreg, 0, 8);
if (arm_current_el(env) == 0 && reg > 7) {
return;
}
switch (reg) {
case 0 ... 7:
if (!(reg & 4)) {
uint32_t apsrmask = 0;
if (mask & 8) {
apsrmask |= 0xf8000000;
}
if ((mask & 4) && arm_feature(env, ARM_FEATURE_THUMB_DSP)) {
apsrmask |= 0x000f0000;
}
xpsr_write(env, val, apsrmask);
}
break;
case 8:
if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) {
env->v7m.other_sp = val;
} else {
env->regs[13] = val;
}
break;
case 9:
if (env->v7m.control & R_V7M_CONTROL_SPSEL_MASK) {
env->regs[13] = val;
} else {
env->v7m.other_sp = val;
}
break;
case 16:
if (val & 1) {
env->daif |= PSTATE_I;
} else {
env->daif &= ~PSTATE_I;
}
break;
case 17:
env->v7m.basepri = val & 0xff;
break;
case 18:
val &= 0xff;
if (val != 0 && (val < env->v7m.basepri || env->v7m.basepri == 0))
env->v7m.basepri = val;
break;
case 19:
if (val & 1) {
env->daif |= PSTATE_F;
} else {
env->daif &= ~PSTATE_F;
}
break;
case 20:
switch_v7m_sp(env, (val & R_V7M_CONTROL_SPSEL_MASK) != 0);
env->v7m.control = val & (R_V7M_CONTROL_SPSEL_MASK |
R_V7M_CONTROL_NPRIV_MASK);
break;
default:
qemu_log_mask(LOG_GUEST_ERROR, "Attempt to write unknown special"
" register %d\n", reg);
return;
}
}
| 1threat
|
def check_integer(text):
text = text.strip()
if len(text) < 1:
return None
else:
if all(text[i] in "0123456789" for i in range(len(text))):
return True
elif (text[0] in "+-") and \
all(text[i] in "0123456789" for i in range(1,len(text))):
return True
else:
return False
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.