problem
stringlengths
26
131k
labels
class label
2 classes
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) { MDECContext * const a = avctx->priv_data; AVFrame *picture = data; AVFrame * const p= (AVFrame*)&a->picture; int i; if (buf_size == 0) { return 0; } if(p->data[0]) avctx->release_buffer(avctx, p); p->reference= 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type= I_TYPE; p->key_frame= 1; a->last_dc[0]= a->last_dc[1]= a->last_dc[2]= 0; a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i=0; i<buf_size; i+=2){ a->bitstream_buffer[i] = buf[i+1]; a->bitstream_buffer[i+1]= buf[i ]; } init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8); skip_bits(&a->gb, 32); a->qscale= get_bits(&a->gb, 16); a->version= get_bits(&a->gb, 16); for(a->mb_x=0; a->mb_x<a->mb_width; a->mb_x++){ for(a->mb_y=0; a->mb_y<a->mb_height; a->mb_y++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, a->mb_x, a->mb_y); } } *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); emms_c(); return (get_bits_count(&a->gb)+31)/32*4; }
1threat
Vuejs Error: The client-side rendered virtual DOM tree is not matching server-rendered : <p>I am using Nuxt.js / Vuejs for mmy app, and I keep facing this error in different places:</p> <pre><code> The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside &lt;p&gt;, or missing &lt;tbody&gt;. Bailing hydration and performing full client-side render. </code></pre> <p>I would like to understand what is the best way to debug this error? Is their a way I can record/get the virtual DOM tree for client and server so I could compare and find where the error lies? </p> <p>Mine is a large application and manually verifying is difficult.</p>
0debug
Hosting Spring-cloud-config server as a micro service in docker : How to host a spring cloud config server registered as Eureka Client in docker containers ? My spring boot micro services architecture includes the below components, 1. eureka-server (Eureka as Service Registry) 2. config-server (registered as Eureka client) 3. Business Logic App (registered as Eureka client) These spring boot applications are working fine in my windows local machine. The same needs to be hosted in docker containers. Config server is not getting registered with Eureka server while running in docker container. I have tried including the below key-value in my config-server properties as suggested in many blogs, trail 1: eureka.client.service-url.defaultZone=http://localhost:8761/eureka/ trail 2: eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka/ Both these suggestions doesn't work. **I would like to get a working example to host the config server registered with Eureka in docker containers.**
0debug
How to align buttons in the MdDialog md-dialog-actions block : <p>In the MdDialog's md-dialog-actions block, is it possible to align a button on the left while there are two buttons aligned to the right?</p> <p>Here's a <a href="http://plnkr.co/edit/zhzxqPANDZagcN1znTzL?p=preview" rel="noreferrer">plnkr</a> of some stuff I'm trying to do. Say, on the first modal, how do I separate the Yes and No buttons? (See the common-model.component.ts file) (This plnkr has some other issues to it that I'm still working on. But it doesn't involve this question.)</p> <pre><code>import { Component } from '@angular/core'; import { MdDialogRef } from "@angular/material"; @Component({ selector: 'common-modal', template: ` &lt;h2 md-dialog-title id="modal-title"&gt;{{ title }}&lt;/h2&gt; &lt;md-dialog-content&gt; &lt;p class="dialog-body" id="modal-message"&gt;{{ message }}&lt;/p&gt; &lt;/md-dialog-content&gt; &lt;md-dialog-actions align="right"&gt; &lt;button md-raised-button md-dialog-close id="modal-close-btn"&gt; {{ buttonOptions.closeText }} &lt;/button&gt; &lt;button md-raised-button *ngIf="buttonOptions.enableNext" id="modal-next-button" (click)="dialogRef.close(true)"&gt; {{ buttonOptions?.nextText }} &lt;/button&gt; &lt;/md-dialog-actions&gt;`, }) export class CommonModalComponent { /** * {string} The text for the header or title of the dialog. */ title: string; /** * {string} The text for the body or content of the dialog. */ message: string; /** * closeText {string} The text of the close button. (No, Done, Cancel, etc) * nextText {string} The text of the confirming button. (Yes, Next, etc) * enableNext {boolean} True to show the next button. False to hide it. */ buttonOptions: { closeText: string, nextText?: string, enableNext: boolean }; constructor(public dialogRef: MdDialogRef&lt;CommonModalComponent&gt;) { } } </code></pre>
0debug
How do make new website using this MEAN stack application in windows 10 home? : Some more days ago!I installed MEAN stack application in my system.but I haven't no idea for MEAN stack application.How do make new website using this MEAN stack application in windows 10? Please help me! Thanking You!
0debug
static void handle_fmov(DisasContext *s, int rd, int rn, int type, bool itof) { if (itof) { TCGv_i64 tcg_rn = cpu_reg(s, rn); switch (type) { case 0: { TCGv_i64 tmp = tcg_temp_new_i64(); tcg_gen_ext32u_i64(tmp, tcg_rn); tcg_gen_st_i64(tmp, cpu_env, fp_reg_offset(rd, MO_64)); tcg_gen_movi_i64(tmp, 0); tcg_gen_st_i64(tmp, cpu_env, fp_reg_hi_offset(rd)); tcg_temp_free_i64(tmp); break; } case 1: { TCGv_i64 tmp = tcg_const_i64(0); tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_offset(rd, MO_64)); tcg_gen_st_i64(tmp, cpu_env, fp_reg_hi_offset(rd)); tcg_temp_free_i64(tmp); break; } case 2: tcg_gen_st_i64(tcg_rn, cpu_env, fp_reg_hi_offset(rd)); break; } } else { TCGv_i64 tcg_rd = cpu_reg(s, rd); switch (type) { case 0: tcg_gen_ld32u_i64(tcg_rd, cpu_env, fp_reg_offset(rn, MO_32)); break; case 1: tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_offset(rn, MO_64)); break; case 2: tcg_gen_ld_i64(tcg_rd, cpu_env, fp_reg_hi_offset(rn)); break; } } }
1threat
How to set android notifications : Please help me. I have created an android applications for my website.. Now I want to notify the users when I update/upload new contents to my website... I mean to say when I update something to my webpage... The users who are using my application Must be get the notification that ".......is added to..... " check out now.... Thanks... I hope u understand what I am trying to say... Sorrry my bad english Eg: just like a newspaper application on adding new news to webpage... Users get notification that.... "Something happen"
0debug
Angular2 Displaying PDF : <p>I have an angular2 project with an ASP.Net Web API. I have code to retrieve a file path from my database which goes to a document on my server. I then want to display this document in the browser in a new tab. Does anybody have any suggestions how to do this?</p> <p>I am happy to retrieve the file in either Angular2 (Typescript) or in my API and stream it down.</p> <p>This is my attempt of retrieving it in my API but i cannot work out how to receive it in Angular2 and display it properly:</p> <pre><code>public HttpResponseMessage GetSOP(string partnum, string description) { var sopPath = _uow.EpicorService.GetSOP(partnum, description).Path; HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); var stream = new FileStream(sopPath, FileMode.Open); result.Content = new StreamContent(stream); result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); return result; } </code></pre> <p>Any help would be greatly appreciated.</p> <p>Many Thanks!!!</p>
0debug
Reloading a Python module per process in the multiprocessing module : <p>Is there a way to load per-process copies of modules in processes created using Python's multiprocessing module? I tried this:</p> <pre><code>def my_fn(process_args): import my_module my_func() </code></pre> <p>...but the sub-imports in my_module get loaded and cached once and for all. In particular, one of the sub-imports reads a config file whose values get set based on the environment of the first process. If I try this:</p> <pre><code>def my_fn(process_args): try: my_module = reload(my_module) except NameError: import my_module </code></pre> <p>...the sub-imports of my_module do not get reloaded.</p>
0debug
Why its necessary to use any string with dot point with self in class python(self.x=x)? : <p>I am learning oop in python so i am having some problem to understand <code>sefl</code> keyword properly. </p> <p>Suppose a program :</p> <pre><code>class ge: def __init__(self,a,b): self.p=a self.l=b def ff(self): aaa=self.p+self.l print(aaa) hh=ge(1,2) hh.ff() </code></pre> <p>I am confuse why its necessary to use any string with self with dot ? what it means ? Like:</p> <p>self.a=a and we can change self.a to ay string like self.b , self.c what it means ?? why its necessary ?</p> <p>My second question is :</p> <p>what is difference between defining class with parameter and without parameter ?</p> <pre><code>class hello(object): def __init__(self,a,v): self.a=a self.v=v def p(self): f=self.a+self.v print(f) he=hello(1,2) he.p() </code></pre> <p>if i defined <code>class hello(object)</code> its working but if i defined class like: <code>class hello():</code> its also working but if i defined like: <code>class hello:</code> its also working </p> <p>what is the difference class <code>hello(object):</code> , <code>class hello()</code>, <code>class hello:</code></p>
0debug
def find_ind(key, i, n, k, arr): ind = -1 start = i + 1 end = n - 1; while (start < end): mid = int(start + (end - start) / 2) if (arr[mid] - key <= k): ind = mid start = mid + 1 else: end = mid return ind def removals(arr, n, k): ans = n - 1 arr.sort() for i in range(0, n): j = find_ind(arr[i], i, n, k, arr) if (j != -1): ans = min(ans, n - (j - i + 1)) return ans
0debug
I am getting error KeyError: 'duration' when it exists : <p>The following code returns error </p> <pre><code>KeyError: 'duration' for i in range(0, 3): exam_df['duration'] = pd.to_datetime(i,(exam_df['Duration '])[i]) exam_df['grade'] = exam_df['Grade'].astype(np.int64) exam_df.plot.scatter(x='duration', y='grade') </code></pre>
0debug
Regex that matches sets of numbers at the start of filename : we have filenames that contain product numbers at the start and based on this we apply processing when adding them to the system i need a regex that should match the following 70707_70708_70709_display1.jpg 70707_Front010.jpg and NOT these 626-this files is tagged.jpg 1000x1000_webbanner2.jpg 2000 years ago_files.jpg 626gamingassets_styleguide.jpg i have a regex that almost does what i want except for one case highlighted below \d{3,}(?=_) 70707_70708_70709_display1.jpg - success 3 matches {70707,70708,70709} 70707_Front010.jpg - success 1 match {70707 } 626-this files is tagged.jpg - success 0 matches 1000x1000_webbanner2.jpg - fail 1 match {1000} 2000 years ago_files.jpg - success 0 matches 626gamingassets_styleguide.jpg - success 0 matches i have a regex test to illustrate this here https://regex101.com/r/qKkC4m/1 The regex should only look for sets of numbers at the beginning.
0debug
how to split length list in python : <p>question</p> <pre><code>my_list = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,...,50] </code></pre> <p>answer</p> <pre><code>listOne = [0,1,2,....,9 listTwo = [10,11,12,...,19] listThree = [20,21,22,...,29] listFour = [30,31,32,...,39] listFive = [40,41,42,...,49] listSix = [50,51,52,...,59] </code></pre> <p>answer</p> <p>If we do not know the number to show in my list how to split list</p>
0debug
I'm trying to get SSH key on my mac, but after trying couple of time I'm stuck when it comes to type passphrase,i cannot type anything : [I'm stuck at the key symbol shown in the picture][1] ![1]: https://i.stack.imgur.com/SQLKG.png
0debug
I'm a beginner here in java oop. my code is showing this error. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 : <p><strong>THIS IS THE CODE</strong> here I want to take value from cmd and use that to get the output. Please let me know if there is any other problem. Thanks</p> <pre><code>class Basic { int b; public void gd(int c){ b=c; } } class HRA extends Basic { double hra=(0.25*b); } class DA extends HRA { double da=(0.75*b); } class PF extends DA { double pf=(0.12*b); } class Netsalary extends PF { double ns=b+hra+da+pf; void display() { System.out.println("The net salary = "+ns); } } class Netsalmain { public static void main(String arb[]) { int a= Integer.parseInt(arb[0]); Netsalary ob=new Netsalary(); ob.gd(a); ob.display(); } } </code></pre> <p><strong>error is showing like this</strong></p> <blockquote> <p>E:>java Netsalmain Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Netsalmain.main(iop.java:54)</p> </blockquote>
0debug
Is it possible to improve quality of image using CSS? : <p>Is it possible to improve quality of image using CSS when I use <code>background: url('image.png')</code>?</p> <p>May be accept filter CSS?</p>
0debug
static void xtensa_lx200_init(MachineState *machine) { static const LxBoardDesc lx200_board = { .flash_base = 0xf8000000, .flash_size = 0x01000000, .flash_sector_size = 0x20000, .sram_size = 0x2000000, }; lx_init(&lx200_board, machine); }
1threat
crashed when call removeItemAtPath:error: in com.apple.main-thread : Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_PROTECTION_FAILURE 0x0000000170043780 -[XYPHPostModel(Manager) removeDraft:] <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> Crashed: com.apple.main-thread 0 (Missing) 0x170043780 (Missing) 1 (Missing) 0x170043780 (Missing) 2 Foundation 0x18545555c -[NSFileManager removeItemAtPath:error:] + 84 3 discover 0x10023fe2c -[XYPHPostModel(Manager) removeDraft:] (XYPHPostModel+Manager.m:130) 4 discover 0x10023f4fc -[XYPHPostModel(Manager) finishPost] (XYPHPostModel+Manager.m:40) 5 discover 0x100252024 -[XYPHPostNoteModel(Manager) setPostStatusToSuccess:] (XYPHPostNoteModel+Manager.m:600) 6 discover 0x10025275c __43-[XYPHPostNoteModel(Manager) postToServer:]_block_invoke_2 (XYPHPostNoteModel+Manager.m:639) 7 discover 0x10082ec3c __89-[XYAPIClient xy_requestPutWithRoute:withParams:withKeyPath:withPattern:success:failure:]_block_invoke (XYAPIClient.m:767) 8 discover 0x100ef2428 -[XYRKHTTPSessionManager handleResponse:success:failure:] (XYRKHTTPSessionManager.m:454) 9 discover 0x100ef0774 __78-[XYRKHTTPSessionManager putForRouteNamed:pattern:parameters:success:failure:]_block_invoke (XYRKHTTPSessionManager.m:254) 10 discover 0x1007a5c2c __116-[AFHTTPSessionManager dataTaskWithHTTPMethod:URLString:parameters:uploadProgress:downloadProgress:success:failure:]_block_invoke.80 (AFHTTPSessionManager.m:290) 11 discover 0x1007b8ba0 __72-[AFURLSessionManagerTaskDelegate URLSession:task:didCompleteWithError:]_block_invoke_2.150 (AFURLSessionManager.m:308) 12 libdispatch.dylib 0x18388a1fc _dispatch_call_block_and_release + 24 13 libdispatch.dylib 0x18388a1bc _dispatch_client_callout + 16 14 libdispatch.dylib 0x18388eb2c _dispatch_main_queue_callback_4CF + 428 15 CoreFoundation 0x1849ae810 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 16 CoreFoundation 0x1849ac3fc __CFRunLoopRun + 1660 17 CoreFoundation 0x1848da2b8 CFRunLoopRunSpecific + 444 18 GraphicsServices 0x18638e198 GSEventRunModal + 180 19 UIKit 0x18a9217fc -[UIApplication _run] + 684 20 UIKit 0x18a91c534 UIApplicationMain + 208 21 discover 0x1006bf610 main (main.m:31) 22 (Missing) 0x1838bd5b8 (Missing) <!-- end snippet -->
0debug
int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, const char *tag) { while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) { bs = bs->file; } if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) { return bs->drv->bdrv_debug_breakpoint(bs, event, tag); } return -ENOTSUP; }
1threat
static int qemu_chr_open_file_out(QemuOpts *opts, CharDriverState **_chr) { int fd_out; TFR(fd_out = qemu_open(qemu_opt_get(opts, "path"), O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666)); if (fd_out < 0) { return -errno; } *_chr = qemu_chr_open_fd(-1, fd_out); return 0; }
1threat
static int xvid_strip_vol_header(AVCodecContext *avctx, AVPacket *pkt, unsigned int header_len, unsigned int frame_len) { int vo_len = 0, i; for( i = 0; i < header_len - 3; i++ ) { if( pkt->data[i] == 0x00 && pkt->data[i+1] == 0x00 && pkt->data[i+2] == 0x01 && pkt->data[i+3] == 0xB6 ) { vo_len = i; break; } } if( vo_len > 0 ) { if( avctx->extradata == NULL ) { avctx->extradata = av_malloc(vo_len); memcpy(avctx->extradata, pkt->data, vo_len); avctx->extradata_size = vo_len; } memmove(pkt->data, &pkt->data[vo_len], frame_len - vo_len); pkt->size = frame_len - vo_len; } return 0; }
1threat
adding two charss intoa short wrong answer c : Hi I have a function that is aimed at getting the value of two chars added together into a short. it seams that the value is getting cut off or mangled. here is my code: void add(char a, char b){ unsigned short x = a + b; printf("init:%hu %hu = %hu\n", (unsigned char)a, (unsigned char)b, (unsigned short)x); ... unsigned char x = add((unsigned char)230, (unsigned char)100); unsigned char y = add((unsigned char )200, (unsigned char)200); unsigned char z = add((unsigned char) 230, (unsigned char)120); and the results are init:230 100 = 74 init:200 200 = 65424 init:230 120 = 94
0debug
Merge JSON objects inside a array : <p>I have a JSON Array as below</p> <pre><code>[ {"Name" : "Arrow", "Year" : "2001" }, {"Name" : "Arrow", "Type" : "Action-Drama" }, { "Name" : "GOT", "Type" : "Action-Drama" } ] </code></pre> <p>and I am trying to convert this into </p> <pre><code>[ { "Name" : "Arrow", "Year" : "2001", "Type" : "Action-Drama", }, { "Name" : "GOT", "Type" : "Action-Drama" } ] </code></pre> <p>Any help greatly appreciated. </p> <p>Thank you. </p>
0debug
How to use computed property in a codable struct (swift) : <p>I've created a "codable" struct to serialize a data set and encode it to Json. Everything is working great except the computed properties don't show in the json string. How can I include computed properties during the encode phase.</p> <p>Ex:</p> <pre><code>struct SolidObject:Codable{ var height:Double = 0 var width:Double = 0 var length:Double = 0 var volume:Double { get{ return height * width * length } } } var solidObject = SolidObject() solidObject.height = 10.2 solidObject.width = 7.3 solidObject.length = 5.0 let jsonEncoder = JSONEncoder() do { let jsonData = try jsonEncoder.encode(solidObject) let jsonString = String(data: jsonData, encoding: .utf8)! print(jsonString) } catch { print(error) } </code></pre> <p>prints out "{"width":7.2999999999999998,"length":5,"height":10.199999999999999}"</p> <p>I am also curious about having 7.29999.. instead of 7.3 but my main question is "how can I include "volume" to this json string too"?</p>
0debug
void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx) { int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { #if HAVE_YASM c->float_interleave = float_interleave_mmx; if(mm_flags & AV_CPU_FLAG_3DNOW){ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->float_to_int16 = ff_float_to_int16_3dnow; c->float_to_int16_interleave = float_to_int16_interleave_3dnow; } } if(mm_flags & AV_CPU_FLAG_3DNOWEXT){ if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->float_to_int16_interleave = float_to_int16_interleave_3dn2; } } #endif if(mm_flags & AV_CPU_FLAG_SSE){ c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; #if HAVE_YASM c->float_to_int16 = ff_float_to_int16_sse; c->float_to_int16_interleave = float_to_int16_interleave_sse; c->float_interleave = float_interleave_sse; #endif } if(mm_flags & AV_CPU_FLAG_SSE2){ c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2; #if HAVE_YASM c->float_to_int16 = ff_float_to_int16_sse2; c->float_to_int16_interleave = float_to_int16_interleave_sse2; #endif } } }
1threat
Generate sequence number in android : <p>I want to generate sequence number that starts from 001,002 and continue like that.I want it to get incremented on each visit of that screen..Any help appreciated.Thank you.</p>
0debug
static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts) { ASFContext *asf = s->priv_data; AVStream *st; AVPacket pkt1, *pkt; int block_align; int64_t pos; int64_t pos_min, pos_max, pts_min, pts_max, cur_pts; pkt = &pkt1; if (pts < 0) pts = 0; if (stream_index == -1) stream_index= av_find_default_stream_index(s); st = s->streams[stream_index]; block_align = asf->packet_size; if (block_align <= 0) return -1; pos_min = 0; pts_min = asf_read_pts(s, &pos_min, stream_index); if (pts_min == AV_NOPTS_VALUE) return -1; pos_max = asf_align(s, url_filesize(url_fileno(&s->pb)) - 1 - s->data_offset); pts_max = pts_min + s->duration; while (pos_min <= pos_max) { if (pts <= pts_min) { pos = pos_min; goto found; } else if (pts >= pts_max) { pos = pos_max; goto found; } else { pos = (int64_t)((double)(pos_max - pos_min) * (double)(pts - pts_min) / (double)(pts_max - pts_min)) + pos_min; pos= asf_align(s, pos); } cur_pts = asf_read_pts(s, &pos, stream_index); if (pts == cur_pts) { goto found; } else if (cur_pts == AV_NOPTS_VALUE) { return -1; } else if (pts < cur_pts) { pos_max = pos; pts_max = asf_read_pts(s, &pos_max, stream_index); , must do backward search, or change this somehow if (pts >= pts_max) { pos = pos_max; goto found; } } else { pos_min = pos + asf->packet_size; pts_min = asf_read_pts(s, &pos_min, stream_index); if (pts <= pts_min) { goto found; } } } pos = pos_min; found: url_fseek(&s->pb, pos + s->data_offset, SEEK_SET); asf_reset_header(s); return 0; }
1threat
int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba, uint8_t ar) { CPUS390XState *env = &cpu->env; uint32_t fh; ZpciFib fib; S390PCIBusDevice *pbdev; uint32_t data; uint64_t cc = ZPCI_PCI_LS_OK; if (env->psw.mask & PSW_MASK_PSTATE) { program_interrupt(env, PGM_PRIVILEGED, 6); return 0; } fh = env->regs[r1] >> 32; if (fiba & 0x7) { program_interrupt(env, PGM_SPECIFICATION, 6); return 0; } pbdev = s390_pci_find_dev_by_fh(fh); if (!pbdev) { setcc(cpu, ZPCI_PCI_LS_INVAL_HANDLE); return 0; } memset(&fib, 0, sizeof(fib)); stq_p(&fib.pba, pbdev->pba); stq_p(&fib.pal, pbdev->pal); stq_p(&fib.iota, pbdev->g_iota); stq_p(&fib.aibv, pbdev->routes.adapter.ind_addr); stq_p(&fib.aisb, pbdev->routes.adapter.summary_addr); stq_p(&fib.fmb_addr, pbdev->fmb_addr); data = ((uint32_t)pbdev->isc << 28) | ((uint32_t)pbdev->noi << 16) | ((uint32_t)pbdev->routes.adapter.ind_offset << 8) | ((uint32_t)pbdev->sum << 7) | pbdev->routes.adapter.summary_offset; stl_p(&fib.data, data); if (pbdev->fh & FH_MASK_ENABLE) { fib.fc |= 0x80; } if (pbdev->error_state) { fib.fc |= 0x40; } if (pbdev->lgstg_blocked) { fib.fc |= 0x20; } if (pbdev->g_iota) { fib.fc |= 0x10; } if (s390_cpu_virt_mem_write(cpu, fiba, ar, (uint8_t *)&fib, sizeof(fib))) { return 0; } setcc(cpu, cc); return 0; }
1threat
a = open("file", "r"); a.readline() output without \n : <p>I am about to write a python script, that is able to read a txt file, but with readline() there is always the \n output. How can i remove this from the variable ? </p> <pre><code>a = open("file", "r") b = a.readline() a.close() </code></pre>
0debug
How can i get mobile number automatically to android app? : I am building an android app in which I consider mobile number as his unique id just like whatsapp. So can anyone please tell me how to get users number directly into my database when he install this android app.
0debug
How to Upload Image with Button : <p>I want to build a Website, where I can upload an image. This image is than shown on this website and under it is an upload button. When I click the upload button the image will be uploaded and the imageview disappears. Can you help me with that? :)</p> <p>HTML</p> <pre><code> &lt;div class="intro-container"&gt; &lt;section class="intro"&gt; &lt;a class="button" href="input" &gt;Go! &lt;label&gt; &lt;input name="datei" type="file" size="50" accept="png/jpg"&gt; &lt;/label&gt;&lt;/a&gt; &lt;/section&gt; &lt;div class="Upload" &gt; &lt;main&gt; &lt;button&gt;Upload&lt;/button&gt; &lt;/main&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>.button { display: inline-block; padding: 30px 60px; text-transform: upppercase; border: 1px solid #b65432; font-size: 40px; input[type="file"] { border: 1px dotted; color: transparent; align-self: center; } } .button:hover { background: #b65432; color: #222; } main { min-height: 30em; padding: 3em; } </code></pre> <p>Thanks for your help.</p>
0debug
The process can not access the file because this file is used by another : <p>i have a file.log continually writing , i copy this file into my desktop with some script and i test if the a keyword is on the last lane on the log , if yes i show a green picture if not i show a red picture the probleme that when i start my program i get this error her is the code </p> <pre><code> { // File.ReadAllLines(@"C:\\Users\\Reta\\Desktop\\TEST\\TEST\\fichiers\\k20\\winvsrTEST.log").Last(); // System.IO.StreamReader file = new System.IO.StreamReader(@"C:\\Users\\Reta\\Desktop\\TEST\\TEST\\fichiers\\k20\\winvsrTEST.log"); string motcle1 = "oee code"; //string line = File.ReadLine().Last().ToString(); var lines = File.ReadAllLines(@"C:\Users\Reta\Desktop\TEST\TEST\fichiers\k20\winvsrTEST.log"); string line = lines.Last(); //line = File.ReadAllLine(); //do { if (line.Contains(motcle1)) { pictureBox2.Show(); pictureBox1.Hide(); } else { pictureBox2.Hide(); pictureBox1.Show(); } } //while ((line = File.ReadLine()) != null); label1.Text = "Hi"; } } </code></pre> <p>}`</p>
0debug
void block_job_completed(BlockJob *job, int ret) { BlockDriverState *bs = job->bs; assert(bs->job == job); job->cb(job->opaque, ret); bs->job = NULL; bdrv_op_unblock_all(bs, job->blocker); error_free(job->blocker); g_free(job); }
1threat
void av_vlog(void* avcl, int level, const char *fmt, va_list vl) { if(av_log_callback) av_log_callback(avcl, level, fmt, vl); }
1threat
struct icp_state *xics_system_init(int nr_irqs) { CPUPPCState *env; CPUState *cpu; int max_server_num; struct icp_state *icp; struct ics_state *ics; max_server_num = -1; for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); if (cpu->cpu_index > max_server_num) { max_server_num = cpu->cpu_index; } } icp = g_malloc0(sizeof(*icp)); icp->nr_servers = max_server_num + 1; icp->ss = g_malloc0(icp->nr_servers*sizeof(struct icp_server_state)); for (env = first_cpu; env != NULL; env = env->next_cpu) { cpu = CPU(ppc_env_get_cpu(env)); struct icp_server_state *ss = &icp->ss[cpu->cpu_index]; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: ss->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: ss->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: hw_error("XICS interrupt model does not support this CPU bus " "model\n"); exit(1); } } ics = g_malloc0(sizeof(*ics)); ics->nr_irqs = nr_irqs; ics->offset = XICS_IRQ_BASE; ics->irqs = g_malloc0(nr_irqs * sizeof(struct ics_irq_state)); ics->islsi = g_malloc0(nr_irqs * sizeof(bool)); icp->ics = ics; ics->icp = icp; ics->qirqs = qemu_allocate_irqs(ics_set_irq, ics, nr_irqs); spapr_register_hypercall(H_CPPR, h_cppr); spapr_register_hypercall(H_IPI, h_ipi); spapr_register_hypercall(H_XIRR, h_xirr); spapr_register_hypercall(H_EOI, h_eoi); spapr_rtas_register("ibm,set-xive", rtas_set_xive); spapr_rtas_register("ibm,get-xive", rtas_get_xive); spapr_rtas_register("ibm,int-off", rtas_int_off); spapr_rtas_register("ibm,int-on", rtas_int_on); qemu_register_reset(xics_reset, icp); return icp; }
1threat
Django - get to home page only through login/signup : Guys help please, I am completely confused. My task is to get home page view only after login/signup action. For exapmple, if we go to example.com we should get login page. And if we are not registrated before then pushing Login button (after entering any username and password because at the moment I have not done yet Signup button) have to move us at signup page. Here the code is - http://pastebin.com/e5LCJmgH And this is my login.html: {% load staticfiles %} {% if form.errors %} <p>Your username and password didn't match. Please try again.</p> {% endif %} {% if next %} {% if user.is_authenticated %} <p>Your account doesn't have access to this page. To proceed, please login with an account that has access.</p> {% else %} <p>Please login to see this page.</p> {% endif %} {% endif %} <form method="post" action="{% url 'my_login' %}"> {% csrf_token %} <table> <tr> <td>{{ form.username.label_tag }}</td> <td>{{ form.username }}</td> </tr> <tr> <td>{{ form.password.label_tag }}</td> <td>{{ form.password }}</td> </tr> </table> <input type="submit" value="Login" /> <input type="hidden" name="next" value="{{ next }}" /> </form> Currently the error is shown (after hiting Login button) - ValueError at /login/ The view evr.views.my_login didn't return an HttpResponse object. It returned None instead. But the point is not only about this error. I am just do not uderstand in general if my direction is right or not? Thanks!
0debug
Sql server Query based on different date and product ids : I want to build the query based on the attached image. [Table Data][1] I want to get the sum of quantity (product Id wise) from "transaction" table where date is greater than the date of first table. for example ProductID 1254 should return 7. [1]: http://i.stack.imgur.com/O753w.jpg Thanks to all
0debug
static inline void gen_efdabs(DisasContext *ctx) { if (unlikely(!ctx->spe_enabled)) { gen_exception(ctx, POWERPC_EXCP_APU); return; } #if defined(TARGET_PPC64) tcg_gen_andi_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], ~0x8000000000000000LL); #else tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]); tcg_gen_andi_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)], ~0x80000000); #endif }
1threat
How to make a username password request with auth0 custom api, getting error "unsupported grant type: password" error : <p>I tried using the auth0 postman template to make an authentication request using username and password and I'm getting an <code>unsupported grant type: password error</code>. What am I doing wrong?</p> <pre><code>var client = new RestClient("https://test.auth0.com/oauth/token"); var request = new RestRequest(Method.POST); request.AddHeader("postman-token", "abc"); request.AddHeader("cache-control", "no-cache"); request.AddHeader("content-type", "application/x-www-form-urlencoded"); request.AddParameter("application/x-www-form-urlencoded", "grant_type=password&amp;client_id=foo&amp;audience=&amp;username=test&amp;password=test&amp;scope=openid%20email%20picture%20nickname", ParameterType.RequestBody); </code></pre>
0debug
Check null in ternary operation : <p>I wanna put a default value on a textfield if _contact is not null. To do this </p> <pre><code>new TextField( decoration: new InputDecoration(labelText: "Email"), maxLines: 1, controller: new TextEditingController(text: (_contact != null) ? _contact.email: "")) </code></pre> <p>Is there a better way to do that? E.g: Javascript would be something like: <code>text: _contact ? _contact.email : ""</code></p>
0debug
After I create my code, how do I give it a database? : <p>I'd say I know how to code fairly well. I've made 2 recent successful programs for work from using just javascript and html. But I only know how to create them to where every program I make and share have individual copies. There's no single database that I can edit the code and in result, subsequently all of my coworkers copies update as well. Instead, any time I make changes to a program, I have to email them all the updated versions and have them update the programs on their computers. What's my next steps to making all copies of my programs be manipulated by one database?</p>
0debug
InnoSetup Uninstall Caption : How to change the title of the window at the uninstall ? http://www.fotolink.su/v.php?id=174c19d3d19cd7985b40553d524f9e56
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
How to show dynamically screenshot of lat long in list Android ?? : [I am stuck to show list of lat, long as a realtime location like screenshot, please help me , give me solution?][1] [1]: https://i.stack.imgur.com/Tfp76.png
0debug
How can I use php to query mysql and convert "5/9/2018 10:15:19" to "2018-05-09 10:15:19" : <p>Could anyone help convert "5/9/2018 10:15:19" to "2018-05-09 10:15:19" using php "explode"method?</p> <p>First question ever here ... be gentle on me!</p>
0debug
Calculate sum of two different HTML elements and show in third div : I have two different HTML elements and i want to calculate the sum and display the value in third div. I have a select box with 3 option values and a div with fixed value. I want the sum to be calculated based on the option selected in dropdown. Here is the code below: <select> <option value ="1100"> $1100 </option> <option value ="1200"> $1200 </option> <option value ="1300"> $1300 </option> </select> <div id="shipping">$4.99</div> <div id ="total"></div> I need to show the total amount in `"total"` div and change as the option change in dropdown. First the default sum will be with the first value + $4.99.
0debug
static int process_work_frame(AVFilterContext *ctx) { FrameRateContext *s = ctx->priv; int64_t work_pts; int interpolate; int ret; if (!s->f1) return 0; if (!s->f0 && !s->flush) return 0; work_pts = s->start_pts + av_rescale_q(s->n, av_inv_q(s->dest_frame_rate), s->dest_time_base); if (work_pts >= s->pts1 && !s->flush) return 0; if (!s->f0) { s->work = av_frame_clone(s->f1); } else { if (work_pts >= s->pts1 + s->delta && s->flush) return 0; interpolate = av_rescale(work_pts - s->pts0, s->max, s->delta); ff_dlog(ctx, "process_work_frame() interpolate:%d/%d\n", interpolate, s->max); if (interpolate > s->interp_end) { s->work = av_frame_clone(s->f1); } else if (interpolate < s->interp_start) { s->work = av_frame_clone(s->f0); } else { ret = blend_frames(ctx, interpolate); if (ret < 0) return ret; if (ret == 0) s->work = av_frame_clone(interpolate > (s->max >> 1) ? s->f1 : s->f0); } } if (!s->work) return AVERROR(ENOMEM); s->work->pts = work_pts; s->n++; return 1; }
1threat
Newbie (C program for loop not printing "@" char) : Hello I need some help Im tyring to print out a random number of "@" charactors but my code is printing out random "\\\" instead. Dont know whats going on here just need a little help. Thanks... int ran,i; ran = 1 + (rand() % 25 + 1 ); for (i = 0; i < ran; i++) { printf("%c", "@"); } printf("\n");
0debug
PHP - Get MP4 location from video URL : <p>I am trying to fetch FREE video courses from Udemy.</p> <p>I have this link for example: <a href="https://www.udemy.com/new-lecture/view/?data=SlFCJUxYR34JQx55Xk5XPFAUTh4NDRsqWBQJe0wBAW5M" rel="nofollow">https://www.udemy.com/new-lecture/view/?data=SlFCJUxYR34JQx55Xk5XPFAUTh4NDRsqWBQJe0wBAW5M</a></p> <p>What I want to do is to fetch where the mp4 is located and embed it in one of my website pages.</p> <p>I have a Chrome plugin that is able to download MP4 videos just by looking at the source page.</p> <p>Is there a way to achieve the same with PHP or Python? Remember I only need the video location not to download it.</p> <p>Thanks</p>
0debug
Chaining Singles together in RxJava : <p>I am using RxJava in my android app along with Retrofit to make network requests to a server. I am using RxJavaCallAdapterFactory so I can have my retrofit requests return singles. In my code, the retrofit object is named 'api'.</p> <p>The code here works fine, but in this example, I need to retrieve the userId before I can make a playlist. I flat map the userId request to the API request, and after making the playlist, I need to use flat map again to convert the JSON response to a usable object. </p> <pre><code>public JSONUser me; public Single&lt;String&gt; getUserId(){ if(me != null){ return Single.just(me.getUserId()); } return api.getMe().flatMap(new Func1&lt;JSONUser, Single&lt;String&gt;&gt;() { @Override public Single&lt;String&gt; call(JSONUser meResult) { me = meResult; return Single.just(me.getUserId()); } }); } public Single&lt;Playlist&gt; createPlaylist(String name) { final NewPlaylistConfig config = new NewPlaylistConfig(name); return getUserId().flatMap(new Func1&lt;String, Single&lt;Playlist&gt;&gt;() { @Override public Single&lt;Playlist&gt; call(String userId) { return api.createPlaylist(userId, config).flatMap( new Func1&lt;JSONPlaylist, Single&lt;? extends SpotifyPlaylist&gt;&gt;() { @Override public Single&lt;? extends Playlist&gt; call(JSONPlaylist data) { return Single.just(new Playlist(data)); } }); } }); } </code></pre> <p>The entry point here would be createPlaylist(). NewPlaylistConfig will be converted to JSON and is simply the body parameter for the POST request. UserId is needed as a path parameter. </p> <p>My main question here, is if there is a way to chain these operations without the "callback-hell" you see here. Like I said, this code works but it is really ugly. I would appreciate if somebody could point me in the right direction regarding this. Is there a way to make this work like promises where you can just chain .thens?</p> <p>Thank you.</p>
0debug
How to add ViewPager with fragment on fragment? : <p>I am building an android application where in a fragment I need to add viewPager. The ViewPager will be holding fragment and will be swipe left and right.</p> <p>Can some one help me to complete above task I am not able to find a tutorial for it. I am facing a lot issue adding viewPager fragment in fragment rather activity</p>
0debug
Web Scrapping with beautifulSoup and unchanging URL : I am trying to Web Scrap ''' url='https://classicalnumismaticgallery.com/advancesearch.aspx?auctioncode=0&pricerange=0&keyword=Indore&category=&material=0&lotno=&endlotno' r = requests.get(url) soup = BeautifulSoup(r.text , 'lxml') details = soup.find_all('span', {'class' : 'src'}) i=0 for d in details: det = d.text det = det + d.string print(det) ''' but it scraps only one webpage. I inspected the `XHR` but nothing gets triggered when we change the page. I also inspected the `FORM DATA` in advancesearch.aspx but it also doesn't have page Index related information. On page click event I found `ctl00$ContentPlaceHolder1$gvItem$ctl01$ctl03` but not sure how to use this in 'URL'. What URL should I use to access the other pages?
0debug
How do I convert a String that looks like an int to the correct format? : <p>Let's say I have a String variable that looks like this. <code>String milli = "2728462"</code> is there a way to convert it to look something like this <code>2,252,251</code> which I guess I want as a long.</p> <p>The thing is it will be passing strings in this format <code>1512</code> <code>52</code> <code>15010</code> <code>1622274628</code></p> <p>and I want it to place the <code>,</code> character where it needs, so if the number is <code>1000</code> then place it like so <code>1,000</code> and <code>100000</code> then <code>100,000</code> etc.</p> <p>How do I properly convert a String variable like that?</p> <p>Because this</p> <pre><code>String s="9990449935"; long l=Long.parseLong(s); System.out.println(l); </code></pre> <p>Will output <code>9990449935</code> and not <code>9,990,449,935</code></p>
0debug
Vectorize a function in clang : <p>I am trying to vectorize the following function with clang according to this <a href="http://llvm.org/docs/Vectorizers.html">clang reference</a>. It takes a vector of byte array and applies a mask according to <a href="https://tools.ietf.org/html/rfc6455#section-5.3">this RFC</a>.</p> <pre><code>static void apply_mask(vector&lt;uint8_t&gt; &amp;payload, uint8_t (&amp;masking_key)[4]) { #pragma clang loop vectorize(enable) interleave(enable) for (size_t i = 0; i &lt; payload.size(); i++) { payload[i] = payload[i] ^ masking_key[i % 4]; } } </code></pre> <p>The following flags are passed to clang:</p> <pre><code>-O3 -Rpass=loop-vectorize -Rpass-analysis=loop-vectorize </code></pre> <p>However, the vectorization fails with the following error:</p> <pre><code>WebSocket.cpp:5: WebSocket.h:14: In file included from boost/asio/io_service.hpp:767: In file included from boost/asio/impl/io_service.hpp:19: In file included from boost/asio/detail/service_registry.hpp:143: In file included from boost/asio/detail/impl/service_registry.ipp:19: c++/v1/vector:1498:18: remark: loop not vectorized: could not determine number of loop iterations [-Rpass-analysis] return this-&gt;__begin_[__n]; ^ c++/v1/vector:1498:18: error: loop not vectorized: failed explicitly specified loop vectorization [-Werror,-Wpass-failed] </code></pre> <p><strong>How do I vectorize this for loop?</strong></p>
0debug
how to implement Stored procedure in Asp.net core : Write Stored procedure to a. Insert Product b. Update Product c. Select Product d. Insert Customer e. Update Customer f. Select Customer g. Insert SalesTransaction h. Update SalesTransaction i. Select SalesTransaction How to implement these in Asp.net core using mssql2008
0debug
static inline void function has warning "control reaches end of non-void function" : <p>I currently have the following function in C:</p> <pre><code>static inline void *cmyk_to_rgb(int *dest, int *cmyk) { double c = cmyk[0] / 100.0; double m = cmyk[1] / 100.0; double y = cmyk[2] / 100.0; double k = cmyk[3] / 100.0; c = c * (1 - k) + k; m = m * (1 - k) + k; y = y * (1 - k) + k; dest[0] = ROUND((1 - c) * 255); dest[1] = ROUND((1 - m) * 255); dest[2] = ROUND((1 - y) * 255); } </code></pre> <p>When compiling, I am warned that</p> <pre><code>warning: control reaches end of non-void function [-Wreturn-type] </code></pre> <p>I've tried adding an explicit <code>return</code> at the end of the function body and that results in an outright error. What is the proper way to resolve this warning? Any solutions I've found online involve adding a return statement where the function is supposed to return some value (<code>int</code> etc.), but that is not the case here.</p>
0debug
i want to display Bangla language from my database . : **i want to display Bangla language from my database . but it shows error massage > i want to display Bangla language from my database . Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\xampp\htdocs\dashboard\ban.php on line 362 Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\dashboard\ban.php on line 364**
0debug
How to use a custom font style in flutter? : <p>I have already set on my pubspec.yaml the following code:</p> <pre><code>fonts: - family: Roboto fonts: - asset: fonts/Roboto-Light.ttf - asset: fonts/Roboto-Thin.ttf - asset: fonts/Roboto-Italic.ttf </code></pre> <p>But I don't know to use, for example, the style "Roboto-Light.ttf" from Roboto in my widget. I tried this:</p> <pre><code>new ListTile( title: new Text( "Home", style: new TextStyle( fontFamily: "Roboto", fontSize: 60.0, ), ), ), </code></pre> <p>I don't know how to access the style "Roboto-Light.ttf". How to do this?</p> <p>Thanks!</p>
0debug
void ppc_tlb_invalidate_one (CPUPPCState *env, target_ulong addr) { #if !defined(FLUSH_ALL_TLBS) addr &= TARGET_PAGE_MASK; switch (env->mmu_model) { case POWERPC_MMU_SOFT_6xx: case POWERPC_MMU_SOFT_74xx: ppc6xx_tlb_invalidate_virt(env, addr, 0); if (env->id_tlbs == 1) ppc6xx_tlb_invalidate_virt(env, addr, 1); break; case POWERPC_MMU_SOFT_4xx: case POWERPC_MMU_SOFT_4xx_Z: ppc4xx_tlb_invalidate_virt(env, addr, env->spr[SPR_40x_PID]); break; case POWERPC_MMU_REAL_4xx: cpu_abort(env, "No TLB for PowerPC 4xx in real mode\n"); break; case POWERPC_MMU_BOOKE: cpu_abort(env, "MMU model not implemented\n"); break; case POWERPC_MMU_BOOKE_FSL: cpu_abort(env, "MMU model not implemented\n"); break; case POWERPC_MMU_32B: case POWERPC_MMU_601: addr &= ~((target_ulong)-1 << 28); tlb_flush_page(env, addr | (0x0 << 28)); tlb_flush_page(env, addr | (0x1 << 28)); tlb_flush_page(env, addr | (0x2 << 28)); tlb_flush_page(env, addr | (0x3 << 28)); tlb_flush_page(env, addr | (0x4 << 28)); tlb_flush_page(env, addr | (0x5 << 28)); tlb_flush_page(env, addr | (0x6 << 28)); tlb_flush_page(env, addr | (0x7 << 28)); tlb_flush_page(env, addr | (0x8 << 28)); tlb_flush_page(env, addr | (0x9 << 28)); tlb_flush_page(env, addr | (0xA << 28)); tlb_flush_page(env, addr | (0xB << 28)); tlb_flush_page(env, addr | (0xC << 28)); tlb_flush_page(env, addr | (0xD << 28)); tlb_flush_page(env, addr | (0xE << 28)); tlb_flush_page(env, addr | (0xF << 28)); break; #if defined(TARGET_PPC64) case POWERPC_MMU_64B: tlb_flush(env, 1); break; #endif default: cpu_abort(env, "Unknown MMU model\n"); break; } #else ppc_tlb_invalidate_all(env); #endif }
1threat
clearInterval function working myseteriousely : We all know that when a function on completion can execute a return value. Now consider the following line of code var t = setInterval(function() {console.log('hey hi hello now 2 seconds have passed down');} ,2000); clearInterval(t); Now here clearInterval() takes the unique id returned by the setInterval function as argument and this will only be returned once the function has completely run now what happens is that before my setInterval function runs it gets cleared and this should not be possible as setinterval() will not return anything until its callback function has been called.
0debug
How do I find the first of a few characters in a string in python. : How do I find the first of a few characters in a string in python? I have used find() and index() but they find only one character. How do I find the first position of a single character out of the few characters I want to be searched for? So I want to find the position of the first operator(out of the 4 arithmetic operators) in an inputted string else it should return -1. Sorry if this is a very stupid question but I have been searching and trying out multiple options over the past few days. I am also a beginner in python.
0debug
SQL Procedure complication : I am trying to call uspCalculateTaxes procedure inside of uspGetGrossPay and i'm not understanding how to use the parameters. Any advice will be greatly Appreciated. Thanks! -- -------------------------------------------------------------------------------- USE dbSQL1; -- Get out of the master database SET NOCOUNT ON; -- Report only errors -- -------------------------------------------------------------------------------- -- Drop Tables -- -------------------------------------------------------------------------------- IF OBJECT_ID( 'TSalaries' ) IS NOT NULL DROP TABLE TSalaries IF OBJECT_ID( 'THours' ) IS NOT NULL DROP TABLE THours IF OBJECT_ID( 'TPayrolls' ) IS NOT NULL DROP TABLE TPayrolls IF OBJECT_ID( 'THourlyPayRate' ) IS NOT NULL DROP TABLE THourlyPayRate IF OBJECT_ID( 'TTaxRates' ) IS NOT NULL DROP TABLE TTaxRates IF OBJECT_ID( 'TEmployees' ) IS NOT NULL DROP TABLE TEmployees IF OBJECT_ID( 'TPayrollStatuses' ) IS NOT NULL DROP TABLE TPayrollStatuses -- -------------------------------------------------------------------------------- -- Drop Procedures -- -------------------------------------------------------------------------------- IF OBJECT_ID( 'uspGetGrossPay') IS NOT NULL DROP PROCEDURE uspGetGrossPay IF OBJECT_ID( 'uspCalculateSalary') IS NOT NULL DROP PROCEDURE uspCalculateSalary IF OBJECT_ID( 'uspCalculateGrossPay') IS NOT NULL DROP PROCEDURE uspCalculateGrossPay IF OBJECT_ID( 'uspCalculateTaxes') IS NOT NULL DROP PROCEDURE uspCalculateTaxes -- -------------------------------------------------------------------------------- -- Step #1: Create Tables -- -------------------------------------------------------------------------------- CREATE TABLE TEmployees ( intEmployeeID INTEGER NOT NULL ,intPayrollStatusID INTEGER NOT NULL --hourly or salary ,strEmployeeID VARCHAR(50) NOT NULL --actual employee ID ,strFirstName VARCHAR(50) NOT NULL ,strLastName VARCHAR(50) NOT NULL ,strAddress VARCHAR(50) NOT NULL ,strCity VARCHAR(50) NOT NULL ,strState VARCHAR(50) NOT NULL ,strZip VARCHAR(50) NOT NULL ,CONSTRAINT TEmployees_PK PRIMARY KEY ( intEmployeeID ) ) CREATE TABLE TPayrollStatuses ( intPayrollStatusID INTEGER NOT NULL ,strStatus VARCHAR(1) NOT NULL --S for salary and H for hourly are only values allowed ,strDescription VARCHAR(50) NOT NULL ,CONSTRAINT TPayrollStatuses_PK PRIMARY KEY ( intPayrollStatusID ) ,CONSTRAINT CK_PayrollStatus CHECK ( strStatus = 'H' OR strStatus = 'S') -- ********CHECK CONSTRAINT ******keeps input to S or H only ) CREATE TABLE THourlyPayRate ( intEmployeeRateID INTEGER NOT NULL ,intEmployeeID INTEGER NOT NULL ,monRate MONEY NOT NULL ,CONSTRAINT THourlyPayRate_PK PRIMARY KEY ( intEmployeeRateID ) ,CONSTRAINT UQ_EmployeeID UNIQUE( intEmployeeID ) -- EMPLOYEES SHOULD ONLY HAVE 1 HOURLY RATE ) CREATE TABLE TSalaries ( intSalaryID INTEGER NOT NULL ,intEmployeeID INTEGER NOT NULL ,monSalary MONEY NOT NULL ,intFrequency INTEGER NOT NULL -- frequency of pay periods # per year for our purpose 52 but could change ,CONSTRAINT TSalaries_PK PRIMARY KEY ( intSalaryID ) ,CONSTRAINT UQ_intEmployeeID UNIQUE( intEmployeeID ) -- EMPLOYEES SHOULD ONLY HAVE 1 SALARY ) CREATE TABLE THours ( intHourID INTEGER NOT NULL ,intEmployeeID INTEGER NOT NULL ,dtmEndDate DATETIME NOT NULL -- date pay period ends ,decHours DECIMAL(6, 2) NOT NULL -- HOURS WORKED THIS PERIOD (6, 2) is referred to as the precision and scale of the decimal ,CONSTRAINT THours_PK PRIMARY KEY ( intHourID ) -- precision is the total digits and scale is the # of digits to the right of the decimal -- in this case we have 6 total with 2 right of the decimal 1962.53 is how it would look ) CREATE TABLE TTaxRates ( intTaxRateID INTEGER NOT NULL ,intEmployeeID INTEGER NOT NULL ,decStateRate DECIMAL(6, 2) NOT NULL -- State income tax rate ,decLocalRate DECIMAL(6, 2) NOT NULL -- Local income tax rate ,CONSTRAINT TTaxRates_PK PRIMARY KEY ( intTaxRateID ) ) CREATE TABLE TPayrolls ( intPayrollID INTEGER IDENTITY NOT NULL ,intEmployeeID INTEGER NOT NULL ,monGrossPay MONEY NOT NULL ,monFederalTax MONEY NOT NULL ,monStateTax MONEY NOT NULL ,monLocalTax MONEY NOT NULL ,dtmCurrentDate DATETIME NOT NULL ,CONSTRAINT TPayrolls_PK PRIMARY KEY ( intPayrollID ) ) -- -------------------------------------------------------------------------------- -- Step #2: Identify and Create Foreign Keys -- -------------------------------------------------------------------------------- -- -- # Child Parent Column(s) -- - ----- ------ --------- -- 1 TEmployees TPayrollStatuses intPayrollStatusID -- 2 THourlyPayRate TEmployees intEmployeeID -- 3 TSalaries TEmployees intEmployeeID -- 4 THours TEmployees intEmployeeID -- 5 TTaxRates TEmployees intEmployeeID -- 1 ALTER TABLE TEmployees ADD CONSTRAINT TEmployees_TPayrollStatuses_FK FOREIGN KEY ( intPayrollStatusID ) REFERENCES TPayrollStatuses ( intPayrollStatusID ) -- 2 ALTER TABLE THourlyPayRate ADD CONSTRAINT THourlyPayRate_TEmployees_FK FOREIGN KEY ( intEmployeeID ) REFERENCES TEmployees ( intEmployeeID ) -- 3 ALTER TABLE TSalaries ADD CONSTRAINT TSalaries_TEmployees_FK FOREIGN KEY ( intEmployeeID ) REFERENCES TEmployees ( intEmployeeID ) -- 4 ALTER TABLE THours ADD CONSTRAINT THours_TEmployees_FK FOREIGN KEY ( intEmployeeID ) REFERENCES TEmployees ( intEmployeeID ) -- 5 ALTER TABLE TTaxRates ADD CONSTRAINT TTaxRates_TEmployees_FK FOREIGN KEY ( intEmployeeID ) REFERENCES TEmployees ( intEmployeeID ) -- -------------------------------------------------------------------------------- -- Step #3: Add data -- -------------------------------------------------------------------------------- INSERT INTO TPayrollStatuses ( intPayrollStatusID, strStatus, strDescription ) VALUES ( 1, 'S', 'Salary' ) ,( 2, 'H', 'Hourly') INSERT INTO TEmployees ( intEmployeeID, intPayrollStatusID, strEmployeeID, strFirstName, strLastName, strAddress, strCity, strState, strZip ) VALUES ( 1, 1, 'AC1524', 'James', 'Allen', '1979 Park Place', 'Cincinnati', 'Oh', '45208' ) ,( 2, 2, 'MN0195', 'Sally', 'Frye', '196 Main St.', 'Milford', 'Oh', '45232' ) ,( 3, 1, 'HR5243', 'Fred', 'Mening', '19 Ft Wayne Ave.', 'West Chester', 'Oh', '45069' ) ,( 4, 2, 'MN0645', 'Bill', 'Leford', '174 Chance Ave', 'Cold Spring', 'Ky', '44038' ) ,( 5, 2, 'SH0326', 'Susan', 'Maelle', '109 Forrest St.', 'Lawrenceburg', 'In', '43098' ) ,( 6, 1, 'EX26410', 'John', 'Snowden', '1709 ALes Lane', 'Milan', 'In', '43168' ) INSERT INTO THourlyPayRate ( intEmployeeRateID, intEmployeeID, monRate ) VALUES ( 1, 2, 10.00 ) ,( 2, 4, 11.86 ) ,( 3, 5, 10.00 ) INSERT INTO TSalaries ( intSalaryID, intEmployeeID, monSalary, intFrequency ) VALUES ( 1, 1, 90000.00, 52 ) ,( 2, 3, 45597.29, 52 ) ,( 3, 6, 255597.29, 52 ) INSERT INTO THours ( intHourID, intEmployeeID, dtmEndDate, decHours ) VALUES ( 1, 2, '1/19/2018', 46.25 ) ,( 2, 4, '1/19/2018', 42.55 ) ,( 3, 5, '1/19/2018', 38.00 ) ,( 4, 2, '1/26/2018', 40.00 ) ,( 5, 1, '1/26/2018', 49.89 ) ,( 6, 2, '1/26/2018', 30.00 ) ,( 7, 3, '1/26/2018', 49.89 ) ,( 8, 4, '1/26/2018', 51.23 ) ,( 9, 5, '1/26/2018', 50.00 ) ,( 10, 6, '1/26/2018', 51.23 ) INSERT INTO TTaxRates ( intTaxRateID, intEmployeeID, decStateRate, decLocalRate ) VALUES ( 1, 1, .0495, .021 ) ,( 2, 2, .0495, .021 ) ,( 3, 3, .0495, .021 ) ,( 4, 4, .055, .021 ) ,( 5, 5, .0323, .021 ) ,( 6, 6, .0323, .021 ) GO CREATE PROCEDURE uspCalculateSalary @monGrossSalary AS MONEY OUTPUT ,@monSalary AS MONEY ,@intFrequency AS INTEGER AS SET XACT_ABORT ON -- Terminate and rollback entire transaction on error BEGIN SET @monGrossSalary = @monSalary / @intFrequency END GO CREATE PROCEDURE uspCalculateGrossPay @monGrossPay AS MONEY OUTPUT ,@decHours AS DECIMAL(6, 2) ,@decRate AS DECIMAL(6, 2) AS SET XACT_ABORT ON -- Terminate and rollback entire transaction on error BEGIN IF @decHours > 40 SET @monGrossPay = ((@decHours - 40) * @decRate * 1.5) + (40 * @decRate) ELSE SET @monGrossPay = @decHours * @decRate END GO CREATE PROCEDURE uspCalculateTaxes @monFederalTax AS MONEY OUTPUT ,@monStateTax AS MONEY OUTPUT ,@monLocalTax AS MONEY OUTPUT ,@monGrossPay AS MONEY ,@decStateRate AS DECIMAL(6,2) ,@decLocalRate AS DECIMAL(6,2) AS SET XACT_ABORT ON -- Terminate and rollback entire transaction on error BEGIN SET @monStateTax = @monGrossPay * @decStateRate SET @monLocalTax = @monGrossPay * @decLocalRate IF @monGrossPay < 961.54 SET @monFederalTax = @monGrossPay * .07 ELSE IF @monGrossPay > 961.54 and @monGrossPay < 1923.08 SET @monFederalTax = @monGrossPay * .08 Else If @monGrossPay > 1923.08 SET @monFederalTax = @monGrossPay * .09 END GO CREATE PROCEDURE uspGetGrossPay @monGrossPay AS MONEY OUTPUT ,@intEmployeeID AS INTEGER AS SET XACT_ABORT ON -- Terminate and rollback entire transaction on error BEGIN DECLARE @monSalary AS MONEY DECLARE @intPayrollStatusID AS INT DECLARE @intFrequency AS INTEGER DECLARE @decHours AS DECIMAL(10, 2) DECLARE @monRate AS MONEY DECLARE @monFederalTax AS MONEY DECLARE @monStateTax AS MONEY DECLARE @monLocalTax AS MONEY DECLARE @decFederalRate AS DECIMAL(10,2) DECLARE @decStateRate AS DECIMAL(10,2) DECLARE @decLocalRate AS DECIMAL(10,2) DECLARE PayStatus CURSOR LOCAL FOR SELECT intPayrollStatusID FROM TEmployees WHERE intEmployeeID = @intEmployeeID OPEN PayStatus FETCH FROM PayStatus INTO @intPayrollStatusID Close PayStatus DECLARE GetTaxRate CURSOR LOCAL FOR SELECT decStateRate, decLocalRate FROM TTaxRates WHERE intEmployeeID = intEmployeeID DECLARE Salary CURSOR LOCAL FOR SELECT monSalary, intFrequency FROM TSalaries WHERE intEmployeeID = @intEmployeeID DECLARE Hourly CURSOR LOCAL FOR SELECT TER.monRate, TH.decHours FROM THourlyPayRate AS TER, THours AS TH WHERE TER.intEmployeeID = TH.intEmployeeID AND TH.intHourID IN (SELECT MAX(intHourID) FROM THours WHERE intEmployeeID = @intEmployeeID) IF @intPayrollStatusID = 1 BEGIN --call Salery OPEN Salary FETCH FROM Salary INTO @monSalary, @intFrequency CLOSE Salary EXECUTE uspCalculateSalary @monGrossPay OUTPUT, @monSalary, @intFrequency END ELSE BEGIN OPEN Hourly FETCH Hourly INTO @monRate, @decHours CLOSE Hourly --call stored proc to calculate hourly pay EXECUTE uspCalculateGrossPay @monGrossPay OUTPUT, @decHours, @monRate END BEGIN OPEN GetTaxRate FETCH GetTaxRate INTO @monGrossPay, @decStateRate, @decLocalRate CLOSE GetTaxRate --call stored proc to calculate hourly pay EXECUTE uspCalculateTaxes @monFederalTax OUTPUT, @monGrossPay, @decStateRate, @decLocalRate END END Go DECLARE @monFederalTax AS MONEY EXECUTE uspGetGrossPay @monFederalTax OUTPUT, 1 Print 'Federal Tax = ' + CAST(@monFederalTax as VARCHAR(50)) --DECLARE @monGross AS MONEY --EXECUTE uspGetGrossPay @monGross OUTPUT, 2 --Print 'Gross Pay = ' + CAST(@monGross as VARCHAR(50))
0debug
CodeIgnitor3 Cannot Load File from Views : It's been a while since I used to make website using Codeigniter, So I want to open a new page once the button is clicked. But it only showed as "Object Not Found. Error 404.", with *http://localhost/xxxxx/reseller* as the URL. I've tried to load it on baseurl, put it in the index function, and it can load perfectly. Here is my code on **Controller** :<br> `public function reseller() { $this->load->view('v_reseller'); }` **Button** <a href="<?php echo base_url(); ?>reseller">Find Out More</a>
0debug
Round Robin (Scheduling) Algorithm with I/O and Virtual round robin : can someone please explain and give me example of Round Robin (Scheduling) Algorithm with I/O and Virtual round robin ?? like explanation with gant chart
0debug
How to use and compile python file? : <p>i have written a python script as <code>cl.py</code> when i run it in the shell by the command <code>python cl.py</code> it run successfully now if there is a <code>function</code> <code>fun1()</code> in my <code>cl.py</code> script and i want to use that function in another script called <code>cl1.py</code> so what would be the right approach</p> <p>as i want to compile the file <code>cl.py</code> for the faster execution </p> <p>both of the files are in the same <code>directory</code> and after running python <code>cl.py</code> </p> <p>when i am importing that <code>cl</code> in another script <code>cl1.py</code> by doing <code>import cl</code> its no getting <code>import</code> </p> <pre><code>invalid syntax </code></pre> <p>here is what i mean </p> <pre><code>file cl.py def fun1(s) print(s) </code></pre> <p>after doing <code>python cl.py</code></p> <p>i wrote another file as</p> <p>file cl1.py</p> <pre><code>import cl v ="hello" fun1(v) </code></pre> <p>why it saying <code>syntax error</code> on import cl</p>
0debug
How to open another activity with a pre-written EditText : I have an activity which consists of an EditText. The problem is I want to open this activity with a pre-written EditText. Here is the example: [Example of a pre-written EditText][1] [1]: https://i.stack.imgur.com/uVQP0.png I want when I open this activity from the MainActivity, the text of EditText will always be set to "Tùng".
0debug
Updating a field with a nested array in Elastic Search : <p>I am trying to update a field in a document with an array. I want to add an array to the field "products". I tried this:</p> <pre><code>POST /index/type/1/_update { "doc" :{ "products": [ { "name": "A", "count": 1 }, { "name": "B", "count": 2 }, { "name": "c", "count": 3 } ] } } </code></pre> <p>this is the error response I am getting when I try and run the code:</p> <pre><code>{ "error": { "root_cause": [ { "type": "mapper_parsing_exception", "reason": "failed to parse [products]" } ], "type": "mapper_parsing_exception", "reason": "failed to parse [products]", "caused_by": { "type": "illegal_state_exception", "reason": "Can't get text on a START_OBJECT at 1:2073" } }, "status": 400 } </code></pre> <p>Anyone know what I am doing wrong?</p>
0debug
Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core project : <p>I've been researching a lot online but did not find a proper solution. I was trying to use Entity Framework Core with MySQL by using database-first scaffold method to mapping table model while always received this error when applied the command</p> <pre><code>Unable to retrieve project metadata. Ensure it's an MSBuild-based .NET Core project. If you're using custom BaseIntermediateOutputPath or MSBuildProjectExtensionsPath values, Use the --msbuildprojectextensionspath option. </code></pre> <p>This is the command I am using to scaffold the database model:</p> <pre><code>Scaffold-DbContext "server=localhost;port=3306;user=root;password=1234;database=world" "Pomelo.EntityFrameworkCore.MySql" -OutputDir .\Models -f </code></pre> <p>And this is my .Net Core project setting:</p> <pre><code> &lt;ItemGroup&gt; &lt;PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.1" /&gt; &lt;PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.0.1" /&gt; &lt;/ItemGroup&gt; &lt;ItemGroup&gt; &lt;DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" /&gt; &lt;/ItemGroup&gt; </code></pre>
0debug
Querying with multiple local Secondary Index Dynamodb : <p>I have 2 LSI in my table with a primary partition Key with primary sort key</p> <p>Org-ID - primary partition Key</p> <p>ClientID- primary sort Key</p> <p>Gender - LSI</p> <p>Section - LSI</p> <p>I have no issue with querying a table with one LSI, but how to mention <strong>2 LSI</strong> in a table schema.</p> <pre><code> var params = { TableName:"MyTable", IndexNames: ['ClientID-Gender-index','ClientID-Section-index'], KeyConditionExpression : '#Key1 = :Value1 and #Key2=:Value2 and #Key3=:Value3', ExpressionAttributeNames:{ "#Key1":"Org-ID", "#Key2":"Gender", "#Key3":"Section" }, ExpressionAttributeValues : { ':Value1' :"Microsoft", ':Value2':"Male", ':Value3':"Cloud Computing" }}; </code></pre> <p>Can anyone fix the issue in <strong>IndexName</strong>(line 3) or KeyConditionExpression(line 4), I'm not sure about it.</p> <p>Issue</p> <p>Condition can be of length 1 or 2 only</p>
0debug
Chrome extension that enables chatting with users on same page : <p>I've seen Chrome extensions that claim to do such thing, but the chat page they provide are all separate page from the original web page, which is really inconvenient. Is there existing plugin that can do this? I may want to build one myself but I'm guessing there may be some permission issue, since that would be showing content from 3rd party.</p> <p>Is it possible to insert content like a chat box into all different web pages using Chrome extension?</p>
0debug
static int piix4_device_hotplug(DeviceState *qdev, PCIDevice *dev, PCIHotplugState state) { int slot = PCI_SLOT(dev->devfn); PIIX4PMState *s = DO_UPCAST(PIIX4PMState, dev, PCI_DEVICE(qdev)); if (state == PCI_COLDPLUG_ENABLED) { return 0; } s->pci0_status.up = 0; s->pci0_status.down = 0; if (state == PCI_HOTPLUG_ENABLED) { enable_device(s, slot); } else { disable_device(s, slot); } pm_update_sci(s); return 0; }
1threat
Is there a way to remove unused imports for Python in VS Code? : <p>I would really like to know if there is some Extension in Visual Studio Code or other means that could help identify and remove any unused imports.</p> <p>I have quite a large number of imports like this and it's getting close to 40 lines. I know some of them aren't in use, the problem is removing them safely.</p> <pre><code>from django.core.mail import EmailMultiAlternatives, send_mail from django.template.loader import render_to_string from django.utils.html import strip_tags from rest_framework import routers, serializers, viewsets, status from rest_framework.views import APIView from rest_framework.response import Response from django.contrib.auth.models import User </code></pre>
0debug
How to call local .dll files in Electron App : <p>i have an issue how to call sample .dll files into my Electron App. I have sample .dll files in my folder, the thing is how to access my sample.dll file and how to call my sample.dll function and gets results. Any tutorials or steps to follow please sample code to start </p>
0debug
Laravel 5.4: how to delete a file stored in storage/app : <p>I want to delete a file that is stored in storage/app/myfolder/file.jpg. I have tried the following codes but none of this works:</p> <pre><code>use File $file_path = url().'/storage/app/jobseekers_cvs/'.$filename; unlink($file_path); </code></pre> <p>and </p> <pre><code>use File $file_path = public_path().'/storage/app/myfolder/'.$filename; unlink($file_path); </code></pre> <p>and </p> <pre><code>use File $file_path = app_path().'/storage/app/myfolder/'.$filename; unlink($file_path); </code></pre> <p>and also,</p> <pre><code>File::Delete('/storage/app/myfolder/'.$filename); </code></pre> <p>Please help.</p>
0debug
How to call the correct overloaded method? : <p>I have a class <strong>A</strong> with a subclass <strong>B</strong>. The class <strong>A</strong> has a method <code>foo()</code> that calls <code>C.test(this)</code>. In class <strong>C</strong>, there are two methods: <code>test(A a)</code> and <code>test(B b)</code>. Whenever <code>A.foo()</code> is called, the method <code>test(A a)</code> is used. That seems normal to me. However, whenever <code>B.foo()</code> is called, the method <code>test(A a)</code> is also used, instead of <code>test(B b)</code> (which is what I want). This surprises me.</p> <p>Why does this happen? How can I change my code structure such that I obtain the behaviour that I want?</p>
0debug
static const uint8_t *pcx_rle_decode(const uint8_t *src, uint8_t *dst, unsigned int bytes_per_scanline, int compressed) { unsigned int i = 0; unsigned char run, value; if (compressed) { while (i<bytes_per_scanline) { run = 1; value = *src++; if (value >= 0xc0) { run = value & 0x3f; value = *src++; } while (i<bytes_per_scanline && run--) dst[i++] = value; } } else { memcpy(dst, src, bytes_per_scanline); src += bytes_per_scanline; } return src; }
1threat
const can only be used in a .ts file react native : <pre><code>const ACCESS_TOKEN = 'access_token'; react-native-cli: 2.0.1 react-native: 0.47.2 </code></pre> <p>I am watching a tutorial video in which the expert get the value from the api and stored it inside the const ACCESS_TOKEN but when i am doing it in my code it gives me an error</p> <blockquote> <p>const can only be used in a .ts file react native</p> </blockquote> <p>Please suggest.</p>
0debug
static void stream_desc_store(struct Stream *s, hwaddr addr) { struct SDesc *d = &s->desc; int i; d->buffer_address = cpu_to_le64(d->buffer_address); d->nxtdesc = cpu_to_le64(d->nxtdesc); d->control = cpu_to_le32(d->control); d->status = cpu_to_le32(d->status); for (i = 0; i < ARRAY_SIZE(d->app); i++) { d->app[i] = cpu_to_le32(d->app[i]); } cpu_physical_memory_write(addr, (void *) d, sizeof *d); }
1threat
How do I incorporate a for-loop into this function and still have the same outcomes? : <p>I have written this code for a class and the outcomes are correct, but I did not realize that I needed to incorporate a for-loop into the function. The exact words from the problem are "Hint, use a variable number of arguments (*values) and access them with a for loop." I don't really understand this and I think all I need to do is add a for loop somehow. </p> <p>I haven't tried anything yet because i'm really bad with for-loops and don't want to mess up the code that I have. Anything helps. This is my code so far:</p> <pre><code>def values(num1 , num2 , num3): sum = num1 + num2 + num 3 ave = sum / 3 x = max (num1 , num2 , num3) y = min (num1 , num2 , num3) product = num1 * num2 * num3 return sum , ave , x , y , product sum , ave , x , y , product = values(2 , 2 , 2) print(sum) print(ave) print(x) print(y) print(product) 6 2.0 2 2 8 </code></pre>
0debug
How do i get elements from a file and read them to a list in python : <p>What i am trying to do is read from a file, and insert the content from a file into a list in python 3. the file should look like this:</p> <pre><code>♥A ♣A ♥Q ♠Q </code></pre> <p>and the result i am expecting when i read from the file is that when i print the specific list is that it shows up like this </p> <pre><code>['♥A', '♣A', '♥Q', '♠Q'] </code></pre> <p>How would i go about solving this?</p> <p>And i have tried multiple solutions for this, like using for loops, but i dont understand how to do this</p>
0debug
change button color react native : <p>I want to simply change the color of the button, but i can't. I tried to change directly in the button, and pass a style to it. But neither of them worked. Here's my very simple code.</p> <pre><code> export default class Dots extends Component { render() { return ( &lt;Image style={styles.container} source={require('./background3.png')}&gt; &lt;Button title='play' style = {{color:'red'}}/&gt; &lt;/Image&gt; ); } } const styles = StyleSheet.create({ container: { flex:1, backgroundColor:'transparent', resizeMode:'cover', justifyContent:'center', alignItems:'center', width:null, height:null }, button:{ backgroundColor:'#ff5c5c', } }); </code></pre>
0debug
Why I cannot upload an image to a database? : <p>I am having a big trouble when trying to upload an image (using <code>PHP</code>) to a database (<code>phpMyAdmin</code>). Everything seems fine to me even debugging (using <code>eclipse</code>). When I run my code the image is uploaded, the SQL-query is launched and the image is moved from the tmp-folder. But nothing in my database. Here is the code:</p> <pre><code>if (isset($_FILES['upload']) &amp;&amp; $_FILES['upload']['size'] &gt; 0) { $file = $_FILES['upload']['tmp_name']; $name = $_FILES['upload']['name']; $type = $_FILES['upload']['type']; $size = $_FILES['upload']['size']; if (is_uploaded_file($file)) { $data = file_get_contents($file); $img-&gt;uploadImg($size, $type, $name, $data); } $older = getcwd () . '/image/'. basename($name); move_uploaded_file($_FILES['upload']['tmp_name'], $folder); } </code></pre> <p>And:</p> <pre><code> public function uploadImg($size, $mimetype, $filename, $code) { try { $sql = "INSERT INTO img_table(fileName, size, mimetype, code) VALUES ($filename, $size, $mimetype, $code)"; $this-&gt;db-&gt;exec($sql); } catch (PDOException $e) { echo $sql.' '.$e-&gt;getMessage(); } } </code></pre> <p>Any idea or hint to tell me where I am doing wrong. i am open to any suggestions.</p>
0debug
How to change <br> height in PHP : hi for this code i want to change `<br>` height this code written inside html tag i've tried echo "<br style:padding-top:xxpx;>" but doesn't work echo " $x" . " Degree"."<br>"."<br>"."<br>"."<br>"; echo " $y" . " percent"."<br>"."<br>"."<br>"; echo " $a" . " percent"."<br>"."<br>"."<br>"."<br>"; echo " $b" . " percent"."<br>"."<br>"."<br>"."<br>"; echo " $c" . " percent"."<br>"."<br>"."<br>"."<br>"; echo " $d" . " percent"; header("Refresh:5"); //}else { //echo "No Results"; //} //$conn->close(); ?> </div>
0debug
String buffer function setCharAt() throws error. Help please : I tried to run this code and remove all uppercase charachters and print the changed string again. But all it does is throwing me a "cannot find symbol - method delete(int,int)" error in the String Buffer function. Im pretty sure the loop variable is visible too. Please help. String s = "Some Random Sentence Here"; int l = s.length() for(int i = 0;i<=l;i++) { char ch = s.charAt(i); if(Character.isUpperCase(ch) == true) { s.delete(i,(i+2)); } } System.out.println(s);
0debug
C++ Screenshot on mouse click does not works : I using Visual Studio 2017, I writted code which should create folder, capture screenshot when mouse button pushed and save screenshot on .bmp file.. But I don't know why that script does not works.. Visual Studio compile it without errors / warns. // variable to store the HANDLE to the hook. Don't declare it anywhere else then globally // or you will get problems since every function uses this variable. HHOOK _hook; // This struct contains the data received by the hook callback. As you see in the callback function // it contains the thing you will need: vkCode = virtual key code. KBDLLHOOKSTRUCT kbdStruct; int filenum = 1; // This is the callback function. Consider it the event that is raised when, in this case, // a key is pressed. void TakeScreenShot(const char* filename) { //keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY, 0); //keybd_event(VK_SNAPSHOT, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); HBITMAP h; POINT a, b; a.x = 0; a.y = 0; b.x = GetSystemMetrics(SM_CXSCREEN); b.y = GetSystemMetrics(SM_CYSCREEN); HDC hScreen = GetDC(NULL); HDC hDC = CreateCompatibleDC(hScreen); HBITMAP hBitmap = CreateCompatibleBitmap(hScreen, abs(b.x - a.x), abs(b.y - a.y)); HGDIOBJ old_obj = SelectObject(hDC, hBitmap); BOOL bRet = BitBlt(hDC, 0, 0, abs(b.x - a.x), abs(b.y - a.y), hScreen, a.x, a.y, SRCCOPY); // save bitmap to clipboard OpenClipboard(NULL); EmptyClipboard(); SetClipboardData(CF_BITMAP, hBitmap); CloseClipboard(); // clean up SelectObject(hDC, old_obj); DeleteDC(hDC); ReleaseDC(NULL, hScreen); DeleteObject(hBitmap); OpenClipboard(NULL); h = (HBITMAP)GetClipboardData(CF_BITMAP); CloseClipboard(); HDC hdc = NULL; FILE*fp = NULL; LPVOID pBuf = NULL; BITMAPINFO bmpInfo; BITMAPFILEHEADER bmpFileHeader; do { hdc = GetDC(NULL); ZeroMemory(&bmpInfo, sizeof(BITMAPINFO)); bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); GetDIBits(hdc, h, 0, 0, NULL, &bmpInfo, DIB_RGB_COLORS); if (bmpInfo.bmiHeader.biSizeImage <= 0) bmpInfo.bmiHeader.biSizeImage = bmpInfo.bmiHeader.biWidth*abs(bmpInfo.bmiHeader.biHeight)*(bmpInfo.bmiHeader.biBitCount + 7) / 8; if ((pBuf = malloc(bmpInfo.bmiHeader.biSizeImage)) == NULL) { MessageBox(NULL, TEXT("Unable to Allocate Bitmap Memory"), TEXT("Error"), MB_OK | MB_ICONERROR); break; } bmpInfo.bmiHeader.biCompression = BI_RGB; GetDIBits(hdc, h, 0, bmpInfo.bmiHeader.biHeight, pBuf, &bmpInfo, DIB_RGB_COLORS); if ((fp = fopen(filename, "wb")) == NULL) { MessageBox(NULL, TEXT("Unable to Create Bitmap File"), TEXT("Error"), MB_OK | MB_ICONERROR); break; } bmpFileHeader.bfReserved1 = 0; bmpFileHeader.bfReserved2 = 0; bmpFileHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmpInfo.bmiHeader.biSizeImage; bmpFileHeader.bfType = 'MB'; bmpFileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER); fwrite(&bmpFileHeader, sizeof(BITMAPFILEHEADER), 1, fp); fwrite(&bmpInfo.bmiHeader, sizeof(BITMAPINFOHEADER), 1, fp); fwrite(pBuf, bmpInfo.bmiHeader.biSizeImage, 1, fp); } while (false); if (hdc)ReleaseDC(NULL, hdc); if (pBuf) free(pBuf); if (fp)fclose(fp); } LRESULT __stdcall HookCallback(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode >= 0) { // the action is valid: HC_ACTION. if (wParam == WM_LBUTTONDOWN) { std::string OutputFolder = "C:\\temp"; std::string filename = "ss"; if (CreateDirectory(OutputFolder.c_str(), NULL) || ERROR_ALREADY_EXISTS == GetLastError()) { } else { // Failed to create directory. } auto numfile = std::to_string(filenum); TakeScreenShot((OutputFolder + "\\" + filename + std::to_string(filenum) + ".bmp").c_str()); filenum++; } } // call the next hook in the hook chain. This is nessecary or your hook chain will break and the hook stops return CallNextHookEx(_hook, nCode, wParam, lParam); } void ReleaseHook() { UnhookWindowsHookEx(_hook); } int main() { // Don't mind this, it is a meaningless loop to keep a console application running. // I used this to test the keyboard hook functionality. If you want to test it, keep it in ;) MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { } } Here is the code.. Compiler in Visual Studio compiles without problems to .exe file, but If I run that .exe, it will run, but if I click with mouseclick does not make directory (if does not exist) and does not create .bmp file.
0debug
static void connex_init(ram_addr_t ram_size, int vga_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { struct pxa2xx_state_s *cpu; int index; uint32_t connex_rom = 0x01000000; uint32_t connex_ram = 0x04000000; if (ram_size < (connex_ram + connex_rom + PXA2XX_INTERNAL_SIZE)) { fprintf(stderr, "This platform requires %i bytes of memory\n", connex_ram + connex_rom + PXA2XX_INTERNAL_SIZE); exit(1); } cpu = pxa255_init(connex_ram); index = drive_get_index(IF_PFLASH, 0, 0); if (index == -1) { fprintf(stderr, "A flash image must be given with the " "'pflash' parameter\n"); exit(1); } if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(connex_rom), drives_table[index].bdrv, sector_len, connex_rom / sector_len, 2, 0, 0, 0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); exit(1); } cpu->env->regs[15] = 0x00000000; smc91c111_init(&nd_table[0], 0x04000300, pxa2xx_gpio_in_get(cpu->gpio)[36]); }
1threat
C# Directory Not Foud Excemption : Here using VS 2015 Community and C# I am trying to read a JSON file stored inside folder called `lib` in the project as `lib/user.json` String jsonSTR = File.ReadAllText("lib/user.json"); but I am getting the Directory Not Found Exception [![enter image description here][1]][1] Can you please let me know why this is happening? Thanks [1]: http://i.stack.imgur.com/LK2gI.png
0debug
I am not able to get specific values from url : I have a url market://details?id=com.balancehero.truebalance&referrer=utm_source%3Dapp%26utm_medium%3Dlink%26utm_term%3D%26utm_content%3D%26utm_campaign%3Dmgm%26campid%3D2FC42T27%26m%3D1%26trackingid%3D000146132647632302db63d958690001 How can i get this value from above url 000146132647632302db63d958690001 Can i use preg_match function or something else.
0debug
Matter.js calculating force needed : <p>Im trying to apply a force to an object. To get it to move in the angle that my mouseposition is generating relative to the object.</p> <p>I have the angle</p> <pre><code> targetAngle = Matter.Vector.angle(myBody.pos, mouse.position); </code></pre> <p>Now I need to apply a force, to get the body to move along that angle. What do I put in the values below for the applyForce method?</p> <pre><code> // applyForce(body, position, force) Body.applyForce(myBody, { x : ??, y : ?? },{ x:??, y: ?? // how do I derive this force?? }); </code></pre> <p>What do I put in the x and y values here to get the body to move along the angle between the mouse and the body.</p>
0debug
Rtf to Html removes the html tables : <p>I have the following code to convert rtf text to html:</p> <pre><code>private string RtfToHtml(string rtf) { IRtfDocument rtfDocument = RtfInterpreterTool.BuildDoc(rtf); RtfHtmlConverter htmlConverter = new RtfHtmlConverter(rtfDocument); return htmlConverter.Convert(); } </code></pre> <p>This is taken from <a href="https://www.codeproject.com/kb/recipes/rtfconverter.aspx" rel="noreferrer">this library on code project.</a></p> <p>If my rtf text contains Html tables such as:</p> <pre><code>{\*\htmltag96 &lt;table cellspacing="0" border="0" width="600"&gt;}\htmlrtf {\pard\plain \f0\fs24 \htmlrtf0 </code></pre> <p>They are removed in the resultant html text. How can I preserve these?</p> <p>However, any text or details in the tables remains, this results in the html text not being formatted correctly because of the lack of tables.</p>
0debug
npm ERR! asyncWrite is not a function : <p>npm install -g firebase-tools npm ERR! asyncWrite is not a function npm ERR! pna.nextTick is not a function</p> <p>npm ERR! A complete log of this run can be found in: npm ERR! /home/developer/.npm/_logs/2018-05-30T05_42_20_569Z-debug.log</p> <p>.log data</p> <pre><code>/home/developer/.npm/_logs/2018-05-30T05_42_20_569Z-debug.log0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'install', 1 verbose cli '-g', 1 verbose cli 'firebase-tools' ] 2 info using npm@6.1.0 3 info using node@v10.3.0 4 verbose npm-session 4ca1ad6ed9bde18f 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 verbose stack TypeError: asyncWrite is not a function 7 verbose stack at onwrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:480:7) 7 verbose stack at WritableState.onwrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:180:5) 7 verbose stack at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:154:13) 7 verbose stack at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13) 7 verbose stack at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64) 7 verbose stack at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5) 7 verbose stack at WriteStream.Writable.write (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11) 7 verbose stack at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:171:25) 7 verbose stack at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13) 7 verbose stack at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64) 7 verbose stack at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5) 7 verbose stack at WriteStream.Writable.write (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:334:11) 7 verbose stack at WriteStream.to [as _worker] (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/cache.js:182:19) 7 verbose stack at WriteStream._write (/usr/local/lib/node_modules/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js:35:13) 7 verbose stack at doWrite (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:428:64) 7 verbose stack at writeOrBuffer (/usr/local/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:417:5) 8 verbose cwd /home/developer/Development/host2 9 verbose Linux 4.15.0-22-generic 10 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "firebase-tools" 11 verbose node v10.3.0 12 verbose npm v6.1.0 13 error asyncWrite is not a function 14 verbose exit [ 1, true ] </code></pre> <p><br><br> npm -v :6.1.0<br> node -v :v10.3.0<br> os :Ubuntu 18.04 LTS<br> graphics :AMD® Juniper<br> processor:Intel® Core™ i7 CPU 960 @ 3.20GHz × 8<br> os type : 64-bit<br></p>
0debug
CpuInfoList *qmp_query_cpus(Error **errp) { MachineState *ms = MACHINE(qdev_get_machine()); MachineClass *mc = MACHINE_GET_CLASS(ms); CpuInfoList *head = NULL, *cur_item = NULL; CPUState *cpu; CPU_FOREACH(cpu) { CpuInfoList *info; #if defined(TARGET_I386) X86CPU *x86_cpu = X86_CPU(cpu); CPUX86State *env = &x86_cpu->env; #elif defined(TARGET_PPC) PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu); CPUPPCState *env = &ppc_cpu->env; #elif defined(TARGET_SPARC) SPARCCPU *sparc_cpu = SPARC_CPU(cpu); CPUSPARCState *env = &sparc_cpu->env; #elif defined(TARGET_MIPS) MIPSCPU *mips_cpu = MIPS_CPU(cpu); CPUMIPSState *env = &mips_cpu->env; #elif defined(TARGET_TRICORE) TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu); CPUTriCoreState *env = &tricore_cpu->env; #endif cpu_synchronize_state(cpu); info = g_malloc0(sizeof(*info)); info->value = g_malloc0(sizeof(*info->value)); info->value->CPU = cpu->cpu_index; info->value->current = (cpu == first_cpu); info->value->halted = cpu->halted; info->value->qom_path = object_get_canonical_path(OBJECT(cpu)); info->value->thread_id = cpu->thread_id; #if defined(TARGET_I386) info->value->arch = CPU_INFO_ARCH_X86; info->value->u.x86.pc = env->eip + env->segs[R_CS].base; #elif defined(TARGET_PPC) info->value->arch = CPU_INFO_ARCH_PPC; info->value->u.ppc.nip = env->nip; #elif defined(TARGET_SPARC) info->value->arch = CPU_INFO_ARCH_SPARC; info->value->u.q_sparc.pc = env->pc; info->value->u.q_sparc.npc = env->npc; #elif defined(TARGET_MIPS) info->value->arch = CPU_INFO_ARCH_MIPS; info->value->u.q_mips.PC = env->active_tc.PC; #elif defined(TARGET_TRICORE) info->value->arch = CPU_INFO_ARCH_TRICORE; info->value->u.tricore.PC = env->PC; #else info->value->arch = CPU_INFO_ARCH_OTHER; #endif if (!cur_item) { head = cur_item = info; } else { cur_item->next = info; cur_item = info; return head;
1threat
OData Support in ASP.net core : <p>Is oData supported now in ASP.netcore now that version 1 has been released?</p> <p>I have searched, but I could not find anything that says one way or the other.</p>
0debug
Storing MySQL query result into a PHP array : <p>Looking at all the questions are using the depreciated <code>mysql_fetch_assoc/array,</code> hence I don't think that this is a duplicate question.</p> <p>I have a MySQL table with 5 columns, </p> <p><code>ID | NAME | AGE | GENDER | HEIGHT</code></p> <p>If I want to store the values of <code>NAME, AGE, GENDER</code> in a PHP array, </p> <pre><code>$query=$mysqli-&gt;query("SELECT NAME,AGE,GENDER FROM TableName") while($result = $query-&gt;fetch_assoc() { $array = []; } </code></pre> <p>Will my array be stored in the format of <code>$array=[[Name,Age,Gender],[Name,Age,Gender]]</code>?</p> <p>If not, what would be my approach in doing this?</p>
0debug
How to disable the typo in comment by resharper : <p>For Resharper can't support Chinese well that all of my comment will be suggest changed.</p> <p><a href="https://i.stack.imgur.com/RdZbJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RdZbJ.png" alt="enter image description here"></a></p> <p>But I don't think I need to do it.</p> <p>Questions 1: how to disable the typo in the comment by Resharper?</p> <p>Questions 2: where can I find the Chinese dictionary? I find <a href="https://github.com/wooorm/dictionaries/tree/master/dictionaries" rel="noreferrer">wooorm/dictionaries</a> but I can't find the Chinese dictionary.</p>
0debug
static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size, const char *boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; unsigned int i; void *iommu, *espdma, *ledma, *main_esp, *nvram; qemu_irq *cpu_irqs, *slavio_irq, *espdma_irq, *ledma_irq; qemu_irq *esp_reset, *le_reset; qemu_irq *fdc_tc; ram_addr_t ram_offset, prom_offset, tcx_offset; unsigned long kernel_size; int ret; char buf[1024]; BlockDriverState *fd[MAX_FD]; int drive_index; void *fw_cfg; if (!cpu_model) cpu_model = hwdef->default_cpu_model; env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "qemu: Unable to find Sparc CPU definition\n"); exit(1); } cpu_sparc_set_id(env, 0); qemu_register_reset(main_cpu_reset, env); cpu_irqs = qemu_allocate_irqs(cpu_set_irq, env, MAX_PILS); env->prom_addr = hwdef->slavio_base; if ((uint64_t)RAM_size > hwdef->max_mem) { fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n", (unsigned int)(RAM_size / (1024 * 1024)), (unsigned int)(hwdef->max_mem / (1024 * 1024))); exit(1); } ram_offset = qemu_ram_alloc(RAM_size); cpu_register_physical_memory(0, RAM_size, ram_offset); prom_offset = qemu_ram_alloc(PROM_SIZE_MAX); cpu_register_physical_memory(hwdef->slavio_base, (PROM_SIZE_MAX + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK, prom_offset | IO_MEM_ROM); if (bios_name == NULL) bios_name = PROM_FILENAME; snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); ret = load_elf(buf, hwdef->slavio_base - PROM_VADDR, NULL, NULL, NULL); if (ret < 0 || ret > PROM_SIZE_MAX) ret = load_image_targphys(buf, hwdef->slavio_base, PROM_SIZE_MAX); if (ret < 0 || ret > PROM_SIZE_MAX) { fprintf(stderr, "qemu: could not load prom '%s'\n", buf); exit(1); } slavio_intctl = sun4c_intctl_init(hwdef->intctl_base, &slavio_irq, cpu_irqs); iommu = iommu_init(hwdef->iommu_base, hwdef->iommu_version, slavio_irq[hwdef->me_irq]); espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq], iommu, &espdma_irq, &esp_reset); ledma = sparc32_dma_init(hwdef->dma_base + 16ULL, slavio_irq[hwdef->le_irq], iommu, &ledma_irq, &le_reset); if (graphic_depth != 8 && graphic_depth != 24) { fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth); exit (1); } tcx_offset = qemu_ram_alloc(hwdef->vram_size); tcx_init(ds, hwdef->tcx_base, phys_ram_base + tcx_offset, tcx_offset, hwdef->vram_size, graphic_width, graphic_height, graphic_depth); if (nd_table[0].model == NULL) nd_table[0].model = "lance"; if (strcmp(nd_table[0].model, "lance") == 0) { lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq, le_reset); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: lance\n"); exit (1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); exit (1); } nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, hwdef->nvram_size, 2); slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq], nographic, ESCC_CLOCK, 1); escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], serial_hds[0], serial_hds[1], ESCC_CLOCK, 1); slavio_misc = slavio_misc_init(0, 0, hwdef->aux1_base, 0, slavio_irq[hwdef->me_irq], NULL, &fdc_tc); if (hwdef->fd_base != (target_phys_addr_t)-1) { memset(fd, 0, sizeof(fd)); drive_index = drive_get_index(IF_FLOPPY, 0, 0); if (drive_index != -1) fd[0] = drives_table[drive_index].bdrv; sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd, fdc_tc); } if (drive_get_max_bus(IF_SCSI) > 0) { fprintf(stderr, "qemu: too many SCSI bus\n"); exit(1); } main_esp = esp_init(hwdef->esp_base, 2, espdma_memory_read, espdma_memory_write, espdma, *espdma_irq, esp_reset); for (i = 0; i < ESP_MAX_DEVS; i++) { drive_index = drive_get_index(IF_SCSI, 0, i); if (drive_index == -1) continue; esp_scsi_attach(main_esp, drives_table[drive_index].bdrv, i); } kernel_size = sun4m_load_kernel(kernel_filename, initrd_filename, RAM_size); nvram_init(nvram, (uint8_t *)&nd_table[0].macaddr, kernel_cmdline, boot_device, RAM_size, kernel_size, graphic_width, graphic_height, graphic_depth, hwdef->nvram_machine_id, "Sun4c"); fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2); fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id); }
1threat
Firestore: Use of unresolved identifier 'Firestore' : <p>I wanted to implement the Firestore Database. In my Podfile I added <code>pod 'Firebase/Firestore'</code> and did <code>pod install</code>. When <code>trying to use let db = Firestore.firestore()</code>I get the Error:<code>Use of unresolved identifier 'Firestore'</code>. I have tried pod update too and it also says <code>Using FirebaseFirestore (0.12.2)</code> but it soll doesn't work. What should I do?</p>
0debug
Edge/IE leaves font bits on screen from last string after text changes : So i made a simple word game with html,css and jquery/js that changes the question on screen after each answer, but on some occasion it leaves font traces/bits on screen from the question before that has these letter "roofs" above the font (inside the red circle in the image). I tried to hide/show refresh the elements after each change of sentence but it did'nt help. [font bits on screen][1] [1]: https://i.stack.imgur.com/e0DVp.jpg
0debug
Equivalent Command for "members" in RHEL : <p>I have requirement to check members of the group "wheel" periodically.</p> <p>I see that 'members wheel' is expected to display the members of that group. However when i tried, it says command not found. I see no entries in the man page as well.</p> <p>I am using RHEL - Linux Version 3.10 (Red Hat 4.8.5)</p> <p>I know we can use awk and cat in combination to get these details from "/etc/group" file</p> <p>But is there a straight forward or a better approach?</p>
0debug