problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
static int win_chr_pipe_init(CharDriverState *chr, const char *filename,
Error **errp)
{
WinCharState *s = chr->opaque;
OVERLAPPED ov;
int ret;
DWORD size;
char openname[CHR_MAX_FILENAME_SIZE];
s->fpipe = TRUE;
s->hsend = CreateEvent(NULL, TRUE, FALSE, NULL);
if (!s->hsend) {
error_setg(errp, "Failed CreateEvent");
goto fail;
}
s->hrecv = CreateEvent(NULL, TRUE, FALSE, NULL);
if (!s->hrecv) {
error_setg(errp, "Failed CreateEvent");
goto fail;
}
snprintf(openname, sizeof(openname), "\\\\.\\pipe\\%s", filename);
s->hcom = CreateNamedPipe(openname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_BYTE | PIPE_READMODE_BYTE |
PIPE_WAIT,
MAXCONNECT, NSENDBUF, NRECVBUF, NTIMEOUT, NULL);
if (s->hcom == INVALID_HANDLE_VALUE) {
error_setg(errp, "Failed CreateNamedPipe (%lu)", GetLastError());
s->hcom = NULL;
goto fail;
}
ZeroMemory(&ov, sizeof(ov));
ov.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
ret = ConnectNamedPipe(s->hcom, &ov);
if (ret) {
error_setg(errp, "Failed ConnectNamedPipe");
goto fail;
}
ret = GetOverlappedResult(s->hcom, &ov, &size, TRUE);
if (!ret) {
error_setg(errp, "Failed GetOverlappedResult");
if (ov.hEvent) {
CloseHandle(ov.hEvent);
ov.hEvent = NULL;
}
goto fail;
}
if (ov.hEvent) {
CloseHandle(ov.hEvent);
ov.hEvent = NULL;
}
qemu_add_polling_cb(win_chr_pipe_poll, chr);
return 0;
fail:
win_chr_close(chr);
return -1;
}
| 1threat
|
PHP add target="_blank : <p>I hope everyone doing great, I need help how I can add target blank to a specific code </p>
<p>this is the code:</p>
<pre><code>if( !empty($social_fb) ){
$result .= '<a href="'.esc_attr($social_fb).'"><i class="fa fa-facebook"></i></a>';
}
</code></pre>
<p>I try to add this:</p>
<pre><code>if( !empty($social_fb) ){
$result .= '<a href=" target="_blank'.esc_attr($social_fb).'"><i class="tana-social tana-size-26 tana-facebook tana-circle fa fa-facebook"></i></a>';
}
</code></pre>
<p>but not work!</p>
<p>I hope someone can help me, many thanks in advances!
Regards
Manny</p>
| 0debug
|
Bulk replace string in linux terminal : <p>I have bunch of wordpress in my server, i need to change each of wordpress database host in wp-config.php file, how i do it using terminal?</p>
<p>current value</p>
<pre><code>define( 'DB_HOST', '127.0.0.1' );
</code></pre>
<p>need to change to</p>
<pre><code>define( 'DB_HOST', 'dbserver.com' );
</code></pre>
| 0debug
|
What options do I have for testing an Angular 2 application with Team City? : <p>Over the next two years we will be building a large Angular 2 application. Part of the test suite will be User Interface Tests. The Unit Tests and Integration tests will be written in C# with NUnit or MSTest. The client has chosen Selenium for the User Interface Tests. Is it possible to write tests for Selenium in C# that can test the Angular 2 User Interface or will Protractor need to be used? I would like to have all the tests run during a Team City build. Can Protractor be run in Team City? If so what does the setup of Protractor look like in Team City?</p>
| 0debug
|
Pod in pending state due to Insufficient CPU : <p>On my GCE Kubernetes cluster I can no longer create pods.</p>
<pre><code>Warning FailedScheduling pod (www.caveconditions.com-f1be467e31c7b00bc983fbe5efdbb8eb-438ef) failed to fit in any node
fit failure on node (gke-prod-cluster-default-pool-b39c7f0c-c0ug): Insufficient CPU
</code></pre>
<p>Looking at the allocated stats of that node</p>
<pre><code>Non-terminated Pods: (8 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits
--------- ---- ------------ ---------- --------------- -------------
default dev.caveconditions.com-n80z8 100m (10%) 0 (0%) 0 (0%) 0 (0%)
default lamp-cnmrc 100m (10%) 0 (0%) 0 (0%) 0 (0%)
default mongo-2-h59ly 200m (20%) 0 (0%) 0 (0%) 0 (0%)
default www.caveconditions.com-tl7pa 100m (10%) 0 (0%) 0 (0%) 0 (0%)
kube-system fluentd-cloud-logging-gke-prod-cluster-default-pool-b39c7f0c-c0ug 100m (10%) 0 (0%) 200Mi (5%) 200Mi (5%)
kube-system kube-dns-v17-qp5la 110m (11%) 110m (11%) 120Mi (3%) 220Mi (5%)
kube-system kube-proxy-gke-prod-cluster-default-pool-b39c7f0c-c0ug 100m (10%) 0 (0%) 0 (0%) 0 (0%)
kube-system kubernetes-dashboard-v1.1.0-orphh 100m (10%) 100m (10%) 50Mi (1%) 50Mi (1%)
Allocated resources:
(Total limits may be over 100%, i.e., overcommitted. More info: http://releases.k8s.io/HEAD/docs/user-guide/compute-resources.md)
CPU Requests CPU Limits Memory Requests Memory Limits
------------ ---------- --------------- -------------
910m (91%) 210m (21%) 370Mi (9%) 470Mi (12%)
</code></pre>
<p>Sure I have 91% allocated and can not fit another 10% into it. But is it not possible to over commit resources?</p>
<p>The usage of the server is at about 10% CPU average</p>
<p><a href="https://i.stack.imgur.com/wBSuc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wBSuc.png" alt="enter image description here"></a></p>
<p>Would be a shame if I can not use more ressources.</p>
| 0debug
|
Ultimate java bad word filter : How can I create the best bad word chat filter? Like let users not type Poop and send them message :"That message is bad!" and WHen they say pooopppp still filter it. or P00p, Po0p, P0o0o0op, (or whatever trick they try to use) etc.
| 0debug
|
remove max and min duplicate of a list of number : > Hi i would i like to remove ONLY max and min duplicate of a list of
> numbers. example: (**1 1 1** 4 4 5 6 **8 8 8**) result (**1** 4 4 5 6
> **8**)
how to combine max() min() function with list(set(x))??
or is there any other way? Please do enlighten me
| 0debug
|
Laravel: how to create a function After or Before save|update : <p>I need to generate a function to call after or before save() or update() but i don't know how to do.
I think I need a callback from save() update() but I don't know how to do.
Thanks</p>
| 0debug
|
why my js cannot be linked to html? : <p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!doctype html>
<html>
<head>
<script type="text/javascript">
var instock=true;
var shipping=false;
var elstock= document.getElmentById('stock');
elstock.className=instock;
var elship= document.getElmentById('note');
elship.className=shipping;
//the text should be updated by values stored
//in these variables.
</script>
</head>
<body>
<h1>Elderflower</h1>
<div id="content">
<div class="message">Available:
<span id="stock"></span>
</div>
<div class="message">Shipping:
<span id="shipping"></span>
</div>
</div>
</body>
</html></code></pre>
</div>
</div>
</p>
<p>why js cannot be linked to html??? and how i can link css images to js as well?
For example, if it is true, show circle image. If it is false, show cross image.</p>
| 0debug
|
Add entity with InheritanceType.JOINED to native query : <p>I am struggling to get native queries to work with <code>InheritanceType.JOINED</code>. From the Hibernate <a href="https://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch13.html#d5e3844">documentation</a> I have found:</p>
<blockquote>
<h1>13.1.6. Handling inheritance</h1>
<p>Native SQL queries which query for entities that are mapped as part of an inheritance must include all properties for the baseclass and all its subclasses.</p>
</blockquote>
<p>Using the following two entities:</p>
<pre class="lang-java prettyprint-override"><code>@Data
@Entity
@Table(name = "my_super")
@EqualsAndHashCode(of = {"id"})
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class MySuper {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE)
private long id;
}
</code></pre>
<p>And:</p>
<pre class="lang-java prettyprint-override"><code>@Data
@Entity
@Table(name = "my_sub_a")
@EqualsAndHashCode(callSuper = true)
public class MySubA extends MySuper {
@Column(name = "x")
private int x;
}
</code></pre>
<p>When I try to create a native query using:</p>
<pre class="lang-java prettyprint-override"><code>Object actual = session
.createNativeQuery("SELECT {s.*} FROM my_super {s} LEFT JOIN my_sub_a {a} USING (id)")
.addEntity("s", MySuper.class)
.getSingleResult();
</code></pre>
<p>It translates to the query:</p>
<pre><code>SELECT s.id as id1_1_0_, s_1_.x as x1_0_0_, case when s_1_.id is not null then 1 when s.id is not null then 0 end as clazz_0_ FROM my_super s LEFT JOIN my_sub_a a USING (id)
</code></pre>
<p>And then fails with:</p>
<pre><code>javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not prepare statement
Caused by: org.hibernate.exception.SQLGrammarException: could not prepare statement
Caused by: org.h2.jdbc.JdbcSQLException: Column "S_1_.X" not found; SQL statement:
</code></pre>
<p>So we observe the alias injection doing its work, figuring out that it may need the <code>x</code> column of <code>my_sub_a</code> as well. It is however unable to figure out the alias for <code>my_sub_a</code>. How should my code be modified so that this alias is connected properly as well?</p>
<p>My code is available at <a href="https://gist.github.com/JWGmeligMeyling/51e8a305f3c268eda473511e202f76e8">https://gist.github.com/JWGmeligMeyling/51e8a305f3c268eda473511e202f76e8</a> for easy reproduction of my issue.</p>
<p><em>(I am aware that this query can easily be expressed in JPQL or HQL as well, and can even be achieved using the <code>EntityManager</code> and <code>Session</code> API's. I do however want to use this in a more complex query, that I simplified to all details required for this question).</em></p>
| 0debug
|
static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id) {
int i;
int cur = 0;
int skip = 0;
int len, toks;
TM2Codes codes;
len = AV_RB32(buf); buf += 4; cur += 4;
skip = len * 4 + 4;
if(len == 0)
return 4;
toks = AV_RB32(buf); buf += 4; cur += 4;
if(toks & 1) {
len = AV_RB32(buf); buf += 4; cur += 4;
if(len == TM2_ESCAPE) {
len = AV_RB32(buf); buf += 4; cur += 4;
}
if(len > 0) {
init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
if(tm2_read_deltas(ctx, stream_id) == -1)
return -1;
buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
}
}
if(AV_RB32(buf) == TM2_ESCAPE) {
buf += 4; cur += 4;
}
buf += 4; cur += 4;
buf += 4; cur += 4;
init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
if(tm2_build_huff_table(ctx, &codes) == -1)
return -1;
buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
toks >>= 1;
if((toks < 0) || (toks > 0xFFFFFF)){
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks);
tm2_free_codes(&codes);
return -1;
}
ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int));
ctx->tok_lens[stream_id] = toks;
len = AV_RB32(buf); buf += 4; cur += 4;
if(len > 0) {
init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
for(i = 0; i < toks; i++)
ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes);
} else {
for(i = 0; i < toks; i++)
ctx->tokens[stream_id][i] = codes.recode[0];
}
tm2_free_codes(&codes);
return skip;
}
| 1threat
|
Passing array into URLSearchParams while consuming http call for get request : <p>Going through the Angular documentation for <a href="https://angular.io/docs/ts/latest/api/http/index/URLSearchParams-class.html">URLSearchParams</a>, I dint find any documentation on passing array as an parameter.</p>
<p>Can anybody help with that?</p>
| 0debug
|
static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata,
int jobnr, int threadnr)
{
VP8Context *s = avctx->priv_data;
VP8ThreadData *td = &s->thread_data[threadnr];
int mb_x, mb_y = td->thread_mb_pos >> 16, num_jobs = s->num_jobs;
AVFrame *curframe = s->curframe->tf.f;
VP8Macroblock *mb;
VP8ThreadData *prev_td, *next_td;
uint8_t *dst[3] = {
curframe->data[0] + 16 * mb_y * s->linesize,
curframe->data[1] + 8 * mb_y * s->uvlinesize,
curframe->data[2] + 8 * mb_y * s->uvlinesize
};
if (s->mb_layout == 1)
mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1);
else
mb = s->macroblocks + (s->mb_height - mb_y - 1) * 2;
if (mb_y == 0)
prev_td = td;
else
prev_td = &s->thread_data[(jobnr + num_jobs - 1) % num_jobs];
if (mb_y == s->mb_height - 1)
next_td = td;
else
next_td = &s->thread_data[(jobnr + 1) % num_jobs];
for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) {
VP8FilterStrength *f = &td->filter_strength[mb_x];
if (prev_td != td)
check_thread_pos(td, prev_td,
(mb_x + 1) + (s->mb_width + 3), mb_y - 1);
if (next_td != td)
if (next_td != &s->thread_data[0])
check_thread_pos(td, next_td, mb_x + 1, mb_y + 1);
if (num_jobs == 1) {
if (s->filter.simple)
backup_mb_border(s->top_border[mb_x + 1], dst[0],
NULL, NULL, s->linesize, 0, 1);
else
backup_mb_border(s->top_border[mb_x + 1], dst[0],
dst[1], dst[2], s->linesize, s->uvlinesize, 0);
}
if (s->filter.simple)
filter_mb_simple(s, dst[0], f, mb_x, mb_y);
else
filter_mb(s, dst, f, mb_x, mb_y);
dst[0] += 16;
dst[1] += 8;
dst[2] += 8;
update_pos(td, mb_y, (s->mb_width + 3) + mb_x);
}
}
| 1threat
|
static bool vregs_needed(void *opaque)
{
#ifdef CONFIG_KVM
if (kvm_enabled()) {
return kvm_check_extension(kvm_state, KVM_CAP_S390_VECTOR_REGISTERS);
}
#endif
return 0;
}
| 1threat
|
static void dec_bcc(DisasContext *dc)
{
unsigned int cc;
unsigned int dslot;
cc = EXTRACT_FIELD(dc->ir, 21, 23);
dslot = dc->ir & (1 << 25);
LOG_DIS("bcc%s r%d %x\n", dslot ? "d" : "", dc->ra, dc->imm);
dc->delayed_branch = 1;
if (dslot) {
dc->delayed_branch = 2;
dc->tb_flags |= D_FLAG;
tcg_gen_st_tl(tcg_const_tl(dc->type_b && (dc->tb_flags & IMM_FLAG)),
cpu_env, offsetof(CPUState, bimm));
}
if (dec_alu_op_b_is_small_imm(dc)) {
int32_t offset = (int32_t)((int16_t)dc->imm);
tcg_gen_movi_tl(env_btarget, dc->pc + offset);
} else {
tcg_gen_movi_tl(env_btarget, dc->pc);
tcg_gen_add_tl(env_btarget, env_btarget, *(dec_alu_op_b(dc)));
}
dc->jmp = JMP_INDIRECT;
eval_cc(dc, cc, env_btaken, cpu_R[dc->ra], tcg_const_tl(0));
}
| 1threat
|
Querying a MYSQL database with a GET variable : <p>I would like to query my database with the contents of my Get variable, then retrieve the matching url and put the matching url into a variable, what's the best and safest way of doing this? </p>
| 0debug
|
Please help ..on basic sql query. .. : I have three tables ..
Student
I'd. Name
1 vesd
2. Eet
Subject table
I'd name
1. Science
2 maths
Marks
Stud_id. Sub_id. Marks
1. 1. 20
1. 2. 30
2. 1. 40
2. 2. 50
| 0debug
|
static void gen_tlbli_6xx(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->pr)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
gen_helper_6xx_tlbi(cpu_env, cpu_gpr[rB(ctx->opcode)]);
#endif
}
| 1threat
|
Why we need to use Redux? : <p>Sorry for this question, but I really don't understand why I have to use <code>redux</code> for <code>react</code> if I can make the same with core <code>react</code> features. I can make <code>this.setState({})</code> and pass this state value between components, and the application will be working in the same way. What is the advantage of <code>redux</code>?</p>
| 0debug
|
How to call a view from a view model using MVVM pattern : I have two view models A and B. On a double click on view A I need to display view B. How can I call a view B from a view Model A using the `MVVM` pattern.
I have looked around and I couldn't find a clear example that demonstrate this fundamental concept for the `MVVM` pattern.
Thank you
| 0debug
|
static inline void mix_3f_2r_to_stereo(AC3DecodeContext *ctx)
{
int i;
float (*output)[256] = ctx->audio_block.block_output;
for (i = 0; i < 256; i++) {
output[1][i] += (output[2][i] + output[4][i]);
output[2][i] += (output[3][i] + output[5][i]);
}
memset(output[3], 0, sizeof(output[3]));
memset(output[4], 0, sizeof(output[4]));
memset(output[5], 0, sizeof(output[5]));
}
| 1threat
|
count elements with specific data using ES6 concatenation : <p>trying to use <code>ecmascript 6</code> variable concatenation.</p>
<p>Expecting <code>exists</code> in console but getting error. Please help: </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>let path = 'abc';
if($('.title[data-path=${path}]').length > 0){
console.log('exists');
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class='title' data-path = 'abc'>lorem</div>
<div class='title' data-path = 'def'>ipsum</div>
<div class='title' data-path = 'abc'>lorem</div></code></pre>
</div>
</div>
</p>
| 0debug
|
boostrap div margin top : **Boostrap**
<div class="mb-md-3 ml-md-3 col-lg-8" >
<!-- <div class="mb-md-3 ml-md-3 col-lg-8" > -->
<a href="<?php echo base_url();?>admin/admin/add_hospital">
<button class="btn btn-success" onclick="add_hospital()">
<i class="fas fa-plus"></i> Add Hospital
</button>
</a>
</div>
please make a margin top as possible, I try some more times ith different ways but it cant fix. boostrap class may *mt-md-3*
| 0debug
|
Can't ping server, but server can ping client : <p>I have a Windows Server 2012 R2 Standard using a D-Link router. I want to Configure it using Static IP Addresses.</p>
<p>on the Internet Protocol Version 4, I set these variables:</p>
<pre><code>IP address -----> IPv4 address from doing ipconfig
Subnet mask -----> 255.255.255.0
Default gateway -> Default gateway from doing ipconfig
Preferred DNS server -> 208.67.222.222
Alternate DNS server -> 208.67.220.220
</code></pre>
<p>Everything seems to be OK, but when I ping the IPv4 address from another computer I got a request timeout, but server can ping client.
The Windows Firewall setting is the default one</p>
| 0debug
|
How to install sshpass on Windows through Cygwin? : <p>In the packages window of CygWin, when I type sshpass, nothing comes up. I tried installing similar packages like openssh etc hoping one of them contains sshpass but no luck.</p>
| 0debug
|
IOS - adding images takes long time (core data) : How can I make the way I add images to the core data more efficient? It's taking 30 seconds to complete with this code.
for(int i = 0; i<photonum; i++){ //Fetch all the missing user ids
NSString *str = [NSString stringWithFormat:@"http://%@/%@%@", httpPath, photoPath,[NSString stringWithFormat:@"%@.JPG",[[photoless objectAtIndex:i] valueForKey:@"user_id"]]];
NSData *imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: str] options:0 error:&error];
if(error){
NSLog(@"Error, image with path %@ not found", str);
NSLog(@"Error : %@ %@", error,error.localizedDescription);
continue;
}
// Set the student picture
NSManagedObject *student = [photoless objectAtIndex:i];
[student setValue:imageData forKey:@"photo"];
[student.managedObjectContext save:&error];
}
| 0debug
|
How does a vector as a key works internally in C++? : <p>This SO answers says that <a href="https://stackoverflow.com/questions/8903737/stl-map-with-a-vector-for-the-key">STL Map with a Vector for the Key</a> the vector can be used as a key. So when we use a vector as a key. How does that actually work since the key needs to be unique so when we insert another vector with the same elements will the <code>map</code> check for duplicate element by element or the name of the vector does specify something? Like the name of the array represents the base address. So an array can be used as a key since the base address can be used as a key in this case but what is the key in case of a vector. How does it work internally.</p>
<p>Because when I print the name of the vector, I do get an error</p>
<pre><code>vector<int> v;
cout<<v; //error
</code></pre>
| 0debug
|
How do i take the table from this website into a dataframe? : <p>I have this link from forbes.. <a href="http://www.forbes.com/global2000/list/" rel="nofollow noreferrer">http://www.forbes.com/global2000/list/</a> . I need to take the top 2000 companies table into a dataframe for analysis. How do i do that?</p>
| 0debug
|
static void armv7m_bitband_init(void)
{
DeviceState *dev;
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x20000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x40000000);
qdev_init(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);
}
| 1threat
|
ngx-translate .instant returns key instead of value : <p>I am trying to make a method which would accept string key and return translated string value by using translate.instant(parameter). The problem is that it returns key(parameter). Usually this is returned if it doesn't find translation. I think the problem is that method gets called before loader loads translations.</p>
<p>My app.module.ts imports:</p>
<pre><code> TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
}
})
</code></pre>
<p>createTranslateLoader function: </p>
<pre><code> export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
</code></pre>
<p>In my app.component:</p>
<pre><code>constructor(public translate: TranslateService){
translate.setDefaultLang('en');
translate.use('en');
}
</code></pre>
<p>When I translate in html using pipes it works ok.</p>
| 0debug
|
How do I run a specific Behat scenario : <p>I'm trying to run a specific Behat scenario from the command line, here's what I'm doing:</p>
<pre><code>$ bin/behat features/features/baseline.feature:3
</code></pre>
<p>However this isn't picking up the scenario.</p>
<p>If I run</p>
<pre><code>bin/behat features/features/baseline.feature
</code></pre>
<p>I can get the entire feature file to run.</p>
<p>Here's what the file looks like -- the scenario I'm trying to run is on line 3 in my text editor:</p>
<pre><code>Feature:
@api
Scenario: Clear cache
Given the cache has been cleared
When I am on the homepage
Then I should get a "200" HTTP response
Scenario:
Given I am not logged in
When I am on the homepage
Then I should see the text "We love our users"
</code></pre>
| 0debug
|
List 'target' of 'links' (powershell) : I need to get the 'target' inside of a shortcut.
But... when i use -Recurse, it follows the links, instead of simply just getting the shortcut target
Here is code that I found online that I edited to serve my purpose ... but it recurses into the links:
#Created By Scott
$varLogFile = "E:\Server\GetBriefsTargets.log"
$varCSVFile = "E:\Server\GetBriefsTargets.csv"
function Get-StartMenuShortcuts
{
$Shortcuts = Get-ChildItem -Recurse "F:\Connect" -Include *.lnk
#$Shortcuts = Get-ChildItem -Recurse "D:\Scripts\scott_testing" -Include *.lnk
$Shell = New-Object -ComObject WScript.Shell
foreach ($Shortcut in $Shortcuts)
{
$Properties = @{
ShortcutName = $Shortcut.Name;
ShortcutFull = $Shortcut.FullName;
ShortcutPath = $shortcut.DirectoryName
Target = $Shell.CreateShortcut($Shortcut).targetpath
}
New-Object PSObject -Property $Properties
}
[Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | Out-Null
}
$Output = Get-StartMenuShortcuts
$Output
ECHO "$Output" >> $varLogFile
ECHO "$Output" >> $varCSVFile
Could someone please offer advice on what I can change so that it still finds all of the shortcuts into all of the folders?
ie:
F:\Connect\CLIENTA\shortcut.lnk
F:\Connect\CLIENTB\shortcut.lnk
etc
There's about 100 clients that I have to get their links and I don't want to do it manually (each month)
| 0debug
|
How to Calculating Scientific Method Using PHP : <p>I'm New in PHP I just ask simply question.I have calculating number without any formula. this is working fine.Now I have using formula in calculation.Check my example..</p>
<pre><code><?php
$calculation = (350/ (1+(18/100)) ;
?>
</code></pre>
<p>i have getting error this
how to calculate this method </p>
| 0debug
|
How to reduce size of an apk file? : <p>First of all, don't suggest me <a href="https://developer.android.com/topic/performance/reduce-apk-size.html" rel="noreferrer">official documentation</a> or <a href="https://stackoverflow.com/questions/40036945/android-studio-2-2-compress-all-so-files-in-built-apk">this</a>. When we build an app from Android Studio with predefined textview that simply displays "hello world", it generates an APK with more than 1.2MB. But some apps on playstore is available under 500KB with lot of features. I already applied all features of Android Studio like proguard, minifyEnabled etc. but that does not help. So, how can i achieve that level of compression?</p>
| 0debug
|
Spark SQL - How to write DataFrame to text file? : <p>I am using <code>Spark SQL</code> for reading parquet and writing parquet file.</p>
<p>But some cases,i need to write the <code>DataFrame</code> as text file instead of Json or Parquet.</p>
<p>Is there any default methods supported or i have to convert that DataFrame to <code>RDD</code> then use <code>saveAsTextFile()</code> method?</p>
| 0debug
|
static void gen_adc(TCGv t0, TCGv t1)
{
TCGv tmp;
tcg_gen_add_i32(t0, t0, t1);
tmp = load_cpu_field(CF);
tcg_gen_add_i32(t0, t0, tmp);
dead_tmp(tmp);
}
| 1threat
|
static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples)
{
AVFilterContext *ctx = inlink->dst;
AVFilterLink *outlink = ctx->outputs[0];
ShowSpectrumContext *s = ctx->priv;
AVFrame *outpicref = s->outpicref;
int ret, plane, x, y, z = s->orientation == VERTICAL ? s->h : s->w;
clear_combine_buffer(s, z);
ctx->internal->execute(ctx, plot_channel, NULL, NULL, s->nb_display_channels);
for (y = 0; y < z * 3; y++) {
s->combine_buffer[y] += s->color_buffer[0][y];
for (x = 1; x < s->nb_display_channels; x++) {
s->combine_buffer[y] += s->color_buffer[x][y];
}
}
av_frame_make_writable(s->outpicref);
if (s->orientation == VERTICAL) {
if (s->sliding == SCROLL) {
for (plane = 0; plane < 3; plane++) {
for (y = 0; y < s->h; y++) {
uint8_t *p = outpicref->data[plane] +
y * outpicref->linesize[plane];
memmove(p, p + 1, s->w - 1);
}
}
s->xpos = s->w - 1;
} else if (s->sliding == RSCROLL) {
for (plane = 0; plane < 3; plane++) {
for (y = 0; y < s->h; y++) {
uint8_t *p = outpicref->data[plane] +
y * outpicref->linesize[plane];
memmove(p + 1, p, s->w - 1);
}
}
s->xpos = 0;
}
for (plane = 0; plane < 3; plane++) {
uint8_t *p = outpicref->data[plane] + s->start_x +
(outlink->h - 1 - s->start_y) * outpicref->linesize[plane] +
s->xpos;
for (y = 0; y < s->h; y++) {
*p = lrintf(av_clipf(s->combine_buffer[3 * y + plane], 0, 255));
p -= outpicref->linesize[plane];
}
}
} else {
if (s->sliding == SCROLL) {
for (plane = 0; plane < 3; plane++) {
for (y = 1; y < s->h; y++) {
memmove(outpicref->data[plane] + (y-1) * outpicref->linesize[plane],
outpicref->data[plane] + (y ) * outpicref->linesize[plane],
s->w);
}
}
s->xpos = s->h - 1;
} else if (s->sliding == RSCROLL) {
for (plane = 0; plane < 3; plane++) {
for (y = s->h - 1; y >= 1; y--) {
memmove(outpicref->data[plane] + (y ) * outpicref->linesize[plane],
outpicref->data[plane] + (y-1) * outpicref->linesize[plane],
s->w);
}
}
s->xpos = 0;
}
for (plane = 0; plane < 3; plane++) {
uint8_t *p = outpicref->data[plane] + s->start_x +
(s->xpos + s->start_y) * outpicref->linesize[plane];
for (x = 0; x < s->w; x++) {
*p = lrintf(av_clipf(s->combine_buffer[3 * x + plane], 0, 255));
p++;
}
}
}
if (s->sliding != FULLFRAME || s->xpos == 0)
outpicref->pts = insamples->pts;
s->xpos++;
if (s->orientation == VERTICAL && s->xpos >= s->w)
s->xpos = 0;
if (s->orientation == HORIZONTAL && s->xpos >= s->h)
s->xpos = 0;
if (!s->single_pic && (s->sliding != FULLFRAME || s->xpos == 0)) {
ret = ff_filter_frame(outlink, av_frame_clone(s->outpicref));
if (ret < 0)
return ret;
}
return s->win_size;
}
| 1threat
|
List of Numbers which the Program Determines to be Prime or Not (Python) : I'm someone who is relatively new to Python (I just started maybe two, three weeks ago) and I'm trying to learn the computer language through SoloLearn. I've been looking for beginner projects online to help me reinforce what I've learned, and I ended up creating my own involving prime numbers. The program goes like this: the user inputs x number of values which will be stored into a list. The program then goes through each number in the list, and determines whether it is prime or not. I've been trying to figure out how I'd do this, however, now I'm really confused and the program doesn't work. Would you help a fella out, and do your best to explain me how I'd fix the program to make it actually work please?
1. Here is what I've got so far:
print("Hello User, this is the Prime Numbers Game!")
print("You will be required to input 5 numbers, and the game will return which numbers are prime, and which numbers aren't")
new_list = []
counter = 0
counter1 = 0
while counter < 5:
new_list.append(int(input()))
counter += 1
index = 0
for index in range(0, int(enumerate(new_list, start = 1)):
for i in range(2, new_list[index]):
if new_list[index] % i != 0:
print(str(new_list[index]) + " IS PRIME")
elif new_list[index] < 2:
print(str(new_list[index]) + " IS PRIME")
elif new_list[index] % i == 0:
print(str(new_list[index]) + " IS NOT PRIME")
| 0debug
|
Android EditText with different floating label and placeholder : <p>How can i create an editText that looks like this?</p>
<p><a href="https://i.stack.imgur.com/jB2pV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jB2pV.png" alt="Edit Text with placeholder and label"></a></p>
| 0debug
|
static int bmdma_prepare_buf(IDEDMA *dma, int is_write)
{
BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);
IDEState *s = bmdma_active_if(bm);
struct {
uint32_t addr;
uint32_t size;
} prd;
int l, len;
qemu_sglist_init(&s->sg, s->nsector / (BMDMA_PAGE_SIZE / 512) + 1);
s->io_buffer_size = 0;
for(;;) {
if (bm->cur_prd_len == 0) {
if (bm->cur_prd_last ||
(bm->cur_addr - bm->addr) >= BMDMA_PAGE_SIZE)
return s->io_buffer_size != 0;
cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&prd, 8);
bm->cur_addr += 8;
prd.addr = le32_to_cpu(prd.addr);
prd.size = le32_to_cpu(prd.size);
len = prd.size & 0xfffe;
if (len == 0)
len = 0x10000;
bm->cur_prd_len = len;
bm->cur_prd_addr = prd.addr;
bm->cur_prd_last = (prd.size & 0x80000000);
}
l = bm->cur_prd_len;
if (l > 0) {
qemu_sglist_add(&s->sg, bm->cur_prd_addr, l);
bm->cur_prd_addr += l;
bm->cur_prd_len -= l;
s->io_buffer_size += l;
}
}
return 1;
}
| 1threat
|
Android how to store all ArrayList<ArrayList<String>> values into ArrayList<String> : stylistIDArray=differentGenderServicesAdapter.getSelectedStylistIdArray();
durationArray=differentGenderServicesAdapter.getSelectedDurArray();
ArrayList<String>stylistId=new ArrayList<>();
ArrayList<String>duration=new ArrayList<>();
for(int i=0; i<stylistIDArray.size(); i++) {
stylistId=stylistIDArray.get(i);
duration=durationArray.get(i);
}
I am having issue to store all values of ArrayList<ArrayList<String>> into ArrayList<String> here stylistIDArray and durationArray is arrayofarray i want to store all values in stylistId and duration.The stylistid and duration are array of string.when i am trying to add its storing only the last position of arrayofarrayList.
| 0debug
|
UIView appereance from bottom to top and vice versa(Core Animation) : <p>My goal is to understand and implement feature via Core Animation.<br>
I think it's not so hard,but unfortunately i don't know swift/Obj C and it's hard to understand native examples. </p>
<hr>
<h2>Visual implementation</h2>
<p>So what exactly i want to do(few steps as shown on images):<br>
1. <a href="https://i.stack.imgur.com/a39bD.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/a39bD.jpg" alt="Source"></a><br>
2. <a href="https://i.stack.imgur.com/ZrzTk.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ZrzTk.jpg" alt="enter image description here"></a><br>
3. <a href="https://i.stack.imgur.com/2w2xs.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/2w2xs.jpg" alt="enter image description here"></a><br>
4. <a href="https://i.stack.imgur.com/QkJF2.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/QkJF2.jpg" alt="enter image description here"></a> </p>
<p>And the same steps to hide view(vice versa,from top to bottom) until this : </p>
<p><a href="https://i.stack.imgur.com/ZrzTk.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ZrzTk.jpg" alt="enter image description here"></a> </p>
<p>Also,i want to make this <strong>UIView</strong> more generic,i mean to put this <strong>UIView</strong> on my StoryBoard and put so constraints on AutoLayout(to support different device screens). </p>
<p>Any ideas? Thanks!</p>
| 0debug
|
import math
def otherside_rightangle(w,h):
s=math.sqrt((w*w)+(h*h))
return s
| 0debug
|
static void update_initial_durations(AVFormatContext *s, AVStream *st,
int stream_index, int duration)
{
AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
int64_t cur_dts = RELATIVE_TS_BASE;
if (st->first_dts != AV_NOPTS_VALUE) {
if (st->update_initial_durations_done)
return;
st->update_initial_durations_done = 1;
cur_dts = st->first_dts;
for (; pktl; pktl = get_next_pkt(s, st, pktl)) {
if (pktl->pkt.stream_index == stream_index) {
if (pktl->pkt.pts != pktl->pkt.dts ||
pktl->pkt.dts != AV_NOPTS_VALUE ||
pktl->pkt.duration)
break;
cur_dts -= duration;
}
}
if (pktl && pktl->pkt.dts != st->first_dts) {
av_log(s, AV_LOG_DEBUG, "first_dts %s not matching first dts %s (pts %s, duration %"PRId64") in the queue\n",
av_ts2str(st->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.duration);
return;
}
if (!pktl) {
av_log(s, AV_LOG_DEBUG, "first_dts %s but no packet with dts in the queue\n", av_ts2str(st->first_dts));
return;
}
pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue;
st->first_dts = cur_dts;
} else if (st->cur_dts != RELATIVE_TS_BASE)
return;
for (; pktl; pktl = get_next_pkt(s, st, pktl)) {
if (pktl->pkt.stream_index != stream_index)
continue;
if (pktl->pkt.pts == pktl->pkt.dts &&
(pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == st->first_dts) &&
!pktl->pkt.duration) {
pktl->pkt.dts = cur_dts;
if (!st->internal->avctx->has_b_frames)
pktl->pkt.pts = cur_dts;
pktl->pkt.duration = duration;
} else
break;
cur_dts = pktl->pkt.dts + pktl->pkt.duration;
}
if (!pktl)
st->cur_dts = cur_dts;
}
| 1threat
|
static int kvm_has_msr_star(CPUState *env)
{
kvm_supported_msrs(env);
return has_msr_star;
}
| 1threat
|
Open interface with image buttons Python : Ok what I'm trying to do is to make a simple interface, a window in which there are some squares containing an image that executes a code when clicking it. The images are contained in a folder. As soon as an user clicks on the image the interface should close and execute a code. Is this possible? I'm using Windows 10 and python 3.5.2
| 0debug
|
Ios objective c progress bar update in background : Ive ran various types of code to try and make a progress bar increment for x seconds and continue to do so even when in background. Currently the bar just resumes from where it left off via the timer when going from background to focus.
How can I continue the timer even when the user minimizes the app?
Many thanks!
| 0debug
|
Python: ValueError: The truth value of a Series is ambiguous. : I'm not sure why I keep getting this error. I've check the path for student and grade and they print out fine. I'm trying to drop any values of current students who have grades listed as fail. Any suggestions on how to improve this code?
df.drop(df.query(student == 'current' and grade == 'fail').index, inplace=True)
This is the full error I get:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Python 3
| 0debug
|
Webpacker configuration file not found - Rails 6.0.0 : <p>I was trying to run "rails s" to run my server then I suddenly run into an error that says webpacker configuration not found. </p>
<p>Here's the info:</p>
<pre><code>boot@noki-K54C:~/Desktop/app$ rails s
=&gt; Booting Puma
=&gt; Rails 6.0.0 application starting in development
=&gt; Run `rails server --help` for more startup options
RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Exiting
<b>Traceback</b> (most recent call last):
79: from bin/rails:3:in `&lt;main&gt;&apos;
78: from bin/rails:3:in `load&apos;
77: from /home/app/Desktop/jonabell/bin/spring:15:in `&lt;top (required)&gt;&apos;
76: from /home/app/Desktop/jonabell/bin/spring:15:in `require&apos;
75: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `&lt;top (required)&gt;&apos;
74: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load&apos;
73: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/bin/spring:49:in `&lt;top (required)&gt;&apos;
72: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run&apos;
71: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call&apos;
70: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call&apos;
69: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load&apos;
68: from /home/app/Desktop/jonabell/bin/rails:9:in `&lt;top (required)&gt;&apos;
67: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require&apos;
66: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency&apos;
65: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require&apos;
64: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require&apos;
63: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi&apos;
62: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register&apos;
61: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi&apos;
60: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require&apos;
59: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `&lt;main&gt;&apos;
58: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke&apos;
57: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform&apos;
56: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch&apos;
55: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command&apos;
54: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run&apos;
53: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform&apos;
52: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap&apos;
51: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:147:in `block in perform&apos;
50: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:37:in `start&apos;
49: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout&apos;
48: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app&apos;
47: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app&apos;
46: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config&apos;
45: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file&apos;
44: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string&apos;
43: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval&apos;
42: from config.ru:in `&lt;main&gt;&apos;
41: from config.ru:in `new&apos;
40: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize&apos;
39: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval&apos;
38: from config.ru:3:in `block in &lt;main&gt;&apos;
37: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative&apos;
36: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require&apos;
35: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency&apos;
34: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require&apos;
33: from /home/app/.rvm/gems/ruby-2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require&apos;
32: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require&apos;
31: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi&apos;
30: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register&apos;
29: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi&apos;
28: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require&apos;
27: from /home/app/Desktop/jonabell/config/environment.rb:5:in `&lt;main&gt;&apos;
26: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!&apos;
25: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers&apos;
24: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each&apos;
23: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each&apos;
22: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component&apos;
21: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `call&apos;
20: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each&apos;
19: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component&apos;
18: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from&apos;
17: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component&apos;
16: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each&apos;
15: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers&apos;
14: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run&apos;
13: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec&apos;
12: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:84:in `block in &lt;class:Engine&gt;&apos;
11: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `bootstrap&apos;
10: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:14:in `bootstrap&apos;
9: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:18:in `refresh&apos;
8: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:83:in `load&apos;
7: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:47:in `public_manifest_path&apos;
6: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:43:in `public_output_path&apos;
5: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:39:in `public_path&apos;
4: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:80:in `fetch&apos;
3: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:84:in `data&apos;
2: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `load&apos;
1: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `read&apos;
/home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `read&apos;: <b>No such file or directory @ rb_sysopen - /home/app/Desktop/jonabell/config/webpacker.yml (</b><u style="text-decoration-style:single"><b>Errno::ENOENT</b></u><b>)</b>
78: from bin/rails:3:in `&lt;main&gt;&apos;
77: from bin/rails:3:in `load&apos;
76: from /home/app/Desktop/jonabell/bin/spring:15:in `&lt;top (required)&gt;&apos;
75: from /home/app/Desktop/jonabell/bin/spring:15:in `require&apos;
74: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `&lt;top (required)&gt;&apos;
73: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load&apos;
72: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/bin/spring:49:in `&lt;top (required)&gt;&apos;
71: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run&apos;
70: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call&apos;
69: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call&apos;
68: from /home/app/.rvm/gems/ruby-2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load&apos;
67: from /home/app/Desktop/jonabell/bin/rails:9:in `&lt;top (required)&gt;&apos;
66: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require&apos;
65: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency&apos;
64: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require&apos;
63: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require&apos;
62: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi&apos;
61: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register&apos;
60: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi&apos;
59: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require&apos;
58: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `&lt;main&gt;&apos;
57: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke&apos;
56: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform&apos;
55: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch&apos;
54: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command&apos;
53: from /home/app/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run&apos;
52: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform&apos;
51: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap&apos;
50: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:147:in `block in perform&apos;
49: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:37:in `start&apos;
48: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout&apos;
47: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app&apos;
46: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app&apos;
45: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config&apos;
44: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file&apos;
43: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string&apos;
42: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval&apos;
41: from config.ru:in `&lt;main&gt;&apos;
40: from config.ru:in `new&apos;
39: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize&apos;
38: from /home/app/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval&apos;
37: from config.ru:3:in `block in &lt;main&gt;&apos;
36: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `require_relative&apos;
35: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require&apos;
34: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency&apos;
33: from /home/app/.rvm/gems/ruby-2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require&apos;
32: from /home/app/.rvm/gems/ruby-2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require&apos;
31: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require&apos;
30: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi&apos;
29: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register&apos;
28: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi&apos;
27: from /home/app/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require&apos;
26: from /home/app/Desktop/jonabell/config/environment.rb:5:in `&lt;main&gt;&apos;
25: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!&apos;
24: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers&apos;
23: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each&apos;
22: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each&apos;
21: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component&apos;
20: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `call&apos;
19: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each&apos;
18: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component&apos;
17: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from&apos;
16: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component&apos;
14: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers&apos;
13: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run&apos;
12: from /home/app/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec&apos;
11: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:84:in `block in &lt;class:Engine&gt;&apos;
10: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `bootstrap&apos;
9: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:14:in `bootstrap&apos;
8: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:18:in `refresh&apos;
7: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:83:in `load&apos;
6: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:47:in `public_manifest_path&apos;
5: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:43:in `public_output_path&apos;
4: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:39:in `public_path&apos;
3: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:80:in `fetch&apos;
2: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:84:in `data&apos;
1: from /home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:87:in `load&apos;
/home/app/.rvm/gems/ruby-2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:91:in `rescue in load&apos;: <b>Webpacker configuration file not found /home/app/Desktop/jonabell/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /home/app/Desktop/jonabell/config/webpacker.yml (</b><u style="text-decoration-style:single"><b>RuntimeError</b></u><b>)</b>
boot@noki-K54C:~/Desktop/app$
</code></pre>
<p>I already check the version of rails and its 6.0.0 my ruby version is 2.6.0.</p>
<p>Tried to search the web and try a few solutions but did not work out for me. </p>
<p>Any idea what am I missing? </p>
| 0debug
|
static char *shorts2str(int16_t *sp, int count, const char *sep)
{
int i;
char *ap, *ap0;
if (!sep) sep = ", ";
ap = av_malloc((5 + strlen(sep)) * count);
if (!ap)
return NULL;
ap0 = ap;
ap[0] = '\0';
for (i = 0; i < count; i++) {
int l = snprintf(ap, 5 + strlen(sep), "%d%s", sp[i], sep);
ap += l;
}
ap0[strlen(ap0) - strlen(sep)] = '\0';
return ap0;
}
| 1threat
|
JavaFX Click through overlaying stackpane : <p><img src="https://i.imgur.com/TMlKICc.png" alt="schematic"></p>
<p>As you can see in the drawing above, I have a stackpane containing two elements, a BorderPane (which again contains a canvas and a statusbar) and another stackpane (which contains some other UI things).</p>
<p>I'd like to be able to click through from invisible areas of the green stackpane to the yellow borderpane but still allow clicking on actual UI stuff on the green stackpane (where there is clickable things like buttons etc.).</p>
<p>How do you do this?</p>
| 0debug
|
static int write_extradata(FFV1Context *f)
{
RangeCoder *const c = &f->c;
uint8_t state[CONTEXT_SIZE];
int i, j, k;
uint8_t state2[32][CONTEXT_SIZE];
unsigned v;
memset(state2, 128, sizeof(state2));
memset(state, 128, sizeof(state));
f->avctx->extradata_size = 10000 + 4 +
(11 * 11 * 5 * 5 * 5 + 11 * 11 * 11) * 32;
f->avctx->extradata = av_malloc(f->avctx->extradata_size);
ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
put_symbol(c, state, f->version, 0);
if (f->version > 2) {
if (f->version == 3)
f->minor_version = 2;
put_symbol(c, state, f->minor_version, 0);
}
put_symbol(c, state, f->ac, 0);
if (f->ac > 1)
for (i = 1; i < 256; i++)
put_symbol(c, state, f->state_transition[i] - c->one_state[i], 1);
put_symbol(c, state, f->colorspace, 0);
put_symbol(c, state, f->bits_per_raw_sample, 0);
put_rac(c, state, f->chroma_planes);
put_symbol(c, state, f->chroma_h_shift, 0);
put_symbol(c, state, f->chroma_v_shift, 0);
put_rac(c, state, f->transparency);
put_symbol(c, state, f->num_h_slices - 1, 0);
put_symbol(c, state, f->num_v_slices - 1, 0);
put_symbol(c, state, f->quant_table_count, 0);
for (i = 0; i < f->quant_table_count; i++)
write_quant_tables(c, f->quant_tables[i]);
for (i = 0; i < f->quant_table_count; i++) {
for (j = 0; j < f->context_count[i] * CONTEXT_SIZE; j++)
if (f->initial_states[i] && f->initial_states[i][0][j] != 128)
break;
if (j < f->context_count[i] * CONTEXT_SIZE) {
put_rac(c, state, 1);
for (j = 0; j < f->context_count[i]; j++)
for (k = 0; k < CONTEXT_SIZE; k++) {
int pred = j ? f->initial_states[i][j - 1][k] : 128;
put_symbol(c, state2[k],
(int8_t)(f->initial_states[i][j][k] - pred), 1);
}
} else {
put_rac(c, state, 0);
}
}
if (f->version > 2) {
put_symbol(c, state, f->ec, 0);
}
f->avctx->extradata_size = ff_rac_terminate(c);
v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0,
f->avctx->extradata, f->avctx->extradata_size);
AV_WL32(f->avctx->extradata + f->avctx->extradata_size, v);
f->avctx->extradata_size += 4;
return 0;
}
| 1threat
|
How to upload an image in php mysql : <p>Hi iam trying to upload an image into database but it is inserting the tmp_name in the database.Can anyone help me this .</p>
<p>Here is my code</p>
<pre><code><?php
$connection = mysql_connect("localhost", "root", "") or die(mysql_error());
$db = mysql_select_db("accountant", $connection);
$title=$_POST['blog_title'];
$description=$_POST['blog_description'];
$name=$_FILES["image"]["tmp_name"];
$type=$_FILES["image"]["type"];
$size=$_FILES["image"]["size"];
$temp=$_FILES["image"]["tmp_name"];
$error=$_FILES["image"]["error"];
if($error>0)
die("error while uploading");
else
{
if($type == "image/png" || $type == "image/jpeg" ||$type == "image/jpg" || $type == "image/svg" || $size >2000000)
{
move_uploaded_file($temp,"upload/".$name);
$sql=mysql_query("INSERT INTO blogs(image,blog_title,blog_description)values('$name','$title','$description')");
echo "upload complete";
}
else
{
die("Format not allowed or file size too big!");
}
}
</code></pre>
<p>Iam trying to insert an image getting errors as </p>
<p>Warning: move_uploaded_file(upload/C:\xampp\tmp\php1908.tmp): failed to open stream: Invalid argument in C:\xampp\htdocs\accounting\admin\blogs.php on line 21</p>
<p>Warning: move_uploaded_file(): Unable to move 'C:\xampp\tmp\php1908.tmp' to 'upload/C:\xampp\tmp\php1908.tmp' </p>
<p>In database it is inserting as C:xampp mpphp1908.tmp</p>
| 0debug
|
Android - How to create a Notification with Action : <p>I'm creating a notification like this. </p>
<pre><code>Notification.Builder builder = new Notification.Builder(context);
builder.setContentTitle(notifyMessage1)
.setContentText(notifyMessage2)
.setSmallIcon(R.mipmap.ic_launcher);
Notification notification = builder.build();
</code></pre>
<p>I want to add a action to my notification with</p>
<pre><code>builder.addAction();
</code></pre>
<p>To realize <code>addAction(icon, title, pendingIntent);</code> is deprecated </p>
<p>My geal is to create a notification action without an icon, how can i achieve that? </p>
| 0debug
|
Getting an error on Android 8 on a Samsung device using SCameraCaptureSession : <p>I'm trying to capture a video using SCameraCaptureSession class. While using a function of this class - setRepeatingRequest (which described <a href="https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingRequest(android.hardware.camera2.CaptureRequest,%20android.hardware.camera2.CameraCaptureSession.CaptureCallback,%20android.os.Handler)" rel="noreferrer">here</a>), I'm getting the following error:</p>
<p><strong>java.lang.IllegalArgumentException: CaptureRequest contains unconfigured Input/Output Surface!</strong></p>
<p>As I noticed, the problem is occurring because of something in the MediaRecorder's Surface object. However, it is working fine while using Android version older than 8 and the crash happens only on Samsung devices running Android 8.
No google search revealed anything useful about that crash, so I believe it is quite new... </p>
<p>Does anyone have any piece of information? How can I make that MediaRecorder's surface work fine on a device like I mentioned?</p>
<p><strong>Important note:</strong> Capturing the video works <strong>great</strong> on any Android version before 8!!!</p>
| 0debug
|
Python, parallelization with joblib: Delayed with multiple arguments : <p>I am using something similar to the following to parallelize a for loop over two matrices</p>
<pre><code>from joblib import Parallel, delayed
import numpy
def processInput(i,j):
for k in range(len(i)):
i[k] = 1
for t in range(len(b)):
j[t] = 0
return i,j
a = numpy.eye(3)
b = numpy.eye(3)
num_cores = 2
(a,b) = Parallel(n_jobs=num_cores)(delayed(processInput)(i,j) for i,j in zip(a,b))
</code></pre>
<p>but I'm getting the following error: Too many values to unpack (expected 2)</p>
<p>Is there a way to return 2 values with delayed? Or what solution would you propose?</p>
<p>Also, a bit OP, is there a more compact way, like the following (which doesn't actually modify anything) to process the matrices?</p>
<pre><code>from joblib import Parallel, delayed
def processInput(i,j):
for k in i:
k = 1
for t in b:
t = 0
return i,j
</code></pre>
<p>I would like to avoid the use of has_shareable_memory anyway, to avoid possible bad interactions in the actual script and lower performances(?)</p>
| 0debug
|
static int sd_create(const char *filename, QEMUOptionParameter *options,
Error **errp)
{
int ret = 0;
uint32_t vid = 0;
char *backing_file = NULL;
BDRVSheepdogState *s;
char tag[SD_MAX_VDI_TAG_LEN];
uint32_t snapid;
bool prealloc = false;
Error *local_err = NULL;
s = g_malloc0(sizeof(BDRVSheepdogState));
memset(tag, 0, sizeof(tag));
if (strstr(filename, ":
ret = sd_parse_uri(s, filename, s->name, &snapid, tag);
} else {
ret = parse_vdiname(s, filename, s->name, &snapid, tag);
}
if (ret < 0) {
goto out;
}
while (options && options->name) {
if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
s->inode.vdi_size = options->value.n;
} else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) {
backing_file = options->value.s;
} else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) {
if (!options->value.s || !strcmp(options->value.s, "off")) {
prealloc = false;
} else if (!strcmp(options->value.s, "full")) {
prealloc = true;
} else {
error_report("Invalid preallocation mode: '%s'",
options->value.s);
ret = -EINVAL;
goto out;
}
} else if (!strcmp(options->name, BLOCK_OPT_REDUNDANCY)) {
ret = parse_redundancy(s, options->value.s);
if (ret < 0) {
goto out;
}
}
options++;
}
if (s->inode.vdi_size > SD_MAX_VDI_SIZE) {
error_report("too big image size");
ret = -EINVAL;
goto out;
}
if (backing_file) {
BlockDriverState *bs;
BDRVSheepdogState *s;
BlockDriver *drv;
drv = bdrv_find_protocol(backing_file, true);
if (!drv || strcmp(drv->protocol_name, "sheepdog") != 0) {
error_report("backing_file must be a sheepdog image");
ret = -EINVAL;
goto out;
}
ret = bdrv_file_open(&bs, backing_file, NULL, 0, &local_err);
if (ret < 0) {
qerror_report_err(local_err);
error_free(local_err);
goto out;
}
s = bs->opaque;
if (!is_snapshot(&s->inode)) {
error_report("cannot clone from a non snapshot vdi");
bdrv_unref(bs);
ret = -EINVAL;
goto out;
}
bdrv_unref(bs);
}
ret = do_sd_create(s, &vid, 0);
if (!prealloc || ret) {
goto out;
}
ret = sd_prealloc(filename);
out:
g_free(s);
return ret;
}
| 1threat
|
How to show all DB result in PDO-form? : So,
I just started with PDO and the connection and stuff work great, but now I have a little problem. I'm stuck on a part where I want to show 6 results per table. My code is as following:
<?php
$sql = "SELECT * FROM db WHERE id BETWEEN 1 AND 6";
$stmt->bindParam(':userName', $userName);
$stmt->bindParam(':hours', $hours);
try {
$stmt = $conn->prepare($sql);
$result = $stmt->execute($parameters);
} while($row = $result->fetch_assoc()){ ?>
<tr>
<td><b><?php echo $row['hours'] ?></b></td>
<td><a href="#"></a></td>
<td id="dayhour-1">
<input placeholder="Name" type="text" class="form-control" id="1" value="<?php echo $row['userName'] ?>">
</td>
</tr>
<?php } $stmt->close(); ?>
When I go to the webpage, it is showing the well-known 500 error. I have no idea what I am doing wrong because I am a starter. Please let me know what I am doing wrong and how I can solve this problem.
| 0debug
|
static int dct_quantize_refine(MpegEncContext *s,
DCTELEM *block, int16_t *weight, DCTELEM *orig,
int n, int qscale){
int16_t rem[64];
DCTELEM d1[64];
const int *qmat;
const uint8_t *scantable= s->intra_scantable.scantable;
const uint8_t *perm_scantable= s->intra_scantable.permutated;
int run_tab[65];
int prev_run=0;
int prev_level=0;
int qmul, qadd, start_i, last_non_zero, i, dc;
uint8_t * length;
uint8_t * last_length;
int lambda;
int rle_index, run, q, sum;
#ifdef REFINE_STATS
static int count=0;
static int after_last=0;
static int to_zero=0;
static int from_zero=0;
static int raise=0;
static int lower=0;
static int messed_sign=0;
#endif
if(basis[0][0] == 0)
build_basis(s->dsp.idct_permutation);
qmul= qscale*2;
qadd= (qscale-1)|1;
if (s->mb_intra) {
if (!s->h263_aic) {
if (n < 4)
q = s->y_dc_scale;
else
q = s->c_dc_scale;
} else{
q = 1;
qadd=0;
}
q <<= RECON_SHIFT-3;
dc= block[0]*q;
start_i = 1;
qmat = s->q_intra_matrix[qscale];
length = s->intra_ac_vlc_length;
last_length= s->intra_ac_vlc_last_length;
} else {
dc= 0;
start_i = 0;
qmat = s->q_inter_matrix[qscale];
length = s->inter_ac_vlc_length;
last_length= s->inter_ac_vlc_last_length;
}
last_non_zero = s->block_last_index[n];
#ifdef REFINE_STATS
{START_TIMER
#endif
dc += (1<<(RECON_SHIFT-1));
for(i=0; i<64; i++){
rem[i]= dc - (orig[i]<<RECON_SHIFT);
}
#ifdef REFINE_STATS
STOP_TIMER("memset rem[]")}
#endif
sum=0;
for(i=0; i<64; i++){
int one= 36;
int qns=4;
int w;
w= ABS(weight[i]) + qns*one;
w= 15 + (48*qns*one + w/2)/w;
weight[i] = w;
assert(w>0);
assert(w<(1<<6));
sum += w*w;
}
lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6);
#ifdef REFINE_STATS
{START_TIMER
#endif
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
int j= perm_scantable[i];
const int level= block[j];
int coeff;
if(level){
if(level<0) coeff= qmul*level - qadd;
else coeff= qmul*level + qadd;
run_tab[rle_index++]=run;
run=0;
s->dsp.add_8x8basis(rem, basis[j], coeff);
}else{
run++;
}
}
#ifdef REFINE_STATS
if(last_non_zero>0){
STOP_TIMER("init rem[]")
}
}
{START_TIMER
#endif
for(;;){
int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0);
int best_coeff=0;
int best_change=0;
int run2, best_unquant_change=0, analyze_gradient;
#ifdef REFINE_STATS
{START_TIMER
#endif
analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
if(analyze_gradient){
#ifdef REFINE_STATS
{START_TIMER
#endif
for(i=0; i<64; i++){
int w= weight[i];
d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12);
}
#ifdef REFINE_STATS
STOP_TIMER("rem*w*w")}
{START_TIMER
#endif
s->dsp.fdct(d1);
#ifdef REFINE_STATS
STOP_TIMER("dct")}
#endif
}
if(start_i){
const int level= block[0];
int change, old_coeff;
assert(s->mb_intra);
old_coeff= q*level;
for(change=-1; change<=1; change+=2){
int new_level= level + change;
int score, new_coeff;
new_coeff= q*new_level;
if(new_coeff >= 2048 || new_coeff < 0)
continue;
score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff);
if(score<best_score){
best_score= score;
best_coeff= 0;
best_change= change;
best_unquant_change= new_coeff - old_coeff;
}
}
}
run=0;
rle_index=0;
run2= run_tab[rle_index++];
prev_level=0;
prev_run=0;
for(i=start_i; i<64; i++){
int j= perm_scantable[i];
const int level= block[j];
int change, old_coeff;
if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
break;
if(level){
if(level<0) old_coeff= qmul*level - qadd;
else old_coeff= qmul*level + qadd;
run2= run_tab[rle_index++];
}else{
old_coeff=0;
run2--;
assert(run2>=0 || i >= last_non_zero );
}
for(change=-1; change<=1; change+=2){
int new_level= level + change;
int score, new_coeff, unquant_change;
score=0;
if(s->avctx->quantizer_noise_shaping < 2 && ABS(new_level) > ABS(level))
continue;
if(new_level){
if(new_level<0) new_coeff= qmul*new_level - qadd;
else new_coeff= qmul*new_level + qadd;
if(new_coeff >= 2048 || new_coeff <= -2048)
continue;
if(level){
if(level < 63 && level > -63){
if(i < last_non_zero)
score += length[UNI_AC_ENC_INDEX(run, new_level+64)]
- length[UNI_AC_ENC_INDEX(run, level+64)];
else
score += last_length[UNI_AC_ENC_INDEX(run, new_level+64)]
- last_length[UNI_AC_ENC_INDEX(run, level+64)];
}
}else{
assert(ABS(new_level)==1);
if(analyze_gradient){
int g= d1[ scantable[i] ];
if(g && (g^new_level) >= 0)
continue;
}
if(i < last_non_zero){
int next_i= i + run2 + 1;
int next_level= block[ perm_scantable[next_i] ] + 64;
if(next_level&(~127))
next_level= 0;
if(next_i < last_non_zero)
score += length[UNI_AC_ENC_INDEX(run, 65)]
+ length[UNI_AC_ENC_INDEX(run2, next_level)]
- length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
else
score += length[UNI_AC_ENC_INDEX(run, 65)]
+ last_length[UNI_AC_ENC_INDEX(run2, next_level)]
- last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
}else{
score += last_length[UNI_AC_ENC_INDEX(run, 65)];
if(prev_level){
score += length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
- last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
}
}
}
}else{
new_coeff=0;
assert(ABS(level)==1);
if(i < last_non_zero){
int next_i= i + run2 + 1;
int next_level= block[ perm_scantable[next_i] ] + 64;
if(next_level&(~127))
next_level= 0;
if(next_i < last_non_zero)
score += length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
- length[UNI_AC_ENC_INDEX(run2, next_level)]
- length[UNI_AC_ENC_INDEX(run, 65)];
else
score += last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
- last_length[UNI_AC_ENC_INDEX(run2, next_level)]
- length[UNI_AC_ENC_INDEX(run, 65)];
}else{
score += -last_length[UNI_AC_ENC_INDEX(run, 65)];
if(prev_level){
score += last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
- length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
}
}
}
score *= lambda;
unquant_change= new_coeff - old_coeff;
assert((score < 100*lambda && score > -100*lambda) || lambda==0);
score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change);
if(score<best_score){
best_score= score;
best_coeff= i;
best_change= change;
best_unquant_change= unquant_change;
}
}
if(level){
prev_level= level + 64;
if(prev_level&(~127))
prev_level= 0;
prev_run= run;
run=0;
}else{
run++;
}
}
#ifdef REFINE_STATS
STOP_TIMER("iterative step")}
#endif
if(best_change){
int j= perm_scantable[ best_coeff ];
block[j] += best_change;
if(best_coeff > last_non_zero){
last_non_zero= best_coeff;
assert(block[j]);
#ifdef REFINE_STATS
after_last++;
#endif
}else{
#ifdef REFINE_STATS
if(block[j]){
if(block[j] - best_change){
if(ABS(block[j]) > ABS(block[j] - best_change)){
raise++;
}else{
lower++;
}
}else{
from_zero++;
}
}else{
to_zero++;
}
#endif
for(; last_non_zero>=start_i; last_non_zero--){
if(block[perm_scantable[last_non_zero]])
break;
}
}
#ifdef REFINE_STATS
count++;
if(256*256*256*64 % count == 0){
printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number);
}
#endif
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
int j= perm_scantable[i];
const int level= block[j];
if(level){
run_tab[rle_index++]=run;
run=0;
}else{
run++;
}
}
s->dsp.add_8x8basis(rem, basis[j], best_unquant_change);
}else{
break;
}
}
#ifdef REFINE_STATS
if(last_non_zero>0){
STOP_TIMER("iterative search")
}
}
#endif
return last_non_zero;
}
| 1threat
|
[VB6]No experience with it but I need it : Private Sub cmdtiehack_Click()
Dim hwnd
hwnd = FindWindow(vbNullString, "Window name")
If hwnd = 0 Then
MsgBox "Program is not open"
Else
Dim Retval As Long
Retval = ShellExecute(Me.hwnd, "open", "5.exe", _ 0, 0, SW_HIDE)
Delay 1
Retval = ShellExecute(Me.hwnd, "open", "6.exe", _ 0, 0, SW_HIDE)
End If
End Sub
I didn't use VB in past, but I can't see where's the error. Should I compile it or save like a .vbs just by using Notepad? Thanks for advice.
| 0debug
|
static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset,
int width, int be)
{
target_phys_addr_t boff;
uint32_t ret;
uint8_t *p;
DPRINTF("%s: offset " TARGET_FMT_plx "\n", __func__, offset);
ret = -1;
if (pfl->rom_mode) {
if (pfl->wcycle == 0)
pflash_register_memory(pfl, 1);
}
offset &= pfl->chip_len - 1;
boff = offset & 0xFF;
if (pfl->width == 2)
boff = boff >> 1;
else if (pfl->width == 4)
boff = boff >> 2;
switch (pfl->cmd) {
default:
DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd);
pfl->wcycle = 0;
pfl->cmd = 0;
case 0x80:
case 0x00:
flash_read:
p = pfl->storage;
switch (width) {
case 1:
ret = p[offset];
break;
case 2:
if (be) {
ret = p[offset] << 8;
ret |= p[offset + 1];
} else {
ret = p[offset];
ret |= p[offset + 1] << 8;
}
break;
case 4:
if (be) {
ret = p[offset] << 24;
ret |= p[offset + 1] << 16;
ret |= p[offset + 2] << 8;
ret |= p[offset + 3];
} else {
ret = p[offset];
ret |= p[offset + 1] << 8;
ret |= p[offset + 2] << 16;
ret |= p[offset + 3] << 24;
}
break;
}
break;
case 0x90:
switch (boff) {
case 0x00:
case 0x01:
ret = pfl->ident[boff & 0x01];
break;
case 0x02:
ret = 0x00;
break;
case 0x0E:
case 0x0F:
if (pfl->ident[2 + (boff & 0x01)] == (uint8_t)-1)
goto flash_read;
ret = pfl->ident[2 + (boff & 0x01)];
break;
default:
goto flash_read;
}
DPRINTF("%s: ID " TARGET_FMT_pld " %x\n", __func__, boff, ret);
break;
case 0xA0:
case 0x10:
case 0x30:
ret = pfl->status;
DPRINTF("%s: status %x\n", __func__, ret);
pfl->status ^= 0x40;
break;
case 0x98:
if (boff > pfl->cfi_len)
ret = 0;
else
ret = pfl->cfi_table[boff];
break;
}
return ret;
}
| 1threat
|
Error in R: Having output to be equal to zero : <p>I'm having some issue concerning the following code. I should get the value of v1 = ( 106.56, 247.97, 417.00, 505.70) but i'm getting it to be ( 106.56, 247.97, 417.00, 0). I can't figure out what the problem is. Can someone please help me out? Thank you in advance. </p>
<pre><code>a <- 0.0008;
b <- 0.00011;
c <- 1.095;
m <- b/log(c, base=exp(1));
z <- (-a/log(c, base=exp(1)))+1;
e <- exp(1);
x <- 30;
k <- 0:69;
del <- 0.05;
v <- e^(-del);
j <- m*c^x;
j1 <- m*c^(x+k);
p <- e^(-a*k+j-j*c^k);
q1 <- e^j1*gamma(z)*(j1^(1-z))*(pgamma(c, z, j1)-pgamma(1, z, j1));
q2 <- 1-e^(-a-j1*c+j1)-q1;
p1 <- p*q1;
p2 <- p*q2;
p3 <- p1+p2;
apbw <- sum(p3*v^(k+1));
app <- e^j*sum(v^k*e^(-a*k-j*c^k));
pw <- 1000*apbw/app;
apb <- cumsum(p2*v^(k+1));
apbn <- apb [35];
app <- e^j*cumsum(v^k*e^(-a*k-j*c^k));
appn <- app[35];
pn <- 1000*apbn/appn;
k <- vector('list', 4);
p <- vector('list',4);
q <- vector('list',4);
j1 <- vector('list',4);
q1 <- vector('list',4);
p1 <- vector('list',4);
p2 <- vector('list',4);
p3 <- vector('list',4);
w <- vector('list',4);
wa <- vector('list',4);
t1 <- vector('list',4);
t2 <- vector('list',4);
ta <- vector('list',4);
nta <- vector('list',4);
vb <- vector('list',4);
vt <- vector('list',4);
v1 <- vector('list',4);
d <- vector('list',4);
t <- c(10, 20, 30, 35);
x1 <- x + t;
for(i in 1:4)
{
j[[i]] <- m*c^x1[i];
k[[i]] <- 0:(100 - x1[i] - 1);
j1[[i]] <- m*c^(x1[i]+k[[i]]);
p[[i]] <- e^(-a*k[[i]]+j[[i]]-j[[i]]*c^k[[i]]);
q[[i]] <- e^j1[[i]]*gamma(z)*(j1[[i]]^(1-z))*(pgamma(c, z, j1[[i]])- pgamma(1, z, j1[[i]]));
q1[[i]] <- 1-e^(-a-j1[[i]]*c+j1[[i]])-q[[i]];
p1[[i]] <- p[[i]]*q[[i]];
p2[[i]] <- p[[i]]*q1[[i]];
p3[[i]] <- p1[[i]]+p2[[i]];
w[[i]] <- sum(p3[[i]]*v^(k[[i]]+1)) ;
wa[[i]] <- e^j[[i]]*sum(v^k[[i]]*e^(-a*k[[i]]-j[[i]]*c^k[[i]]));
t1[[i]] <- cumsum(p2[[i]]*v^(k[[i]]+1));
t2[[i]] <- t1[[i]][65-x1[i]] ;
ta[[i]] <- e^j[[i]]*cumsum(v^k[[i]]*e^(-a*k[[i]]-j[[i]]*c^k[[i]]));
nta[[i]] <- ta[[i]][65-x1[i]];
vb[[i]] <- round(1000*w[[i]]-(pw*wa[[i]]), 2);
vt[[i]] <- round(1000*t2[[i]]-(pn*nta[[i]]), 2);
v1[[i]] <- vb[[i]]+vt[[i]];
}
</code></pre>
| 0debug
|
Unable to ssh localhost within a running Docker container : <p>I'm building a Docker image for an application which requires to ssh into localhost (i.e ssh user@localhost)</p>
<p>I'm working on a Ubuntu desktop machine and started with a basic ubuntu:16.04 container.
Following is the content of my Dockerfile:</p>
<pre><code>FROM ubuntu:16.04
RUN apt-get update && apt-get install -y \
openjdk-8-jdk \
ssh && \
groupadd -r custom_group && useradd -r -g custom_group -m user1
USER user1
RUN ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N "" && \
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
</code></pre>
<p>Then I build this container using the command:</p>
<pre><code>docker build -t test-container .
</code></pre>
<p>And run it using:</p>
<pre><code>docker run -it test-container
</code></pre>
<p>The container opens with the following prompt and the keys are generated correctly to enable ssh into localhost:</p>
<pre><code>user1@0531c0f71e0a:/$
user1@0531c0f71e0a:/$ cd ~/.ssh/
user1@0531c0f71e0a:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub
</code></pre>
<p>Then ssh into localhost and greeted by the error:</p>
<pre><code>user1@0531c0f71e0a:~$ ssh user1@localhost
ssh: connect to host localhost port 22: Cannot assign requested address
</code></pre>
<p>Is there anything I'm doing wrong or any additional network settings that needs to be configured? I just want to ssh into localhost within the running container.</p>
| 0debug
|
static int svq3_decode_frame (AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size) {
MpegEncContext *const s = avctx->priv_data;
H264Context *const h = avctx->priv_data;
int m, mb_type;
unsigned char *extradata;
unsigned int size;
s->flags = avctx->flags;
s->flags2 = avctx->flags2;
s->unrestricted_mv = 1;
if (!s->context_initialized) {
s->width = avctx->width;
s->height = avctx->height;
h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c;
h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c;
h->halfpel_flag = 1;
h->thirdpel_flag = 1;
h->unknown_svq3_flag = 0;
h->chroma_qp = 4;
if (MPV_common_init (s) < 0)
return -1;
h->b_stride = 4*s->mb_width;
alloc_tables (h);
extradata = (unsigned char *)avctx->extradata;
for (m = 0; m < avctx->extradata_size; m++) {
if (!memcmp (extradata, "SEQH", 4))
break;
extradata++;
}
if (extradata && !memcmp (extradata, "SEQH", 4)) {
GetBitContext gb;
size = AV_RB32(&extradata[4]);
init_get_bits (&gb, extradata + 8, size*8);
if (get_bits (&gb, 3) == 7) {
get_bits (&gb, 12);
get_bits (&gb, 12);
}
h->halfpel_flag = get_bits1 (&gb);
h->thirdpel_flag = get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
s->low_delay = get_bits1 (&gb);
get_bits1 (&gb);
while (get_bits1 (&gb)) {
get_bits (&gb, 8);
}
h->unknown_svq3_flag = get_bits1 (&gb);
avctx->has_b_frames = !s->low_delay;
}
}
if (buf_size == 0) {
if (s->next_picture_ptr && !s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->next_picture;
*data_size = sizeof(AVFrame);
}
return 0;
}
init_get_bits (&s->gb, buf, 8*buf_size);
s->mb_x = s->mb_y = 0;
if (svq3_decode_slice_header (h))
return -1;
s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
if(avctx->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
s->adaptive_quant, s->qscale
);
}
s->current_picture.pict_type = s->pict_type;
s->current_picture.key_frame = (s->pict_type == I_TYPE);
if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0;
if (avctx->hurry_up && s->pict_type == B_TYPE) return 0;
if (avctx->hurry_up >= 5) return 0;
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL)
return 0;
if (s->next_p_frame_damaged) {
if (s->pict_type == B_TYPE)
return 0;
else
s->next_p_frame_damaged = 0;
}
frame_start (h);
if (s->pict_type == B_TYPE) {
h->frame_num_offset = (h->slice_num - h->prev_frame_num);
if (h->frame_num_offset < 0) {
h->frame_num_offset += 256;
}
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
h->prev_frame_num = h->frame_num;
h->frame_num = h->slice_num;
h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
if (h->prev_frame_num_offset < 0) {
h->prev_frame_num_offset += 256;
}
}
for(m=0; m<2; m++){
int i;
for(i=0; i<4; i++){
int j;
for(j=-1; j<4; j++)
h->ref_cache[m][scan8[0] + 8*i + j]= 1;
h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
}
}
for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
s->gb.size_in_bits = 8*buf_size;
if (svq3_decode_slice_header (h))
return -1;
}
mb_type = svq3_get_ue_golomb (&s->gb);
if (s->pict_type == I_TYPE) {
mb_type += 8;
} else if (s->pict_type == B_TYPE && mb_type >= 4) {
mb_type += 4;
}
if (mb_type > 33 || svq3_decode_mb (h, mb_type)) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (mb_type != 0) {
hl_decode_mb (h);
}
if (s->pict_type != B_TYPE && !s->low_delay) {
s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
(s->pict_type == P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
}
}
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
MPV_frame_end(s);
if (s->pict_type == B_TYPE || s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->current_picture;
} else {
*(AVFrame *) data = *(AVFrame *) &s->last_picture;
}
avctx->frame_number = s->picture_number - 1;
if (s->last_picture_ptr || s->low_delay) {
*data_size = sizeof(AVFrame);
}
return buf_size;
}
| 1threat
|
extra column appears at last while hovering mouse : I have created a table with two columns in html using css. While hovering mouse outside the table an extra column appears at the right side. I don't want that extra unwanted column in my table. Please suggest what more changes do I need to make here. In the end, I need only 2 columns.
I have pasted the html code. Please help.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="gwt:property" content="locale=en_US">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
tr.even {
background-color: #FFFFFF;
}
tr.odd {
background-color: #EEEEEE;
}
.expand b{
font-size:30px;
}
.xhide
{
}
.expCode td:hover {background-color: #ddd;}
.expCode th {
padding-top: 12px;
padding-bottom: 12px;
text-align: center;
font-size:16px;
background-color: #276B8E;
color: #FFFFFF;
}
table{
border-color:grey;
display:table;
width:75%;
}
</style>
</head>
<!-- comments only
-->
<body>
<table class="expCode">
<tbody>
<tr>
<td><table border="1" cellspacing="0"; style="width:75%">
<thead>
<tr>
<th style="width:25%">Column1</th>
<th style="width:50%">Column2</th>
</tr>
</thead>
<tbody>
<tr class="even">
<td>Text</td>
<td>
<p>Text</p>
</tr>
<tr class="odd">
<td> Text</td>
<td><p>Text</p></td>
</tr>
<tr class="even">
<td>Text</td>
<td><p>Text</p></td>
</tr>
</tbody>
</tbody>
</table>
</body>
</html>
| 0debug
|
static ssize_t proxy_pwritev(FsContext *ctx, V9fsFidOpenState *fs,
const struct iovec *iov,
int iovcnt, off_t offset)
{
ssize_t ret;
#ifdef CONFIG_PREADV
ret = pwritev(fs->fd, iov, iovcnt, offset);
#else
ret = lseek(fs->fd, offset, SEEK_SET);
if (ret >= 0) {
ret = writev(fs->fd, iov, iovcnt);
}
#endif
#ifdef CONFIG_SYNC_FILE_RANGE
if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) {
sync_file_range(fs->fd, offset, ret,
SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE);
}
#endif
return ret;
}
| 1threat
|
pg_restore error: role XXX does not exist : <p>Trying to replicate a database from one system to another. The versions involved are 9.5.0 (source) and 9.5.2 (target). </p>
<p>Source db name is <code>foodb</code> with owner <code>pgdba</code> and target db name will be named <code>foodb_dev</code> with owner <code>pgdev</code>.</p>
<p>All commands are run on the target system that will host the replica.</p>
<p>The <code>pg_dump</code> command is:</p>
<pre><code> pg_dump -f schema_backup.dump --no-owner -Fc -U pgdba -h $PROD_DB_HOSTNAME -p $PROD_DB_PORT -d foodb -s --clean;
</code></pre>
<p>This runs without errors.</p>
<p>The corresponding <code>pg_restore</code> is:</p>
<pre><code> pg_restore --no-owner --if-exists -1 -c -U pgdev -d foodb_dev schema_backup.dump
</code></pre>
<p>which throws error:</p>
<pre><code>pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3969; 0 0 ACL public pgdba
pg_restore: [archiver (db)] could not execute query: ERROR: role "pgdba" does not exist
Command was: REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM pgdba;
GRANT ALL ON SCHEMA public TO pgdba;
GRANT ...
</code></pre>
<p>If I generate the dump file in plain text format (<code>-Fp</code>) I see it includes several entries like:</p>
<pre><code>REVOKE ALL ON TABLE dump_thread FROM PUBLIC;
REVOKE ALL ON TABLE dump_thread FROM pgdba;
GRANT ALL ON TABLE dump_thread TO pgdba;
GRANT SELECT ON TABLE dump_thread TO readonly;
</code></pre>
<p>that try to set privileges for user <code>pgdba</code> who of course doesn't even exist as a user on the target system which only has user <code>pgdev</code>, and thus the errors from <code>pg_restore</code>.</p>
<p>On the source db the privileges for example of the <code>dump_thread</code> table:</p>
<pre><code># \dp+ dump_thread
Access privileges
-[ RECORD 1 ]-----+--------------------
Schema | public
Name | dump_thread
Type | table
Access privileges | pgdba=arwdDxt/pgdba+
| readonly=r/pgdba
Column privileges |
Policies |
</code></pre>
<p>A quick solution would be to simply add a user <code>pgdba</code> on the target cluster and be done with it. </p>
<p>But shouldn't the <code>--no-owner</code> take care of not including owner specific commands in the dump in the first place?</p>
| 0debug
|
Solutions to fair distribution programming problems : <p>I have run into a wall since I attended a coding contest. I think this problem falls into the category of fair distribution, but I am not sure.
I am attaching the problem <a href="http://pastebin.com/xd3eywKj" rel="nofollow noreferrer">here</a>.</p>
<p>I have come out with an empirical formula so which I tested successfully for 3 iterations attached <a href="http://pastebin.com/t9JyrUce" rel="nofollow noreferrer">here</a>.</p>
<p>I am unable to come up with a working code that can solve this programming problem. Any help is appreciated.</p>
| 0debug
|
polymorphic functions in Haskell : <p>Have a parametrically polymorphic function <code>foo :: a -> a -> a</code>. Give four of the argument so that the resulting expression
<code>foo arg1 arg2 arg3 arg4</code> would have type <code>Bool</code>.</p>
<pre><code>-- foo :: a -> a -> a function is defined in a code
arg1 = undefined
arg2 = undefined
arg3 = undefined
arg4 = undefined
</code></pre>
| 0debug
|
How to pass parameter to PythonOperator in Airflow : <p>I just started using <strong>Airflow</strong>, can anyone enlighten me how to pass a parameter into <strong>PythonOperator</strong> like below:</p>
<pre><code>t5_send_notification = PythonOperator(
task_id='t5_send_notification',
provide_context=True,
python_callable=SendEmail,
op_kwargs=None,
#op_kwargs=(key1='value1', key2='value2'),
dag=dag,
)
def SendEmail(**kwargs):
msg = MIMEText("The pipeline for client1 is completed, please check.")
msg['Subject'] = "xxxx"
msg['From'] = "xxxx"
......
s = smtplib.SMTP('localhost')
s.send_message(msg)
s.quit()
</code></pre>
<p>I would like to be able to pass some parameters into the <code>t5_send_notification</code>'s callable which is <code>SendEmail</code>, ideally I want to attach the full log and/or part of the log (which is essentially from the kwargs) to the email to be sent out, guessing the <code>t5_send_notification</code> is the place to gather those information.</p>
<p>Thank you very much.</p>
| 0debug
|
Return last item of strings.Split() slice in Golang : <p>I am <a href="https://golang.org/pkg/strings/#Split" rel="noreferrer">splitting</a> file names in Go to get at the file extension (e.g. <code>import ("strings") ; strings.Split("example.txt", ".")</code>).
For this reason, I would like to return the last item in the slice returned by the split, i.e. </p>
<blockquote>
<p>for strings.Split("ex.txt", "."), I want txt</p>
</blockquote>
<p><a href="https://stackoverflow.com/questions/22535775/the-last-element-of-a-slice#22535888">This</a> question suggests that doing </p>
<pre><code>strings.Split("ex.txt", ".")[len(strings.Split("ex.txt", ".")) - 1]
</code></pre>
<p>is the only way to get at it. That is, there is no <code>-1</code> as in Python. This seems very wasteful to me, as I feel we are doing the same splitting operation twice. </p>
<ul>
<li>Is there no better command for getting the last item of a slice in Go?</li>
<li>If no, would the best approach be to write the result of <code>Split</code> into a variable, or just do the above?</li>
</ul>
<p>Thank you!</p>
| 0debug
|
static struct pathelem *new_entry(const char *root,
struct pathelem *parent,
const char *name)
{
struct pathelem *new = malloc(sizeof(*new));
new->name = strdup(name);
new->pathname = g_strdup_printf("%s/%s", root, name);
new->num_entries = 0;
return new;
}
| 1threat
|
How do I append an HTTP header in this format in PHP (cURL)? : <p>I am trying to make a GET request in PHP using cURL and here is what the documentation says about my header:</p>
<blockquote>
<p>Append an HTTP header called zuluapi using the created signature.</p>
<p><code>zuluapi <publicKey>:<base 64 encoded signature></code></p>
</blockquote>
<p>I have the publicKey and signature, I just can't seem to figure out how to attach the header in the way they want. When I try to add the header, like below, I get bad header error.</p>
<pre><code>$headers = [
"zuluapi {$public}:{$signedMessage}"
];
</code></pre>
| 0debug
|
This code compiles using ecj but not javac. Is this a bug in ecj, javac or neither? : <p>The following code creates a <code>Collector</code> that produces an <code>UnmodifiableSortedSet</code>:</p>
<pre><code>package com.stackoverflow;
import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.stream.Collector;
import java.util.stream.Collectors;
public class SOExample {
public static <T extends Comparable<T>> Collector<T, ?, SortedSet<T>> toSortedSet() {
return Collectors.toCollection(TreeSet::new);
}
public static <T extends Comparable<T>> Collector<T, ?, SortedSet<T>> toUnmodifiableSortedSet() {
return Collectors.collectingAndThen(toSortedSet(), Collections::<T> unmodifiableSortedSet);
}
}
</code></pre>
<p>The codes compiles under the ecj compiler:</p>
<pre><code>$ java -jar ~/Downloads/ecj-3.13.101.jar -source 1.8 -target 1.8 SOExample.java
Picked up _JAVA_OPTIONS: -Duser.language=en -Duser.country=GB
</code></pre>
<p>Under javac however:</p>
<pre><code>$ javac -version
Picked up _JAVA_OPTIONS: -Duser.language=en -Duser.country=GB
javac 1.8.0_73
$ javac SOExample.java
Picked up _JAVA_OPTIONS: -Duser.language=en -Duser.country=GB
SOExample.java:16: error: method collectingAndThen in class Collectors cannot be applied to given types;
return Collectors.collectingAndThen(toSortedSet(), Collections::<T> unmodifiableSortedSet);
^
required: Collector<T#1,A,R>,Function<R,RR>
found: Collector<T#2,CAP#1,SortedSet<T#2>>,Collection[...]edSet
reason: cannot infer type-variable(s) T#3
(actual and formal argument lists differ in length)
where T#1,A,R,RR,T#2,T#3 are type-variables:
T#1 extends Object declared in method <T#1,A,R,RR>collectingAndThen(Collector<T#1,A,R>,Function<R,RR>)
A extends Object declared in method <T#1,A,R,RR>collectingAndThen(Collector<T#1,A,R>,Function<R,RR>)
R extends Object declared in method <T#1,A,R,RR>collectingAndThen(Collector<T#1,A,R>,Function<R,RR>)
RR extends Object declared in method <T#1,A,R,RR>collectingAndThen(Collector<T#1,A,R>,Function<R,RR>)
T#2 extends Comparable<T#2>
T#3 extends Object declared in method <T#3>unmodifiableSortedSet(SortedSet<T#3>)
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
1 error
</code></pre>
<p>If I change the offending line to the following, the code compiles under both compilers:</p>
<pre><code>return Collectors.collectingAndThen(toSortedSet(), (SortedSet<T> p) -> Collections.unmodifiableSortedSet(p));
</code></pre>
<p>Is this a bug in ecj, javac or an underspecification that allows for both behaviours?</p>
<p>Javac behaves the same in java 9 and 10.</p>
| 0debug
|
static int usb_msd_initfn(USBDevice *dev)
{
MSDState *s = DO_UPCAST(MSDState, dev, dev);
if (!s->conf.dinfo || !s->conf.dinfo->bdrv) {
error_report("usb-msd: drive property not set");
s->dev.speed = USB_SPEED_FULL;
scsi_bus_new(&s->bus, &s->dev.qdev, 0, 1, usb_msd_command_complete);
s->scsi_dev = scsi_bus_legacy_add_drive(&s->bus, s->conf.dinfo, 0);
s->bus.qbus.allow_hotplug = 0;
usb_msd_handle_reset(dev);
if (bdrv_key_required(s->conf.dinfo->bdrv)) {
if (cur_mon) {
monitor_read_bdrv_key_start(cur_mon, s->conf.dinfo->bdrv,
usb_msd_password_cb, s);
s->dev.auto_attach = 0;
} else {
autostart = 0;
return 0;
| 1threat
|
static void xen_ram_init(ram_addr_t ram_size)
{
RAMBlock *new_block;
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
new_block = qemu_mallocz(sizeof (*new_block));
pstrcpy(new_block->idstr, sizeof (new_block->idstr), "xen.ram");
new_block->host = NULL;
new_block->offset = 0;
new_block->length = ram_size;
QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next);
ram_list.phys_dirty = qemu_realloc(ram_list.phys_dirty,
new_block->length >> TARGET_PAGE_BITS);
memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS),
0xff, new_block->length >> TARGET_PAGE_BITS);
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
below_4g_mem_size = 0xe0000000;
} else {
below_4g_mem_size = ram_size;
}
cpu_register_physical_memory(0, below_4g_mem_size, new_block->offset);
#if TARGET_PHYS_ADDR_BITS > 32
if (above_4g_mem_size > 0) {
cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
new_block->offset + below_4g_mem_size);
}
#endif
}
| 1threat
|
install mssql server 2012 on ubuntu : how can i install mssql server 2012 on ubuntu?
| 0debug
|
static int usb_net_handle_dataout(USBNetState *s, USBPacket *p)
{
int ret = p->len;
int sz = sizeof(s->out_buf) - s->out_ptr;
struct rndis_packet_msg_type *msg =
(struct rndis_packet_msg_type *) s->out_buf;
uint32_t len;
#ifdef TRAFFIC_DEBUG
fprintf(stderr, "usbnet: data out len %u\n", p->len);
{
int i;
fprintf(stderr, ":");
for (i = 0; i < p->len; i++) {
if (!(i & 15))
fprintf(stderr, "\n%04x:", i);
fprintf(stderr, " %02x", p->data[i]);
}
fprintf(stderr, "\n\n");
}
#endif
if (sz > ret)
sz = ret;
memcpy(&s->out_buf[s->out_ptr], p->data, sz);
s->out_ptr += sz;
if (!is_rndis(s)) {
if (ret < 64) {
qemu_send_packet(&s->nic->nc, s->out_buf, s->out_ptr);
s->out_ptr = 0;
}
return ret;
}
len = le32_to_cpu(msg->MessageLength);
if (s->out_ptr < 8 || s->out_ptr < len)
return ret;
if (le32_to_cpu(msg->MessageType) == RNDIS_PACKET_MSG) {
uint32_t offs = 8 + le32_to_cpu(msg->DataOffset);
uint32_t size = le32_to_cpu(msg->DataLength);
if (offs + size <= len)
qemu_send_packet(&s->nic->nc, s->out_buf + offs, size);
}
s->out_ptr -= len;
memmove(s->out_buf, &s->out_buf[len], s->out_ptr);
return ret;
}
| 1threat
|
static int xen_host_pci_config_open(XenHostPCIDevice *d)
{
char path[PATH_MAX];
int rc;
rc = xen_host_pci_sysfs_path(d, "config", path, sizeof (path));
if (rc) {
return rc;
}
d->config_fd = open(path, O_RDWR);
if (d->config_fd < 0) {
return -errno;
}
return 0;
}
| 1threat
|
How do I get a list of files with specific file extension using node.js? : <p>The node <a href="https://www.npmjs.com/package/node-fs" rel="noreferrer">fs</a> package has the following methods to list a directory:</p>
<blockquote>
<p><strong>fs.readdir(path, [callback])</strong> Asynchronous readdir(3). Reads the
contents of a directory. The callback gets two arguments (err, files)
where files is an array of the names of the files in the directory
excluding '.' and '..'.</p>
<p><strong>fs.readdirSync(path)</strong> Synchronous readdir(3). Returns an array of
filenames excluding '.' and '..</p>
</blockquote>
<p>But how do I get a list of files matching a file specification, for example <strong>*.txt</strong>?</p>
| 0debug
|
static void isabus_bridge_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
dc->fw_name = "isa";
}
| 1threat
|
static void l2tpv3_update_fd_handler(NetL2TPV3State *s)
{
qemu_set_fd_handler2(s->fd,
s->read_poll ? l2tpv3_can_send : NULL,
s->read_poll ? net_l2tpv3_send : NULL,
s->write_poll ? l2tpv3_writable : NULL,
s);
}
| 1threat
|
I get a TypeError: Cannot read property 'val' of undefined when i try to send notification with Frebase : So here us my error;
TypeError: Cannot read property 'val' of undefined
at exports.sendNotification.functions.database.ref.onWrite (/user_code/index.js:14:19)
at Object.<anonymous> (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:112:27)
at next (native)
at /user_code/node_modules/firebase-functions/lib/cloud-functions.js:28:71
at __awaiter (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:24:12)
at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:82:36)
at /var/tmp/worker/worker.js:728:24
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
and here is my code:
exports.sendNotification = functions.database.ref('/notifications/{user_id}/{notification_id}').onWrite((change, context) => {
const user_id = context.params.user_id;
const notification = context.params.notification;
console.log('We have a notification to send to : ', user_id);
if(!context.data.val()){
return console.log('A notification has been deleted from the database:', notification_id);
}
const deviceToken = admin.database().ref(`/Users/${user_id}/deviceToken`).once('value');
return deviceToken.then(result => {
const token_id = result.val();
const payload = {
notification: {
title : "Friend Request",
body : "You've receieved a new Friend Request",
icon : "default"
}
};
return admin.messaging().sendToDevice(token_id, payload).then(response => {
console.log('This is the notification Feature');
});
});
});
| 0debug
|
RSpec partial match against a nested hash : <p>I've got a JSON structure that I'd like to match a single nested element in, while ignoring other data. The JSON looks like this (minimally):</p>
<pre><code>{
"employee": {
"id": 1,
"jobs_count": 0
},
"messages": [ "something" ]
}
</code></pre>
<p>Here's what I'm using right now:</p>
<pre><code>response_json = JSON.parse(response.body)
expect(response_json).to include("employee")
expect(response_json["employee"]).to include("jobs_count" => 0)
</code></pre>
<p>What I'd like to do is something like:</p>
<pre><code>expect(response_json).to include("employee" => { "jobs_count" => 0 })
</code></pre>
<p>Unfortunately, <code>include</code> requires an exact match for anything but a simple top-level key check (at least with that syntax).</p>
<p><strong>Is there any way to partially match a nested hash while ignoring the rest of the structure?</strong></p>
| 0debug
|
How to work out the median C# : <p>So I'm struggling to get this piece to output a median value with 4 values.
The output produces a value one above the actual middle value and I cannot seem to get it to output a decimal even when I change 2 to 2.0. I can get it to output a value with 3 numbers just haven't achieved it with 4.</p>
<pre><code> Console.Write("Median Value: ");
var items = new[]{num1, num2, num3, num4 };
Array.Sort(items);
Console.WriteLine(items[items.Length/2]);
</code></pre>
<p>This work is an extension task in my computing class so I may have very well taken a completely wrong approach to this task.
Thanks in advance</p>
| 0debug
|
static int mmu40x_get_physical_address (CPUState *env, mmu_ctx_t *ctx,
target_ulong address, int rw, int access_type)
{
ppcemb_tlb_t *tlb;
target_phys_addr_t raddr;
int i, ret, zsel, zpr, pr;
ret = -1;
raddr = (target_phys_addr_t)-1ULL;
pr = msr_pr;
for (i = 0; i < env->nb_tlb; i++) {
tlb = &env->tlb[i].tlbe;
if (ppcemb_tlb_check(env, tlb, &raddr, address,
env->spr[SPR_40x_PID], 0, i) < 0)
continue;
zsel = (tlb->attr >> 4) & 0xF;
zpr = (env->spr[SPR_40x_ZPR] >> (28 - (2 * zsel))) & 0x3;
LOG_SWTLB("%s: TLB %d zsel %d zpr %d rw %d attr %08x\n",
__func__, i, zsel, zpr, rw, tlb->attr);
switch (zpr) {
case 0x2:
if (pr != 0)
goto check_perms;
case 0x3:
ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
ret = 0;
break;
case 0x0:
if (pr != 0) {
ctx->prot = 0;
ret = -2;
break;
}
case 0x1:
check_perms:
ctx->prot = tlb->prot;
ctx->prot |= PAGE_EXEC;
ret = check_prot(ctx->prot, rw, access_type);
break;
}
if (ret >= 0) {
ctx->raddr = raddr;
LOG_SWTLB("%s: access granted " TARGET_FMT_lx " => " TARGET_FMT_plx
" %d %d\n", __func__, address, ctx->raddr, ctx->prot,
ret);
return 0;
}
}
LOG_SWTLB("%s: access refused " TARGET_FMT_lx " => " TARGET_FMT_plx
" %d %d\n", __func__, address, raddr, ctx->prot, ret);
return ret;
}
| 1threat
|
How to add an edit text on a button : <p>I was wondering how to have the user be able to edit the text on a button in Android programming? I tried to put the edit text on top of the button but it is not working. How should I do this?</p>
| 0debug
|
static void aio_signal_handler(int signum)
{
if (posix_aio_state) {
char byte = 0;
write(posix_aio_state->wfd, &byte, sizeof(byte));
}
qemu_service_io();
}
| 1threat
|
Is there a way to default to "Replace in all cells" in the "Find and Replace" in jupyter? : <p>I usually want to find and replace all, but it looks like it has been set to current/highlighted cell only (<a href="https://github.com/jupyter/notebook/pull/2131" rel="noreferrer">https://github.com/jupyter/notebook/pull/2131</a>). jupyter also doesn't remember the option after the dialog goes away. Is there a way to change this behavior? Thanks.</p>
| 0debug
|
def _sum(arr):
sum=0
for i in arr:
sum = sum + i
return(sum)
| 0debug
|
static int libquvi_close(AVFormatContext *s)
{
LibQuviContext *qc = s->priv_data;
if (qc->fmtctx)
avformat_close_input(&qc->fmtctx);
return 0;
}
| 1threat
|
Can i write two foreach in only one? [PHP] : In my code i've this:
$im = $database->query("SELECT * FROM cms_messaggi_importanti WHERE messo_da = :id ORDER BY ID DESC", array("id"=>$functions->Utente("id")));
foreach($im as $imp){
$mex_i = $database->query("SELECT * FROM cms_messaggi WHERE id = :id ORDER BY ID DESC", array("id"=>$imp['id_mex']));
foreach($mex_i as $mex_imp){
} }
Can i write this code in only one? Because i've to use a lot of variable with this method... is there a solution to my problem? For example.. using "JOIN".
Thanks!
| 0debug
|
PHP syntax eroor : <p>Parse error: syntax error, unexpected '$user' (T_VARIABLE) in C:\xampp\htdocs\home\login.php on line 4</p>
<pre><code> <?php
$host = "localhost"
$user = "root"; <------ line 4
$pass = "";
$db = "table";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
if (isset($_POST['username'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$res = mysql_query($sql);
if (mysql_num_rows($res) == 1) {
echo "Super";
exit();
} else {
echo "Siper";
exit();
}
}
?>
</code></pre>
<p>How can resolved this?</p>
| 0debug
|
Android Stud, Create new project : Guys.
I don't know if I changed something without realizing it but I keep getting a different window when I try to create a new project.
Do I need to reset Android Stud, if so how do I do that, or is there any way for me to fix this or at least how to get around it..?
[enter image description here][1]
[1]: https://i.stack.imgur.com/mOfyO.png
| 0debug
|
make validate useranme without Regex, must be alphanumeric : function isUser(username)
{
var numaric = username;
for(var j=0; j<numaric.length; j++)
{
var alphaa = numaric.charAt(j);
var hh = alphaa.charCodeAt(0);
if((hh > 96 && hh<123) || (hh > 64 && hh<91) ==false){ //A-Z - a-z
}else if((hh > 47 && hh<58) ==false){ //0-9
}else if( true == (hh > 96 && hh<123) || (hh > 64 && hh<91) || (hh > 47 && hh<58)){ //A~Z - a~z - 1~9
}else{
alert("Your Alpha Numeric Test Falid");
return false;
}
alert("Your Alpha Numeric Test passed");
return true;
}
}
| 0debug
|
static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
VirtIOBlock *s = VIRTIO_BLK(dev);
remove_migration_state_change_notifier(&s->migration_state_notifier);
virtio_blk_data_plane_destroy(s->dataplane);
s->dataplane = NULL;
qemu_del_vm_change_state_handler(s->change);
unregister_savevm(dev, "virtio-blk", s);
blockdev_mark_auto_del(s->bs);
virtio_cleanup(vdev);
}
| 1threat
|
Get Images From File In Android Directory As Integers : Am storing some images in `List` Initialized by `Integer`. I want to add images from the user directory in the same manner but I have trouble converting the files to `int`.
List<Integer> ids = new ArrayList<>();
ids.add(R.drawable.pic1);
ids.add(files[i].getName()) //change this to an int from path-string
ids.add(R.drawable.pic2);
Help me out
| 0debug
|
static void omap_pwl_init(target_phys_addr_t base, struct omap_mpu_state_s *s,
omap_clk clk)
{
int iomemtype;
s->pwl.base = base;
omap_pwl_reset(s);
iomemtype = cpu_register_io_memory(0, omap_pwl_readfn,
omap_pwl_writefn, s);
cpu_register_physical_memory(s->pwl.base, 0x800, iomemtype);
omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]);
}
| 1threat
|
Create Cookie ASP.NET & MVC : <p>I have a quite simple problem - I want to create a cookie at a Client, that is created by the server.
I've found a lot of <a href="http://www.codeproject.com/Articles/244904/Cookies-in-ASP-NET" rel="noreferrer">pages</a> that describe, how to use it - but I always stuck at the same point.</p>
<p>I have a DBController that gets invoked when there is a request to the DB. </p>
<p>The DBController's constructor is like this:</p>
<pre><code>public class DBController : Controller
{
public DBController()
{
HttpCookie StudentCookies = new HttpCookie("StudentCookies");
StudentCookies.Value = "hallo";
StudentCookies.Expires = DateTime.Now.AddHours(1);
Response.Cookies.Add(StudentCookies);
Response.Flush();
}
[... more code ...]
}
</code></pre>
<p>I get the Error "Object reference not set to an instance of an object" at:</p>
<pre><code>StudentCookies.Expire = DateTime.Now.AddHours(1)
</code></pre>
<p>This is a kind of a basic error message - so what kind of basic thing I've forgot?</p>
| 0debug
|
Why does GNU Diff not understand Unicode (only UTF-8)? : Why does GNU Diff not understand Unicode (only UTF-8)?
This GNU Diff is used by default in Git.
Why this bug does not fix?
BOM is part of the Unicode standard. http://www.unicode.org/faq/utf_bom.html#bom4
Why is BOM ignored by most programmers?
In Windows, the encoding of UTF-16 is used by default for some source files.
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.