problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Importing data from multiple text files into Excel VBA : <p>I might have a question about VBA and Excel Macros. The thing that I need to do is to import data (actually integer values) from multiple text files that have random generated names (for example 12345678.txt, 8654321.txt, etc.) but which are stored in the same folder (let's call it Data folder) to excel into a column. </p>
<p>The problem that I face is that I have the same name for the measured values (called MVA) that are repeating over and over in the text files. I don't need all the data from the text files, only some specific rows of these MVA (for the example below let's say that I need only the MVA number for the "LED 01 Intensity" which is 6250 to be stored in a new cell in Excel. And I need to get that value that comes after "LED 01 Intensity" in the MVA row from 10 multiple text files (with random names that I don't know) to be stored each one in separate cells in Excel (from A1 to A10).</p>
<p>Example_____________________________________________________________________</p>
<p>Name: 153588.txt</p>
<p>Date: 14.05.2016</p>
<p>Name of product: Electronic Device 01</p>
<p>CHECK TEST</p>
<p>Resistance 101</p>
<p>MVA: 2 Ohm</p>
<p>MAX: 5 Ohm</p>
<p>MIN: 0 Ohm</p>
<p>PASS</p>
<p>LED 01 Intensity</p>
<p>MVA: 6250</p>
<p>MAX: 10000</p>
<p>MIN: 5000</p>
<p>PASS</p>
<hr>
<p>I need a lot of these MVA values to be stored in Excel for analysis and I need to get an idea if this problem can be solved with VBA. If you can offer me some help to create a macro for this I would be thankful (I have basic knowledge of programming but I'm a beginner in VBA).</p>
| 0debug |
static void dp8393x_realize(DeviceState *dev, Error **errp)
{
dp8393xState *s = DP8393X(dev);
int i, checksum;
uint8_t *prom;
address_space_init(&s->as, s->dma_mr, "dp8393x");
memory_region_init_io(&s->mmio, OBJECT(dev), &dp8393x_ops, s,
"dp8393x-regs", 0x40 << s->it_shift);
s->nic = qemu_new_nic(&net_dp83932_info, &s->conf,
object_get_typename(OBJECT(dev)), dev->id, s);
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s);
s->regs[SONIC_SR] = 0x0004;
memory_region_init_rom_device(&s->prom, OBJECT(dev), NULL, NULL,
"dp8393x-prom", SONIC_PROM_SIZE, NULL);
prom = memory_region_get_ram_ptr(&s->prom);
checksum = 0;
for (i = 0; i < 6; i++) {
prom[i] = s->conf.macaddr.a[i];
checksum += prom[i];
if (checksum > 0xff) {
checksum = (checksum + 1) & 0xff;
}
}
prom[7] = 0xff - checksum;
}
| 1threat |
Postgresql function return affected row count : <p>I created a function. I defined returning value void. But I want to show affected row count. How can I do? </p>
<pre><code>CREATE OR REPLACE FUNCTION update() RETURNS void AS
$BODY$
BEGIN
update test_a set name='cde' where name='abc';
update test_b set name='mno' where name='klm';
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION update()
OWNER TO postgres;
</code></pre>
| 0debug |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
void kvm_irqchip_add_irq_route(KVMState *s, int irq, int irqchip, int pin)
{
struct kvm_irq_routing_entry e;
assert(pin < s->gsi_count);
e.gsi = irq;
e.type = KVM_IRQ_ROUTING_IRQCHIP;
e.flags = 0;
e.u.irqchip.irqchip = irqchip;
e.u.irqchip.pin = pin;
kvm_add_routing_entry(s, &e);
}
| 1threat |
void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp)
{
inet_nonblocking_connect(host_port, tcp_wait_for_connect, s, errp);
}
| 1threat |
How to temporarily make imports from a base github repo point to its fork? : <p>I'm working on an open source Go app. Let's call it "projectA". In it there're multiple packages - "pack1", "pack2" ... "packN". I've forked the repo. I have import like these:</p>
<pre><code>import (
"go_package1"
"go_package2"
//........
"github.com/some_user/projectA/package1"
"github.com/some_user/projectA/package2"
"github.com/some_user/projectA/package3"
)
</code></pre>
<p>accross the code. </p>
<p>I want to temporarily replace or re-point all these imports to "github projectA" such that they point to my fork on github <strong>as I'm working on it</strong>. Otherwise, I won't see changes that I make in these packages because they'll point to the original repo "projectA". </p>
<p>But, it should be in a smart way somehow, such that a PR that I'll make to "projectA" will contain the origin imports.</p>
<p>Or perhaps it could be via local imports somehow?</p>
<p>How can I do that?</p>
| 0debug |
void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq,
int err)
{
#if HAVE_THREADS
pthread_mutex_lock(&mq->lock);
mq->err_recv = err;
pthread_cond_broadcast(&mq->cond);
pthread_mutex_unlock(&mq->lock);
#endif
}
| 1threat |
Fatal error: Uncaught Error: Call to undefined function sellerLogIn() : <p>I'm trying to pass the variables to the function where the actual assigning of values to Session variables are, but it gives me an error where it says the function is undefined</p>
<pre><code>if(isset($_POST['submit'])){
$username=$_POST['un'];
$pass=$_POST['pass'];
$uType=$_POST['logn'];
$conn = new mysqli("localhost","bns_admin","hellobns","buynsave") or die('<script src="Connectfail.js"></script>');
if($uType="seller"){
$query="SELECT * FROM sellers WHERE sellerUserName='".$username."'";
$passQuery="SELECT * FROM sellers WHERE sellerPassWD='".$pass."'";
sellerLogIn($conn,$passQuery,$query,$username,$uType);
}
function sellerLogIn($conn,$passQuery,$query,$username,$uType){
$result=$conn->query($query);
$passResult=$conn->query($passQuery);
if($result && $passResult){
$getIDQ="SELECT sellerID FROM sellers WHERE sellerUserName='".$username."'";
$getID=$conn->query($getIDQ);
$_SESSION['usertype']=$uType;
$_SESSION['username']=$username;
$_SESSION['sellerID']=$getID;
}
else
echo '<script src="logDeb.js"></script>';
}
</code></pre>
| 0debug |
Breakpoints not hit in Xcode (9.3) : <p>None of my breakpoints are being hit.</p>
<p>I've tried the following:</p>
<ul>
<li>Deleted Derived Data directory</li>
<li>Cleaned build folder</li>
<li>Deleted the xcuserdata directory</li>
<li>Made sure build configuration is <code>Debug</code> and <code>Debug executable</code> is
ticked</li>
<li>Made sure <code>Generate debug symbols</code> is set to <code>Yes</code></li>
<li>Changed <code>Optimization level</code> to <code>No optimization</code></li>
</ul>
<p>The breakpoints are still not being hit.</p>
| 0debug |
I need to accept user input immediately upon running my program : <p>First of all, I'm extremely new to Java, so simple answers would be much appreciated.
I'm trying to write a program so that the user can either input the following:</p>
<p>java howManyFiles 10</p>
<p>and get the output:</p>
<p>You selected 10 files.</p>
<p>Or, the user can input the following:</p>
<p>java howManyFiles</p>
<p>and get the output:</p>
<p>How many files would you like?</p>
<p>I can't seem to figure out a way to create a scanner that reads the initial input. The nextLine() scanner method looks for a new user input, rather than checking to see if one already exists. Any help would be a life saver. Thanks</p>
| 0debug |
Why do structured bindings depend on tuple_element? : <p>The <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0144r2.pdf" rel="noreferrer">most recent draft</a> of the structured bindings proposal (on which the C++17 feature was based) requires <code>std::tuple_size</code>, member <code>get</code> or <code>std::get</code>, and <code>std::tuple_element</code>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0144r1.pdf" rel="noreferrer">Previous drafts</a> require only <code>std::tuple_size</code> and member <code>get</code> or <code>std::get</code>. As far as I can tell, there was no discussion on adding this, it just appeared in the final draft. Is there a compelling reason to require the <code>tuple_element</code> specialization, considering I believe it can be implemented in general as</p>
<pre><code>template<std::size_t index, typename T>
struct tuple_element {
using type = decltype(std::get<index>(std::declval<T>()));
};
</code></pre>
<p>Does anyone know of why this requirement was added?</p>
| 0debug |
static void decode_profile_tier_level(HEVCContext *s, PTLCommon *ptl)
{
int i;
HEVCLocalContext *lc = s->HEVClc;
GetBitContext *gb = &lc->gb;
ptl->profile_space = get_bits(gb, 2);
ptl->tier_flag = get_bits1(gb);
ptl->profile_idc = get_bits(gb, 5);
if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN)
av_log(s->avctx, AV_LOG_DEBUG, "Main profile bitstream\n");
else if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN_10)
av_log(s->avctx, AV_LOG_DEBUG, "Main 10 profile bitstream\n");
else if (ptl->profile_idc == FF_PROFILE_HEVC_MAIN_STILL_PICTURE)
av_log(s->avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n");
else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT)
av_log(s->avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n");
else
av_log(s->avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc);
for (i = 0; i < 32; i++)
ptl->profile_compatibility_flag[i] = get_bits1(gb);
ptl->progressive_source_flag = get_bits1(gb);
ptl->interlaced_source_flag = get_bits1(gb);
ptl->non_packed_constraint_flag = get_bits1(gb);
ptl->frame_only_constraint_flag = get_bits1(gb);
skip_bits(gb, 16);
skip_bits(gb, 16);
skip_bits(gb, 12);
}
| 1threat |
Python: Remove one of two JSON elements if they have the same text : <p>How can I remove a JSON element if there's already one with the same text?</p>
| 0debug |
PLEASE How to change width of search Bar in bootstrap i Think its being overwritten when i change the width: 83,33333333% : ***[how do i change the width im being overwritten
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
@media (min-width: 992px)
.col-md-10 {
width: 83.33333333%;
}
@media (min-width: 992px)
.col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9 {
float: left;
}
@media (min-width: 768px)
.col-sm-6 {
width: 50%;
}
<!-- end snippet -->
][1]***
[1]: http:// | 0debug |
how to check input for use ngif? : i want check Comment if is not null open the div
Uncaught Error: Template parse errors:
Unexpected closing tag "div". It may happen when the tag has already been closed by another tag. For more info see
<div class="form-group">
<label>توضیحات</label>
<textarea [(ngModel)]="name" style="direction: rtl; color: rgb(3, 0, 0);" class="form-control" formControlName="Comment"
aria-label="With textarea"></textarea>
</div>
<div *ngIf="{{name}} == ''"></div>
<app-upload style="width: inherit; float: inline-start; width: 100px;"
(onUploadFinished)="uploadFinished($event)"></app-upload>
<img src="http://localhost:54277/{{this.response.dbPath}}" width="200px"
height="200px">
</div> | 0debug |
static double block_angle(int x, int y, int cx, int cy, MotionVector *shift)
{
double a1, a2, diff;
a1 = atan2(y - cy, x - cx);
a2 = atan2(y - cy + shift->y, x - cx + shift->x);
diff = a2 - a1;
return (diff > M_PI) ? diff - 2 * M_PI :
(diff < -M_PI) ? diff + 2 * M_PI :
diff;
}
| 1threat |
static void virtio_9p_get_config(VirtIODevice *vdev, uint8_t *config)
{
struct virtio_9p_config *cfg;
V9fsState *s = to_virtio_9p(vdev);
cfg = g_malloc0(sizeof(struct virtio_9p_config) +
s->tag_len);
stw_raw(&cfg->tag_len, s->tag_len);
memcpy(cfg->tag, s->tag, s->tag_len);
memcpy(config, cfg, s->config_size);
g_free(cfg);
}
| 1threat |
How to set maximum expanded height in android support design bottom sheet? : <p>I already showed my bottom sheet layout with its peek height set to 100dp. But how can I limit my bottom sheet to expand to 500dp only? This is my sample layout:</p>
<pre><code><android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
<android.support.v4.widget.NestedScrollView
android:id="@+id/design_bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
app:behavior_hideable="true"
app:behavior_peekHeight="100dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:background="#e444ff" />
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:background="#e444ff" />
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginBottom="5dp"
android:background="#e444ff" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_margin="@dimen/activity_horizontal_margin"
app:layout_anchor="@+id/design_bottom_sheet"
app:layout_anchorGravity="top|right|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.design.widget.CoordinatorLayout>
</code></pre>
<p>In addition to my question, how can I disallow the user from dragging the bottom sheet up and down?</p>
| 0debug |
Override a property for a single Spring Boot test : <p>Consider the following example:</p>
<pre><code>@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = {
"some.property=valueA"
})
public class ServiceTest {
@Test
public void testA() { ... }
@Test
public void testB() { ... }
@Test
public void testC() { ... }
}
</code></pre>
<p>I'm using <code>SpringBootTest</code> annotation's <code>properties</code> attribute to set <code>some.property</code> property's value for all tests in this test suite. Now I'd like to set another value of this property for one of this tests (let's say <code>testC</code>) without affecting the others. How can I achieve this? I've read the <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html" rel="noreferrer">"Testing" chapter of Spring Boot docs</a>, but I haven't found anything that'd match my use case.</p>
| 0debug |
void *pl110_init(DisplayState *ds, uint32_t base, qemu_irq irq,
int versatile)
{
pl110_state *s;
int iomemtype;
s = (pl110_state *)qemu_mallocz(sizeof(pl110_state));
iomemtype = cpu_register_io_memory(0, pl110_readfn,
pl110_writefn, s);
cpu_register_physical_memory(base, 0x00000fff, iomemtype);
s->base = base;
s->ds = ds;
s->versatile = versatile;
s->irq = irq;
graphic_console_init(ds, pl110_update_display, pl110_invalidate_display,
NULL, s);
return s;
}
| 1threat |
static void FUNCC(pred4x4_127_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
((pixel4*)(src+0*stride))[0]=
((pixel4*)(src+1*stride))[0]=
((pixel4*)(src+2*stride))[0]=
((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4((1<<(BIT_DEPTH-1))-1);
}
| 1threat |
How to make HTTP request to In Flutter Web : <p>I was trying my hands on flutter web. I tried to connect a simple flutter web app I created to mysql database and localhost using the http package. However I dont get any data returned from the request method. When I tried to print out <code>snaphot.error</code> I got this: <code>XMLHttpRequest error</code>. I have this method in a <code>FutureBuilder()</code></p>
<pre><code>getMethod()async{
String theUrl = 'https://localhost/fetchData.php';
var res = await http.get(Uri.encodeFull(theUrl),headers: {"Accept":"application/json"});
var responsBody = json.decode(res.body);
print(responsBody);
return responsBody;
}
</code></pre>
| 0debug |
Hello friends, I need to store the values in variables from dynamic object Array in swift : This is my JSON, The keyfields have n length & based on key length the array object value also increase
{
"key_fields": [
{
"fieldName": "xxxxx"
},
{
"fieldName": "yyyyy"
}
],
"Array": [
{
"xxxxx": 1,
"yyyyy": 2
},
{
"xxxxx": 3,
"yyyyy": 4
}
]
} | 0debug |
after second trigred function button inside execute code twice : i make a game and i have problem that i cant solve.
I have function and inside i have buttons with .click(). After i execute function for second time buttons clicks execute code twice for example i post here a simple code with same problem.
When i click 1st button alert is trigred onece. WHen i click 2nd and then 1st button alert is trigred twice. I want trigre alert just onece. Buttons must stay in function. Sorry for bad English
also jsfiddle here https://jsfiddle.net/o2gxgz9r/25237/
function testf()
{
$("#1").click(function()
{
alert("test");
});
$("#2").click(function()
{
testf();
});
}
testf(); | 0debug |
static void gen_check_interrupts(DisasContext *dc)
{
if (dc->tb->cflags & CF_USE_ICOUNT) {
gen_io_start();
}
gen_helper_check_interrupts(cpu_env);
if (dc->tb->cflags & CF_USE_ICOUNT) {
gen_io_end();
}
}
| 1threat |
Recursive implementation of Greatest Common Divisor in Python : <p>Can someone please help me I am new to programming?</p>
<p>I would like to write a recursive method to get the Greatest Common Divisor in python. </p>
<p>I have been given this:</p>
<pre><code>def gcd(x, y):
while y:
x, y = y, x % y
return abs(x)
</code></pre>
| 0debug |
C# how to restart application with few changes : <p>i created a graphical simulator with c# using toolboxes and timers. I should repeat the same process 3 times for completing a task. The main problem is that it will last too long for me to repeat the same code 3 times. That's why i need a solution thought i can restart my application but with few changes in it. Before i created a button and wrote Apllication.Restart() but it's just returning the starting position of my app. I need the starting position but with a few materials added in their
thank you.</p>
| 0debug |
use formControl in angular code : <p>I'm not able to use formControl in my mat-select.</p>
<p>I'll remove all innecessary data from files.</p>
<p>this is my package.json</p>
<pre><code>"dependencies": {
"@angular/cdk": "5.0.4",
"@angular/common": "~5.2.0",
"@angular/compiler": "~5.2.0",
"@angular/core": "~5.2.0",
"@angular/flex-layout": "2.0.0-beta.12",
"@angular/forms": "~5.2.0",
"@angular/material": "5.0.4"
}
</code></pre>
<p>The folder structure:</p>
<pre><code>-src
-app
-myComponent
-myComponent.component.html
-myComponent.component.ts
-myCompnent.module.ts
-shared
-material
-material.module.ts
-shared.module.ts
</code></pre>
<p>material.module.ts:</p>
<pre><code>import { FormsModule } from '@angular/forms';
import { MatSelectModule } from '@angular/material';
@NgModule({
providers: [],
imports: [
FormsModule
],
exports: [
MatSelectModule
]
})
export class CustomMaterialModule {
}
</code></pre>
<p>shared.module.ts</p>
<pre><code>import { CustomMaterialModule } from './material/material.module';
@NgModule({
exports: [
CustomMaterialModule
],
declarations: []
})
export class SharedModule {
}
</code></pre>
<p>and in myComponent.module </p>
<pre><code>import { SharedModule } from "../shared/shared.module";
@NgModule({
imports: [
SharedModule,
],
declarations: [myComponent],
exports: [myComponent]
})
export class myComponentModule { }
</code></pre>
<p>Now my component.html and ts from <a href="https://material.angular.io/components/select/overview" rel="nofollow noreferrer">https://material.angular.io/components/select/overview</a>:</p>
<pre><code> export class myComponent {
toppings = new FormControl();
toppingList = ['Extra cheese', 'Mushroom', 'Onion', 'Pepperoni', 'Sausage', 'Tomato'];
<mat-form-field>
<mat-select placeholder="Toppings" [formControl]="toppings" multiple>
<mat-select-trigger>
{{toppings.value ? toppings.value[0] : ''}}
<span *ngIf="toppings.value?.length > 1" class="example-additional-selection">
(+{{toppings.value.length - 1}} others)
</span>
</mat-select-trigger>
<mat-option *ngFor="let topping of toppingList" [value]="topping">{{topping}}</mat-option>
</mat-select>
</mat-form-field>
</code></pre>
<p>I have this error when executing:</p>
<pre><code>Can't bind to 'formControl' since it isn't a known property of 'mat-select'.
1. If 'mat-select' is an Angular component and it has 'formControl' input, then verify that it is part of this module.
2. If 'mat-select' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
</code></pre>
<p>What are I'm missing?</p>
| 0debug |
Deserialize from string to object : <p>I been stuck on this problem for long time now so I´m asking here.</p>
<p>I´m getting following error message:</p>
<pre><code>"Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'XXX' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly."
</code></pre>
<p>This is how my class looks like:</p>
<pre><code>public class SSN
{
public IDictionary<string,string> ssns { get; set; }
}
</code></pre>
<p>Here is the json-format:</p>
<p><a href="https://i.stack.imgur.com/brjMQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/brjMQ.png" alt="enter image description here"></a></p>
| 0debug |
Lodash to find if object property exists in array : <p>I have an array of objects like this:</p>
<pre><code>[ {"name": "apple", "id": "apple_0"},
{"name": "dog", "id": "dog_1"},
{"name": "cat", "id": "cat_2"}
]
</code></pre>
<p>I want to insert another element, also named <code>apple</code>, however, because I don't want duplicates in there, how can I use lodash to see if there already is an object in the array with that same name? </p>
| 0debug |
static int64_t realloc_refcount_block(BlockDriverState *bs, int reftable_index,
uint64_t offset)
{
BDRVQcowState *s = bs->opaque;
int64_t new_offset = 0;
void *refcount_block = NULL;
int ret;
new_offset = qcow2_alloc_clusters(bs, s->cluster_size);
if (new_offset < 0) {
fprintf(stderr, "Could not allocate new cluster: %s\n",
strerror(-new_offset));
ret = new_offset;
goto fail;
}
ret = qcow2_cache_get(bs, s->refcount_block_cache, offset, &refcount_block);
if (ret < 0) {
fprintf(stderr, "Could not fetch refcount block: %s\n", strerror(-ret));
goto fail;
}
ret = qcow2_pre_write_overlap_check(bs, 0, new_offset, s->cluster_size);
if (ret < 0) {
fprintf(stderr, "Could not write refcount block; metadata overlap "
"check failed: %s\n", strerror(-ret));
new_offset = 0;
goto fail;
}
ret = bdrv_write(bs->file, new_offset / BDRV_SECTOR_SIZE, refcount_block,
s->cluster_sectors);
if (ret < 0) {
fprintf(stderr, "Could not write refcount block: %s\n", strerror(-ret));
goto fail;
}
assert(!offset_into_cluster(s, new_offset));
s->refcount_table[reftable_index] = new_offset;
ret = write_reftable_entry(bs, reftable_index);
if (ret < 0) {
fprintf(stderr, "Could not update refcount table: %s\n",
strerror(-ret));
goto fail;
}
fail:
if (new_offset && (ret < 0)) {
qcow2_free_clusters(bs, new_offset, s->cluster_size,
QCOW2_DISCARD_ALWAYS);
}
if (refcount_block) {
if (ret < 0) {
qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
} else {
ret = qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block);
}
}
if (ret < 0) {
return ret;
}
return new_offset;
}
| 1threat |
void slavio_intctl_set_cpu(void *opaque, unsigned int cpu, CPUState *env)
{
SLAVIO_INTCTLState *s = opaque;
s->cpu_envs[cpu] = env;
}
| 1threat |
Client is unauthorized to retrieve access tokens using this method Gmail API C# : <p>I am getting the following error when i tried to authorize gmail api using service account</p>
<blockquote>
<p>"Client is unauthorized to retrieve access tokens using this method"</p>
</blockquote>
<pre><code>static async Task MainAsync()
{
sstageEntities db = new sstageEntities();
//UserCredential credential;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
String serviceAccountEmail =
"xxx.iam.gserviceaccount.com";
var certificate = new X509Certificate2(
AppDomain.CurrentDomain.BaseDirectory +
"xxx-8c7a4169631a.p12",
"notasecret",
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.Exportable);
//string userEmail = "user@domainhere.com.au";
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
User = "xxx@xxx.com",
Scopes = new[] { "https://mail.google.com/" }
}.FromCertificate(certificate)
);
// Create Gmail API service.
var gmailService = new GmailService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
// Define parameters of request.
var emailListRequest = gmailService.Users.Messages.List("xxx@xxx.com");
emailListRequest.LabelIds = "INBOX";
emailListRequest.IncludeSpamTrash = true;
emailListRequest.Q = "from:bpm@xxx.co.in is:unread";
//Get our emails
var emailListResponse = await emailListRequest.ExecuteAsync();
</code></pre>
<p>I am using the p12 key which i got while creating service account.But when i run my console app the following error occurs.Any help would be really appreciated.</p>
<p>Thanks in advance !</p>
| 0debug |
static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
int log2w, int log2h, int stride)
{
const int index = size2index[log2h][log2w];
const int h = 1 << log2h;
int code = get_vlc2(&f->gb,
block_type_vlc[1 - (f->version > 1)][index].table,
BLOCK_TYPE_VLC_BITS, 1);
uint16_t *start = (uint16_t *)f->last_picture.data[0];
uint16_t *end = start + stride * (f->avctx->height - h + 1) - (1 << log2w);
av_assert2(code >= 0 && code <= 6);
if (code == 0) {
if (f->g.buffer_end - f->g.buffer < 1) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
return;
}
src += f->mv[bytestream2_get_byte(&f->g)];
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
mcdc(dst, src, log2w, h, stride, 1, 0);
} else if (code == 1) {
log2h--;
decode_p_block(f, dst, src, log2w, log2h, stride);
decode_p_block(f, dst + (stride << log2h),
src + (stride << log2h), log2w, log2h, stride);
} else if (code == 2) {
log2w--;
decode_p_block(f, dst , src, log2w, log2h, stride);
decode_p_block(f, dst + (1 << log2w),
src + (1 << log2w), log2w, log2h, stride);
} else if (code == 3 && f->version < 2) {
mcdc(dst, src, log2w, h, stride, 1, 0);
} else if (code == 4) {
if (f->g.buffer_end - f->g.buffer < 1) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
return;
}
src += f->mv[bytestream2_get_byte(&f->g)];
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
if (f->g2.buffer_end - f->g2.buffer < 1){
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
mcdc(dst, src, log2w, h, stride, 1, bytestream2_get_le16(&f->g2));
} else if (code == 5) {
if (f->g2.buffer_end - f->g2.buffer < 1) {
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2));
} else if (code == 6) {
if (f->g2.buffer_end - f->g2.buffer < 2) {
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return;
}
if (log2w) {
dst[0] = bytestream2_get_le16(&f->g2);
dst[1] = bytestream2_get_le16(&f->g2);
} else {
dst[0] = bytestream2_get_le16(&f->g2);
dst[stride] = bytestream2_get_le16(&f->g2);
}
}
}
| 1threat |
static void mov_fix_index(MOVContext *mov, AVStream *st)
{
MOVStreamContext *msc = st->priv_data;
AVIndexEntry *e_old = st->index_entries;
int nb_old = st->nb_index_entries;
const AVIndexEntry *e_old_end = e_old + nb_old;
const AVIndexEntry *current = NULL;
MOVStts *ctts_data_old = msc->ctts_data;
int64_t ctts_index_old = 0;
int64_t ctts_sample_old = 0;
int64_t ctts_count_old = msc->ctts_count;
int64_t edit_list_media_time = 0;
int64_t edit_list_duration = 0;
int64_t frame_duration = 0;
int64_t edit_list_dts_counter = 0;
int64_t edit_list_dts_entry_end = 0;
int64_t edit_list_start_ctts_sample = 0;
int64_t curr_cts;
int64_t curr_ctts = 0;
int64_t min_corrected_pts = -1;
int64_t empty_edits_sum_duration = 0;
int64_t edit_list_index = 0;
int64_t index;
int flags;
int64_t start_dts = 0;
int64_t edit_list_start_encountered = 0;
int64_t search_timestamp = 0;
int64_t* frame_duration_buffer = NULL;
int num_discarded_begin = 0;
int first_non_zero_audio_edit = -1;
int packet_skip_samples = 0;
MOVIndexRange *current_index_range;
int i;
int found_keyframe_after_edit = 0;
if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) {
return;
}
msc->index_ranges = av_malloc((msc->elst_count + 1) * sizeof(msc->index_ranges[0]));
if (!msc->index_ranges) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n");
return;
}
msc->current_index_range = msc->index_ranges;
current_index_range = msc->index_ranges - 1;
st->index_entries = NULL;
st->index_entries_allocated_size = 0;
st->nb_index_entries = 0;
msc->ctts_data = NULL;
msc->ctts_count = 0;
msc->ctts_index = 0;
msc->ctts_sample = 0;
msc->ctts_allocated_size = 0;
if (msc->dts_shift > 0) {
edit_list_dts_entry_end -= msc->dts_shift;
av_log(mov->fc, AV_LOG_DEBUG, "Shifting DTS by %d because of negative CTTS.\n", msc->dts_shift);
}
start_dts = edit_list_dts_entry_end;
while (get_edit_list_entry(mov, msc, edit_list_index, &edit_list_media_time,
&edit_list_duration, mov->time_scale)) {
av_log(mov->fc, AV_LOG_DEBUG, "Processing st: %d, edit list %"PRId64" - media time: %"PRId64", duration: %"PRId64"\n",
st->index, edit_list_index, edit_list_media_time, edit_list_duration);
edit_list_index++;
edit_list_dts_counter = edit_list_dts_entry_end;
edit_list_dts_entry_end += edit_list_duration;
num_discarded_begin = 0;
if (edit_list_media_time == -1) {
empty_edits_sum_duration += edit_list_duration;
continue;
}
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
if (first_non_zero_audio_edit < 0) {
first_non_zero_audio_edit = 1;
} else {
first_non_zero_audio_edit = 0;
}
if (first_non_zero_audio_edit > 0)
st->skip_samples = msc->start_pad = 0;
}
search_timestamp = edit_list_media_time;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp);
}
if (find_prev_closest_index(st, e_old, nb_old, ctts_data_old, ctts_count_old, search_timestamp, 0,
&index, &ctts_index_old, &ctts_sample_old) < 0) {
av_log(mov->fc, AV_LOG_WARNING,
"st: %d edit list: %"PRId64" Missing key frame while searching for timestamp: %"PRId64"\n",
st->index, edit_list_index, search_timestamp);
if (find_prev_closest_index(st, e_old, nb_old, ctts_data_old, ctts_count_old, search_timestamp, AVSEEK_FLAG_ANY,
&index, &ctts_index_old, &ctts_sample_old) < 0) {
av_log(mov->fc, AV_LOG_WARNING,
"st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n",
st->index, edit_list_index, search_timestamp);
index = 0;
ctts_index_old = 0;
ctts_sample_old = 0;
}
}
current = e_old + index;
edit_list_start_ctts_sample = ctts_sample_old;
edit_list_start_encountered = 0;
found_keyframe_after_edit = 0;
for (; current < e_old_end; current++, index++) {
frame_duration = (current + 1 < e_old_end) ?
((current + 1)->timestamp - current->timestamp) : edit_list_duration;
flags = current->flags;
curr_cts = current->timestamp + msc->dts_shift;
curr_ctts = 0;
if (ctts_data_old && ctts_index_old < ctts_count_old) {
curr_ctts = ctts_data_old[ctts_index_old].duration;
av_log(mov->fc, AV_LOG_DEBUG, "stts: %"PRId64" ctts: %"PRId64", ctts_index: %"PRId64", ctts_count: %"PRId64"\n",
curr_cts, curr_ctts, ctts_index_old, ctts_count_old);
curr_cts += curr_ctts;
ctts_sample_old++;
if (ctts_sample_old == ctts_data_old[ctts_index_old].count) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&msc->ctts_allocated_size,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old,
ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
ctts_index_old++;
ctts_sample_old = 0;
edit_list_start_ctts_sample = 0;
}
}
if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id != AV_CODEC_ID_VORBIS &&
curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&
first_non_zero_audio_edit > 0) {
packet_skip_samples = edit_list_media_time - curr_cts;
st->skip_samples += packet_skip_samples;
edit_list_dts_counter -= packet_skip_samples;
if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
if (frame_duration_buffer) {
fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, num_discarded_begin);
}
}
av_log(mov->fc, AV_LOG_DEBUG, "skip %d audio samples from curr_cts: %"PRId64"\n", packet_skip_samples, curr_cts);
} else {
flags |= AVINDEX_DISCARD_FRAME;
av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index);
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) {
num_discarded_begin++;
frame_duration_buffer = av_realloc(frame_duration_buffer,
num_discarded_begin * sizeof(int64_t));
if (!frame_duration_buffer) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot reallocate frame duration buffer\n");
break;
}
frame_duration_buffer[num_discarded_begin - 1] = frame_duration;
if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) {
st->skip_samples += frame_duration;
}
}
}
} else {
if (min_corrected_pts < 0) {
min_corrected_pts = edit_list_dts_counter + curr_ctts + msc->dts_shift;
} else {
min_corrected_pts = FFMIN(min_corrected_pts, edit_list_dts_counter + curr_ctts + msc->dts_shift);
}
if (edit_list_start_encountered == 0) {
edit_list_start_encountered = 1;
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) {
fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter,
frame_duration_buffer, num_discarded_begin);
}
}
}
if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size,
current->min_distance, flags) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n");
break;
}
if (current_index_range < msc->index_ranges || index != current_index_range->end) {
current_index_range++;
current_index_range->start = index;
}
current_index_range->end = index + 1;
if (edit_list_start_encountered > 0) {
edit_list_dts_counter = edit_list_dts_counter + frame_duration;
}
if ((curr_cts + frame_duration >= (edit_list_duration + edit_list_media_time)) &&
((flags & AVINDEX_KEYFRAME) || ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)))) {
if (ctts_data_old) {
if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO && found_keyframe_after_edit == 0) {
found_keyframe_after_edit = 1;
continue;
}
if (ctts_sample_old != 0) {
if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count,
&msc->ctts_allocated_size,
ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration) == -1) {
av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n",
ctts_index_old, ctts_sample_old - edit_list_start_ctts_sample,
ctts_data_old[ctts_index_old].duration);
break;
}
}
}
break;
}
}
}
min_corrected_pts -= empty_edits_sum_duration;
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && min_corrected_pts > 0) {
av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by %"PRId64" to make first pts zero.\n", min_corrected_pts);
for (i = 0; i < st->nb_index_entries; ++i) {
st->index_entries[i].timestamp -= min_corrected_pts;
}
}
st->duration = edit_list_dts_entry_end - start_dts;
msc->start_pad = st->skip_samples;
av_free(e_old);
av_free(ctts_data_old);
current_index_range++;
current_index_range->start = 0;
current_index_range->end = 0;
msc->current_index = msc->index_ranges[0].start;
} | 1threat |
ansible SSH connection fail : <p>I'm trying to run ansible role on multiple servers, but i get an error:</p>
<blockquote>
<p>fatal: [192.168.0.10]: UNREACHABLE! => {"changed": false, "msg":
"Failed to connect to the host via ssh.", "unreachable": true}</p>
</blockquote>
<p>My /etc/ansible/hosts file looks like this:</p>
<pre><code>192.168.0.10 ansible_sudo_pass='passphrase' ansible_ssh_user=user
192.168.0.11 ansible_sudo_pass='passphrase' ansible_ssh_user=user
192.168.0.12 ansible_sudo_pass='passphrase' ansible_ssh_user=user
</code></pre>
<p>I have no idea what's going on - everything looks fine - I can login via SSH, but ansible ping returns the same error.</p>
<p>The log from verbose execution:</p>
<blockquote>
<p><192.168.0.10> ESTABLISH SSH CONNECTION FOR USER: user <192.168.0.10>
SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o User=user -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.0.10
'/bin/sh -c '"'"'( umask 22 && mkdir -p "<code>echo
$HOME/.ansible/tmp/ansible-tmp-1463151813.31-156630225033829</code>" &&
echo "<code>echo
$HOME/.ansible/tmp/ansible-tmp-1463151813.31-156630225033829</code>"
)'"'"''</p>
</blockquote>
<p>Can you help me somehow? If I have to use ansible in local mode (-c local), then it's useless.</p>
<p>I've tried to delete ansible_sudo_pass and ansible_ssh_user, but it did'nt help.</p>
| 0debug |
Import IntelliJ key bindings to Xcode : <p>Is there a keymap for Xcode that would make it behave the same as products from JetBrains? (IntelliJ keymap)</p>
<p>I tried Googling, but Google is completely useless in this case, as it presents results for the other way around (importing Xcode key map to IntelliJ products), when searching for "import intellij key bindings into xcode".</p>
<p>I'd prefer not to see myself reassigning all the bindings manually :)</p>
| 0debug |
what does "echo" mean when it comes to using maven : I'm currently learning how to use Maven and have encountered a term called "echo". I was just wondering what it actually means? Thanks in advance for any suggestions and help!
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/7MhXb.png | 0debug |
qemu_acl *qemu_acl_init(const char *aclname)
{
qemu_acl *acl;
acl = qemu_acl_find(aclname);
if (acl)
return acl;
acl = qemu_malloc(sizeof(*acl));
acl->aclname = qemu_strdup(aclname);
acl->defaultDeny = 1;
acl->nentries = 0;
TAILQ_INIT(&acl->entries);
acls = qemu_realloc(acls, sizeof(*acls) * (nacls +1));
acls[nacls] = acl;
nacls++;
return acl;
}
| 1threat |
static inline void gen_movcf_s (int fs, int fd, int cc, int tf)
{
uint32_t ccbit;
int cond;
TCGv r_tmp1 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp0 = tcg_temp_local_new(TCG_TYPE_I32);
TCGv fp1 = tcg_temp_local_new(TCG_TYPE_I32);
int l1 = gen_new_label();
if (cc)
ccbit = 1 << (24 + cc);
else
ccbit = 1 << 23;
if (tf)
cond = TCG_COND_EQ;
else
cond = TCG_COND_NE;
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, fd);
tcg_gen_andi_i32(r_tmp1, fpu_fcr31, ccbit);
tcg_gen_brcondi_i32(cond, r_tmp1, 0, l1);
tcg_gen_mov_i32(fp1, fp0);
tcg_temp_free(fp0);
gen_set_label(l1);
tcg_temp_free(r_tmp1);
gen_store_fpr32(fp1, fd);
tcg_temp_free(fp1);
}
| 1threat |
import re
def remove_lowercase(str1):
remove_lower = lambda text: re.sub('[a-z]', '', text)
result = remove_lower(str1)
return result | 0debug |
Does Firebase Analytics Work Offline? : <p>I know Firebase in general works offline, and syncs whenever an opportunity. Does the same thing apply to Firebase-Analytics for mobile (Android, iOS) apps?</p>
<p>If yes (or partially yes) - how long can the user be offline?</p>
| 0debug |
How would I print a random array element? : <p>I'm trying to print a random element, to create a random guessing game, but i dont know how i would call a random element. How would i make a random number that the array would take and output the element assigned to that number?</p>
| 0debug |
Gradle: How to get output from test STDERR/STDOUT into console? : <p>(Gradle 3.2.1) I run some java tests, which logs output in Stderr/Stdout. I can see that output, if I start</p>
<pre><code>gradle test --info
</code></pre>
<p>but in that case, much of unwanted output from 3-rd party libraries is there too.</p>
<p><a href="https://docs.gradle.org/current/userguide/logging.html#sec:external_tools" rel="noreferrer">Documentation</a> suggests using <code>logging.caputureStandardError / logging.caputureStandardError (loglevel)</code>, but it doesn't seem to have any effect.</p>
<pre><code>tasks.withType(Test) {
logging.captureStandardOutput LogLevel.QUIET
logging.captureStandardError LogLevel.QUIET
}
</code></pre>
<p>Then if running <code>gradle test</code>, not STDERR/STDOUT is output in console.</p>
<p>How can I get just the output from the tests classes in console?</p>
| 0debug |
How to average all columns in dataset by group : <p>I'm using aggregate in R to try and summarize my dataset. I currently have 3-5 observation per ID and I need to average these so that I have 1 value (the mean) per ID. Some columns are returning all "NA" when I use aggregate. </p>
<p>So far, I've created a vector for each column to average it, then tried to use merge to combine all of them. Some columns are characters, so I tried converting them to numbers using as.numeric(as.character(column)), but that returns too many NA in the column. </p>
<pre><code>library(dplyr)
Tr1 <- data %>% group_by(ID) %>% summarise(mean = mean(Tr1))
Tr2 <- data %>% group_by(ID) %>% summarise(mean = mean(Tr2))
Tr3 <- data %>% group_by(ID) %>% summarise(mean = mean(Tr3))
data2 <- merge(Tr1,Tr2,Tr3, by = ID)
</code></pre>
<p>From this code I get error codes: </p>
<pre><code>There were 50 or more warnings (use warnings() to see the first 50)
</code></pre>
<p>then,</p>
<pre><code>Error in fix.by(by.x, x) :
'by' must specify one or more columns as numbers, names or logical
</code></pre>
<p>My original dataset looks like:</p>
<pre><code>ID Tr1 Tr2 Tr3
1 4 5 6
1 5 3 9
1 3 5 9
4 5 1 8
4 2 6 4
6 2 8 6
6 2 7 4
6 7 1 9
</code></pre>
<p>and I am trying to find a code so that it looks like:</p>
<pre><code>ID Tr1 Tr2 Tr3
1 4 4.3 8
4 3.5 3.5 6
6 3.7 5.3 6.3
</code></pre>
| 0debug |
void ff_frame_thread_encoder_free(AVCodecContext *avctx){
int i;
ThreadContext *c= avctx->internal->frame_thread_encoder;
pthread_mutex_lock(&c->task_fifo_mutex);
c->exit = 1;
pthread_cond_broadcast(&c->task_fifo_cond);
pthread_mutex_unlock(&c->task_fifo_mutex);
for (i=0; i<avctx->thread_count; i++) {
pthread_join(c->worker[i], NULL);
}
pthread_mutex_destroy(&c->task_fifo_mutex);
pthread_mutex_destroy(&c->finished_task_mutex);
pthread_mutex_destroy(&c->buffer_mutex);
pthread_cond_destroy(&c->task_fifo_cond);
pthread_cond_destroy(&c->finished_task_cond);
av_fifo_freep(&c->task_fifo);
av_freep(&avctx->internal->frame_thread_encoder);
}
| 1threat |
How do I get Python Split to work properly? : I have a problem with python split which I can't figure out what I am missing that results in the split function not to work properly. I have been using similar splits before and they worked just fine.
content=open(file).read)()
Sep = content.split(r'Document [a-zA-Z0-9]{25}\n')
The file I am reading is something very easy as:
"I like coffee.
Document CLASSAR020181030eeat0000l
I like tea as well.
Document CLASSAR020181030eeat0000l
I like both coffee and tea."
Any help will be appreciated. | 0debug |
ExtJS 6. Use data from 1st store in 2nd store constructor : <p>There are 2 stores. I need data from 1st store in 2nd store constructor. How can it be done?</p>
| 0debug |
Javascript doesn't update Inputs : <p>I'm trying to create some temperature converters, but i can't do it because innerHTML doesn't update the values in the Input Boxes.</p>
<p>I used some console.log to check for the values of valID and valNum, but both seemed ok, so i don't understand why the code doesn't work.</p>
<p>
</p>
<pre><code><body>
<h2><u>Temperature Converter</u></h2>
<p>
<label>Fahrenheit</label>
<input id="fahrenheit" type="number" placeholder="Fahrenheit" onchange="tempConverter(this.id, this.value)" oninput="tempConverter(this.id, this.value)">
</p>
<p>
<label>Celsius</label>
<input id="celsius" type="number" placeholder="Celsius" onchange="tempConverter(this.id, this.value)" oninput="tempConverter(this.id, this.value)">
</p>
<p>
<label>Kelvin</label>
<input id="kelvin" type="number" placeholder="Kelvin" onchange="tempConverter(this.id, this.value)" oninput="tempConverter(this.id, this.value)">
</p>
<script>
function tempConverter(valID, valNum)
{
valNum = parseFloat(valNum);
if (valID === "fahrenheit")
{
document.getElementById("celsius").innerHTML = (valNum - 32) / 1.8;
document.getElementById("kelvin").innerHTML = ((valNum - 32) / 1.8) + 273.15;
}
if (valID === "celsius")
{
document.getElementById("fahrenheit").innerHTML = (valNum * 1.8) + 32;
document.getElementById("kelvin").innerHTML = valNum + 273.15;
}
if (valID === "kelvin")
{
document.getElementById("fahrenheit").innerHTML = ((valNum - 273.15) * 1.8) + 32;
document.getElementById("celsius").innerHTML = valNum - 273.15;
}
}
</script>
</body>
</code></pre>
<p></p>
| 0debug |
Cell from Xib with Swift 3 : <p>I already read and saw some videos about this subject but i can't get this to work. Im trying to a cell from a xib instead of the storyboard.</p>
<p>This is my ViewController (where i have the Table View).</p>
<pre><code>import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CellTableView
cell.test.text = "A";
return cell;
}
}
</code></pre>
<p>This is my CellTableView (the class where i have my Cell):</p>
<pre><code>import UIKit
class CellTableView: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
@IBOutlet var teste: UILabel!
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
</code></pre>
<p>I always used the Table View Cell inside the Table View on the StoryBoard but i want to try a XIB approach now.</p>
<p>I added the <strong>cell</strong> Identifier on the cell XIB to call it with the dequeueReusableCell method.</p>
<p>What i could be doing wrong? I tried to Outlet the <strong>dataSource</strong> and the <strong>delegate</strong> of the Table View but i got an error (and i think its not the right steps).</p>
| 0debug |
static bool msix_vector_masked(PCIDevice *dev, unsigned int vector, bool fmask)
{
unsigned offset = vector * PCI_MSIX_ENTRY_SIZE;
uint32_t *data = (uint32_t *)&dev->msix_table[offset + PCI_MSIX_ENTRY_DATA];
if (xen_is_pirq_msi(*data)) {
return false;
}
return fmask || dev->msix_table[offset + PCI_MSIX_ENTRY_VECTOR_CTRL] &
PCI_MSIX_ENTRY_CTRL_MASKBIT;
}
| 1threat |
static void omap_l4_io_writeh(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
return omap_l4_io_writeh_fn[i](omap_l4_io_opaque[i], addr, value);
}
| 1threat |
void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
uint32_t event, uint32_t reason)
{
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
VirtIOSCSIReq *req;
VirtIOSCSIEvent *evt;
VirtIODevice *vdev = VIRTIO_DEVICE(s);
if (!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
return;
}
if (s->dataplane_started) {
assert(s->ctx);
aio_context_acquire(s->ctx);
}
req = virtio_scsi_pop_req(s, vs->event_vq);
if (!req) {
s->events_dropped = true;
goto out;
}
if (s->events_dropped) {
event |= VIRTIO_SCSI_T_EVENTS_MISSED;
s->events_dropped = false;
}
if (virtio_scsi_parse_req(req, 0, sizeof(VirtIOSCSIEvent))) {
virtio_scsi_bad_req();
}
evt = &req->resp.event;
memset(evt, 0, sizeof(VirtIOSCSIEvent));
evt->event = virtio_tswap32(vdev, event);
evt->reason = virtio_tswap32(vdev, reason);
if (!dev) {
assert(event == VIRTIO_SCSI_T_EVENTS_MISSED);
} else {
evt->lun[0] = 1;
evt->lun[1] = dev->id;
if (dev->lun >= 256) {
evt->lun[2] = (dev->lun >> 8) | 0x40;
}
evt->lun[3] = dev->lun & 0xFF;
}
virtio_scsi_complete_req(req);
out:
if (s->dataplane_started) {
aio_context_release(s->ctx);
}
}
| 1threat |
Will an instant return function call compile to a "nop" instruction? : <p>Say I have a function:</p>
<pre><code>void foo ( int bar ){
return;
}
</code></pre>
<p>will this compile to a <code>nop</code> instruction?</p>
| 0debug |
Difference between junit-jupiter-api and junit-jupiter-engine : <p>What is difference between maven modules <code>junit-jupiter-api</code> and <code>junit-jupiter-engine</code>? Is it necessary to include both dependencies in <code>build.gradle</code>?</p>
<p>Do I need to write both dependencies like </p>
<pre><code>testCompile("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
</code></pre>
<p>or </p>
<pre><code>testCompile("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
</code></pre>
<p>is enough?</p>
<p>And do I need to add dependency on <code>junit-vintage-engine</code>?</p>
| 0debug |
Calling action from constructor vs a life cycle method : <p>Where's the best place to call an action that will make an API call to hydrate my state? Constructor or one of the life cycle methods e.g. ComponentWillMount?</p>
| 0debug |
void pcmcia_socket_register(PCMCIASocket *socket)
{
struct pcmcia_socket_entry_s *entry;
entry = g_malloc(sizeof(struct pcmcia_socket_entry_s));
entry->socket = socket;
entry->next = pcmcia_sockets;
pcmcia_sockets = entry;
}
| 1threat |
Please help me make a script of autodownloading file from FTP : I need a simple scirpt which will download file/files from my external FTP server.
I tried to run it in batch file, but it didn't work:
ftp yourftpaddress
user yourusername
yourpassword
get yourfile.type
bye
pause
I need it for Windows 7
Please, help! :( | 0debug |
Android 7 WebView with wrap_content : <p>I have a <code>WebView</code> with <code>android:layout_height="wrap_content"</code> inside a <code>ScrollView</code>. Prior to Android 7 this resulted in the WebView resizing to the height of the local html content I set with <code>loadData</code>. On my Nexus 5X with Android 7 though, the WebView height seems to be unreliable, sometimes it only shows parts of the first text line, sometimes there's a big gap at the end of the content.<br>
I think it could be due to Google now using Chrome for WebViews starting with Nougat.
Does anyone have an explanation or fix/workaround for this issue? </p>
<p>It might also be important that the views are contained in the cells of a <code>RecyclerView</code> .</p>
| 0debug |
Find shortest path between multiple locations c# : <p>I have list of location with their coordinates and also current location with lat long.
Now,i want to find shortest route according to my list of locations(lat-longs)</p>
<p>Just i need to sort the location according to route wise.</p>
<p>Any help will be appreciated.</p>
| 0debug |
static ssize_t test_block_init_func(QCryptoBlock *block,
size_t headerlen,
Error **errp,
void *opaque)
{
Buffer *header = opaque;
g_assert_cmpint(header->capacity, ==, 0);
buffer_reserve(header, headerlen);
return headerlen;
}
| 1threat |
void kbd_put_keycode(int keycode)
{
if (!runstate_is_running()) {
return;
}
if (qemu_put_kbd_event) {
qemu_put_kbd_event(qemu_put_kbd_event_opaque, keycode);
}
}
| 1threat |
Make struct Hashable? : <p>I'm trying to create a dictionary of the sort <code>[petInfo : UIImage]()</code> but I'm getting the error <code>Type 'petInfo' does not conform to protocol 'Hashable'</code>. My petInfo struct is this:</p>
<pre><code>struct petInfo {
var petName: String
var dbName: String
}
</code></pre>
<p>So I want to somehow make it hashable but none of its components are an integer which is what the <code>var hashValue: Int</code> requires. How can I make it conform to the protocol if none of its fields are integers? Can I use the <code>dbName</code> if I know it's going to be unique for all occurrences of this struct?</p>
| 0debug |
Using Dart (webdev) to write a js library / expose a dart api to js. IN THE BROWSER : <p>Please give a simple but complete example showing how to write a library in dart that can be used from javascript in the browser without using requirejs. </p>
<p>The library should contain a function, a class and a global variable. </p>
<p>A reference to sass-dart is not a solution to that problem because it is for use with nodejs and requirejs.</p>
| 0debug |
array and .push? waht does it do? : <p>What does this code mean? I know that we are declaring var points as an array and we're using a loop but im not too experienced to fully understand. can someone elaborate?</p>
<pre><code> var points = [];
for (var i = 0; i < x; i++) {
points.push( random() );
}
return points;
};
</code></pre>
| 0debug |
Sequelize Sync vs Migrations : <p>Im learning Sequelize and I'd like some clarification around syncing vs migrations.</p>
<p>I understand that sync will create missing tables based on my model schema but I have also read that sync is meant for initializing the database whereas migrations are meant for production.</p>
<p>If that is the case, the express-example shows <a href="https://github.com/sequelize/express-example/blob/master/bin/www#L23" rel="noreferrer">calling sync from <code>bin/www</code></a>. Is that something that should not be used in production?</p>
<p>As an extension of this, if I am not to use sync in production, how do you apply model associations? Do I need to add them to migrations manually?</p>
<p>Essentially I am asking for an explanation of how these two concepts are meant to work together.</p>
<p>Thanks</p>
| 0debug |
how to insert a colon in between string as like date formats in c++ : I have string 20150410 121416 in c++
output- 20150410 12:14:16
how can i insert a colon to the string.Can anyone please help me out. | 0debug |
How do I code so a picture can be cropped on android app? : <p>here is my java:</p>
<pre><code>public class MainPage extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener {
TabLayout tabLayout;
ViewPageAdapter viewPageAdapter;
ViewPager viewPager;
ImageView pfp;
Bitmap bitmap_one;
private String UPLOAD_URL = "http://.php";
private int PICK_IMAGE_REQUEST = 1;
private String KEY_IMAGE = "image";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_page);
initTypeface();
String username = getIntent().getStringExtra("Username");
TextView tv = (TextView)findViewById(R.id.usernameND);
tv.setText(username);
//id's
pfp = (ImageView) findViewById(R.id.imageView_one);
pfp.setOnClickListener(this);
//SearchIntent
Intent searchI = getIntent();
if (Intent.ACTION_SEARCH.equals(searchI.getAction())) {
String query = searchI.getStringExtra(SearchManager.QUERY);
Toast.makeText(MainPage.this, query, Toast.LENGTH_SHORT).show();
}
//Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(null);
//Tabs
tabLayout = (TabLayout) findViewById(R.id.tablayout_two);
viewPager = (ViewPager) findViewById(R.id.viewPager_two);
viewPageAdapter = new ViewPageAdapter(getSupportFragmentManager());
viewPageAdapter.addFragments(new FeedFragment(), "Feed");
viewPageAdapter.addFragments(new MessagesFragment(), "Messages");
viewPageAdapter.addFragments(new NotificationsFragment(), "Notifications");
viewPager.setAdapter(viewPageAdapter);
tabLayout.setupWithViewPager(viewPager);
//FloatingActionButton
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
//NavigationDrawer
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.profile) {
Intent i = new Intent(this, Profile.class);
startActivity(i);
} else if (id == R.id.whatshot) {
Intent i = new Intent(this, WhatsHot.class);
startActivity(i);
} else if (id == R.id.trending) {
Intent i = new Intent(this, Trending.class);
startActivity(i);
} else if (id == R.id.radioplayer) {
Intent i = new Intent(this, Radio.class);
startActivity(i);
} else if (id == R.id.musicplayer) {
Intent i = new Intent(this, MusicPlayer.class);
startActivity(i);
} else if (id == R.id.settings) {
Intent i = new Intent(this, Settings.class);
startActivity(i);
} else if (id == R.id.info) {
Intent i = new Intent(this, Info.class);
startActivity(i);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.search_view).getActionView();
SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
return super.onCreateOptionsMenu(menu);
}
//ImageInfo
private void showFileChooser() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
Uri filePath = data.getData();
try {
bitmap_one = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
pfp.setImageBitmap(bitmap_one);
} catch (IOException e) {
e.printStackTrace();
}
}
}
//Typeface
private void initTypeface() {
Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/Amble-Regular.ttf");
TextView text = (TextView) findViewById(R.id.toolbarTitle);
text.setTypeface(myTypeface);
myTypeface = Typeface.createFromAsset(getAssets(), "fonts/Amble-Regular.ttf");
text = (TextView) findViewById(R.id.usernameND);
text.setTypeface(myTypeface);
}
@Override
public void onClick(View v) {
if (v == pfp) {
showFileChooser();
}
}
</code></pre>
<p>}</p>
<p>Here is my xml:</p>
<pre><code> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main_page"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#e9eaea"
app:itemIconTint="#2A363B"
app:itemTextColor="#2A363B"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main_page"
app:menu="@menu/main_page_drawer">
<ImageView
android:id="@+id/imageView_one"
android:layout_width="90dp"
android:scaleType="fitCenter"
android:padding="5dp"
android:background="#2A363B"
android:adjustViewBounds="true"
android:onClick="pfpClick"
android:layout_marginLeft="8dp"
android:layout_marginTop="20dp"
android:layout_height="90dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="108dp"
android:text=""
android:textColor="#FFf"
android:textSize="18sp"
android:id="@+id/usernameND"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
android:id="@+id/textView"
android:layout_marginTop="126dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
</code></pre>
<p>What I want to know is, how can I code my app so onclick of my imageview (imageView_one) it opens up a window or an editor so I can crop a pic into a square so it fits and places it on the Imageview. that is what i am trying to figure out. I am new to android so thank you.</p>
| 0debug |
static void portio_list_add_1(PortioList *piolist,
const MemoryRegionPortio *pio_init,
unsigned count, unsigned start,
unsigned off_low, unsigned off_high)
{
MemoryRegionPortio *pio;
MemoryRegionOps *ops;
MemoryRegion *region, *alias;
unsigned i;
pio = g_new(MemoryRegionPortio, count + 1);
memcpy(pio, pio_init, sizeof(MemoryRegionPortio) * count);
memset(pio + count, 0, sizeof(MemoryRegionPortio));
for (i = 0; i < count; ++i) {
pio[i].offset -= off_low;
}
ops = g_new0(MemoryRegionOps, 1);
ops->old_portio = pio;
region = g_new(MemoryRegion, 1);
alias = g_new(MemoryRegion, 1);
memory_region_init_io(region, ops, piolist->opaque, piolist->name,
INT64_MAX);
memory_region_init_alias(alias, piolist->name,
region, start + off_low, off_high - off_low);
memory_region_add_subregion(piolist->address_space,
start + off_low, alias);
piolist->regions[piolist->nr] = region;
piolist->aliases[piolist->nr] = alias;
++piolist->nr;
}
| 1threat |
static void scsi_realize(SCSIDevice *dev, Error **errp)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
Error *err = NULL;
if (!s->qdev.conf.bs) {
error_setg(errp, "drive property not set");
return;
}
if (!(s->features & (1 << SCSI_DISK_F_REMOVABLE)) &&
!bdrv_is_inserted(s->qdev.conf.bs)) {
error_setg(errp, "Device needs media, but drive is empty");
return;
}
blkconf_serial(&s->qdev.conf, &s->serial);
if (dev->type == TYPE_DISK) {
blkconf_geometry(&dev->conf, NULL, 65535, 255, 255, &err);
if (err) {
error_propagate(errp, err);
return;
}
}
if (s->qdev.conf.discard_granularity == -1) {
s->qdev.conf.discard_granularity =
MAX(s->qdev.conf.logical_block_size, DEFAULT_DISCARD_GRANULARITY);
}
if (!s->version) {
s->version = g_strdup(qemu_get_version());
}
if (!s->vendor) {
s->vendor = g_strdup("QEMU");
}
if (bdrv_is_sg(s->qdev.conf.bs)) {
error_setg(errp, "unwanted /dev/sg*");
return;
}
if ((s->features & (1 << SCSI_DISK_F_REMOVABLE)) &&
!(s->features & (1 << SCSI_DISK_F_NO_REMOVABLE_DEVOPS))) {
bdrv_set_dev_ops(s->qdev.conf.bs, &scsi_disk_removable_block_ops, s);
} else {
bdrv_set_dev_ops(s->qdev.conf.bs, &scsi_disk_block_ops, s);
}
bdrv_set_guest_block_size(s->qdev.conf.bs, s->qdev.blocksize);
bdrv_iostatus_enable(s->qdev.conf.bs);
}
| 1threat |
I'm going INSANE! I am trying to make an 'IMAGE' Embed code responsive in CSS - won't work : PLEASE HELP
So I have an embed code for an single image taken from a host picture archive. I want to attach the embed to my website so no one can drag the picture off and steal it.
The problem is it needs to be responsive to height and width and the set values in the embed are making it very difficult.
I have changed the width to 100% but obviously it makes the height non responsive - height is currently set at 1000. I can manually change them but it does not comply across all devices.
I need the image to shrink to the bloody device I am using it on and be responsive If i make my browser smaller or larger
Here is the embed code I have been putting into my CSS on Wordpress
Please Help
<iframe id="embed-frame-11855" style="border: 0px none;" src="http://media.atlanticimages.uk/embed/0x4c6679423647313463494761457a726c3973553870336a6364327a58306b7771744c543334524e316f62433478354644704c744778596f6d727275427531794438384f556f7a6e3134623150486c796f31424f4b446b2f47734a354b707052434c47334449334345526a6b76353273426f463343344759544c50507174686463" width="686" height="1000" scrolling="no" data-image-link="http://media.atlanticimages.uk/item/en/1/11855"></iframe>
| 0debug |
CPUAlphaState * cpu_alpha_init (const char *cpu_model)
{
CPUAlphaState *env;
int implver, amask, i, max;
env = qemu_mallocz(sizeof(CPUAlphaState));
cpu_exec_init(env);
alpha_translate_init();
tlb_flush(env, 1);
implver = IMPLVER_21264;
amask = (AMASK_BWX | AMASK_FIX | AMASK_CIX | AMASK_MVI
| AMASK_TRAP | AMASK_PREFETCH);
max = ARRAY_SIZE(cpu_defs);
for (i = 0; i < max; i++) {
if (strcmp (cpu_model, cpu_defs[i].name) == 0) {
implver = cpu_defs[i].implver;
amask = cpu_defs[i].amask;
break;
}
}
env->implver = implver;
env->amask = amask;
env->ps = 0x1F00;
#if defined (CONFIG_USER_ONLY)
env->ps |= 1 << 3;
cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD
| FPCR_UNFD | FPCR_INED | FPCR_DNOD));
#endif
pal_init(env);
#if defined (CONFIG_USER_ONLY)
env->ipr[IPR_EXC_ADDR] = 0;
env->ipr[IPR_EXC_SUM] = 0;
env->ipr[IPR_EXC_MASK] = 0;
#else
{
uint64_t hwpcb;
hwpcb = env->ipr[IPR_PCBB];
env->ipr[IPR_ASN] = 0;
env->ipr[IPR_ASTEN] = 0;
env->ipr[IPR_ASTSR] = 0;
env->ipr[IPR_DATFX] = 0;
env->ipr[IPR_FEN] = 0;
env->ipr[IPR_IPL] = 31;
env->ipr[IPR_MCES] = 0;
env->ipr[IPR_PERFMON] = 0;
env->ipr[IPR_SISR] = 0;
env->ipr[IPR_VIRBND] = -1ULL;
}
#endif
qemu_init_vcpu(env);
return env;
}
| 1threat |
FFAMediaFormat *ff_AMediaFormat_new(void)
{
JNIEnv *env = NULL;
FFAMediaFormat *format = NULL;
format = av_mallocz(sizeof(FFAMediaFormat));
if (!format) {
return NULL;
}
format->class = &amediaformat_class;
env = ff_jni_get_env(format);
if (!env) {
av_freep(&format);
return NULL;
}
if (ff_jni_init_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format) < 0) {
goto fail;
}
format->object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id);
if (!format->object) {
goto fail;
}
format->object = (*env)->NewGlobalRef(env, format->object);
if (!format->object) {
goto fail;
}
return format;
fail:
ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format);
av_freep(&format);
return NULL;
}
| 1threat |
matplotlib: make plots in functions and then add each to a single subplot figure : <p>I haven't been able to find a solution to this.. Say I define some plotting function so that I don't have to copy-paste tons of code every time I make similar plots... </p>
<p>What I'd like to do is use this function to create a few different plots individually and then put them together as subplots into one figure. Is this even possible? I've tried the following but it just returns blanks:</p>
<pre><code>import numpy as np
import matplotlib.pyplot as plt
# function to make boxplots
def make_boxplots(box_data):
fig, ax = plt.subplots()
box = ax.boxplot(box_data)
#plt.show()
return ax
# make some data:
data_1 = np.random.normal(0,1,500)
data_2 = np.random.normal(0,1.1,500)
# plot it
box1 = make_boxplots(box_data=data_1)
box2 = make_boxplots(box_data=data_2)
plt.close('all')
fig, ax = plt.subplots(2)
ax[0] = box1
ax[1] = box2
plt.show()
</code></pre>
| 0debug |
Is there a python equivalent for RSpec to do TDD? : <p>I'm looking for a test framework like Ruby's RSpec to do test driven development in Python. The advantage of a framework like RSpec is that it offers a DSL that lends itself well to TDD. First you describe the test in english, and then you write the test, and when it fails you get a message saying what test failed with your nice description of what the test is trying to do.</p>
<p>So far I've looked at PyTest and Nose. PyTest seems closer to ruby's MiniTest than RSpec. Instead of offering a DSL with language to make it read like specifications, it focuses on assertions. Nose seems like a wrapper on PyTest that doesn't add its own DSL.</p>
<p>Is there another option I'm missing? Or am I just misusing PyTest and Nose? Has the Python community settled on some totally different way of doing this and I should stop trying to make it like Ruby? It doesn't seem, based on the number of stars on GitHub, that the community has really anointed either of these options as the preferred testing framework.</p>
| 0debug |
static void sysbus_ahci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = sysbus_ahci_realize;
dc->vmsd = &vmstate_sysbus_ahci;
dc->props = sysbus_ahci_properties;
dc->reset = sysbus_ahci_reset;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
} | 1threat |
Swift 3 - Fetch All Photos From Library : <p>I've tried to fetch photos from the library. It works, but I just got 3 photos from 9 photos from the library. Here's my code:</p>
<pre><code>let options = PHFetchOptions()
let userAlbums = PHAssetCollection.fetchAssetCollections(with: PHAssetCollectionType.album, subtype: PHAssetCollectionSubtype.any, options: options)
let userPhotos = PHAsset.fetchKeyAssets(in: userAlbums.firstObject!, options: nil)
let imageManager = PHCachingImageManager()
userPhotos?.enumerateObjects({ (object: AnyObject!, count: Int, stop: UnsafeMutablePointer) in
if object is PHAsset {
let obj:PHAsset = object as! PHAsset
let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
fetchOptions.predicate = NSPredicate(format: "mediaType = %d", PHAssetMediaType.image.rawValue)
let options = PHImageRequestOptions()
options.deliveryMode = .fastFormat
options.isSynchronous = true
imageManager.requestImage(for: obj, targetSize: CGSize(width: obj.pixelWidth, height: obj.pixelHeight), contentMode: .aspectFill, options: options, resultHandler: { img, info in
self.images.append(img!)
})
}
})
</code></pre>
<p>When I tried <code>images.count</code>, it said 3. Can anyone help me to find my mistake and get all photos? Big thanks!</p>
| 0debug |
static av_cold int movie_common_init(AVFilterContext *ctx)
{
MovieContext *movie = ctx->priv;
AVInputFormat *iformat = NULL;
int64_t timestamp;
int nb_streams, ret, i;
char default_streams[16], *stream_specs, *spec, *cursor;
char name[16];
AVStream *st;
if (!*movie->file_name) {
av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
return AVERROR(EINVAL);
}
movie->seek_point = movie->seek_point_d * 1000000 + 0.5;
stream_specs = movie->stream_specs;
if (!stream_specs) {
snprintf(default_streams, sizeof(default_streams), "d%c%d",
!strcmp(ctx->filter->name, "amovie") ? 'a' : 'v',
movie->stream_index);
stream_specs = default_streams;
}
for (cursor = stream_specs, nb_streams = 1; *cursor; cursor++)
if (*cursor == '+')
nb_streams++;
if (movie->loop_count != 1 && nb_streams != 1) {
av_log(ctx, AV_LOG_ERROR,
"Loop with several streams is currently unsupported\n");
return AVERROR_PATCHWELCOME;
}
av_register_all();
iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
movie->format_ctx = NULL;
if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) {
av_log(ctx, AV_LOG_ERROR,
"Failed to avformat_open_input '%s'\n", movie->file_name);
return ret;
}
if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
if (movie->seek_point > 0) {
timestamp = movie->seek_point;
if (movie->format_ctx->start_time != AV_NOPTS_VALUE) {
if (timestamp > INT64_MAX - movie->format_ctx->start_time) {
av_log(ctx, AV_LOG_ERROR,
"%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n",
movie->file_name, movie->format_ctx->start_time, movie->seek_point);
return AVERROR(EINVAL);
}
timestamp += movie->format_ctx->start_time;
}
if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) {
av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n",
movie->file_name, timestamp);
return ret;
}
}
for (i = 0; i < movie->format_ctx->nb_streams; i++)
movie->format_ctx->streams[i]->discard = AVDISCARD_ALL;
movie->st = av_calloc(nb_streams, sizeof(*movie->st));
if (!movie->st)
return AVERROR(ENOMEM);
for (i = 0; i < nb_streams; i++) {
spec = av_strtok(stream_specs, "+", &cursor);
if (!spec)
return AVERROR_BUG;
stream_specs = NULL;
st = find_stream(ctx, movie->format_ctx, spec);
if (!st)
return AVERROR(EINVAL);
st->discard = AVDISCARD_DEFAULT;
movie->st[i].st = st;
movie->max_stream_index = FFMAX(movie->max_stream_index, st->index);
}
if (av_strtok(NULL, "+", &cursor))
return AVERROR_BUG;
movie->out_index = av_calloc(movie->max_stream_index + 1,
sizeof(*movie->out_index));
if (!movie->out_index)
return AVERROR(ENOMEM);
for (i = 0; i <= movie->max_stream_index; i++)
movie->out_index[i] = -1;
for (i = 0; i < nb_streams; i++)
movie->out_index[movie->st[i].st->index] = i;
for (i = 0; i < nb_streams; i++) {
AVFilterPad pad = { 0 };
snprintf(name, sizeof(name), "out%d", i);
pad.type = movie->st[i].st->codec->codec_type;
pad.name = av_strdup(name);
pad.config_props = movie_config_output_props;
pad.request_frame = movie_request_frame;
ff_insert_outpad(ctx, i, &pad);
ret = open_stream(ctx, &movie->st[i]);
if (ret < 0)
return ret;
if ( movie->st[i].st->codec->codec->type == AVMEDIA_TYPE_AUDIO &&
!movie->st[i].st->codec->channel_layout) {
ret = guess_channel_layout(&movie->st[i], i, ctx);
if (ret < 0)
return ret;
}
}
av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
movie->seek_point, movie->format_name, movie->file_name,
movie->stream_index);
return 0;
}
| 1threat |
static int mpeg4video_probe(AVProbeData *probe_packet)
{
uint32_t temp_buffer= -1;
int VO=0, VOL=0, VOP = 0, VISO = 0, res=0;
int i;
for(i=0; i<probe_packet->buf_size; i++){
temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
if ((temp_buffer & 0xffffff00) != 0x100)
continue;
if (temp_buffer == VOP_START_CODE) VOP++;
else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++;
else if (temp_buffer < 0x120) VO++;
else if (temp_buffer < 0x130) VOL++;
else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
&& !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
}
if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION : AVPROBE_SCORE_EXTENSION/2;
return 0;
}
| 1threat |
Traceback (most recent call last): File "python", line 1, in <module> File "python", line 4, in find_missing IndexError: list index out of range : You are presented with two arrays, all containing positive integers. One of the arrays will have one extra number, see below:
[1,2,3] and [1,2,3,4] should return 4
[4,66,7] and [66,77,7,4] should return 77
my code:
def find_missing(arr1, arr2):
if len(arr1) != len(arr2):
for i in arr1 and arr2:
if arr1[i] != arr2[i]:
return i | 0debug |
Increase counter upon change of value : <p>I made a function to increase a counter whenever the value in a vector changes:</p>
<pre><code>track_change = function(x) {
counter = numeric(length(x))
for (i in seq_along(x)) {
if (i > 1 && x[i] != x[i-1])
counter[i] = counter[i-1] + 1
else if (i > 1)
counter[i] = counter[i-1]
}
counter
}
</code></pre>
<p>Example (see how <code>track</code> changes upon every change of <code>carb</code>):</p>
<pre><code>mtcars$track = track_change(mtcars$carb)
head(mtcars[, 10:12])
gear carb track
Mazda RX4 4 4 0
Mazda RX4 Wag 4 4 0
Datsun 710 4 1 1
Hornet 4 Drive 3 1 1
Hornet Sportabout 3 2 2
Valiant 3 1 3
</code></pre>
<p>Is there a better way to do this in R? (It should also be able to track changes in non-numerical vectors, incl. lists.)</p>
| 0debug |
text-align: -webkit-center vs text-align: center : <p>Does anyone know why there is a difference between text-align: center and , text-align:-webkit-center ? For example if you have :</p>
<pre><code><section>
<h1>Title<h1>
<div class="image"></div>
</section>
</code></pre>
<p>// CSS with text-align: center;</p>
<pre><code>section{
text-align: center;
}
</code></pre>
<p>This will center just the text</p>
<p>// CSS with text-align: -webkit-center</p>
<pre><code>section{
text-align: -webkit-center;
}
</code></pre>
<p>This will center the text and the image.</p>
<p>Same goes for text-align: -moz-center;</p>
| 0debug |
how to get from form input absolute value php : I know it is abs() but why this one does not work ? in php or if its wrong how to make it right:
<?php
echo "Number";
echo "\x20";
echo $_GET["luku"];
echo "\x20";
echo "absolute value is";
echo "\x20";
echo $_GET[abs("luku")];
?>
first 'get' is working but second one not.
Im just increasing my knowledge on php | 0debug |
How to setup a tabbed activity as a main activity : <p>Can anyone guide me how to make a tabbed activity with 3 tabs as my launcher activity(similar to Whatsapp) for my application.
Thanks,</p>
| 0debug |
MySQL how to query five tables in one SELECT : <p>I have 5 tables as follows:</p>
<ul>
<li><strong>tbl_individ</strong> - consists of user data (<em>uID, Firstname, Lastname, Mobile, eMail</em>)</li>
<li><strong>tbl_role</strong> - consists of roles (<em>rID, Rolename, RoleDescription</em>)</li>
<li><strong>tbl_group</strong> - consists of groups (<em>gID, Groupname, GroupDescription</em>)</li>
<li><strong>tbl_inro</strong> - consists of which roles a user has (<em>uID, rID</em>)</li>
<li><strong>tbl_ingr</strong> - consists of which groups a user belongs to (<em>uID, gID</em>)</li>
</ul>
<p>I'd like to achieve the output where I list all the users in the <strong>tbl_individ</strong> and list what each user what roles they has and as well what groups they belong to.</p>
<p>I created the <strong>tbl_inro</strong> to only map the user (uID) and the role (rID) and the same for the <strong>tbl_ingr</strong> to only map the user (uID) and the group (gID).</p>
<p>It all as output in one row?</p>
| 0debug |
If Statments on python : What is wrong with this?
passcode = 10
question = raw_input("type code ")
if question == passcode:
print"yey"
| 0debug |
void op_flush_icache_range(void) {
CALL_FROM_TB2(tlb_flush_page, env, T0 + T1);
RETURN();
}
| 1threat |
Dictionary being treated as NoneType (Python 3.5.1) : <pre><code>from statistics import stdev
data = [line.rstrip('\n').split(',') for line in open('C:/Users/User/Downloads/documents-export-2016-05-04/Data.csv')]
dates = list(open('C:/Users/User/Downloads/documents-export-2016-05-04/Dates.csv').read().split('\n'))
stock_values = [int(x) for x in open('C:/Users/User/Downloads/documents-export-2016-05-04/stock_value.csv').read().split(',')]
companies = open('C:/Users/User/Downloads/documents-export-2016-05-04/companies.csv').read().split(',')
prices = dict(zip(companies, stock_values))
PRICE = 0
old_volatility = 0
new_volatility = 0
def get_change(values, invested):
sum_product = ([x * y for x, y in zip(values, invested)])
return(sum(sum_product) / sum(invested))
def get_volatility(invested):
changes = {}
for i, j in enumerate(list(reversed(dates))):
changes[j] = get_change(list(map(float, data[i])), invested.values())
vals = changes.values()
volatility = stdev(vals)
return volatility
def tuner(invested, company):
global PRICE
global old_volatility
temp_invested = invested.copy()
temp_invested[company] += 1
new_volatility = get_volatility(temp_invested)
new_price = PRICE + prices[company]
if new_volatility - old_volatility < -0.01 and new_price <= BUDGET:
old_volatility = new_volatility
PRICE = new_price
tuner(temp_invested, company)
else:
return invested
if __name__ == "__main__":
BUDGET = int(input())
invested = {}
for company in companies: invested[company] = 0
invested['A'] = 1
old_volatility = get_volatility(invested)
for company in companies:
if PRICE < BUDGET:
invested = tuner(invested, company)
else:
break
print("Price = ", PRICE)
print("Volatility = ", old_volatility)
</code></pre>
<p>For some reason in the above code, after 3 iterations of the for loop "for company in companies", I get an error that says "'NoneType' object has no attribute 'copy'", referring to the dictionary 'invested'. I don't understand why after a few iterations, the dictionary would suddenly be treated as NoneType. The original data are just being read in as lists of strings so they don't really matter. Any help is appreciated. Thanks.</p>
| 0debug |
How do I process a set of images for a neural network? : <p>So this is my first time branching away from the mnist data set so i'm wondering how I should go about processing the images. </p>
<p>Currently, I have a folder filled with images and a list of labels. I'd like to read the images into an array that will be fed into my CNN. </p>
<p>Here is how I think this should be done:</p>
<pre><code>from PIL import Image
from numpy import array
for i in image_list:
img = Image.open("i")
training_set.append(array(img))
</code></pre>
<p>I'm not sure if this is the most effective way to do this. Any feedback would be much appreciated. </p>
| 0debug |
How to fix VM issue with minikube start ? : <p>I am a beginner to Kubernetes and starting off with <a href="https://kubernetes.io/docs/tutorials/hello-minikube/#create-your-node-js-application" rel="noreferrer">this</a> tutorial. I installed <a href="https://www.virtualbox.org/wiki/Downloads" rel="noreferrer">VM</a> and expected to be able to start a cluster by using the command: </p>
<pre><code>minikube start
</code></pre>
<p>But I get the error: </p>
<pre><code>Starting local Kubernetes v1.10.0 cluster...
Starting VM...
E0911 13:34:45.394430 41676 start.go:174] Error starting host: Error
creating host: Error executing step: Creating VM.
: Error setting up host only network on machine start: The host-only
adapter we just created is not visible. This is a well known
VirtualBox bug. You might want to uninstall it and reinstall at least
version 5.0.12 that is is supposed to fix this issue.
</code></pre>
<p>It says that it is a well known bug in Virtualbox but I installed its latest version. Any ideas?</p>
| 0debug |
void ff_put_h264_qpel16_mc33_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_16w_msa(src + stride - 2,
src - (stride * 2) +
sizeof(uint8_t), stride, dst, stride, 16);
}
| 1threat |
How to check if numbers in a list add up to a certain number? : <p>e.g
a = [7,8,8,9,4]
--> would give three points. Since <strong>7 + 8</strong> (8 at index --> 0), <strong>7 + 8</strong> (8 at index --> 1), <strong>9 + 4</strong> all equal 15</p>
<p>How do you write a code to do this in python?</p>
| 0debug |
Cannot Compile Java project : <p>I'm trying to compile an old java program that I wrote on BlueJ but now trying to run it without it.
It's a simple code that uses <code>java.awt., java.io.*, and java.util.*</code> if that makes a difference.</p>
<p>I have the java JDK downloaded and all variables set. I can run a different program that I coded without an IDE (Its an entire project file with its own lib file tho if that makes a different).</p>
<p><strong>If i run it with javac filename.java i get this error:</strong> error: file not found: filename.java
Usage: javac
use --help for a list of possible options</p>
<p><strong>If i add -cp it says:</strong> error: no source files</p>
<p>and I've tried several other things that all resulted in the same or similar errors.</p>
<p>My best guess is java cant locate its lib folder but that shouldn't be a problem considering a JDK and JDR and downloaded and set</p>
| 0debug |
static void pc_xen_hvm_init(MachineState *machine)
{
PCIBus *bus;
pc_xen_hvm_init_pci(machine);
bus = pci_find_primary_bus();
if (bus != NULL) {
pci_create_simple(bus, -1, "xen-platform"); | 1threat |
Unbound variable with bash script : <p>Im becoming desperate when debugging my script, I used some constructions recommended to me from my senior collegue and I dont know how to make it work properly. </p>
<pre><code> #!/bin/bash -x
set -ueo pipefail
exec &>/tmp/dq.log
source ${BASH_SOURCE%/*}/env-prd.sh
times=${2:-1}
sleep=${3:-1}
name="all-dq_hourly"
fs_lock_file="/tmp/mwa/jobs/prd-${name}.lock"
( flock -n 200
log="/var/log/mwa/prd/$(date +%Y-%m-%d)__${name}.log"
for i in $(seq 1 $times); do
if [[ ! -f /tmp/stop ]]; then
couple commands
fi
sleep $sleep
done
) 200>"$fs_lock_file" | tee -a $log
rm $fs_lock_file
</code></pre>
<p>From the execs , I can see there is an issue with unbound variable for the <code>tee -a $log</code> part, <code>couple commands</code> get executed allright. I tried to use backtics in the log path, but to no benefit. I suspect the same issue with fs_lock_file, but I havent fixed the logging first yet.<br>
Can somebody open my eyes and tell me what Im missing? Im not able to make the script logging to path specified.</p>
| 0debug |
DECLARE_LOOP_FILTER(mmxext)
DECLARE_LOOP_FILTER(sse2)
DECLARE_LOOP_FILTER(ssse3)
DECLARE_LOOP_FILTER(sse4)
#endif
#define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \
c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT
#define VP8_MC_FUNC(IDX, SIZE, OPT) \
c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \
c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \
c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \
c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \
c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \
VP8_LUMA_MC_FUNC(IDX, SIZE, OPT)
#define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \
c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT
av_cold void ff_vp8dsp_init_x86(VP8DSPContext* c)
{
#if HAVE_YASM
int mm_flags = av_get_cpu_flags();
if (mm_flags & AV_CPU_FLAG_MMX) {
c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
#if ARCH_X86_32
c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
c->vp8_idct_add = ff_vp8_idct_add_mmx;
c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmx;
c->put_vp8_epel_pixels_tab[0][0][0] =
c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx;
#endif
c->put_vp8_epel_pixels_tab[1][0][0] =
c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx;
#if ARCH_X86_32
c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmx;
c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmx;
c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmx;
c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmx;
c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmx;
c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmx;
c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmx;
c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmx;
c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmx;
c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmx;
#endif
}
if (mm_flags & AV_CPU_FLAG_MMXEXT) {
VP8_MC_FUNC(2, 4, mmxext);
VP8_BILINEAR_MC_FUNC(2, 4, mmxext);
#if ARCH_X86_32
VP8_LUMA_MC_FUNC(0, 16, mmxext);
VP8_MC_FUNC(1, 8, mmxext);
VP8_BILINEAR_MC_FUNC(0, 16, mmxext);
VP8_BILINEAR_MC_FUNC(1, 8, mmxext);
c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmxext;
c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmxext;
c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmxext;
c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmxext;
c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmxext;
c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmxext;
c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmxext;
c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmxext;
c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmxext;
c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmxext;
#endif
}
if (mm_flags & AV_CPU_FLAG_SSE) {
c->vp8_idct_add = ff_vp8_idct_add_sse;
c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse;
c->put_vp8_epel_pixels_tab[0][0][0] =
c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
}
if (mm_flags & (AV_CPU_FLAG_SSE2|AV_CPU_FLAG_SSE2SLOW)) {
VP8_LUMA_MC_FUNC(0, 16, sse2);
VP8_MC_FUNC(1, 8, sse2);
VP8_BILINEAR_MC_FUNC(0, 16, sse2);
VP8_BILINEAR_MC_FUNC(1, 8, sse2);
c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2;
#if ARCH_X86_64 || HAVE_ALIGNED_STACK
c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2;
c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_sse2;
c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_sse2;
c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2;
#endif
}
if (mm_flags & AV_CPU_FLAG_SSE2) {
c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2;
c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
#if ARCH_X86_64 || HAVE_ALIGNED_STACK
c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2;
c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2;
c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse2;
c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2;
#endif
}
if (mm_flags & AV_CPU_FLAG_SSSE3) {
VP8_LUMA_MC_FUNC(0, 16, ssse3);
VP8_MC_FUNC(1, 8, ssse3);
VP8_MC_FUNC(2, 4, ssse3);
VP8_BILINEAR_MC_FUNC(0, 16, ssse3);
VP8_BILINEAR_MC_FUNC(1, 8, ssse3);
VP8_BILINEAR_MC_FUNC(2, 4, ssse3);
c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_ssse3;
c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_ssse3;
#if ARCH_X86_64 || HAVE_ALIGNED_STACK
c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_ssse3;
c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_ssse3;
c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_ssse3;
c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_ssse3;
c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_ssse3;
c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_ssse3;
c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_ssse3;
c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3;
#endif
}
if (mm_flags & AV_CPU_FLAG_SSE4) {
c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4;
c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4;
#if ARCH_X86_64 || HAVE_ALIGNED_STACK
c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4;
c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4;
#endif
}
#endif
}
| 1threat |
PCIBus *pci_apb_init(hwaddr special_base,
hwaddr mem_base,
qemu_irq *ivec_irqs, PCIBus **busA, PCIBus **busB,
qemu_irq **pbm_irqs)
{
DeviceState *dev;
SysBusDevice *s;
PCIHostState *phb;
APBState *d;
IOMMUState *is;
PCIDevice *pci_dev;
PCIBridge *br;
dev = qdev_create(NULL, TYPE_APB);
d = APB_DEVICE(dev);
phb = PCI_HOST_BRIDGE(dev);
phb->bus = pci_register_bus(DEVICE(phb), "pci",
pci_apb_set_irq, pci_pbm_map_irq, d,
&d->pci_mmio,
get_system_io(),
0, 32, TYPE_PCI_BUS);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(s, 0, special_base);
sysbus_mmio_map(s, 1, special_base + 0x1000000ULL);
sysbus_mmio_map(s, 2, special_base + 0x2000000ULL);
memory_region_init(&d->pci_mmio, OBJECT(s), "pci-mmio", 0x100000000ULL);
memory_region_add_subregion(get_system_memory(), mem_base, &d->pci_mmio);
*pbm_irqs = d->pbm_irqs;
d->ivec_irqs = ivec_irqs;
pci_create_simple(phb->bus, 0, "pbm-pci");
is = &d->iommu;
memset(is, 0, sizeof(IOMMUState));
memory_region_init_iommu(&is->iommu, sizeof(is->iommu),
TYPE_APB_IOMMU_MEMORY_REGION, OBJECT(dev),
"iommu-apb", UINT64_MAX);
address_space_init(&is->iommu_as, MEMORY_REGION(&is->iommu), "pbm-as");
pci_setup_iommu(phb->bus, pbm_pci_dma_iommu, is);
pci_dev = pci_create_multifunction(phb->bus, PCI_DEVFN(1, 0), true,
TYPE_PBM_PCI_BRIDGE);
br = PCI_BRIDGE(pci_dev);
pci_bridge_map_irq(br, "pciB", pci_apb_map_irq);
qdev_init_nofail(&pci_dev->qdev);
*busB = pci_bridge_get_sec_bus(br);
pci_dev = pci_create_multifunction(phb->bus, PCI_DEVFN(1, 1), true,
TYPE_PBM_PCI_BRIDGE);
br = PCI_BRIDGE(pci_dev);
pci_bridge_map_irq(br, "pciA", pci_apb_map_irq);
qdev_prop_set_bit(DEVICE(pci_dev), "busA", true);
qdev_init_nofail(&pci_dev->qdev);
*busA = pci_bridge_get_sec_bus(br);
return phb->bus;
}
| 1threat |
How to throw observable error manually in angular2? : <p>I am working on angular2 app in which I am making a rest call through HTTp as below:</p>
<pre><code>login(email, password) {
let headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
let options = new RequestOptions({ headers: headers });
let body = `identity=${email}&password=${password}`;
return this.http.post(`${this._configService.getBaseUrl()}/login`, body, options)
.map((res: any) => {
let response: any = JSON.parse(res._body);
if (response.success == 0) {
Observable.throw(response); // not working
} else if (response.success == 1) {
console.log('success');
localStorage.setItem('auth_token', 'authenticated');
this.loggedIn = true;
return response;
}
});
}
</code></pre>
<p>basically I want my component to get response & error in my subscribe call.</p>
<p>i.e.</p>
<pre><code>this._authenticateService.login(this.loginObj['identity'],this.loginObj['password']).subscribe(
(success)=>{
this.credentialsError=null;
this.loginObj={};
this._router.navigate(['dashboard']);
},
(error)=>{
console.log(error);
this.credentialsError=error;
}
);
</code></pre>
<p>but my api always returns success as it id defined that way.</p>
<p>So I want to know how can I throw error msg if <code>response.success == 0</code> , so that it will be accessed inside error argument of my subscribe callback.</p>
| 0debug |
C# reverse complement of a sequence : Problem is below: (need to write ReserveComplemenet method in c#)
--------------
The reverse complement of a sequence is formed by exchanging all of its nucleobases with their base complements, and then reversing the resulting sequence. The reverse complement of a DNA sequence is formed by exchanging all instances of:
A with T
T with A
G with C
C with G
and then reversing the resulting sequence.
For example, given the DNA sequence AAGCT the reverse complement is AGCTT
This method, ReverseComplement, must take the following parameter:
a reference to a DNA sequence
This method should return void and mutate the referenced DNA sequence to its reverse complement.
Im stuck and wondering how I do this? Any help would be greatly appreciated. | 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.