problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Xamarin studio can not start mac osx 10.11.5 beta : I installed Xamarin Studio on my mac. After installation complete (everything seems correct) Xamarin studio does not start :S I click xamarin application and nothing happens.
My opration system version is El Capitan 10.11.5 Beta
What is that problem?
Thanks
| 0debug
|
void ff_vp3_v_loop_filter_mmx(uint8_t *src, int stride, int *bounding_values)
{
__asm__ volatile(
"movq %0, %%mm6 \n\t"
"movq %1, %%mm4 \n\t"
"movq %2, %%mm2 \n\t"
"movq %3, %%mm1 \n\t"
VP3_LOOP_FILTER(%4)
"movq %%mm4, %1 \n\t"
"movq %%mm3, %2 \n\t"
: "+m" (*(uint64_t*)(src - 2*stride)),
"+m" (*(uint64_t*)(src - 1*stride)),
"+m" (*(uint64_t*)(src + 0*stride)),
"+m" (*(uint64_t*)(src + 1*stride))
: "m"(*(uint64_t*)(bounding_values+129))
);
}
| 1threat
|
How To Apply .MTL File on .OBJ 3d Model via SceneKit & Model I/O : <p>I am trying to apply an .mtl file texture on .obj 3d model via SceneKit & Model I/0.</p>
<p>My code below works fine when I try to apply .jpg of a texture on it:</p>
<pre><code> let url = NSBundle.mainBundle().URLForResource("chair", withExtension: "obj")
let asset = MDLAsset(URL: NSURL(string:url)!)
guard let object = asset.objectAtIndex(0) as? MDLMesh else {
//fatalError("Failed to get mesh from asset.")
return
}
if shouldApplyTexture == true {
var textureFileName = "chair.mtl"
// Create a material from the various textures
let scatteringFunction = MDLScatteringFunction()
let material = MDLMaterial(name: "baseMaterial", scatteringFunction: scatteringFunction)
material.setTextureProperties(textures: [
.BaseColor:textureFileName])
// Apply the texture to every submesh of the asset
for submesh in object.submeshes! {
if let submesh = submesh as? MDLSubmesh {
submesh.material = material
}
}
}
// Wrap the ModelIO object in a SceneKit object
let node = SCNNode(MDLObject: object)
if (scene.rootNode.childNodes.count > 0){
scene.rootNode.enumerateChildNodesUsingBlock { (node, stop) -> Void in
node.removeFromParentNode()
}
}
scene.rootNode.addChildNode(node)
</code></pre>
<p>I am using the following MDMaterial extension for setTextureProperties:</p>
<pre><code>extension MDLMaterial {
func setTextureProperties([MDLMaterialSemantic:String]) -> Void {
for (key,value) in textures {
var finalURL = NSBundle.mainBundle().URLForResource(value, withExtension: "")
guard let url = finalURL else {
// fatalError("Failed to find URL for resource \(value).")
return
}
let property = MDLMaterialProperty(name:fileName!, semantic: key, URL: url)
self.setProperty(property)
}
}
}
</code></pre>
<p>How should I load an .mtl file and apply it on my model to have texture on it?
What properties of SCNMaterial should I declare for getting texture data from a .mtl file?</p>
| 0debug
|
where does the message goes when we use pythoncom.PumpMessages() : I would like to know where does the function pythoncom.PumpMessage() stores the message when it comes into play.I was going through a site and just saw a Python Script for Key logger , I copied the code and used it on my computer but I don't feel safe , after deleting that code I think it's still running in the background and copying my key press . Is it so please help.
| 0debug
|
Delegats should display text : I have following code in c#:
public class FClass{
public delegate string Show(int n);
public void ShowDelegate(Show SD){
SD(1);
}
}
public class SClass{
static string ReturnString(int n){
return n.ToString();
}
static void Main(string[] args){
FClass fclass = new FClass();
FClass.Show show = new FClass.Show(ReturnString);
Console.WriteLine(fclass.ShowDelegate(show));
}
}
It should display "1" but it showed error
| 0debug
|
Why has the behaviour of Lazy.CreateFromValue changed in F# between .NET framework versions? : <p>I just encountered a change in behaviour between framework versions when compiling this piece of code in F#:</p>
<pre><code>let test = Lazy.CreateFromValue 1
</code></pre>
<p>Compiled against .NET framework 2.0, the expression results in an "already created" Lazy object, that is:</p>
<pre><code>test.IsValueCreated = true
</code></pre>
<p>When compiled against .NET framework 4.0, the expression results in an "unevaluated" lazy object, that is:</p>
<pre><code> test.IsValueCreated = false
</code></pre>
<p>Only after accessing <strong>test.Value</strong> in the latter case the two are equivalent.</p>
<p>I couldn't find any reference to this change anywhere, hence my question is why does this behave differently and what was the reasoning behind the change (it's breaking). In my opinion, the behaviour in .NET 2.0 makes more sense - creating a Lazy object from a concrete value should result in an "already evaluated" lazy object.</p>
| 0debug
|
void net_rx_pkt_attach_iovec_ex(struct NetRxPkt *pkt,
const struct iovec *iov, int iovcnt,
size_t iovoff, bool strip_vlan,
uint16_t vet)
{
uint16_t tci = 0;
uint16_t ploff = iovoff;
assert(pkt);
pkt->vlan_stripped = false;
if (strip_vlan) {
pkt->vlan_stripped = eth_strip_vlan_ex(iov, iovcnt, iovoff, vet,
pkt->ehdr_buf,
&ploff, &tci);
}
pkt->tci = tci;
net_rx_pkt_pull_data(pkt, iov, iovcnt, ploff);
}
| 1threat
|
static int pxa2xx_timer_init(SysBusDevice *dev)
{
int i;
int iomemtype;
PXA2xxTimerInfo *s;
qemu_irq irq4;
s = FROM_SYSBUS(PXA2xxTimerInfo, dev);
s->irq_enabled = 0;
s->oldclock = 0;
s->clock = 0;
s->lastload = qemu_get_clock(vm_clock);
s->reset3 = 0;
for (i = 0; i < 4; i ++) {
s->timer[i].value = 0;
sysbus_init_irq(dev, &s->timer[i].irq);
s->timer[i].info = s;
s->timer[i].num = i;
s->timer[i].level = 0;
s->timer[i].qtimer = qemu_new_timer(vm_clock,
pxa2xx_timer_tick, &s->timer[i]);
}
if (s->flags & (1 << PXA2XX_TIMER_HAVE_TM4)) {
sysbus_init_irq(dev, &irq4);
for (i = 0; i < 8; i ++) {
s->tm4[i].tm.value = 0;
s->tm4[i].tm.info = s;
s->tm4[i].tm.num = i + 4;
s->tm4[i].tm.level = 0;
s->tm4[i].freq = 0;
s->tm4[i].control = 0x0;
s->tm4[i].tm.qtimer = qemu_new_timer(vm_clock,
pxa2xx_timer_tick4, &s->tm4[i]);
s->tm4[i].tm.irq = irq4;
}
}
iomemtype = cpu_register_io_memory(pxa2xx_timer_readfn,
pxa2xx_timer_writefn, s, DEVICE_NATIVE_ENDIAN);
sysbus_init_mmio(dev, 0x00001000, iomemtype);
return 0;
}
| 1threat
|
Groupby sum, count the number based on condition and concatenate in pandas : <p>I have a dataframe as shown below</p>
<pre><code>Sector Property_ID Unit_ID Unit_usage Property_Usage Rent_Unit_Status Unit_Area
SE1 1 1 Shop Commercial Rented 200
SE1 1 2 Resid Commercial Rented 200
SE1 1 3 Shop Commercial Vacant 100
SE1 2 1 Shop Residential Vacant 200
SE1 2 2 Apartment Residential Rented 100
SE2 1 1 Resid Commercial Rented 400
SE2 1 2 Shop Commercial Vacant 100
SE2 2 1 Apartment Residential Vacant 500
</code></pre>
<p>From the above dataframe I would like to prepare below dataframe.</p>
<pre><code>Sector No_of_Properties No_of_Units Total_area %_Vacant %_Rented %_Shop %_Apartment
SE1 2 5 800 37.5 62.5 62.5 12.5
SE2 2 3 1000 60 40 10 50
</code></pre>
| 0debug
|
How to render multi-line Text component with white gap between lines : <p>I am trying to replicate the following in React Native, a Text component with a <em>white gap</em> between lines.</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-css lang-css prettyprint-override"><code>span {
background: rgba(255, 235, 0);
line-height: 1.5;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc at condimentum leo. Suspendisse potenti. Praesent ut lorem ac tortor auctor laoreet. Fusce egestas orci quis dui egestas, ac malesuada lacus feugiat. Etiam at augue vel nisl luctus dignissim. Sed iaculis nec metus vitae interdum. Vivamus tincidunt fermentum ligula, eu tincidunt orci sodales at. Ut tristique velit erat, sed malesuada sapien ornare sit amet. Nunc congue imperdiet sapien in feugiat. Aenean id ipsum quis lorem rhoncus fermentum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec ornare, risus in dictum dignissim, dui libero blandit velit, a fringilla ligula lacus quis purus. Vivamus ullamcorper lorem vel velit dignissim lacinia. Vestibulum pulvinar leo eget magna lacinia, sit amet porttitor risus cursus. Integer nec tincidunt orci. Proin maximus viverra arcu, sit amet bibendum diam sagittis ut.</span></code></pre>
</div>
</div>
</p>
<p>Adding the same CSS above to a <code>Text</code> component doesn't output the same as the above snippet.</p>
| 0debug
|
what is difference between do(onNext:) and subscribe(onNext:)? : <p>I'm new in RxSwift, I don't understand what is difference between <code>do(onNext:)</code> and <code>subscribe(onNext:)</code>.</p>
<p>I google it but did't found good resources to explain the difference.</p>
| 0debug
|
BlockBackend *blk_new_with_bs(Error **errp)
{
BlockBackend *blk;
BlockDriverState *bs;
blk = blk_new(errp);
if (!blk) {
return NULL;
}
bs = bdrv_new_root();
blk->root = bdrv_root_attach_child(bs, "root", &child_root);
blk->root->opaque = blk;
bs->blk = blk;
return blk;
}
| 1threat
|
Continuous memory allocation in C : everyone. This is maybe an easy question for many of you. But I
have been stuck on this problem almost whole day. So, any hint would be appreciated. For the code below, I am going to read tokens, for example,
x, y, and z, and allocate them into a list of tokens' lexeme. The code is shown below:
` int parse_varlist(void)
{
token = lexer.GetToken();
char* lexeme = (char*)malloc(sizeof(token.lexeme) + 1);
memcpy(lexeme, (token.lexeme).c_str(), (token.lexeme).size() + 1);
addList(lexeme); //This function is used to add tokens' lexeme into a
list
if (token.token_type == ID) //ID is token's type
{
token = lexer.GetToken(); //read next token
parse_varlist(); //let parse_varlist() call itself to add
tokens' lexeme into list
printList(); // print list of token's lexeme
}
else {
cout << "\n Syntax Error \n";
}
free(lexeme);
return(0);
}`
Suppose we are going to read **x, y** and store their lexeme into the list. Currently, I can get these two tokens. But, after calling **printList()** I can only have **x** in my list.
I checked the possible solution online. I may use **alloc()** instead **malloc()** to allocated these memeory?
But, for the list that I am trying to create, am I allocating the memory into a single block or multiple block? Since this is one significant between **alloc()** and **malloc()** .
[enter image description here][1]
Thank you for your reading!
[1]: https://i.stack.imgur.com/rq8dm.png
| 0debug
|
Your session has expired. Please log in, Xcode 8.2 giving this error while adding account : <p>apple developer id is not able to add in xcode 8.2, it gives error like below.</p>
<p><a href="https://i.stack.imgur.com/NO2m9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NO2m9.png" alt="enter image description here"></a></p>
| 0debug
|
static inline void RENAME(rgb16to15)(const uint8_t *src,uint8_t *dst,long src_size)
{
register const uint8_t* s=src;
register uint8_t* d=dst;
register const uint8_t *end;
const uint8_t *mm_end;
end = s + src_size;
#ifdef HAVE_MMX
__asm __volatile(PREFETCH" %0"::"m"(*s));
__asm __volatile("movq %0, %%mm7"::"m"(mask15rg));
__asm __volatile("movq %0, %%mm6"::"m"(mask15b));
mm_end = end - 15;
while(s<mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movq %1, %%mm0\n\t"
"movq 8%1, %%mm2\n\t"
"movq %%mm0, %%mm1\n\t"
"movq %%mm2, %%mm3\n\t"
"psrlq $1, %%mm0\n\t"
"psrlq $1, %%mm2\n\t"
"pand %%mm7, %%mm0\n\t"
"pand %%mm7, %%mm2\n\t"
"pand %%mm6, %%mm1\n\t"
"pand %%mm6, %%mm3\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm3, %%mm2\n\t"
MOVNTQ" %%mm0, %0\n\t"
MOVNTQ" %%mm2, 8%0"
:"=m"(*d)
:"m"(*s)
);
d+=16;
s+=16;
}
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
mm_end = end - 3;
while(s < mm_end)
{
register uint32_t x= *((uint32_t *)s);
*((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
s+=4;
d+=4;
}
if(s < end)
{
register uint16_t x= *((uint16_t *)s);
*((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
s+=2;
d+=2;
}
}
| 1threat
|
Q: How to use Angular 2 template form with ng-content? : <p>Is it not possible to have form input elements within an ng-content and have that "connect" to the ngForm instance of the parent component?</p>
<p>Take this basic template for a parent component:</p>
<pre><code><form (ngSubmit)="onSubmit(editForm)" #editForm="ngForm" novalidate>
<ng-content></ng-content>
<button type="submit">Submit</button>
</form>
</code></pre>
<p>Then inside the child component, which is put inside "ng-content", something like this:</p>
<pre><code><input type="text" [(ngModel)]="user.firstName" #firstName="ngModel" name="firstName" required minlength="2">
</code></pre>
<p>On submit of the parent form, the child controls are not available, which also means that dirty/validation of whatever is in the child component is not reflected on the parent form.</p>
<p>What is missing here?</p>
| 0debug
|
Replace service registration in ASP.NET Core built-in DI container? : <p>Let us consider a service registration in <code>Startup.ConfigureServices</code>:</p>
<pre><code>public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IFoo, FooA>();
}
</code></pre>
<p>Is it possible to change <code>IFoo</code> registration to <code>FooB</code> after <code>AddTransient</code> has been called? It can be helpful for testing purposes (for example, in <code>TestStartup</code> subclass) or if our access to codebase is limited.</p>
<p>If we register another <code>IFoo</code> implementation:</p>
<pre><code>services.AddTransient<IFoo, FooA>();
services.AddTransient<IFoo, FooB>();
</code></pre>
<p>Then <code>GetService<IFoo></code> returns <code>FooB</code> instead of <code>FooA</code>:</p>
<pre><code>IFoo service = services.BuildServiceProvider().GetService<IFoo>();
Assert.True(service is FooB);
</code></pre>
<p>However, <code>GetServices<IFoo></code> successfully returns both implementations (and the same for <code>GetService<IEnumerable<IFoo>></code>):</p>
<pre><code>var list = services.BuildServiceProvider().GetServices<IFoo>().ToList();
Assert.Equal(2, list.Count);
</code></pre>
<p>There is <code>Remove(ServiceDescriptor)</code> method in <code>IServiceCollection</code> contract. What should I do with <code>ServiceDescriptor</code> to modify a service registration?</p>
| 0debug
|
int ff_mpeg_update_thread_context(AVCodecContext *dst,
const AVCodecContext *src)
{
MpegEncContext *s = dst->priv_data, *s1 = src->priv_data;
if (dst == src || !s1->context_initialized)
return 0;
if (!s->context_initialized) {
memcpy(s, s1, sizeof(MpegEncContext));
s->avctx = dst;
s->picture_range_start += MAX_PICTURE_COUNT;
s->picture_range_end += MAX_PICTURE_COUNT;
s->bitstream_buffer = NULL;
s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0;
ff_MPV_common_init(s);
}
if (s->height != s1->height || s->width != s1->width || s->context_reinit) {
int err;
s->context_reinit = 0;
s->height = s1->height;
s->width = s1->width;
if ((err = ff_MPV_common_frame_size_change(s)) < 0)
return err;
}
s->avctx->coded_height = s1->avctx->coded_height;
s->avctx->coded_width = s1->avctx->coded_width;
s->avctx->width = s1->avctx->width;
s->avctx->height = s1->avctx->height;
s->coded_picture_number = s1->coded_picture_number;
s->picture_number = s1->picture_number;
s->input_picture_number = s1->input_picture_number;
memcpy(s->picture, s1->picture, s1->picture_count * sizeof(Picture));
memcpy(&s->last_picture, &s1->last_picture,
(char *) &s1->last_picture_ptr - (char *) &s1->last_picture);
for (i = 0; i < s->picture_count; i++)
s->picture[i].f.extended_data = s->picture[i].f.data;
s->last_picture_ptr = REBASE_PICTURE(s1->last_picture_ptr, s, s1);
s->current_picture_ptr = REBASE_PICTURE(s1->current_picture_ptr, s, s1);
s->next_picture_ptr = REBASE_PICTURE(s1->next_picture_ptr, s, s1);
s->next_p_frame_damaged = s1->next_p_frame_damaged;
s->workaround_bugs = s1->workaround_bugs;
memcpy(&s->time_increment_bits, &s1->time_increment_bits,
(char *) &s1->shape - (char *) &s1->time_increment_bits);
s->max_b_frames = s1->max_b_frames;
s->low_delay = s1->low_delay;
s->dropable = s1->dropable;
s->divx_packed = s1->divx_packed;
if (s1->bitstream_buffer) {
if (s1->bitstream_buffer_size +
FF_INPUT_BUFFER_PADDING_SIZE > s->allocated_bitstream_buffer_size)
av_fast_malloc(&s->bitstream_buffer,
&s->allocated_bitstream_buffer_size,
s1->allocated_bitstream_buffer_size);
s->bitstream_buffer_size = s1->bitstream_buffer_size;
memcpy(s->bitstream_buffer, s1->bitstream_buffer,
s1->bitstream_buffer_size);
memset(s->bitstream_buffer + s->bitstream_buffer_size, 0,
FF_INPUT_BUFFER_PADDING_SIZE);
}
memcpy(&s->progressive_sequence, &s1->progressive_sequence,
(char *) &s1->rtp_mode - (char *) &s1->progressive_sequence);
if (!s1->first_field) {
s->last_pict_type = s1->pict_type;
if (s1->current_picture_ptr)
s->last_lambda_for[s1->pict_type] = s1->current_picture_ptr->f.quality;
if (s1->pict_type != AV_PICTURE_TYPE_B) {
s->last_non_b_pict_type = s1->pict_type;
}
}
return 0;
}
| 1threat
|
I'm supposed to be reading data from a file and dumping part of it into another text file. But I'm having an error : <p>//the code below is constantly giving me errors since its not reading the file
public static void main(String[]args) throws IOException{</p>
<pre><code> String file="marc21.txt";
String a;
BufferedReader br=new BufferedReader(new FileReader(file));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("marc22.txt")));
while(br.readLine()!=null){
//obtaining first five characters of file
file.substring(0, 4);
//saving substring to value
a=file.substring(0, 4);
//converting a to integer
int x=Integer.parseInt(a);
System.out.println("x is "+x);
//taking record to marc21 to another file marc22
bw.write(file.substring(0, x));
bw.write("\n");
bw.close();
}
</code></pre>
| 0debug
|
Problems with flask and bad request : <p>I was programming myself a pretty nice api to get some json data from my gameserver to my webspace using json,</p>
<p>but everytime i am sending a request using angular i am getting this: 127.0.0.1 - - [20/Mar/2018 17:07:33] code 400, message Bad request version ("β\x9cββ{β'\x12\x99βββ\xadH\x00\x00\x14β+β/β,β0β\x13β\x14\x00/\x005\x00")
127.0.0.1 - - [20/Mar/2018 17:07:33] "β\x9dtTcβ\x93β4βMβββββ\x9cββ{β'\x99ββββHβ+β/β,β0ββ/5" HTTPStatus.BAD_REQUEST -
127.0.0.1 - - [20/Mar/2018 17:07:33] code 400, message Bad request syntax ('\x16\x03\x01\x00β\x01\x00\x00\x9d\x03\x03βk,&ββua\x8c\x82\x17\x05βQwQ$β0ββ\x9fβB1\x98\x19Wββββ\x00\x00\x14β+β/β,β0β\x13β\x14\x00/\x005\x00')
127.0.0.1 - - [20/Mar/2018 17:07:33] "β\x9dβk,&ββua\x8c\x82βQwQ$β0ββ\x9fβB1\x98Wβββββ+β/β,β0ββ/5" HTTPStatus.BAD_REQUEST -
127.0.0.1 - - [20/Mar/2018 17:07:33] code 400, message Bad request syntax ('\x16\x03\x01\x00β\x01\x00\x00β\x03\x03)ββ\x1e\xa0β\t\r\x14g%ββ\x17ββ\x80\x8d}βFββ\x08UβΔ‘ββ\x06β\x00\x00\x1cβ+β/β,β0β')
g%ββββ\x80\x8d}βFβUβΔ‘ββββ+β/β,β0β" HTTPStatus.BAD_REQUEST -</p>
<p>My api</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-html lang-html prettyprint-override"><code>from flask import Flask, jsonify
from flaskext.mysql import MySQL
from flask_cors import CORS, cross_origin
app = Flask(__name__)
CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
cors = CORS(app, resources={r"/punishments": {"origins": "http://localhost:5000" "*"}})
mysql = MySQL()
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'test'
app.config['MYSQL_DATABASE_PASSWORD'] = 'Biologie1'
app.config['MYSQL_DATABASE_DB'] = 'test'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)
@app.route('/punishments', methods=['GET'])
@cross_origin(origin='localhost:5000',headers=['Content- Type','Authorization'])
def get():
cur = mysql.connect().cursor()
cur.execute('''select * from test.punishments''')
r = [dict((cur.description[i][0], value)
for i, value in enumerate(row)) for row in cur.fetchall()]
return jsonify({'punishments' : r})
if __name__ == '__main__':
app.run()</code></pre>
</div>
</div>
</p>
<p>My client function </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-html lang-html prettyprint-override"><code>export class ApiUserService {
private _postsURL = "https://localhost:5000/punishments";
constructor(private http: HttpClient) {
}
getPosts(): Observable<Punishments[]> {
let headers = new HttpHeaders();
headers = headers.set('Content-Type', 'application/json; charset=utf-8');
return this.http
.get(this._postsURL,{
headers: {'Content-Type':'application/json; charset=utf-8'}
})
.map((response: Response) => {
return <Punishments[]>response.json();
})
.catch(this.handleError);
}
private handleError(error: Response) {
return Observable.throw(error.statusText);
}
}</code></pre>
</div>
</div>
</p>
| 0debug
|
Angular ContentChildren of extended class : <p>I have 3 components. 1 parent component that can wrap one of any 2 child components inside an ng-content. My child components have shared functionality so they are extending an abstract class that have the shared functionality. </p>
<p>When I try to use ContentChildren to get the ng-content reference, it works fine if I am using one of the child classes. When I reference the abstract class, it does not work. Is there a way to make this work? plkr is: <a href="http://plnkr.co/edit/f3vc2t2gjtOrusfeesHa?p=preview" rel="noreferrer">http://plnkr.co/edit/f3vc2t2gjtOrusfeesHa?p=preview</a> </p>
<p>Here is my code: </p>
<p>Child abstract class: </p>
<pre><code> abstract export class Child{
value: any;
abstract setValue();
}
</code></pre>
<p>My parent code: </p>
<pre><code>@Component({
selector: 'parent',
template: `
<div>
parent
<ng-content></ng-content>
</div>
`,
})
export class Parent {
@ContentChild(Child)
child: Child;
name:string;
constructor() {
}
ngAfterViewInit() {
this.child.setValue();
}
}
</code></pre>
<p>First child: </p>
<pre><code>@Component({
selector: 'child1',
template: `
<div>
value is: {{value}}
</div>
`,
})
export class Child1 extends Child {
name:string;
constructor() {
}
setValue() {this.value = 'Value from child 1'}
}
</code></pre>
<p>Second child: </p>
<pre><code>@Component({
selector: 'child2',
template: `
<div>
value is: {{value}}
</div>
`,
})
export class Child2 extends Child {
name:string;
constructor() {
}
setValue() {this.value = 'Value from child 2'}
}
</code></pre>
| 0debug
|
static bool rtas_event_log_contains(uint32_t event_mask, bool exception)
{
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
sPAPREventLogEntry *entry = NULL;
if ((event_mask & EVENT_MASK_EPOW) == 0) {
return false;
}
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
if (entry->exception != exception) {
continue;
}
if (entry->log_type == RTAS_LOG_TYPE_EPOW ||
entry->log_type == RTAS_LOG_TYPE_HOTPLUG) {
return true;
}
}
return false;
}
| 1threat
|
How to create a shared class and use it in another classes in swift : <p>I need to use a shared class for my new project for reusing objects and functions in swift .I also need to know how this can be used in another classes.
Thanks in Advance
Berry</p>
| 0debug
|
void OPPROTO op_check_subfo (void)
{
if (likely(!(((uint32_t)(~T2) ^ (uint32_t)T1 ^ UINT32_MAX) &
((uint32_t)(~T2) ^ (uint32_t)T0) & (1UL << 31)))) {
xer_ov = 0;
} else {
xer_ov = 1;
xer_so = 1;
}
RETURN();
}
| 1threat
|
Bash evaluation of expression .[].[] : <p>Consider the following expression evaluations:</p>
<pre><code>$ echo .
.
$ echo .[]
.[]
$ echo .[].
.[].
$ echo .[].[]
.. # <- WAT??
$ echo .[].[].
.[].[].
$ echo .[].[].[]
.[].[].[]
</code></pre>
<p>Can someone explain why <code>.[].[]</code> has this special behavior?</p>
<p>(Tested in bash <code>3.2.57(1)-release (x86_64-apple-darwin18)</code> and <code>4.4.23(1)-release (arm-unknown-linux-androideabi)</code>.</p>
<p>I suspect it has something to do with <code>..</code> being a valid "file" (the parent directory). But then why doesn't e.g. <code>.[].</code> produce the same result?</p>
| 0debug
|
I want to hide rown in SQL server but not want to remove it : [enter image description here][1]
[1]: https://i.stack.imgur.com/Xlc6r.png
I want to hide the rows of null value but don't want remove it
| 0debug
|
GPUs and google container engine : <p>Kubernetes supports GPUs as an experimental feature. Does it work in google container engine? Do I need to have some special configuration to enable it? I want to be able to run machine learning workloads, but want to use Python 3 which isn't available in CloudML.</p>
| 0debug
|
static void nvdimm_build_device_dsm(Aml *dev)
{
Aml *method;
method = aml_method("_DSM", 4, AML_NOTSERIALIZED);
aml_append(method, aml_return(aml_call4(NVDIMM_COMMON_DSM, aml_arg(0),
aml_arg(1), aml_arg(2), aml_arg(3))));
aml_append(dev, method);
}
| 1threat
|
How to create page feature similar to msword, wordpad or page software(mac) using WPF and C# : <p>I have struggling with this issue since long time. I am working of a project in which there is requirement to create pages similar to msword or wordpad or page software(mac). In the mentioned softwares, user can able to type text and once the text reaches to the bottom, a new page appears below it. User continues typing in next page. </p>
<p>I could not able to figure out how to achieve this. I am developing this software using c# and WPF. </p>
<p>Any guidance will be helpful. Thanks in advance. Hope you understand my requirement. So far, I guess, the pages must be similar to iframes in website design. Anyways, any guidance will be helpful. Thank you. </p>
| 0debug
|
django 1.9 createsuperuser bypass the password validation checking : <p>Try to work on the new django 1.9 version, and create a super user by this: </p>
<pre><code>python manage.py createsuperuser
</code></pre>
<p>And I just want to use a simple password for my local development environment, like only one character, django1.9 upgrade to a very strict password validation policy, how can I bypass it?</p>
<pre><code>Password:
Password (again):
This password is too short. It must contain at least 8 characters.
This password is too common.
This password is entirely numeric.
</code></pre>
| 0debug
|
static void bdrv_cow_init(void)
{
bdrv_register(&bdrv_cow);
}
| 1threat
|
SQL Vb.net read table : i have database and table name restaurant..
in this table there is columns name "time" and "tableno",this table have 20 rows,
i also have this code:
Dim connString As String = "server=DESKTOP-69QA9LH\SQLEXPRESS; database=servicedb; integrated security=true"
Dim conn As New SqlConnection(connString)
Dim command As SqlCommand
Dim reader As SqlDataReader
conn.Open()
Dim query As String
query = "select time,tableno from restaurant "
command = New SqlCommand(query, conn)
reader = command.ExecuteReader
reader.Read()
Dim d1 As DateTime = ToolStripStatusLabel1.Text
Dim d2 As DateTime = reader("time")
Dim diff As Short = DateDiff(DateInterval.Minute, d2, d1)
If reader("tableno") = "2" AndAlso diff = "5" Then
Button3.BackColor = Color.LawnGreen
End If
If reader("tableno") = "2" AndAlso diff = "10" Then
Button3.BackColor = Color.LawnGreen
End If
If reader("tableno") = "2" AndAlso diff = "15" Then
Button3.BackColor = Color.LawnGreen
End If
If reader("tableno") = "1" AndAlso diff = "5" Then
Button1.BackColor = Color.Brown
End If
If reader("tableno") = "1" AndAlso diff = "10" Then
Button1.BackColor = Color.Brown
End If
If reader("tableno") = "1" AndAlso diff = "15" Then
Button1.BackColor = Color.Brown
End If
its work well,but problem is that its only read only 1st row in database.
i mean,when i click button to process this code ,buttons change background color based only on first row from database.
row with table 2 is 1st row,and i can change background color.
but table 1 is 2nd row and i cant read this row to change background color.
how can i make it work with others rows.
thanks
| 0debug
|
static int mxf_add_metadata_set(MXFContext *mxf, void *metadata_set)
{
int err;
if (mxf->metadata_sets_count+1 >= UINT_MAX / sizeof(*mxf->metadata_sets))
return AVERROR(ENOMEM);
if ((err = av_reallocp_array(&mxf->metadata_sets, mxf->metadata_sets_count + 1,
sizeof(*mxf->metadata_sets))) < 0) {
mxf->metadata_sets_count = 0;
return err;
}
mxf->metadata_sets[mxf->metadata_sets_count] = metadata_set;
mxf->metadata_sets_count++;
return 0;
}
| 1threat
|
HTML/JavaScript - How do I make a textbox blurred/disabled when it acquires focus using JavaScript? : How do I go about disabling/blurring a textbox when it gains focus using Javascript without using disabled/readonly?
| 0debug
|
Cannot convert type 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' to 'ZXing.LuminanceSource' on UWP : I'm trying to use ZXing on UWP project and I have read a lots of tutorials, that I can't get to work. The last tutorial said that I should use WritableBitmap, 'cos Bitmap is not awailable in UWP.
However it says to me
> Cannot convert type 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' to
> 'ZXing.LuminanceSource'
public class QrCodeHelpers
{
public static void ReadQrCodeFromBitmap(WriteableBitmap image)
{
IBarcodeReader reader = new BarcodeReader();
var generic = new BarcodeReaderGeneric<WriteableBitmap>();
// detect and decode the barcode inside the bitmap
var result = reader.Decode((ZXing.LuminanceSource)image);
// do something with the result
}
}
How could I get this work? I have an image from MediaCapture and it would be fine to use that and get the QR code's data. Any solution?
| 0debug
|
What is the right way to send Alt + Tab in Ahk? : <p>Ok. I know this is a very stupid question.
But I'm stuck already for an hour.</p>
<p>I got very little experience with ahk, however I made work every script until now with no problems. I explored the ahk tutorials but found no solution up to now.</p>
<p>I'm trying to switch to prev. app with a single numpad off key.
I've tried:</p>
<pre><code>!{Tab}
</code></pre>
<p>,</p>
<pre><code>{Alt down}{Tab}{Alt up}
</code></pre>
<p>I've tried it with Sleep delays, multiline, multiline inside brackets, with and without commas after commands, etc.</p>
<p>I'm quite sure is very simple but something I've not tried yet.</p>
<p>Any suggestion?</p>
| 0debug
|
static int qemu_balloon(ram_addr_t target, MonitorCompletion cb, void *opaque)
{
if (!balloon_event_fn) {
return 0;
}
trace_balloon_event(balloon_opaque, target);
balloon_event_fn(balloon_opaque, target, cb, opaque);
return 1;
}
| 1threat
|
static void simple_list(void)
{
int i;
struct {
const char *encoded;
LiteralQObject decoded;
} test_cases[] = {
{
.encoded = "[43,42]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
QLIT_QINT(43),
QLIT_QINT(42),
{ }
})),
},
{
.encoded = "[43]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
QLIT_QINT(43),
{ }
})),
},
{
.encoded = "[]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
{ }
})),
},
{
.encoded = "[{}]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
QLIT_QDICT(((LiteralQDictEntry[]){
{},
})),
{},
})),
},
{ }
};
for (i = 0; test_cases[i].encoded; i++) {
QObject *obj;
QString *str;
obj = qobject_from_json(test_cases[i].encoded, NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
obj = qobject_from_json(qstring_get_str(str), NULL);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
}
}
| 1threat
|
inserts, updates and deletes to SAP tables : can some one post me an example C# code to update a table record in SAP Subsystem using BAPIs.
I was able to select record from a SAP table using the example explained in the below link
https://stackoverflow.com/questions/5300049/step-by-step-tutorial-to-use-sap-net-connector-with-vs-2008
I checked couple of threads in the forums for this but couldnt get an understandable notes reragding the same.
Thanks in advance.
| 0debug
|
static ssize_t nbd_co_receive_request(NBDRequest *req, struct nbd_request *request)
{
NBDClient *client = req->client;
int csock = client->sock;
ssize_t rc;
client->recv_coroutine = qemu_coroutine_self();
if (nbd_receive_request(csock, request) == -1) {
rc = -EIO;
goto out;
}
if (request->len > NBD_BUFFER_SIZE) {
LOG("len (%u) is larger than max len (%u)",
request->len, NBD_BUFFER_SIZE);
rc = -EINVAL;
goto out;
}
if ((request->from + request->len) < request->from) {
LOG("integer overflow detected! "
"you're probably being attacked");
rc = -EINVAL;
goto out;
}
TRACE("Decoding type");
if ((request->type & NBD_CMD_MASK_COMMAND) == NBD_CMD_WRITE) {
TRACE("Reading %u byte(s)", request->len);
if (qemu_co_recv(csock, req->data, request->len) != request->len) {
LOG("reading from socket failed");
rc = -EIO;
goto out;
}
}
rc = 0;
out:
client->recv_coroutine = NULL;
return rc;
}
| 1threat
|
Runtime errors in Java interpreter : <p>is the Java interpreter the one that does run the bytecode? The runtime errors are detected by the interpreter ?<br>
Thanks </p>
| 0debug
|
Cannot resolve symbol 'RequestQueue' : <p>I am new to android studio and volley library so please bear with me.</p>
<p>I've added volley library by GitHub and then and added this line to build gradle file: compile 'com.android.support:appcompat-v7:23.0.1'</p>
<p>And now I am trying some tutorials about request and response from api, but for some reason I cannot make an instance of RequestQueue why?
I am using Android 4.0.3 IceCreamSandwish</p>
<p>Thank you</p>
| 0debug
|
Unable to work with React Native Async Storage : <p>I am having difficulty working with react native async storage.
Most of the time my code jumps off the current execution and goes to the next line without getting the results from the current line. I am getting errors most of the time.</p>
<p>I tried this example-</p>
<pre><code>'use strict';
var React = require('react-native');
var {
AsyncStorage,
PickerIOS,
Text,
View
} = React;
var PickerItemIOS = PickerIOS.Item;
var STORAGE_KEY = '@AsyncStorageExample:key';
var COLORS = ['red', 'orange', 'yellow', 'green', 'blue'];
var BasicStorageExample = React.createClass({
componentDidMount() {
this._loadInitialState().done();
},
async _loadInitialState() {
try {
var value = await AsyncStorage.getItem(STORAGE_KEY);
if (value !== null){
this.setState({selectedValue: value});
this._appendMessage('Recovered selection from disk: ' + value);
} else {
this._appendMessage('Initialized with no selection on disk.');
}
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
},
getInitialState() {
return {
selectedValue: COLORS[0],
messages: [],
};
},
render() {
var color = this.state.selectedValue;
return (
<View>
<PickerIOS
selectedValue={color}
onValueChange={this._onValueChange}>
{COLORS.map((value) => (
<PickerItemIOS
key={value}
value={value}
label={value}
/>
))}
</PickerIOS>
<Text>
{'Selected: '}
<Text style={{color}}>
{this.state.selectedValue}
</Text>
</Text>
<Text>{' '}</Text>
<Text onPress={this._removeStorage}>
Press here to remove from storage.
</Text>
<Text>{' '}</Text>
<Text>Messages:</Text>
{this.state.messages.map((m) => <Text key={m}>{m}</Text>)}
</View>
);
},
async _onValueChange(selectedValue) {
this.setState({selectedValue});
try {
await AsyncStorage.setItem(STORAGE_KEY, selectedValue);
this._appendMessage('Saved selection to disk: ' + selectedValue);
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
},
async _removeStorage() {
try {
await AsyncStorage.removeItem(STORAGE_KEY);
this._appendMessage('Selection removed from disk.');
} catch (error) {
this._appendMessage('AsyncStorage error: ' + error.message);
}
},
_appendMessage(message) {
this.setState({messages: this.state.messages.concat(message)});
},
});
exports.title = 'AsyncStorage';
exports.description = 'Asynchronous local disk storage.';
exports.examples = [
{
title: 'Basics - getItem, setItem, removeItem',
render(): ReactElement { return <BasicStorageExample />; }
},
];
</code></pre>
<p>This works. But, my functions doesn't work as expected. I am getting <code>undefined</code>.</p>
| 0debug
|
Tomcat 7.0.73 doesn't work with java 9 : <p>Unable to start tomcat based app with java 9 because of default "java.endorsed.dirs" option in catalina.sh.</p>
<pre><code>-Djava.endorsed.dirs=/usr/local/share/tomcat/endorsed is not supported. Endorsed standards and standalone APIs in modular form will be supported via the concept of upgradeable modules.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
</code></pre>
<p>Is there a work around for this?</p>
| 0debug
|
Choosing x and y labels on matploblib, Python : <p>I currently have this function on matploblib:</p>
<pre><code>x = np.arange(0,31)
y = x/(30-x)
plt.plot(x,y)
plt.ylabel('some numbers')
axes = plt.gca()
axes.set_ylim([0,3])
axes.set_xlim([0,25])
plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/T21rY.png" rel="nofollow noreferrer">picture</a></p>
<p>However, I want to show only the numbers 3, 2 and 1/3 on the y axis and, corresponding to those numbers, 3T/4, 2T/3, T/4. Ideally, there would be a dashed line to indicate those points. (1/3, T/4), (2T/3, 2) and (3T/4, 3)</p>
<p>That is, I want to represent the equation X/(T-X), where T is a constant. Is that possible?</p>
| 0debug
|
C# / .NET MVC Razor language translation : <p>this is the first time that I'm encountering this issue so I wanted to shed some light on this matter. I'm building a .NET MVC application which consumes a JSON web service, and the response messages from that server are written in chinese mandarin language. With each message comes a corresponding status code with it's English translation (not in the reply itself but documentation). So later on I noticed that not all errors are covered in the documentation and that I don't have their status code thus I don't know what they mean except I translate them through google translate. I figured if I used some kind of translation library that offers this kind of service where I can translate Chinese mandarin into English, it would be really nice. </p>
<p>What would you guys suggest I' should do here?</p>
<p>Every advice is helpful as I want to maintain the code as simple as I can without including any extra library that I don't really need.</p>
<p>Thanks a lot ! =) </p>
<p>P.S. so the respons message example is like following:</p>
<pre><code>θ―₯θΏθΎζΉεΌδΈε―η¨
</code></pre>
<p>Which would translate to:</p>
<pre><code>The shipping method is not available
</code></pre>
| 0debug
|
from values filled with javascript didnt submit : i have a webform, some values are filled with javacript from another div, sadly they are not submitted, here is my javacript that fill the forms, fields with values from another div -
$('.item-buy-btn').on('click', function(target){
var getBasket = $('#edit-submitted-goods').val();
var currentItem = $(this).parent().parent('.stamps').children('.views-field-nid').children('.field-content').text();
$('#edit-submitted-goods').val(currentItem);
});
the values are putted in the form, https://yadi.sk/i/9zJtSrGsvaQae
but when i click submit, data from it is reseted, and the result from it comes empty
thank you for any help with this
| 0debug
|
Get object as JSON in IntelliJ Idea from debugger : <p>Is it possible to get the whole object from debugger as Json?
There is an option <code>View text</code> but can I somehow <code>View JSON</code>?</p>
| 0debug
|
static av_cold int adx_encode_init(AVCodecContext *avctx)
{
ADXContext *c = avctx->priv_data;
if (avctx->channels > 2)
return -1;
avctx->frame_size = 32;
avctx->coded_frame = avcodec_alloc_frame();
avctx->coded_frame->key_frame = 1;
c->cutoff = 500;
ff_adx_calculate_coeffs(c->cutoff, avctx->sample_rate, COEFF_BITS, c->coeff);
return 0;
}
| 1threat
|
Why use an integer to store 4 chars? Any practical benefits? : <p>I know how to store 4 chars in a single integer.</p>
<p>My question is more to understand why is this useful?</p>
<p><strong>Any real-world practical examples</strong> would help a lot.</p>
| 0debug
|
static void read_partition(uint8_t *p, struct partition_record *r)
{
r->bootable = p[0];
r->start_head = p[1];
r->start_cylinder = p[3] | ((p[2] << 2) & 0x0300);
r->start_sector = p[2] & 0x3f;
r->system = p[4];
r->end_head = p[5];
r->end_cylinder = p[7] | ((p[6] << 2) & 0x300);
r->end_sector = p[6] & 0x3f;
r->start_sector_abs = p[8] | p[9] << 8 | p[10] << 16 | p[11] << 24;
r->nb_sectors_abs = p[12] | p[13] << 8 | p[14] << 16 | p[15] << 24;
}
| 1threat
|
Create Json in jquery : i need create json code in each loop for read my input data like this but i I do not know.
{
"element1": {
"type": "text",
"id": "1"
},
"element2": {
"type": "text",
"id": "1"
},
"element3": {
"type": "text",
"id": "1"
}
}
| 0debug
|
regex to match number followed by space followed by 2 char : <p>I have a requirement in my python app to match 2 to 7 digit number followed by a string with 2 chars in caps. </p>
<p>Examples - 6892 NY, 12382 OP</p>
<p>If these pattern appear anywhere in a line of text, need to add the two words(number and 2 chars) as one string to a list. Any insights how we can achieve this?</p>
| 0debug
|
static void r2d_init(MachineState *machine)
{
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
SuperHCPU *cpu;
CPUSH4State *env;
ResetData *reset_info;
struct SH7750State *s;
MemoryRegion *sdram = g_new(MemoryRegion, 1);
qemu_irq *irq;
DriveInfo *dinfo;
int i;
DeviceState *dev;
SysBusDevice *busdev;
MemoryRegion *address_space_mem = get_system_memory();
PCIBus *pci_bus;
if (cpu_model == NULL) {
cpu_model = "SH7751R";
}
cpu = cpu_sh4_init(cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
env = &cpu->env;
reset_info = g_malloc0(sizeof(ResetData));
reset_info->cpu = cpu;
reset_info->vector = env->pc;
qemu_register_reset(main_cpu_reset, reset_info);
memory_region_init_ram(sdram, NULL, "r2d.sdram", SDRAM_SIZE, &error_abort);
vmstate_register_ram_global(sdram);
memory_region_add_subregion(address_space_mem, SDRAM_BASE, sdram);
s = sh7750_init(cpu, address_space_mem);
irq = r2d_fpga_init(address_space_mem, 0x04000000, sh7750_irl(s));
dev = qdev_create(NULL, "sh_pci");
busdev = SYS_BUS_DEVICE(dev);
qdev_init_nofail(dev);
pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
sysbus_mmio_map(busdev, 0, P4ADDR(0x1e200000));
sysbus_mmio_map(busdev, 1, A7ADDR(0x1e200000));
sysbus_connect_irq(busdev, 0, irq[PCI_INTA]);
sysbus_connect_irq(busdev, 1, irq[PCI_INTB]);
sysbus_connect_irq(busdev, 2, irq[PCI_INTC]);
sysbus_connect_irq(busdev, 3, irq[PCI_INTD]);
sm501_init(address_space_mem, 0x10000000, SM501_VRAM_SIZE,
irq[SM501], serial_hds[2]);
dinfo = drive_get(IF_IDE, 0, 0);
dev = qdev_create(NULL, "mmio-ide");
busdev = SYS_BUS_DEVICE(dev);
sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
qdev_prop_set_uint32(dev, "shift", 1);
qdev_init_nofail(dev);
sysbus_mmio_map(busdev, 0, 0x14001000);
sysbus_mmio_map(busdev, 1, 0x1400080c);
mmio_ide_init_drives(dev, dinfo, NULL);
dinfo = drive_get(IF_PFLASH, 0, 0);
pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
(16 * 1024), FLASH_SIZE >> 16,
1, 4, 0x0000, 0x0000, 0x0000, 0x0000,
0x555, 0x2aa, 0);
for (i = 0; i < nb_nics; i++)
pci_nic_init_nofail(&nd_table[i], pci_bus,
"rtl8139", i==0 ? "2" : NULL);
usb_create_simple(usb_bus_find(-1), "usb-kbd");
memset(&boot_params, 0, sizeof(boot_params));
if (kernel_filename) {
int kernel_size;
kernel_size = load_image_targphys(kernel_filename,
SDRAM_BASE + LINUX_LOAD_OFFSET,
INITRD_LOAD_OFFSET - LINUX_LOAD_OFFSET);
if (kernel_size < 0) {
fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
exit(1);
}
address_space_stl(&address_space_memory, SH7750_BCR1, 1 << 3,
MEMTXATTRS_UNSPECIFIED, NULL);
address_space_stw(&address_space_memory, SH7750_BCR2, 3 << (3 * 2),
MEMTXATTRS_UNSPECIFIED, NULL);
reset_info->vector = (SDRAM_BASE + LINUX_LOAD_OFFSET) | 0xa0000000;
}
if (initrd_filename) {
int initrd_size;
initrd_size = load_image_targphys(initrd_filename,
SDRAM_BASE + INITRD_LOAD_OFFSET,
SDRAM_SIZE - INITRD_LOAD_OFFSET);
if (initrd_size < 0) {
fprintf(stderr, "qemu: could not load initrd '%s'\n", initrd_filename);
exit(1);
}
boot_params.loader_type = tswap32(1);
boot_params.initrd_start = tswap32(INITRD_LOAD_OFFSET);
boot_params.initrd_size = tswap32(initrd_size);
}
if (kernel_cmdline) {
strncpy(boot_params.kernel_cmdline, kernel_cmdline,
sizeof(boot_params.kernel_cmdline));
}
rom_add_blob_fixed("boot_params", &boot_params, sizeof(boot_params),
SDRAM_BASE + BOOT_PARAMS_OFFSET);
}
| 1threat
|
Trim whitespace ASCII character "194" from string : <p>Recently ran into a very odd issue where my database contains strings with what appear to be normal whitespace characters but are in fact something else.</p>
<p>For instance, applying <code>trim()</code> to the string:</p>
<pre><code>"TEST "
</code></pre>
<p>is getting me:</p>
<pre><code>"TEST "
</code></pre>
<p>as a result. So I copy and paste the last character in the string and:</p>
<pre><code>echo ord(' ');
194
</code></pre>
<p>194? According to ASCII tables that should be <code>β¬</code>. So I'm just confused at this point. Why does this character appear to be whitespace and how can I <code>trim()</code> characters like this when <code>trim()</code> fails?</p>
| 0debug
|
alert('Hello ' + user_input);
| 1threat
|
Fastest way to update a character in a string in Python : <p>I have to replace every '%' character with '%%' in a string and as string are immutable i am doing <code>list(string)</code> and then replace every '%' with '%%'.
But string can be huge(len(string)>2000) and as a result list can be huge that can slow down so i want to know the fastest way to do that in python 2.7</p>
| 0debug
|
Order by error in creat view in sql server : **CREATE VIEW tblSanPham_VIEW
AS
SELECT TenSP, MaDanhMuc, Mamau
FROM tblSanPham
ORDER BY MaSP DESC**
Msg 1033, Level 15, State 1, Procedure tblSanPham_VIEW, Line 6 [Batch Start Line 47]
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
| 0debug
|
JavaFX Border and Label : <p>I have no idea how to do this red line <a href="https://i.stack.imgur.com/ZCVAr.png" rel="nofollow noreferrer">picture</a></p>
<pre><code>GridPane left = new GridPane();
root.setLeft(left);
left.setPadding(new Insets(10, 10, 10, 15));
Label l1=new Label("Panel plikΓ³w");
left.addRow(0,l1);
left.setPrefSize(350, Double.MAX_VALUE);
Border b = new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT));
left.setBorder(b);
</code></pre>
<p>Can you help me?</p>
| 0debug
|
static void check_mc(void)
{
LOCAL_ALIGNED_32(uint8_t, buf, [72 * 72 * 2]);
LOCAL_ALIGNED_32(uint8_t, dst0, [64 * 64 * 2]);
LOCAL_ALIGNED_32(uint8_t, dst1, [64 * 64 * 2]);
VP9DSPContext dsp;
int op, hsize, bit_depth, filter, dx, dy;
declare_func(void, uint8_t *dst, ptrdiff_t dst_stride,
const uint8_t *ref, ptrdiff_t ref_stride,
int h, int mx, int my);
static const char *const filter_names[4] = {
"8tap_smooth", "8tap_regular", "8tap_sharp", "bilin"
};
static const char *const subpel_names[2][2] = { { "", "h" }, { "v", "hv" } };
static const char *const op_names[2] = { "put", "avg" };
char str[256];
for (op = 0; op < 2; op++) {
for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) {
ff_vp9dsp_init(&dsp, bit_depth, 0);
for (hsize = 0; hsize < 5; hsize++) {
int size = 64 >> hsize;
for (filter = 0; filter < 4; filter++) {
for (dx = 0; dx < 2; dx++) {
for (dy = 0; dy < 2; dy++) {
if (dx || dy) {
sprintf(str, "%s_%s_%d%s", op_names[op],
filter_names[filter], size,
subpel_names[dy][dx]);
} else {
sprintf(str, "%s%d", op_names[op], size);
}
if (check_func(dsp.mc[hsize][filter][op][dx][dy],
"vp9_%s_%dbpp", str, bit_depth)) {
int mx = dx ? 1 + (rnd() % 14) : 0;
int my = dy ? 1 + (rnd() % 14) : 0;
randomize_buffers();
call_ref(dst0, size * SIZEOF_PIXEL,
src, SRC_BUF_STRIDE * SIZEOF_PIXEL,
size, mx, my);
call_new(dst1, size * SIZEOF_PIXEL,
src, SRC_BUF_STRIDE * SIZEOF_PIXEL,
size, mx, my);
if (memcmp(dst0, dst1, DST_BUF_SIZE))
fail();
if (filter >= 1 && filter <= 2) continue;
if (bit_depth == 12 && filter == 3) continue;
bench_new(dst1, size * SIZEOF_PIXEL,
src, SRC_BUF_STRIDE * SIZEOF_PIXEL,
size, mx, my);
}
}
}
}
}
}
}
report("mc");
}
| 1threat
|
A proper way to plot climate data on an irregular grid : <p>I have asked this question as part of the <a href="https://stackoverflow.com/questions/48952435/efficient-way-to-plot-data-on-an-irregular-grid">Efficient way to plot data on an irregular grid</a> question, but the general feedback was to split the original question in more manageable chunks. Hence, this new question.</p>
<p>I work with satellite data organized on an irregular two-dimensional grid whose dimensions are scanline (along track dimension, i.e. Y axis) and ground pixel (across track dimension, i.e. X axis). Latitude and longitude information for each centre pixel are stored in auxiliary coordinate variables, as well as the four corners coordinate pairs (latitude and longitude coordinates are given on the WGS84 reference ellipsoid).</p>
<p>Let's build a toy data set, consisting in a 12x10 potentially irregular grid and associated surface temperature measurements. </p>
<pre><code>library(pracma) # for the meshgrid function
library(ggplot2)
num_sl <- 12 # number of scanlines
num_gp <- 10 # number of ground pixels
l <- meshgrid(seq(from=-20, to=20, length.out = num_gp),
seq(from=30, to=60, length.out = num_sl))
lon <- l[[1]] + l[[2]]/10
lat <- l[[2]] + l[[1]]/10
data <- matrix(seq(from = 30, to = 0, length.out = num_sl*num_gp),
byrow = TRUE, nrow = num_sl, ncol = num_gp) +
matrix(runif(num_gp*num_sl)*6, nrow = num_sl, ncol = num_gp)
df <- data.frame(lat=as.vector(lat), lon=as.vector(lon), temp=as.vector(data))
</code></pre>
<p>The <code>lon</code> and <code>lat</code> data contain the centre pixel coordinates as provided in the original product I'm working with, stored as two-dimensional matrix, whose axes are ground_pixel (X axis) and scanline (Y axis). The <code>data</code> matrixβsame dimensionsβcontains my measurements. I then <em>flatten</em> the three matrix and store them in a data frame.</p>
<p>I would like to plot the ground pixels (as quadrilaterals) on a map, filled accordingly with the temperature measurement. </p>
<p>Using tiles I get:</p>
<pre><code>ggplot(df, aes(y=lat, x=lon, fill=temp)) +
geom_tile(width=2, height=2) +
geom_point(size=.1) +
borders('world', colour='gray50', size=.2) +
coord_quickmap(xlim=range(lon), ylim=range(lat)) +
scale_fill_distiller(palette='Spectral') +
theme_minimal()
</code></pre>
<p><a href="https://i.stack.imgur.com/zTkfW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zTkfW.png" alt="Using tiles"></a></p>
<p>But that's not what I am after. I could play with <code>width</code> and <code>height</code> to make the tiles "touch" each other, but of course that wouldn't even come close to my desired goal, which is to plot the actual <em>projected</em> ground pixels on the map.<br>
Python's xarray can, for example, automatically infer the pixel boundaries given the pixel centre coordinates:</p>
<p><a href="https://i.stack.imgur.com/6iQa6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6iQa6.png" alt="Xarray solution"></a> </p>
<h2>Question</h2>
<p>Is there a way to achieve the same results in R, that is: having the pixel boundaries automatically inferred from the pixel centres, and plotting the pixels as filled polygons on a map? Maybe using the <code>sf</code> package? </p>
<p>I can see it done in the answer to this <a href="https://stackoverflow.com/questions/43612903/how-to-properly-plot-projected-gridded-data-in-ggplot2">question</a> but the answer that refers to using <code>sf</code> is a bit unclear to me, as it deals with different projections and potentially regular grids, whereas in my case I suppose I don't have to re-project my data, and, furthermore, my data is not on a regular grid.</p>
<p>If this is not possible, I suppose I can resort to use the pixel boundaries information in my products, but maybe that's a topic for another question should this one prove to be not easy to tackle. </p>
| 0debug
|
Can't access to data in S3 with Lambda : IΒ΄m using Javascript for a few months and my code runs well in local but I have always the same problem in a lambda function.
I cant show any data from s3.getObject.
This is an simple code that doesnt run on lambda function.
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
exports.myHandler = function(event, context, callback) {
// Retrieve the object
s3.getObject({
Bucket: 'XXXXXX',
Key: 'YYYYY'
}, function(err, data) {
if (err) {
console.log(err);
} else {
console.log("data");
}
});
};
| 0debug
|
Python - Need help to understand how to call a function : <p>I am new to programming, and trying out with a little Python3.</p>
<p>I have some trouble understanding the concept behind calling a function? having the defined the following function, what would be the proper way to call it?</p>
<pre><code>def string_length(mystring):
return len(mystring)
</code></pre>
<p>Thanks in advance guys</p>
| 0debug
|
void cpu_loop(CPUAlphaState *env)
{
int trapnr;
target_siginfo_t info;
abi_long sysret;
while (1) {
trapnr = cpu_alpha_exec (env);
env->intr_flag = 0;
switch (trapnr) {
case EXCP_RESET:
fprintf(stderr, "Reset requested. Exit\n");
exit(1);
break;
case EXCP_MCHK:
fprintf(stderr, "Machine check exception. Exit\n");
exit(1);
break;
case EXCP_SMP_INTERRUPT:
case EXCP_CLK_INTERRUPT:
case EXCP_DEV_INTERRUPT:
fprintf(stderr, "External interrupt. Exit\n");
exit(1);
break;
case EXCP_MMFAULT:
env->lock_addr = -1;
info.si_signo = TARGET_SIGSEGV;
info.si_errno = 0;
info.si_code = (page_get_flags(env->trap_arg0) & PAGE_VALID
? TARGET_SEGV_ACCERR : TARGET_SEGV_MAPERR);
info._sifields._sigfault._addr = env->trap_arg0;
queue_signal(env, info.si_signo, &info);
break;
case EXCP_UNALIGN:
env->lock_addr = -1;
info.si_signo = TARGET_SIGBUS;
info.si_errno = 0;
info.si_code = TARGET_BUS_ADRALN;
info._sifields._sigfault._addr = env->trap_arg0;
queue_signal(env, info.si_signo, &info);
break;
case EXCP_OPCDEC:
do_sigill:
env->lock_addr = -1;
info.si_signo = TARGET_SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPC;
info._sifields._sigfault._addr = env->pc;
queue_signal(env, info.si_signo, &info);
break;
case EXCP_ARITH:
env->lock_addr = -1;
info.si_signo = TARGET_SIGFPE;
info.si_errno = 0;
info.si_code = TARGET_FPE_FLTINV;
info._sifields._sigfault._addr = env->pc;
queue_signal(env, info.si_signo, &info);
break;
case EXCP_FEN:
break;
case EXCP_CALL_PAL:
env->lock_addr = -1;
switch (env->error_code) {
case 0x80:
info.si_signo = TARGET_SIGTRAP;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
info._sifields._sigfault._addr = env->pc;
queue_signal(env, info.si_signo, &info);
break;
case 0x81:
info.si_signo = TARGET_SIGTRAP;
info.si_errno = 0;
info.si_code = 0;
info._sifields._sigfault._addr = env->pc;
queue_signal(env, info.si_signo, &info);
break;
case 0x83:
trapnr = env->ir[IR_V0];
sysret = do_syscall(env, trapnr,
env->ir[IR_A0], env->ir[IR_A1],
env->ir[IR_A2], env->ir[IR_A3],
env->ir[IR_A4], env->ir[IR_A5],
0, 0);
if (trapnr == TARGET_NR_sigreturn
|| trapnr == TARGET_NR_rt_sigreturn) {
break;
}
if (env->ir[IR_V0] == 0) {
env->ir[IR_V0] = sysret;
} else {
env->ir[IR_V0] = (sysret < 0 ? -sysret : sysret);
env->ir[IR_A3] = (sysret < 0);
}
break;
case 0x86:
break;
case 0x9E:
abort();
case 0x9F:
abort();
case 0xAA:
info.si_signo = TARGET_SIGFPE;
switch (env->ir[IR_A0]) {
case TARGET_GEN_INTOVF:
info.si_code = TARGET_FPE_INTOVF;
break;
case TARGET_GEN_INTDIV:
info.si_code = TARGET_FPE_INTDIV;
break;
case TARGET_GEN_FLTOVF:
info.si_code = TARGET_FPE_FLTOVF;
break;
case TARGET_GEN_FLTUND:
info.si_code = TARGET_FPE_FLTUND;
break;
case TARGET_GEN_FLTINV:
info.si_code = TARGET_FPE_FLTINV;
break;
case TARGET_GEN_FLTINE:
info.si_code = TARGET_FPE_FLTRES;
break;
case TARGET_GEN_ROPRAND:
info.si_code = 0;
break;
default:
info.si_signo = TARGET_SIGTRAP;
info.si_code = 0;
break;
}
info.si_errno = 0;
info._sifields._sigfault._addr = env->pc;
queue_signal(env, info.si_signo, &info);
break;
default:
goto do_sigill;
}
break;
case EXCP_DEBUG:
info.si_signo = gdb_handlesig (env, TARGET_SIGTRAP);
if (info.si_signo) {
env->lock_addr = -1;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
break;
case EXCP_STL_C:
case EXCP_STQ_C:
do_store_exclusive(env, env->error_code, trapnr - EXCP_STL_C);
break;
case EXCP_INTERRUPT:
break;
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
exit (1);
}
process_pending_signals (env);
}
}
| 1threat
|
static void do_transmit_packets(dp8393xState *s)
{
uint16_t data[12];
int width, size;
int tx_len, len;
uint16_t i;
width = (s->regs[SONIC_DCR] & SONIC_DCR_DW) ? 2 : 1;
while (1) {
DPRINTF("Transmit packet at %08x\n",
(s->regs[SONIC_UTDA] << 16) | s->regs[SONIC_CTDA]);
size = sizeof(uint16_t) * 6 * width;
s->regs[SONIC_TTDA] = s->regs[SONIC_CTDA];
s->memory_rw(s->mem_opaque,
((s->regs[SONIC_UTDA] << 16) | s->regs[SONIC_TTDA]) + sizeof(uint16_t) * width,
(uint8_t *)data, size, 0);
tx_len = 0;
s->regs[SONIC_TCR] = data[0 * width] & 0xf000;
s->regs[SONIC_TPS] = data[1 * width];
s->regs[SONIC_TFC] = data[2 * width];
s->regs[SONIC_TSA0] = data[3 * width];
s->regs[SONIC_TSA1] = data[4 * width];
s->regs[SONIC_TFS] = data[5 * width];
if (s->regs[SONIC_TCR] & SONIC_TCR_PINT) {
s->regs[SONIC_ISR] |= SONIC_ISR_PINT;
} else {
s->regs[SONIC_ISR] &= ~SONIC_ISR_PINT;
}
for (i = 0; i < s->regs[SONIC_TFC]; ) {
len = s->regs[SONIC_TFS];
if (tx_len + len > sizeof(s->tx_buffer)) {
len = sizeof(s->tx_buffer) - tx_len;
}
s->memory_rw(s->mem_opaque,
(s->regs[SONIC_TSA1] << 16) | s->regs[SONIC_TSA0],
&s->tx_buffer[tx_len], len, 0);
tx_len += len;
i++;
if (i != s->regs[SONIC_TFC]) {
size = sizeof(uint16_t) * 3 * width;
s->memory_rw(s->mem_opaque,
((s->regs[SONIC_UTDA] << 16) | s->regs[SONIC_TTDA]) + sizeof(uint16_t) * (4 + 3 * i) * width,
(uint8_t *)data, size, 0);
s->regs[SONIC_TSA0] = data[0 * width];
s->regs[SONIC_TSA1] = data[1 * width];
s->regs[SONIC_TFS] = data[2 * width];
}
}
if (!(s->regs[SONIC_TCR] & SONIC_TCR_CRCI)) {
} else {
tx_len -= 4;
}
if (s->regs[SONIC_RCR] & (SONIC_RCR_LB1 | SONIC_RCR_LB0)) {
s->regs[SONIC_TCR] |= SONIC_TCR_CRSL;
if (s->vc->fd_can_read(s)) {
s->loopback_packet = 1;
s->vc->receive(s, s->tx_buffer, tx_len);
}
} else {
qemu_send_packet(s->vc, s->tx_buffer, tx_len);
}
s->regs[SONIC_TCR] |= SONIC_TCR_PTX;
data[0 * width] = s->regs[SONIC_TCR] & 0x0fff;
size = sizeof(uint16_t) * width;
s->memory_rw(s->mem_opaque,
(s->regs[SONIC_UTDA] << 16) | s->regs[SONIC_TTDA],
(uint8_t *)data, size, 1);
if (!(s->regs[SONIC_CR] & SONIC_CR_HTX)) {
size = sizeof(uint16_t) * width;
s->memory_rw(s->mem_opaque,
((s->regs[SONIC_UTDA] << 16) | s->regs[SONIC_TTDA]) + sizeof(uint16_t) * (4 + 3 * s->regs[SONIC_TFC]) * width,
(uint8_t *)data, size, 0);
s->regs[SONIC_CTDA] = data[0 * width] & ~0x1;
if (data[0 * width] & 0x1) {
break;
}
}
}
s->regs[SONIC_CR] &= ~SONIC_CR_TXP;
s->regs[SONIC_ISR] |= SONIC_ISR_TXDN;
dp8393x_update_irq(s);
}
| 1threat
|
convert custom text to html : <p>Where can I find A code do this <a href="https://i.stack.imgur.com/FMjok.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FMjok.png" alt="enter image description here"></a></p>
<p>to convert colored an aligned text to html . </p>
<p>or what should search for to find something like that .</p>
| 0debug
|
static void gen_op_update_neg_cc(void)
{
tcg_gen_neg_tl(cpu_cc_src, cpu_T[0]);
tcg_gen_mov_tl(cpu_cc_dst, cpu_T[0]);
}
| 1threat
|
DirectX open-source engine licensing : <p>I would like to publish source code (only source code, no binaries) for basic game engine I created under zlib or MIT license, however it uses DirectX libraries (such as Direct2D, Direct3D, etc.) which are not open-source. I am not going to include them in my project's repository, so that should be fine when it comes to source code itself but wouldn't there be any license conflict when it comes to actually compiling the source code? Will the license cover the binaries as well or not? Should I add to license or readme file some note saying that 3rd party libraries are not covered by my chosen license just to be sure or I don't need to care about this at all?</p>
| 0debug
|
AVRational av_get_q(void *obj, const char *name, const AVOption **o_out)
{
int64_t intnum=1;
double num=1;
int den=1;
av_get_number(obj, name, o_out, &num, &den, &intnum);
if (num == 1.0 && (int)intnum == intnum)
return (AVRational){intnum, den};
else
return av_d2q(num*intnum/den, 1<<24);
}
| 1threat
|
What's the difference between git stash save and git stash push? : <p>When should I use <code>git stash save</code> instead of <code>git stash push</code> and vice-versa?</p>
| 0debug
|
What do 3 dots/periods/ellipsis in a relay/graphql query mean? : <p>The <a href="https://facebook.github.io/relay/docs/graphql-object-identification.html#content" rel="noreferrer">relay docs</a> contain this fragment:</p>
<pre><code>query RebelsRefetchQuery {
node(id: "RmFjdGlvbjox") {
id
... on Faction {
name
}
}
}
</code></pre>
<p>What does this <code>... on Faction</code> on syntax mean?</p>
| 0debug
|
Passing through a function, but not getting the right value : I having trouble understanding what is happening. The value of second token is some random number instead of 1. Why does the value of second token not the value in the function?
struct player
{
char name[20];
enum cell token;
unsigned score;
};
BOOLEAN init_player2(struct player *second, enum cell token)
{
token = 1;
}
int main()
{
struct player second;
init_player2(&second, second.token);
printf("The value of second token is: %d\n", second.token);
return 0;
}
| 0debug
|
Use sudo inside Dockerfile (Alpine) : <p>I have this Dockerfile ...</p>
<pre><code>FROM keymetrics/pm2:latest-alpine
RUN apk update && \
apk upgrade && \
apk add \
bash
COPY . ./
EXPOSE 1886 80 443
CMD pm2-docker start --auto-exit --env ${NODE_ENV} ecosystem.config.js
</code></pre>
<p>How can I execute the <code>CMD</code> command using <code>sudo</code> ?</p>
<p>I need to do this because the port 443 is allowed only for sudo user.</p>
| 0debug
|
static int read_motion_values(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
{
int t, sign, v;
const uint8_t *dec_end;
CHECK_READ_VAL(gb, b, t);
dec_end = b->cur_dec + t;
if (dec_end > b->data_end) {
av_log(avctx, AV_LOG_ERROR, "Too many motion values\n");
return -1;
}
if (get_bits1(gb)) {
v = get_bits(gb, 4);
if (v) {
sign = -get_bits1(gb);
v = (v ^ sign) - sign;
}
memset(b->cur_dec, v, t);
b->cur_dec += t;
} else {
do {
v = GET_HUFF(gb, b->tree);
if (v) {
sign = -get_bits1(gb);
v = (v ^ sign) - sign;
}
*b->cur_dec++ = v;
} while (b->cur_dec < dec_end);
}
return 0;
}
| 1threat
|
static int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s)
{
int ret = 0;
int i;
VHDXHeader *hdr;
hdr = s->headers[s->curr_header];
for (i = 0; i < sizeof(hdr->log_guid.data4); i++) {
ret |= hdr->log_guid.data4[i];
}
if (hdr->log_guid.data1 == 0 &&
hdr->log_guid.data2 == 0 &&
hdr->log_guid.data3 == 0 &&
ret == 0) {
goto exit;
}
if (hdr->log_version != 0) {
ret = -EINVAL;
goto exit;
}
if (hdr->log_length == 0) {
goto exit;
}
ret = -ENOTSUP;
exit:
return ret;
}
| 1threat
|
static void visitor_input_teardown(TestInputVisitorData *data,
const void *unused)
{
qobject_decref(data->obj);
data->obj = NULL;
if (data->qiv) {
visit_free(data->qiv);
data->qiv = NULL;
}
}
| 1threat
|
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
{
AVVDPAUContext *hwctx = avctx->hwaccel_context;
MpegEncContext *s = avctx->priv_data;
Picture *pic = s->current_picture_ptr;
struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
VdpVideoSurface surf = ff_vdpau_get_surface_id(&pic->f);
hwctx->render(hwctx->decoder, surf, (void *)&pic_ctx->info,
pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
av_freep(&pic_ctx->bitstream_buffers);
return 0;
}
| 1threat
|
How to get bounds with react-leaflet : <p>I want to get bounds of the current map so that I can search those bounds with the Overpass API.</p>
<p>For leaflet I know the method is just map.getBounds(), but I don't know how to implement that in react-leaflet.</p>
<pre><code>class SimpleExample extends React.Component {
constructor() {
super();
this.state = {
lat: 51.505,
lng: -0.09,
zoom: 13,
};
}
componentDidMount() {
console.log(this.refs.map.getBounds())
}
render() {
const position = [this.state.lat, this.state.lng];
return (
<Map center={position} zoom={this.state.zoom} ref='map'>
<TileLayer
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
/>
</Map>
);
}
}
</code></pre>
<p>This is what I've tried. Error says that <code>this.refs.map.getBounds</code> isn't a function.</p>
| 0debug
|
How can I sequence a character vector where "0.1" is distinguished from "0.10"? : I need to create a function that sequences a character vector in this fashion:
as.character(c(seq(0.1, 0.9, by = 0.1),
"0.10", seq(0.11, 0.19, by = 0.01),
"0.20", seq(0.21, 0.29, by = 0.01)))
[1] "0.1" "0.2" "0.3" "0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "0.10" "0.11" "0.12" "0.13" "0.14"
[15] "0.15" "0.16" "0.17" "0.18" "0.19" "0.20" "0.21" "0.22" "0.23" "0.24" "0.25" "0.26" "0.27" "0.28"
[29] "0.29"
In short, I need "0.1" to be distinguished from "0.10" within the sequence.
| 0debug
|
A challenge which improve my skills at programming python? : <p>I have just started programming and I have done quite a few online courses. I know most of the basics like loops,commands,lists ext. I was wanting a challenge where I could use my skills in a python program and extend my knowledge of actually using my skills. </p>
| 0debug
|
CSS: ID doesn't work but Class does : <p>When applying a style to something like an unordered list, why does Class work but Id has no effect. Listo1 displays a bulleted list and Listo2 displays an unbulleted list (at least in the html editors I've tried such as the W3 and Codecademy ones).</p>
<pre><code><!DOCTYPE html>
<html>
<body>
<style>
.listo1{
list-style-type : none;
}
.listo2{
list-style-type : none;
}
</style>
<h2>Unordered List without Bullets</h2>
<ul id="listo1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ul class="listo2">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
</code></pre>
| 0debug
|
static void vtd_do_iommu_translate(IntelIOMMUState *s, uint8_t bus_num,
uint8_t devfn, hwaddr addr, bool is_write,
IOMMUTLBEntry *entry)
{
VTDContextEntry ce;
uint64_t slpte;
uint32_t level;
uint16_t source_id = vtd_make_source_id(bus_num, devfn);
int ret_fr;
bool is_fpd_set = false;
bool reads = true;
bool writes = true;
if (vtd_is_interrupt_addr(addr)) {
if (is_write) {
VTD_DPRINTF(MMU, "write request to interrupt address "
"gpa 0x%"PRIx64, addr);
entry->iova = addr & VTD_PAGE_MASK_4K;
entry->translated_addr = addr & VTD_PAGE_MASK_4K;
entry->addr_mask = ~VTD_PAGE_MASK_4K;
entry->perm = IOMMU_WO;
return;
} else {
VTD_DPRINTF(GENERAL, "error: read request from interrupt address "
"gpa 0x%"PRIx64, addr);
vtd_report_dmar_fault(s, source_id, addr, VTD_FR_READ, is_write);
return;
}
}
ret_fr = vtd_dev_to_context_entry(s, bus_num, devfn, &ce);
is_fpd_set = ce.lo & VTD_CONTEXT_ENTRY_FPD;
if (ret_fr) {
ret_fr = -ret_fr;
if (is_fpd_set && vtd_is_qualified_fault(ret_fr)) {
VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests "
"through this context-entry (with FPD Set)");
} else {
vtd_report_dmar_fault(s, source_id, addr, ret_fr, is_write);
}
return;
}
ret_fr = vtd_gpa_to_slpte(&ce, addr, is_write, &slpte, &level,
&reads, &writes);
if (ret_fr) {
ret_fr = -ret_fr;
if (is_fpd_set && vtd_is_qualified_fault(ret_fr)) {
VTD_DPRINTF(FLOG, "fault processing is disabled for DMA requests "
"through this context-entry (with FPD Set)");
} else {
vtd_report_dmar_fault(s, source_id, addr, ret_fr, is_write);
}
return;
}
entry->iova = addr & VTD_PAGE_MASK_4K;
entry->translated_addr = vtd_get_slpte_addr(slpte) & VTD_PAGE_MASK_4K;
entry->addr_mask = ~VTD_PAGE_MASK_4K;
entry->perm = (writes ? 2 : 0) + (reads ? 1 : 0);
}
| 1threat
|
static int debugcon_parse(const char *devname)
{
QemuOpts *opts;
if (!qemu_chr_new("debugcon", devname, NULL)) {
exit(1);
}
opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1);
if (!opts) {
fprintf(stderr, "qemu: already have a debugcon device\n");
exit(1);
}
qemu_opt_set(opts, "driver", "isa-debugcon");
qemu_opt_set(opts, "chardev", "debugcon");
return 0;
}
| 1threat
|
target_ulong helper_load_slb_vsid(CPUPPCState *env, target_ulong rb)
{
target_ulong rt;
if (ppc_load_slb_vsid(env, rb, &rt) < 0) {
helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL);
}
return rt;
}
| 1threat
|
How can I retrieve the port from a Session : I'm trying the examples from the crust cargo but cannot figure how to obtain the port from a peer I'm connected to.
I've got the connection established and can obtain the IP with service.get_peer_ip_addr(&PeerId) but the result has no port.
Is there another method to obtain the port?
Thanks a lot.
| 0debug
|
static int oggvorbis_decode_init(AVCodecContext *avccontext) {
OggVorbisDecContext *context = avccontext->priv_data ;
uint8_t *p= avccontext->extradata;
int i, hsizes[3];
unsigned char *headers[3], *extradata = avccontext->extradata;
vorbis_info_init(&context->vi) ;
vorbis_comment_init(&context->vc) ;
if(! avccontext->extradata_size || ! p) {
av_log(avccontext, AV_LOG_ERROR, "vorbis extradata absent\n");
return -1;
}
if(p[0] == 0 && p[1] == 30) {
for(i = 0; i < 3; i++){
hsizes[i] = bytestream_get_be16((const uint8_t **)&p);
headers[i] = p;
p += hsizes[i];
}
} else if(*p == 2) {
unsigned int offset = 1;
p++;
for(i=0; i<2; i++) {
hsizes[i] = 0;
while((*p == 0xFF) && (offset < avccontext->extradata_size)) {
hsizes[i] += 0xFF;
offset++;
p++;
}
if(offset >= avccontext->extradata_size - 1) {
av_log(avccontext, AV_LOG_ERROR,
"vorbis header sizes damaged\n");
return -1;
}
hsizes[i] += *p;
offset++;
p++;
}
hsizes[2] = avccontext->extradata_size - hsizes[0]-hsizes[1]-offset;
#if 0
av_log(avccontext, AV_LOG_DEBUG,
"vorbis header sizes: %d, %d, %d, / extradata_len is %d \n",
hsizes[0], hsizes[1], hsizes[2], avccontext->extradata_size);
#endif
headers[0] = extradata + offset;
headers[1] = extradata + offset + hsizes[0];
headers[2] = extradata + offset + hsizes[0] + hsizes[1];
} else {
av_log(avccontext, AV_LOG_ERROR,
"vorbis initial header len is wrong: %d\n", *p);
return -1;
}
for(i=0; i<3; i++){
context->op.b_o_s= i==0;
context->op.bytes = hsizes[i];
context->op.packet = headers[i];
if(vorbis_synthesis_headerin(&context->vi, &context->vc, &context->op)<0){
av_log(avccontext, AV_LOG_ERROR, "%d. vorbis header damaged\n", i+1);
return -1;
}
}
avccontext->channels = context->vi.channels;
avccontext->sample_rate = context->vi.rate;
avccontext->sample_fmt = AV_SAMPLE_FMT_S16;
avccontext->time_base= (AVRational){1, avccontext->sample_rate};
vorbis_synthesis_init(&context->vd, &context->vi);
vorbis_block_init(&context->vd, &context->vb);
return 0 ;
}
| 1threat
|
int kvm_arch_remove_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp)
{
uint8_t int3;
if (cpu_memory_rw_debug(env, bp->pc, &int3, 1, 0) || int3 != 0xcc ||
cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1))
return -EINVAL;
return 0;
}
| 1threat
|
void tpm_backend_cancel_cmd(TPMBackend *s)
{
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
assert(k->cancel_cmd);
k->cancel_cmd(s);
}
| 1threat
|
Unfortunately, APP has stopped error. Are there any view limitations for an activity? : <p>I am trying to develop an app for Android with Android studio.
I have a login page and trying to open an another activity named main with button from login page. I have lots of rows in two table layout. You can find codes there.
When i clicked imagebutton in login, sometimes i get Unfortunately, APP has stopped error. Sometimes dont get <strong>with same codes.</strong></p>
<p>Are there any limitations for number of widgets for an activity page?
I am getting this error on emulator.
Here are the codes.
Thank for your replies.</p>
<p><strong>login.java</strong></p>
<pre><code>protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Button mainBtn = (Button) findViewById(R.id.bt_enter);
mainBtn.setOnClickListener(new View.OnClickListener(){
public void onClick(View v)
{
Intent intent = new Intent(login.this, main.class);
startActivity(intent);
}
});
}
</code></pre>
<p><strong>content_main</strong></p>
<pre><code> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.dasyapi.erp.dait.main"
tools:showIn="@layout/activity_main"
android:background="@drawable/gravis">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/iv_logo"
android:src="@drawable/ust_logo"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="false"
android:layout_alignParentRight="false"
android:baselineAlignBottom="false"
android:adjustViewBounds="true" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_logo"
android:layout_alignLeft="@+id/iv_logo"
android:layout_alignRight="@+id/iv_logo"
android:id="@+id/ly_content"
android:scrollbars="vertical"
android:weightSum="1"
android:paddingTop="20dp"
android:layout_alignEnd="@+id/iv_logo"
android:layout_alignStart="@+id/iv_logo">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:id="@+id/tl_content">
<TableRow
android:id="@+id/tr_1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:measureWithLargestChild="false"
android:gravity="center_horizontal"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ly_ajanda"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginRight="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_ajanda"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/ajanda"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ly_kasa"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginLeft="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_kasa"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/kasa"
android:clickable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tr_2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:measureWithLargestChild="false"
android:gravity="center_horizontal"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_siparis"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginRight="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_siparis"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/siparis"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_puantaj"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginLeft="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_puantaj"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/puantaj"
android:clickable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tr_3"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:measureWithLargestChild="false"
android:gravity="center_horizontal"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_gelirler"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginRight="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_gelirler"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/gelirler"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_giderler"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginLeft="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_giderler"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/giderler"
android:clickable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tr_4"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:measureWithLargestChild="false"
android:gravity="center_horizontal"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_stoklar"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginRight="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_stoklar"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/stoklar"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_kritik"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginLeft="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_kritik"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/kritik"
android:clickable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tr_5"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:measureWithLargestChild="false"
android:gravity="center_horizontal"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_sikayet"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginRight="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_sikayet"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/sikayet"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_tutanak"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginLeft="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_tutanak"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/tutanak"
android:clickable="true" />
</LinearLayout>
</TableRow>
<TableRow
android:id="@+id/tr_6"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:measureWithLargestChild="false"
android:gravity="center_horizontal"
android:paddingBottom="10dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_is_kazasi"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginRight="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_is_kazasi"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/is_kazasi"
android:clickable="true" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ly_kamera"
android:weightSum="1"
android:background="@color/dBlueDark"
android:layout_marginLeft="7dp">
<ImageButton
android:layout_width="146dp"
android:layout_height="65dp"
android:id="@+id/ibt_kamera"
android:soundEffectsEnabled="false"
android:adjustViewBounds="true"
android:keepScreenOn="false"
android:background="@drawable/kamera"
android:clickable="true" />
</LinearLayout>
</TableRow>
</TableLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentEnd="false"
android:id="@+id/fl_bottom">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:id="@+id/tl_bottom">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|bottom"
android:id="@+id/tr_bottom">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="@+id/ll_personel">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="65dp"
android:id="@+id/ibt_personel"
android:background="@color/dOrange"
android:src="@drawable/personel"
android:adjustViewBounds="true"
android:clickable="true"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="@+id/ll_taseron">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="65dp"
android:id="@+id/ibt_taseron"
android:background="@color/dOrange"
android:src="@drawable/taseron"
android:adjustViewBounds="true"
android:clickable="true"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="@+id/ll_musteri">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="65dp"
android:id="@+id/ibt_musteri"
android:background="@color/dOrange"
android:src="@drawable/musteri"
android:adjustViewBounds="true"
android:clickable="true"
android:scaleType="fitXY" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="@+id/ll_threedots">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="65dp"
android:id="@+id/ibt_threedots"
android:background="@color/dOrange"
android:src="@drawable/diger"
android:adjustViewBounds="true"
android:clickable="true"
android:scaleType="fitXY" />
</LinearLayout>
</TableRow>
</TableLayout>
</FrameLayout>
</code></pre>
<p></p>
| 0debug
|
Get union type from indexed object values : <p>Say I have an indexed type:</p>
<pre><code>type X = {
a: 'A',
b: 'B'
}
</code></pre>
<p>is it possible to get (derived) from it:</p>
<pre><code>type V = 'A' | 'B'
</code></pre>
<p>not using explicit method like:</p>
<pre><code>type V = X['a'] | X['b']
</code></pre>
<p>What I want is something like <code>keyof</code> (for getting keys union type), but for values.</p>
| 0debug
|
MySql to MS Access query conversion : <p>I have a mysql query, which I want to use in MS Access. </p>
<pre><code>SELECT company_name, agent_id FROM
( SELECT company_name, agent_id, @rn := IF(@prev = agent_id, @rn + 1, 1)
AS rn, @prev := agent_id FROM users
JOIN (SELECT @prev := NULL, @rn := 0) AS vars
ORDER BY agent_id DESC, company_name)
AS T1
WHERE T1.agent_id is not null and rn <= 3;
</code></pre>
<p>I have been trying to run it in Access but its throwing the error: "Syntax error in from clause". </p>
| 0debug
|
Replace values in json string : I want to replace all string values in below json string to empty string, true to false, and 1 to 0 in square brackets using JavaScipt.
Addition informatio: json string is placed in a string type variable.
NOTE: properties are dynamic. Meaning sometimes I could have MobilePhone and there will be a case that this property will be missing. So referencing the property name is not an option.
My JSON string:
{"MobilePhone":true,"ToDeleteIndex":1,"BusinessPhone":true,"ApplicantType":"HOLDER","Title":"Mr","FirstName":"Andrew","RemoveApplicant":[1,null]}
Expected results:
{"MobilePhone":false,"ToDeleteIndex":1,"BusinessPhone":false,"ApplicantType":"","Title":"","FirstName":"","RemoveApplicant":[0,null]}
| 0debug
|
Bootstrap 4 | Collapse other sections when one is expanded : <p>I am working on bootstrap 4 Collapse. Wanted to collapse other sections when one is expanded</p>
<p>So far i did is : </p>
<p><strong>HTML</strong></p>
<pre><code><p>
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
content 1
</a>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample2" aria-expanded="false" aria-controls="collapseExample2">
Content 2
</button>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body">
Content one here
</div>
</div>
<div class="collapse" id="collapseExample2">
<div class="card card-body">
Content 2 here
</div>
</div>
</code></pre>
<p>Live demo: <a href="https://codepen.io/sifulislam/pen/NYBEMJ" rel="noreferrer">Live Demo</a></p>
| 0debug
|
static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){
int temp[16];
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i;
rv34_row_transform(temp, block);
memset(block, 0, 16*sizeof(DCTELEM));
for(i = 0; i < 4; i++){
const int z0 = 13*(temp[4*0+i] + temp[4*2+i]) + 0x200;
const int z1 = 13*(temp[4*0+i] - temp[4*2+i]) + 0x200;
const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i];
const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i];
dst[0] = cm[ dst[0] + ( (z0 + z3) >> 10 ) ];
dst[1] = cm[ dst[1] + ( (z1 + z2) >> 10 ) ];
dst[2] = cm[ dst[2] + ( (z1 - z2) >> 10 ) ];
dst[3] = cm[ dst[3] + ( (z0 - z3) >> 10 ) ];
dst += stride;
}
}
| 1threat
|
static void test_qemu_strtoul_octal(void)
{
const char *str = "0123";
char f = 'X';
const char *endptr = &f;
unsigned long res = 999;
int err;
err = qemu_strtoul(str, &endptr, 8, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, 0123);
g_assert(endptr == str + strlen(str));
res = 999;
endptr = &f;
err = qemu_strtoul(str, &endptr, 0, &res);
g_assert_cmpint(err, ==, 0);
g_assert_cmpint(res, ==, 0123);
g_assert(endptr == str + strlen(str));
}
| 1threat
|
static void kvm_s390_flic_realize(DeviceState *dev, Error **errp)
{
S390FLICState *fs = S390_FLIC_COMMON(dev);
KVMS390FLICState *flic_state = KVM_S390_FLIC(dev);
struct kvm_create_device cd = {0};
struct kvm_device_attr test_attr = {0};
int ret;
Error *errp_local = NULL;
KVM_S390_FLIC_GET_CLASS(dev)->parent_realize(dev, &errp_local);
if (errp_local) {
goto fail;
}
flic_state->fd = -1;
if (!kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {
error_setg_errno(&errp_local, errno, "KVM is missing capability"
" KVM_CAP_DEVICE_CTRL");
trace_flic_no_device_api(errno);
goto fail;
}
cd.type = KVM_DEV_TYPE_FLIC;
ret = kvm_vm_ioctl(kvm_state, KVM_CREATE_DEVICE, &cd);
if (ret < 0) {
error_setg_errno(&errp_local, errno, "Creating the KVM device failed");
trace_flic_create_device(errno);
goto fail;
}
flic_state->fd = cd.fd;
test_attr.group = KVM_DEV_FLIC_CLEAR_IO_IRQ;
flic_state->clear_io_supported = !ioctl(flic_state->fd,
KVM_HAS_DEVICE_ATTR, test_attr);
fs->ais_supported = false;
return;
fail:
error_propagate(errp, errp_local);
}
| 1threat
|
Testing vi Editor Functionality with Python? : <p>How do I write an automated test that can check the vi editor is properly working programmed using Python?</p>
| 0debug
|
c++ inter thread communication : here is my simple code, i want to get in the console_task, the value of the variable i in the dialer_task... without using global variable
Thanks for help
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <thread>
#include "console.hpp"
using namespace std;
void console_task(){
console();
}
void dialer_task(){
int i=0;
while (1) {
printf("LOOP %d\n",i);
i++;
sleep(5);
}
}
int main()
{
thread t1(console_task);
thread t2(dialer_task);
t1.join();
t2.join();
return 0;
}
| 0debug
|
Config your IIS server to use the "Content-Security-Policy" header : <p>I need to add custom headers in IIS for
"Content-Security-Policy", "X-Content-Type-Options" and "X-XSS-Protection".</p>
<p>I get the procedure to add these headers but i am not sure what should be the value of these keys.
<a href="https://technet.microsoft.com/pl-pl/library/cc753133(v=ws.10).aspx" rel="noreferrer">https://technet.microsoft.com/pl-pl/library/cc753133(v=ws.10).aspx</a></p>
<p><a href="http://content-security-policy.com/" rel="noreferrer">http://content-security-policy.com/</a></p>
<p>Please suggest. Thanks</p>
| 0debug
|
Run Angular and ASP.NET Web API on the same port : <p>I am currently using angular to issue API call to an API server running ASP.NET. However, I have a cross-origin issue as for angular development, I am using localhost. While in the production version they will all run under the same domain using IIS. </p>
<p>Is there a way to run the angular app on the same port with ASP.NET?</p>
<p>P.S.: I am also open for other alternatives on solving this issue. </p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.