problem
stringlengths
26
131k
labels
class label
2 classes
static void cpu_common_initfn(Object *obj) { CPUState *cpu = CPU(obj); CPUClass *cc = CPU_GET_CLASS(obj); cpu->cpu_index = UNASSIGNED_CPU_INDEX; cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs; cpu->nr_cores = 1; cpu->nr_threads = 1; qemu_mutex_init(&cpu->work_mutex); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); cpu->trace_dstate = bitmap_new(trace_get_vcpu_event_count()); cpu_exec_initfn(cpu); }
1threat
static void decode_q_branch(SnowContext *s, int level, int x, int y){ const int w= s->b_width << s->block_max_depth; const int rem_depth= s->block_max_depth - level; const int index= (x + y*w) << rem_depth; int trx= (x+1)<<rem_depth; const BlockNode *left = x ? &s->block[index-1] : &null_block; const BlockNode *top = y ? &s->block[index-w] : &null_block; const BlockNode *tl = y && x ? &s->block[index-w-1] : left; const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; int s_context= 2*left->level + 2*top->level + tl->level + tr->level; if(s->keyframe){ set_blocks(s, level, x, y, null_block.color[0], null_block.color[1], null_block.color[2], null_block.mx, null_block.my, null_block.ref, BLOCK_INTRA); return; } if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){ int type, mx, my; int l = left->color[0]; int cb= left->color[1]; int cr= left->color[2]; int ref = 0; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx)); int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my)); type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0; if(type){ pred_mv(s, &mx, &my, 0, left, top, tr); l += get_symbol(&s->c, &s->block_state[32], 1); cb+= get_symbol(&s->c, &s->block_state[64], 1); cr+= get_symbol(&s->c, &s->block_state[96], 1); }else{ if(s->ref_frames > 1) ref= get_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], 0); pred_mv(s, &mx, &my, ref, left, top, tr); mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1); my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1); } set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type); }else{ decode_q_branch(s, level+1, 2*x+0, 2*y+0); decode_q_branch(s, level+1, 2*x+1, 2*y+0); decode_q_branch(s, level+1, 2*x+0, 2*y+1); decode_q_branch(s, level+1, 2*x+1, 2*y+1); } }
1threat
Push to vuex store array not working in VueJS : <p>I'm using Vuex to show a list of users from 'store.js'. That js file has array like this.</p> <pre><code>var store = new Vuex.Store({ state: { customers: [ { id: '1', name: 'user 1',}, ] } }) </code></pre> <p>I want to insert a new set of values to the same array </p> <blockquote> <p>{ id: '1', name: 'user 1',}</p> </blockquote> <p>The above values are obtained from a URL (vue-resource). Below is the code to push the obtained data to the array. However, the data is not inserting</p> <pre><code>mounted: function() { this.$http.get('http://localhost/facebook-login/api/get_customers.php') .then(response =&gt; { return response.data; }) .then(data =&gt; { store.state.customers.push(data) // not working!! console.log(data) // prints { id: '2', name: 'User 2',} store.state.customers.push({ id: '2', name: 'User 2',}) }); } </code></pre>
0debug
Invalid columnname c# SQL-statement : first i got that USER was incorrect synthax and it should be "[USER]" instead. But now i get that the ex: {"Invalid column name 'USER'."}. I don't know what to do, it seems that i either get one error or the other. private void btnEDIT_Click(object sender, EventArgs e) { string _ID = lblUserID.Text; // THESE ARE TO COLLECT THE INFORMAITON FROM THE TEXTBOXES IN WHICH YOU EDIT THE "USERS" string _user = tbUser.Text.Trim(); string _password = tbPassword.Text.Trim().ToLower(); string _role = tbRole.Text.Trim(); editDataGrid(_user, _password, _role); // THIS IS FOR UPDATING MY GRID AT THE SAME TIME string str = "Update UserValidation SET [USER] = '" + _user + "', PASSWORD = '" + _password + "', ROLE = '" + _role + "' WHERE userID ='" + _ID + "'"; clsDB.InsUpDel(str); // MY METHOD FOR EXECUTING SQL STATMENTS }
0debug
How to get backup database in google cloud platform : i had a google cloud account with 300 $ free, and i have created some website with it, when my account spent all free money 300$ ,its was stop service but i forgot save backup database of all websites. So please anyone can help me to get backup my database of websites from google cloud ?? or show me how to get link to download it . Thanks
0debug
static void do_audio_out(AVFormatContext *s, OutputStream *ost, AVFrame *frame) { AVCodecContext *enc = ost->enc_ctx; AVPacket pkt; int got_packet = 0; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; if (!check_recording_time(ost)) return; if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0) frame->pts = ost->sync_opts; ost->sync_opts = frame->pts + frame->nb_samples; ost->samples_encoded += frame->nb_samples; ost->frames_encoded++; av_assert0(pkt.size || !pkt.data); update_benchmark(NULL); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder <- type:audio " "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n", av_ts2str(frame->pts), av_ts2timestr(frame->pts, &enc->time_base), enc->time_base.num, enc->time_base.den); } if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) { av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); exit_program(1); } update_benchmark("encode_audio %d.%d", ost->file_index, ost->index); if (got_packet) { av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:audio " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); } write_frame(s, &pkt, ost); } }
1threat
Angular2: Export of RouterModule, Why it is required? : <p>I am learning <a href="http://angular.io" rel="noreferrer">Angular 2</a>'s <a href="https://angular.io/docs/ts/latest/guide/ngmodule.html#app-routing" rel="noreferrer">app-routing</a> from official documentation. I am going through following piece of code. </p> <pre><code>import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; export const routes: Routes = [ { path: '', redirectTo: 'contact', pathMatch: 'full'}, { path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' }, { path: 'heroes', loadChildren: 'app/hero/hero.module#HeroModule' } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule {} </code></pre> <p>It creates an <code>AppRoutingModule</code> and defines <code>routes</code> for it. The part which I am not able to understand is <strong>Why do we need to export RouterModule again?</strong> I believe it's one of the core angular module and which available everywhere by import of <code>@angular/router</code>. </p>
0debug
How to create table according to screenshoot using html and css : [enter image description here][1] [1]: https://i.stack.imgur.com/zieQ2.png I have only problem with the small column. How to create the small column. Please see the image. Thanks in Advance.
0debug
PHP Insert into my database won't work : <p>I'm trying to insert html input into my database. Php returns me no error, but when I go to my database, there is nothing, why ?</p> <pre><code>if(isset($_POST['texte'])) { $texte = $_POST['texte']; try { $dbh = new PDO('mysql:host=localhost;dbname=textes', 'root', ''); $req = $dbh-&gt;prepare('INSERT INTO textes VALUES(txt)'); $req-&gt;execute(array( 'txt' =&gt; $texte )); echo 'Le jeu a bien été ajouté !'; } catch (Exception $e) { die('Erreur : ' . $e-&gt;getMessage()); } </code></pre>
0debug
c# wpf treeviewitem with contextmenu : <p>i just want to make right click menucontext with normal treeviewitem. all example i can find , it ask to bind with something . but i just don't want to bind any thing .</p> <p>for example:</p> <pre><code> TreeViewItem ceo = new TreeViewItem() { Header = "CEO" }; TreeViewItem manager1 = new TreeViewItem() { Header = "Manager1" }; TreeViewItem manager2 = new TreeViewItem() { Header = "Manager2" }; TreeViewItem person1 = new TreeViewItem() { Header = "person1" }; TreeViewItem person2 = new TreeViewItem() { Header = "person2" }; manager1.Items.Add(person1); manager2.Items.Add(person2); ceo.Items.Add(manager1); ceo.Items.Add(manager2); </code></pre> <p>i just want to make the subnode menucontext , can we?</p>
0debug
def magic_square_test(my_matrix): iSize = len(my_matrix[0]) sum_list = [] sum_list.extend([sum (lines) for lines in my_matrix]) for col in range(iSize): sum_list.append(sum(row[col] for row in my_matrix)) result1 = 0 for i in range(0,iSize): result1 +=my_matrix[i][i] sum_list.append(result1) result2 = 0 for i in range(iSize-1,-1,-1): result2 +=my_matrix[i][i] sum_list.append(result2) if len(set(sum_list))>1: return False return True
0debug
Docker build-arg and copy : <p>Trying to copy a folders content, it works when i hard code the path like:</p> <pre><code>COPY ./my-folder /path/to/location </code></pre> <p>But need to be able to change this path so i tried using a build argument like this:</p> <pre><code>COPY ${folderVariable} /path/to/location </code></pre> <p>and then build with </p> <pre><code>--build-arg folderVariable=./my-folder </code></pre> <p>But it copies everything in the same folder as "my-folder", when i only want the contents of "my-folder"</p>
0debug
delete pairs of data out of a range : I'm trying to delete from a matrix like this: x y 37.013930 048.775597 43.015619 348.803652 06.017302 349.831709 05.018978 348.859767 37.020646 300.887827 23.022307 348.915887l . . . . . . the data pairs (x, y) that are not in the range (44,350.5)=>(4.5,35.8). Does anyone know how to do it?
0debug
React Native - Dynamically Add Element to DOM on button press : <p>In react native i'm trying to dynamically add an element to the DOM on a button click.</p> <p>This is what I have so far in the Render() method:</p> <pre><code>&lt;TouchableHighlight style={styles.button} onPress={this.addAnotherRow}&gt; &lt;Text&gt;Add new row&lt;/Text&gt; &lt;/TouchableHighlight&gt; </code></pre> <p>I'm not sure what to return from the onpress function to add another DOM element:</p> <pre><code>addAnotherRow() { return &lt;Text&gt;New Row&lt;/Text&gt; } </code></pre> <p>Any help please?</p>
0debug
How can I store the value of the attribute example style which is inside a div tag which is in the form of property value : **<div class="card card-stats" style="background-color:#FF001A">** 1.The above line is the part of HTML code . 2.The below line is the javascript where I am fetching the background color- red which is in hex code . 3. I am confused with the syntax and methods how can we fetch the style attribute value which is having **#FF001A** hex code and store it in a variable using javascript.Later I will compare that value with Red color and my code will execute further. ---------------------------------------------------------------------- ***UnSure** //var a=document.getElementsByTagName('div').item(0).getAttributeNode('style'); // var b=a.getAttributeNode("STYLE").value ;
0debug
static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len, const uint8_t **srcbuf, int buf_size, int non_mod, uint8_t *map_table) { GetBitContext gb; int bits; int run_length; int pixels_read = 0; init_get_bits(&gb, *srcbuf, buf_size << 3); while (get_bits_count(&gb) < buf_size << 3 && pixels_read < dbuf_len) { bits = get_bits(&gb, 2); if (bits) { if (non_mod != 1 || bits != 1) { if (map_table) *destbuf++ = map_table[bits]; else *destbuf++ = bits; } pixels_read++; } else { bits = get_bits1(&gb); if (bits == 1) { run_length = get_bits(&gb, 3) + 3; bits = get_bits(&gb, 2); if (non_mod == 1 && bits == 1) pixels_read += run_length; else { if (map_table) bits = map_table[bits]; while (run_length-- > 0 && pixels_read < dbuf_len) { *destbuf++ = bits; pixels_read++; } } } else { bits = get_bits1(&gb); if (bits == 0) { bits = get_bits(&gb, 2); if (bits == 2) { run_length = get_bits(&gb, 4) + 12; bits = get_bits(&gb, 2); if (non_mod == 1 && bits == 1) pixels_read += run_length; else { if (map_table) bits = map_table[bits]; while (run_length-- > 0 && pixels_read < dbuf_len) { *destbuf++ = bits; pixels_read++; } } } else if (bits == 3) { run_length = get_bits(&gb, 8) + 29; bits = get_bits(&gb, 2); if (non_mod == 1 && bits == 1) pixels_read += run_length; else { if (map_table) bits = map_table[bits]; while (run_length-- > 0 && pixels_read < dbuf_len) { *destbuf++ = bits; pixels_read++; } } } else if (bits == 1) { pixels_read += 2; if (map_table) bits = map_table[0]; else bits = 0; if (pixels_read <= dbuf_len) { *destbuf++ = bits; *destbuf++ = bits; } } else { (*srcbuf) += (get_bits_count(&gb) + 7) >> 3; return pixels_read; } } else { if (map_table) bits = map_table[0]; else bits = 0; *destbuf++ = bits; pixels_read++; } } } } if (get_bits(&gb, 6)) av_log(0, AV_LOG_ERROR, "DVBSub error: line overflow\n"); (*srcbuf) += (get_bits_count(&gb) + 7) >> 3; return pixels_read; }
1threat
Ajax return call for error is not returning : <p>I have an Ajax call inside a function like so:</p> <pre><code>function send_data(url, data) { $.ajax({ url: url, type: 'POST', data: data, success: function (data) { //Empty for now }, error: function (xhr) { return xhr.responseJSON; }, }); } </code></pre> <p>and then I trigger this function like so:</p> <pre><code>console.log(send_data(url, data)); </code></pre> <p>I should receive the response output, but I don't. I instead, get undefined. I know JavaScript is asynchronous, but shouldn't this work? I added a <code>console.log</code> output inside the error function, before the return statement, and it outputs the data correctly. So why doesn't it return the data?</p>
0debug
How can I access array's item when there is an object in it? : <p>I have an array like this:</p> <pre><code>echo "&lt;pre&gt;"; print_r($res_users); /* Array ( [0] =&gt; stdClass Object ( [position] =&gt; 1 [user] =&gt; stdClass Object ( [full_name] =&gt; دکوراسیون [is_private] =&gt; 1 [has_anonymous_profile_picture] =&gt; [byline] =&gt; 39.3k followers [profile_pic_url] =&gt; https://scontent-frt3-1.cdninstagram.com/t51.2885-19/s150x150/11352072_817936521647202_201395223_a.jpg [pk] =&gt; 1480272396 [follower_count] =&gt; 39326 [is_verified] =&gt; [mutual_followers_count] =&gt; 0 [username] =&gt; sajad.sobhi ) ) ) </code></pre> <p>All I'm trying to do is selecting following URL from array above:</p> <pre><code>https://scontent-frt3-1.cdninstagram.com/t51.2885-19/s150x150/11352072_817936521647202_201395223_a.jpg </code></pre> <p>Which is the value of <code>profile_pic_url</code>. How can I get that?</p> <hr> <p>Noted that this doesn't work:</p> <pre><code>echo $res_users[0]['user']['profile_pic_url']; </code></pre>
0debug
liste chainées C : i dunno how to formulate a question when i dunno what's the problem at all, since i'm still new at the linked list stuff in C, anyhow this is my code #include <stdio.h> #include <stdlib.h> typedef struct Element{ int val; struct Element* suivant; }Element; Element* initialiserListe(Element* L){ L = NULL; return L; } Element* nouveau; Element* insererEnTete(Element* L){ nouveau = (Element*)malloc(sizeof(Element)); if(L == NULL) printf("initialisation : "); printf("donner une valeur : "); scanf("%d", &nouveau->val); nouveau->suivant = L; return nouveau; } int listeVide(Element* L){ return L == NULL; } void affichageListe(Element* L){ if(listeVide(L)) printf("liste vide"); else{ Element* temp = L; while(temp != NULL){ printf("%d", temp->val); temp = temp->suivant; } } } int main() { printf("Hello world!\n"); Element *L = NULL; initialiserListe(L); insererEnTete(L); affichageListe(L); return 0; } all i wanna know is why does it print "liste vide" when it should print the vals from the list
0debug
static void avc_luma_midv_qrt_8w_msa(const uint8_t *src, int32_t src_stride, uint8_t *dst, int32_t dst_stride, int32_t height, uint8_t ver_offset) { uint32_t loop_cnt; v16i8 src0, src1, src2, src3, src4; v16i8 mask0, mask1, mask2; v8i16 hz_out0, hz_out1, hz_out2, hz_out3; v8i16 hz_out4, hz_out5, hz_out6, hz_out7, hz_out8; v8i16 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7; v16u8 out; LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2); LD_SB5(src, src_stride, src0, src1, src2, src3, src4); XORI_B5_128_SB(src0, src1, src2, src3, src4); src += (5 * src_stride); hz_out0 = AVC_HORZ_FILTER_SH(src0, mask0, mask1, mask2); hz_out1 = AVC_HORZ_FILTER_SH(src1, mask0, mask1, mask2); hz_out2 = AVC_HORZ_FILTER_SH(src2, mask0, mask1, mask2); hz_out3 = AVC_HORZ_FILTER_SH(src3, mask0, mask1, mask2); hz_out4 = AVC_HORZ_FILTER_SH(src4, mask0, mask1, mask2); for (loop_cnt = (height >> 2); loop_cnt--;) { LD_SB4(src, src_stride, src0, src1, src2, src3); XORI_B4_128_SB(src0, src1, src2, src3); src += (4 * src_stride); hz_out5 = AVC_HORZ_FILTER_SH(src0, mask0, mask1, mask2); hz_out6 = AVC_HORZ_FILTER_SH(src1, mask0, mask1, mask2); hz_out7 = AVC_HORZ_FILTER_SH(src2, mask0, mask1, mask2); hz_out8 = AVC_HORZ_FILTER_SH(src3, mask0, mask1, mask2); dst0 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out0, hz_out1, hz_out2, hz_out3, hz_out4, hz_out5); dst2 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out1, hz_out2, hz_out3, hz_out4, hz_out5, hz_out6); dst4 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out2, hz_out3, hz_out4, hz_out5, hz_out6, hz_out7); dst6 = AVC_CALC_DPADD_H_6PIX_2COEFF_SH(hz_out3, hz_out4, hz_out5, hz_out6, hz_out7, hz_out8); if (ver_offset) { dst1 = __msa_srari_h(hz_out3, 5); dst3 = __msa_srari_h(hz_out4, 5); dst5 = __msa_srari_h(hz_out5, 5); dst7 = __msa_srari_h(hz_out6, 5); } else { dst1 = __msa_srari_h(hz_out2, 5); dst3 = __msa_srari_h(hz_out3, 5); dst5 = __msa_srari_h(hz_out4, 5); dst7 = __msa_srari_h(hz_out5, 5); } SAT_SH4_SH(dst1, dst3, dst5, dst7, 7); dst0 = __msa_aver_s_h(dst0, dst1); dst1 = __msa_aver_s_h(dst2, dst3); dst2 = __msa_aver_s_h(dst4, dst5); dst3 = __msa_aver_s_h(dst6, dst7); out = PCKEV_XORI128_UB(dst0, dst0); ST8x1_UB(out, dst); dst += dst_stride; out = PCKEV_XORI128_UB(dst1, dst1); ST8x1_UB(out, dst); dst += dst_stride; out = PCKEV_XORI128_UB(dst2, dst2); ST8x1_UB(out, dst); dst += dst_stride; out = PCKEV_XORI128_UB(dst3, dst3); ST8x1_UB(out, dst); dst += dst_stride; hz_out0 = hz_out4; hz_out1 = hz_out5; hz_out2 = hz_out6; hz_out3 = hz_out7; hz_out4 = hz_out8; } }
1threat
How to extract date in dd-mmm-yyyy from string using regular expression : I am not good at creating regular expression.can any one help me with that.I need to extract Date Time from Following string. This Date time format remain constant and not going change.Can any one help me with that Composed by super, mtzshm to super, mtzshm on 31-Mar-2016 02:24 with Normal priority and Message Type General Message Composed by super, mtzshm to (Group)My Favorites on 31-Mar-2016 02:24 with Normal priority and Message Type General Message Attached by super, mtzshm on 31-Mar-2016 02:24 Patient: MTzPatient, 89107 Chart: 31-Mar-2016 02:23 Visit: 31-Mar-2016 17:22 Displayed by super, mtzshm on 31-Mar-2016 02:24 Displayed by super, mtzshm on 31-Mar-2016 03:14
0debug
target_ulong spapr_hypercall(CPUPPCState *env, target_ulong opcode, target_ulong *args) { if (msr_pr) { hcall_dprintf("Hypercall made with MSR[PR]=1\n"); return H_PRIVILEGE; } if ((opcode <= MAX_HCALL_OPCODE) && ((opcode & 0x3) == 0)) { spapr_hcall_fn fn = papr_hypercall_table[opcode / 4]; if (fn) { return fn(env, spapr, opcode, args); } } else if ((opcode >= KVMPPC_HCALL_BASE) && (opcode <= KVMPPC_HCALL_MAX)) { spapr_hcall_fn fn = kvmppc_hypercall_table[opcode - KVMPPC_HCALL_BASE]; if (fn) { return fn(env, spapr, opcode, args); } } hcall_dprintf("Unimplemented hcall 0x" TARGET_FMT_lx "\n", opcode); return H_FUNCTION; }
1threat
static int dmg_open(BlockDriverState *bs, int flags) { BDRVDMGState *s = bs->opaque; off_t info_begin,info_end,last_in_offset,last_out_offset; uint32_t count; uint32_t max_compressed_size=1,max_sectors_per_chunk=1,i; int64_t offset; bs->read_only = 1; s->n_chunks = 0; s->offsets = s->lengths = s->sectors = s->sectorcounts = NULL; offset = bdrv_getlength(bs->file); if (offset < 0) { goto fail; } offset -= 0x1d8; info_begin = read_off(bs, offset); if (info_begin == 0) { goto fail; } if (read_uint32(bs, info_begin) != 0x100) { goto fail; } count = read_uint32(bs, info_begin + 4); if (count == 0) { goto fail; } info_end = info_begin + count; offset = info_begin + 0x100; last_in_offset = last_out_offset = 0; while (offset < info_end) { uint32_t type; count = read_uint32(bs, offset); if(count==0) goto fail; offset += 4; type = read_uint32(bs, offset); if (type == 0x6d697368 && count >= 244) { int new_size, chunk_count; offset += 4; offset += 200; chunk_count = (count-204)/40; new_size = sizeof(uint64_t) * (s->n_chunks + chunk_count); s->types = g_realloc(s->types, new_size/2); s->offsets = g_realloc(s->offsets, new_size); s->lengths = g_realloc(s->lengths, new_size); s->sectors = g_realloc(s->sectors, new_size); s->sectorcounts = g_realloc(s->sectorcounts, new_size); for(i=s->n_chunks;i<s->n_chunks+chunk_count;i++) { s->types[i] = read_uint32(bs, offset); offset += 4; if(s->types[i]!=0x80000005 && s->types[i]!=1 && s->types[i]!=2) { if(s->types[i]==0xffffffff) { last_in_offset = s->offsets[i-1]+s->lengths[i-1]; last_out_offset = s->sectors[i-1]+s->sectorcounts[i-1]; } chunk_count--; i--; offset += 36; continue; } offset += 4; s->sectors[i] = last_out_offset+read_off(bs, offset); offset += 8; s->sectorcounts[i] = read_off(bs, offset); offset += 8; s->offsets[i] = last_in_offset+read_off(bs, offset); offset += 8; s->lengths[i] = read_off(bs, offset); offset += 8; if(s->lengths[i]>max_compressed_size) max_compressed_size = s->lengths[i]; if(s->sectorcounts[i]>max_sectors_per_chunk) max_sectors_per_chunk = s->sectorcounts[i]; } s->n_chunks+=chunk_count; } } s->compressed_chunk = g_malloc(max_compressed_size+1); s->uncompressed_chunk = g_malloc(512*max_sectors_per_chunk); if(inflateInit(&s->zstream) != Z_OK) goto fail; s->current_chunk = s->n_chunks; qemu_co_mutex_init(&s->lock); return 0; fail: return -1; }
1threat
static hwaddr get_offset(hwaddr phys_addr, DumpState *s) { RAMBlock *block; hwaddr offset = s->memory_offset; int64_t size_in_block, start; if (s->has_filter) { if (phys_addr < s->begin || phys_addr >= s->begin + s->length) { return -1; } } QTAILQ_FOREACH(block, &ram_list.blocks, next) { if (s->has_filter) { if (block->offset >= s->begin + s->length || block->offset + block->length <= s->begin) { continue; } if (s->begin <= block->offset) { start = block->offset; } else { start = s->begin; } size_in_block = block->length - (start - block->offset); if (s->begin + s->length < block->offset + block->length) { size_in_block -= block->offset + block->length - (s->begin + s->length); } } else { start = block->offset; size_in_block = block->length; } if (phys_addr >= start && phys_addr < start + size_in_block) { return phys_addr - start + offset; } offset += size_in_block; } return -1; }
1threat
static always_inline void gen_farith2 (void *helper, int rb, int rc) { if (unlikely(rc == 31)) return; if (rb != 31) tcg_gen_helper_1_1(helper, cpu_fir[rc], cpu_fir[rb]); else { TCGv tmp = tcg_const_i64(0); tcg_gen_helper_1_1(helper, cpu_fir[rc], tmp); tcg_temp_free(tmp); } }
1threat
static int local_chown(FsContext *fs_ctx, const char *path, FsCred *credp) { if ((credp->fc_uid == -1 && credp->fc_gid == -1) || (fs_ctx->fs_sm == SM_PASSTHROUGH)) { return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); } else if (fs_ctx->fs_sm == SM_MAPPED) { return local_set_xattr(rpath(fs_ctx, path), credp); } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); } return -1; }
1threat
android ImageView allways top and bottom : <p>In activity, i has 2 ImageView and LinearLayout1 hold some text and button.<br> i want like :</p> <p><a href="https://i.stack.imgur.com/iZLNi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iZLNi.png" alt="enter image description here"></a></p> <p>how to do it?</p>
0debug
Python aiohttp/asyncio - how to process returned data : <p>Im in the process of moving some synchronous code to asyncio using aiohttp. the synchronous code was taking 15 minutes to run, so I'm hoping to improves this.</p> <p>I have some working code which gets data from some urls and returns the body of each. But this is just against 1 lab site, I have 70+ actual sites.</p> <p>So if I got a loop to create a list of all the urls for all sites that would make 700 urls in a list to be processed. Now processing them I don't think is a problem?</p> <p>But doing 'stuff' with the results, I'm not sure how to program? I have code already that will do 'stuff' to each of the results that are returned, but I'm not sure how to program against the right type of result.</p> <p>When the code runs does it process all urls and depending on the time to run, return an unknown order?</p> <p>Do I need a function that will process any type of result?</p> <pre><code>import asyncio, aiohttp, ssl from bs4 import BeautifulSoup def page_content(page): return BeautifulSoup(page, 'html.parser') async def fetch(session, url): with aiohttp.Timeout(15, loop=session.loop): async with session.get(url) as response: return page_content(await response.text()) async def get_url_data(urls, username, password): tasks = [] # Fetch all responses within one Client session, # keep connection alive for all requests. async with aiohttp.ClientSession(auth=aiohttp.BasicAuth(username, password)) as session: for i in urls: task = asyncio.ensure_future(fetch(session, i)) tasks.append(task) responses = await asyncio.gather(*tasks) # you now have all response bodies in this variable for i in responses: print(i.title.text) return responses def main(): username = 'monitoring' password = '*********' ip = '10.10.10.2' urls = [ 'http://{0}:8444/level/15/exec/-/ping/{1}/timeout/1/source/vlan/5/CR'.format(ip,'10.10.0.1'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'10.10.0.1'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'frontend.domain.com'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'planner.domain.com'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'10.10.10.1'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'10.11.11.1'), 'http://{0}:8444/level/15/exec/-/ping/{1}/timeout/1/source/vlan/5/CR'.format(ip,'10.12.12.60'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'10.12.12.60'), 'http://{0}:8444/level/15/exec/-/ping/{1}/timeout/1/source/vlan/5/CR'.format(ip,'lon-dc-01.domain.com'), 'http://{0}:8444/level/15/exec/-/traceroute/{1}/source/vlan/5/probe/2/timeout/1/ttl/0/10/CR'.format(ip,'lon-dc-01.domain.com'), ] loop = asyncio.get_event_loop() future = asyncio.ensure_future(get_url_data(urls,username,password)) data = loop.run_until_complete(future) print(data) if __name__ == "__main__": main() </code></pre>
0debug
Can I test AWS Glue code locally? : <p>After reading Amazon docs, my understanding is that the only way to run/test a Glue script is to deploy it to a dev endpoint and debug remotely if necessary. At the same time, if the (Python) code consists of multiple files and packages, all except the main script need to be zipped. All this gives me the feeling that Glue is not suitable for any complex ETL task as development and testing is cumbersome. I could test my Spark code locally without having to upload the code to S3 every time, and verify the tests on a CI server without having to pay for a development Glue endpoint.</p>
0debug
static int xcbgrab_reposition(AVFormatContext *s, xcb_query_pointer_reply_t *p, xcb_get_geometry_reply_t *geo) { XCBGrabContext *c = s->priv_data; int x = c->x, y = c->y, p_x = p->win_x, p_y = p->win_y; int w = c->width, h = c->height, f = c->follow_mouse; if (!p || !geo) return AVERROR(EIO); if (f == FOLLOW_CENTER) { x = p_x - w / 2; y = p_y - h / 2; } else { int left = x + f; int right = x + w - f; int top = y + f; int bottom = y + h + f; if (p_x > right) { x += p_x - right; } else if (p_x < left) { x -= left - p_x; } if (p_y > bottom) { y += p_y - bottom; } else if (p_y < top) { y -= top - p_y; } } c->x = FFMIN(FFMAX(0, x), geo->width - w); c->y = FFMIN(FFMAX(0, y), geo->height - h); return 0; }
1threat
White Page PHP data insert : Good day comrades. I am looking for answers about 10 hours on stackoverflow and google, have read about 50 same questions, every time its different, my head is allready has been boiling. I have a simple PHP CRUD application with OOP. It has a connection to BD(it works, my data gets from bd and i could see it at my index.php in opera/safari), has 'add' action(it doesn't work - white page), 'edit' action (it doesn't work - white page), 'delete' action (it works). I am using in my project: -PHPSTORM -PHP CLI interpreter 7.2 -PHP language level 5.6 add.php code: <html> <head> <title>Add Data</title> </head> <body> <?php include_once("classes/Crud.php"); include_once("classes/Validation.php"); $crud = new Crud(); $validation = new Validation(); if(isset($_POST['Submit'])) { $name = $crud->escape_string($_POST['name']); $age = $crud->escape_string($_POST['age']); $email = $crud->escape_string($_POST['email']); $msg = $validation->check_empty($_POST, array('name', 'age', 'email')); $check_age = $validation->is_age_valid($_POST['age']); $check_email = $validation->is_email_valid($_POST['email']); if($msg != null) { echo $msg; echo "<br/><a href='javascript:self.history.back();'>Go Back</a>"; } elseif (!$check_age) { echo 'Please provide proper age.'; } elseif (!$check_email) { echo 'Please provide proper email.'; } else { $result = $crud->execute("INSERT INTO users(name,age,email) VALUES('$name','$age','$email')"); echo "<p style='color=green'>Data added successfully."; echo "<br/><a href='index.php'>View Result</a>"; } }?> </body> </html> edit.php <?php include_once("classes/Crud.php"); $crud = new Crud(); $id = $crud->escape_string($_GET['id']); $result = $crud->getData("SELECT * FROM users WHERE id=$id"); foreach ($result as $res) { $name = $res['name']; $age = $res['age']; $email = $res['email']; } ?> <html> <head> <title>Edit Data</title> </head> <body> <a href="index.php">Home</a> <br/><br/> <form name="form1" method="post" action="editaction.php"> <table border="0"> <tr> <td>Name</td> <td><input type="text" name="name" value="<?php echo $name;?>"></td> </tr> <tr> <td>Age</td> <td><input type="text" name="age" value="<?php echo $age;?>"></td> </tr> <tr> <td>Email</td> <td><input type="text" name="email" value="<?php echo $email;?>"></td> </tr> <tr> <td><input type="hidden" name="id" value=<?php echo $_GET['id'];?>></td> <td><input type="submit" name="update" value="Update"> </td> </tr> </table> </form> </body> </html> editaction.php <?php include_once("classes/Crud.php"); include_once("classes/Validation.php"); $crud = new Crud(); $validation = new Validation(); if(isset($_POST['update'])) { $id = $crud->escape_string($_POST['id']); $name = $crud->escape_string($_POST['name']); $age = $crud->escape_string($_POST['age']); $email = $crud->escape_string($_POST['email']); $msg = $validation->check_empty($_POST, array('name', 'age', 'email')); $check_age = $validation->is_age_valid($_POST['age']); $check_email = $validation->is_email_valid($_POST['email']); if($msg) { echo $msg; echo "<br/><a href='javascript:self.history.back();'>Go Back</a>"; } elseif (!$check_age) { echo 'Please provide proper age.'; } elseif (!$check_email) { echo 'Please provide proper email.'; } else { $result = $crud->execute("UPDATE users SET name='$name',age='$age',email='$email' WHERE id=$id"); header("Location: index.php"); } } ?> If local experts need more information or files from my project i will provide it. Help me, plz.
0debug
Limit results from database using ajax (by selecting a dropdown menu) : <p>So I got a simple dropdown menu with some values in it. What I want to happen is the following:</p> <p>When a user selects a value in the dropdownlist, for example '8'. I want the query to change it's limit to 8. </p> <p>And when a user selects '12' I want the limit to change to 12.</p> <p>So change the amount of results loaded according to the value selected in the drop-down list.</p> <p>I know I can achieve this with ajax, but I have no idea where to start. Does anyone know some good tutorials? Or does anyone have some code to get me started?</p> <p>I'm familiar with PHP, just not with ajax.</p>
0debug
def list_to_float(test_list): res = [] for tup in test_list: temp = [] for ele in tup: if ele.isalpha(): temp.append(ele) else: temp.append(float(ele)) res.append((temp[0],temp[1])) return (str(res))
0debug
How I can Check if numbers are in a specific range : I'm beginner:( How I can Check if numbers are in a specific range ? for example I have to find an number between 0 to 500 int k = 200; if (k<=0 && k>500){ if (k<=0 && k>249){
0debug
Using Realm in React Native app with Redux : <p>I am about to undertake the development of a React Native app and am thoroughly convinced of the benefits of managing the app's state using Redux, however I'd like to make the app's data available whilst offline by using Realm for persistent storage. What I'm wondering is how Redux will play with Realm?</p> <p>The app I'm developing will pull a large amount of JSON data via a RESTful API and then I'd like to persist this data to local storage - Realm seems to be an excellent option for this. What I'm unsure of however is how the Realm database will exist within the Redux store? Will it have to exist external to the store? Is using Realm within a Redux based app somehow a contradiction?</p> <p>I've had a good search for articles describing the use of Realm, or other storage options (Asyncstorage or SQLite) for large datasets with Redux and could find little information.</p>
0debug
static void nfs_co_generic_bh_cb(void *opaque) { NFSRPC *task = opaque; task->complete = 1; qemu_bh_delete(task->bh); qemu_coroutine_enter(task->co, NULL); }
1threat
Cake PHP show Internal Server Error 500 : Following cake php code is in index.php file when it runs on server it shows internal server error 500. <?php if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!defined('ROOT')) { define('ROOT', dirname(dirname(dirname(__FILE__)))); } if (!defined('APP_DIR')) { define('APP_DIR', basename(dirname(dirname(__FILE__)))); } $vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib'; $dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php'; if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) { define('CAKE_CORE_INCLUDE_PATH', $vendorPath); } if (!defined('WEBROOT_DIR')) { define('WEBROOT_DIR', basename(dirname(__FILE__))); } if (!defined('WWW_ROOT')) { define('WWW_ROOT', dirname(__FILE__) . DS); } if (php_sapi_name() === 'cli-server') { if ($_SERVER['REQUEST_URI'] !== '/' && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) { return false; } $_SERVER['PHP_SELF'] = '/' . basename(__FILE__); } if (!defined('CAKE_CORE_INCLUDE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); } if (!include 'Cake' . DS . 'bootstrap.php') { $failed = true; } } else { if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') { $failed = true; } } if (!empty($failed)) { trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR); } App::uses('Dispatcher', 'Routing'); $Dispatcher = new Dispatcher(); $Dispatcher->dispatch( new CakeRequest(), new CakeResponse() ); Cake PHP show Internal Server Error 500 Cake PHP show Internal Server Error 500 Cake PHP show Internal Server Error 500
0debug
why [::-1] reverse a list instead of returning the first index only? : <p>peace upon you guys i was starting to learn python using head first book and i came across this [::-1] in lists i know that when u dont include the "start" it equals to 0 by default and the "stop" equals the maximum index number in the list so if we said the max is 5 so this means [0:5:-1] and if u run this u will get the first index but if u run this [::-1] it gives u the list in reverse order why? isnt [::-1] == [0:5:-1] but it seems it equals this instead [-1:5:-1]! so why the step index here define the start index !? </p> <pre><code>book = "The Hitchhiker's Guide to the Galaxy" booklist = list(book) booklist = ['T', 'h', 'e', ' ', 'H', 'i', 't', 'c', 'h', 'h', 'i', 'k', 'e', 'r', "'", 's', ' ', 'G', 'u', 'i', 'd', 'e', ' ', 't', 'o', ' ', 't', 'h', 'e', ' ', 'G', 'a', 'l', 'a', 'x', 'y'] backwards = booklist[::-1] print(''.join(backwards)) </code></pre> <p>output >>> yxalaG eht ot ediuG s'rekihhctiH ehT </p> <p><code>backwards = booklist[0::-1] print(''.join(backwards))</code></p> <p>output >>> T</p> <pre><code>backwards = booklist[-1::-1] print(''.join(backwards)) </code></pre> <p>output >>> yxalaG eht ot ediuG s'rekihhctiH ehT</p>
0debug
.CSS replace item in menu using only custom.css in wordpress : I would like to replace this image when i scroll down on another image . 1stly menu looks like : [![enter image description here][1]][1] And when i scroll little bit down menu looks like : [![enter image description here][2]][2] Is it possible to replace using custom.css this item in menu? I just want to replace this picture on another picture. Is it possible to do by using only custom.css or i need to have acces to files and use here java? When it's possible can somene just tell how? Thank you. [1]: https://i.stack.imgur.com/eIRVC.png [2]: https://i.stack.imgur.com/zmEiw.png
0debug
Creating a custom iOS voice recognition software : <p>I have a fairly general question, but I cannot find what I'm looking for online. I've already developed an iOS app which gives stats about a certain cryptocurrency.</p> <p>I want the user to be able to say which currency they want, and the app returns that info.</p> <p>The problem is, coins that don't have English names (Poloniex), aren't recognized. </p> <p>My question is: Where can I find a voice recognition API where I can add <strong>custom words</strong> to my app.</p>
0debug
Is stack unwinding with exceptions guaranteed by c++ standard? : <p>Concerning the stack unwinding, the c++ standard says: </p> <blockquote> <p>An exception is considered uncaught after completing the initialization of the exception object ([except.throw]) until completing the activation of a handler for the exception ([except.handle]). This includes stack unwinding. </p> </blockquote> <p>at <a href="http://eel.is/c++draft/except#uncaught-1">par 15.5.3</a> of the current standard. I was trying to understand what the latest sentence (<code>This includes stack unwindings</code>) is referring to:</p> <ul> <li>is it supposed that the compiler must take care of unwinding the stack?</li> <li>or, is it saying that it is compiler-dependent whether to unwind or not the stack?</li> </ul> <p>The question arises from the following snippet:</p> <pre><code>#include &lt;iostream&gt; #include &lt;exception&gt; struct S{ S() { std::cout &lt;&lt; " S constructor" &lt;&lt; std::endl; } virtual ~S() { std::cout &lt;&lt; " S destructor" &lt;&lt; std::endl; } }; void f() { try{throw(0);} catch(...){} } void g() { throw(10); } int main() { S s; f(); //g(); } </code></pre> <p>Now: </p> <ol> <li>if you run it as-is (catching the exception), you have a hint of the stack unwinding</li> <li>if you comment <code>f();</code> and uncomment <code>g();</code> (not catching the exception), you have hint of stack not being unwound</li> </ol> <p>So, the two experiments seem to be in favor of the first bullet above; both clang++ and g++ agree on the result (but it is not a discriminant). </p> <p>Also, it seems to me very strange that the standard, which is really careful in specifying the object <em>live time</em> and <em>duration</em> is leaving a shadow here.</p> <p>May anyone clarify? Is stack unwinding for uncaught exceptions guaranteed by the standard? If yes, where? If not, why?</p>
0debug
How to change a Div background url which is inside a <a> tag? : I have 6 div tags with background images, inside a <a> tags. What I want to do is highlight or change the relevant background image of the div tag once clicked it. <td><a href="../pages/index.php"><div id="dashboardDiv" style="background:url(../images/home.png) no-repeat center";)></div></a></td> <td></td> <td><a href="../pages/suppliers.php"><div id="suppliersDiv" style="background:url(../images/Suppliers.png) no-repeat center";)></div></a></td> <td></td> <td><a href="../pages/customers.php"><div id="customersDiv" style="background:url(../images/customers.png) no-repeat center";)></div></a> </td> <td></td> <td><a href="../pages/purchases.php"><div id="purchasesDiv" style="background:url(../images/Purchases.png) no-repeat center";)></div></a> </td> <td></td> <td><a href="../pages/sales.php"> <div id="salesDiv" style="background:url(../images/Sales.png) no-repeat center";)></div></a></td> <td></td> <td><a href="../pages/inventory.php"><div id="inventoryDiv" style="background:url(../images/Inventory.png) no-repeat center";)></div></a></td> <td></td> <td><a href="../pages/reports.php"><div id="reportsDiv" style="background:url(../images/Reports.png) no-repeat center";)></div></a></td> <td></td> </tr> CSS: #dashboardDiv{ border:thin; float:left; height: 133px; width: 133px; }
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
static int xface_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { XFaceContext *xface = avctx->priv_data; ProbRangesQueue pq = {{ 0 }, 0}; uint8_t bitmap_copy[XFACE_PIXELS]; BigInt b = {0}; int i, j, k, ret = 0; const uint8_t *buf; uint8_t *p; char intbuf[XFACE_MAX_DIGITS]; if (avctx->width || avctx->height) { if (avctx->width != XFACE_WIDTH || avctx->height != XFACE_HEIGHT) { av_log(avctx, AV_LOG_ERROR, "Size value %dx%d not supported, only accepts a size of %dx%d\n", avctx->width, avctx->height, XFACE_WIDTH, XFACE_HEIGHT); return AVERROR(EINVAL); } } avctx->width = XFACE_WIDTH; avctx->height = XFACE_HEIGHT; buf = frame->data[0]; i = j = 0; do { for (k = 0; k < 8; k++) xface->bitmap[i++] = (buf[j]>>(7-k))&1; if (++j == XFACE_WIDTH/8) { buf += frame->linesize[0]; j = 0; } } while (i < XFACE_PIXELS); memcpy(bitmap_copy, xface->bitmap, XFACE_PIXELS); ff_xface_generate_face(xface->bitmap, bitmap_copy); encode_block(xface->bitmap, 16, 16, 0, &pq); encode_block(xface->bitmap + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16 + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 16 + 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32 + 16, 16, 16, 0, &pq); encode_block(xface->bitmap + XFACE_WIDTH * 32 + 32, 16, 16, 0, &pq); while (pq.prob_ranges_idx > 0) push_integer(&b, pq.prob_ranges[--pq.prob_ranges_idx]); i = 0; while (b.nb_words) { uint8_t r; ff_big_div(&b, XFACE_PRINTS, &r); intbuf[i++] = r + XFACE_FIRST_PRINT; } if ((ret = ff_alloc_packet2(avctx, pkt, i+2)) < 0) return ret; p = pkt->data; while (--i >= 0) *(p++) = intbuf[i]; *(p++) = '\n'; *(p++) = 0; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
1threat
static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, int letter, const char *buf) { RTSPState *rt = s->priv_data; char buf1[64], st_type[64]; const char *p; enum AVMediaType codec_type; int payload_type; AVStream *st; RTSPStream *rtsp_st; RTSPSource *rtsp_src; struct sockaddr_storage sdp_ip; int ttl; av_dlog(s, "sdp: %c='%s'\n", letter, buf); p = buf; if (s1->skip_media && letter != 'm') return; switch (letter) { case 'c': get_word(buf1, sizeof(buf1), &p); if (strcmp(buf1, "IN") != 0) return; get_word(buf1, sizeof(buf1), &p); if (strcmp(buf1, "IP4") && strcmp(buf1, "IP6")) return; get_word_sep(buf1, sizeof(buf1), "/", &p); if (get_sockaddr(buf1, &sdp_ip)) return; ttl = 16; if (*p == '/') { p++; get_word_sep(buf1, sizeof(buf1), "/", &p); ttl = atoi(buf1); } if (s->nb_streams == 0) { s1->default_ip = sdp_ip; s1->default_ttl = ttl; } else { rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; rtsp_st->sdp_ip = sdp_ip; rtsp_st->sdp_ttl = ttl; } break; case 's': av_dict_set(&s->metadata, "title", p, 0); break; case 'i': if (s->nb_streams == 0) { av_dict_set(&s->metadata, "comment", p, 0); break; } break; case 'm': s1->skip_media = 0; s1->seen_fmtp = 0; s1->seen_rtpmap = 0; codec_type = AVMEDIA_TYPE_UNKNOWN; get_word(st_type, sizeof(st_type), &p); if (!strcmp(st_type, "audio")) { codec_type = AVMEDIA_TYPE_AUDIO; } else if (!strcmp(st_type, "video")) { codec_type = AVMEDIA_TYPE_VIDEO; } else if (!strcmp(st_type, "application")) { codec_type = AVMEDIA_TYPE_DATA; } if (codec_type == AVMEDIA_TYPE_UNKNOWN || !(rt->media_type_mask & (1 << codec_type))) { s1->skip_media = 1; return; } rtsp_st = av_mallocz(sizeof(RTSPStream)); if (!rtsp_st) return; rtsp_st->stream_index = -1; dynarray_add(&rt->rtsp_streams, &rt->nb_rtsp_streams, rtsp_st); rtsp_st->sdp_ip = s1->default_ip; rtsp_st->sdp_ttl = s1->default_ttl; copy_default_source_addrs(s1->default_include_source_addrs, s1->nb_default_include_source_addrs, &rtsp_st->include_source_addrs, &rtsp_st->nb_include_source_addrs); copy_default_source_addrs(s1->default_exclude_source_addrs, s1->nb_default_exclude_source_addrs, &rtsp_st->exclude_source_addrs, &rtsp_st->nb_exclude_source_addrs); get_word(buf1, sizeof(buf1), &p); rtsp_st->sdp_port = atoi(buf1); get_word(buf1, sizeof(buf1), &p); if (!strcmp(buf1, "udp")) rt->transport = RTSP_TRANSPORT_RAW; else if (strstr(buf1, "/AVPF") || strstr(buf1, "/SAVPF")) rtsp_st->feedback = 1; get_word(buf1, sizeof(buf1), &p); rtsp_st->sdp_payload_type = atoi(buf1); if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) { if (rt->transport == RTSP_TRANSPORT_RAW) { if (!rt->ts && CONFIG_RTPDEC) rt->ts = ff_mpegts_parse_open(s); } else { RTPDynamicProtocolHandler *handler; handler = ff_rtp_handler_find_by_id( rtsp_st->sdp_payload_type, AVMEDIA_TYPE_DATA); init_rtp_handler(handler, rtsp_st, NULL); if (handler && handler->init) handler->init(s, -1, rtsp_st->dynamic_protocol_context); } } else if (rt->server_type == RTSP_SERVER_WMS && codec_type == AVMEDIA_TYPE_DATA) { } else { st = avformat_new_stream(s, NULL); if (!st) return; st->id = rt->nb_rtsp_streams - 1; rtsp_st->stream_index = st->index; st->codec->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { RTPDynamicProtocolHandler *handler; ff_rtp_get_codec_info(st->codec, rtsp_st->sdp_payload_type); if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->codec->sample_rate > 0) avpriv_set_pts_info(st, 32, 1, st->codec->sample_rate); handler = ff_rtp_handler_find_by_id( rtsp_st->sdp_payload_type, st->codec->codec_type); init_rtp_handler(handler, rtsp_st, st->codec); if (handler && handler->init) handler->init(s, st->index, rtsp_st->dynamic_protocol_context); } } av_strlcpy(rtsp_st->control_url, rt->control_uri, sizeof(rtsp_st->control_url)); break; case 'a': if (av_strstart(p, "control:", &p)) { if (s->nb_streams == 0) { if (!strncmp(p, "rtsp: av_strlcpy(rt->control_uri, p, sizeof(rt->control_uri)); } else { char proto[32]; rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; av_url_split(proto, sizeof(proto), NULL, 0, NULL, 0, NULL, NULL, 0, p); if (proto[0] == '\0') { if (rtsp_st->control_url[strlen(rtsp_st->control_url)-1]!='/') av_strlcat(rtsp_st->control_url, "/", sizeof(rtsp_st->control_url)); av_strlcat(rtsp_st->control_url, p, sizeof(rtsp_st->control_url)); } else av_strlcpy(rtsp_st->control_url, p, sizeof(rtsp_st->control_url)); } } else if (av_strstart(p, "rtpmap:", &p) && s->nb_streams > 0) { get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; if (rtsp_st->stream_index >= 0) { st = s->streams[rtsp_st->stream_index]; sdp_parse_rtpmap(s, st, rtsp_st, payload_type, p); } s1->seen_rtpmap = 1; if (s1->seen_fmtp) { parse_fmtp(s, rt, payload_type, s1->delayed_fmtp); } } else if (av_strstart(p, "fmtp:", &p) || av_strstart(p, "framesize:", &p)) { get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); if (s1->seen_rtpmap) { parse_fmtp(s, rt, payload_type, buf); } else { s1->seen_fmtp = 1; av_strlcpy(s1->delayed_fmtp, buf, sizeof(s1->delayed_fmtp)); } } else if (av_strstart(p, "range:", &p)) { int64_t start, end; rtsp_parse_range_npt(p, &start, &end); s->start_time = start; s->duration = (end == AV_NOPTS_VALUE) ? AV_NOPTS_VALUE : end - start; } else if (av_strstart(p, "IsRealDataType:integer;",&p)) { if (atoi(p) == 1) rt->transport = RTSP_TRANSPORT_RDT; } else if (av_strstart(p, "SampleRate:integer;", &p) && s->nb_streams > 0) { st = s->streams[s->nb_streams - 1]; st->codec->sample_rate = atoi(p); } else if (av_strstart(p, "crypto:", &p) && s->nb_streams > 0) { rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; get_word(buf1, sizeof(buf1), &p); get_word(rtsp_st->crypto_suite, sizeof(rtsp_st->crypto_suite), &p); p += strspn(p, SPACE_CHARS); if (av_strstart(p, "inline:", &p)) get_word(rtsp_st->crypto_params, sizeof(rtsp_st->crypto_params), &p); } else if (av_strstart(p, "source-filter:", &p)) { int exclude = 0; get_word(buf1, sizeof(buf1), &p); if (strcmp(buf1, "incl") && strcmp(buf1, "excl")) return; exclude = !strcmp(buf1, "excl"); get_word(buf1, sizeof(buf1), &p); if (strcmp(buf1, "IN") != 0) return; get_word(buf1, sizeof(buf1), &p); if (strcmp(buf1, "IP4") && strcmp(buf1, "IP6") && strcmp(buf1, "*")) return; get_word(buf1, sizeof(buf1), &p); while (*p != '\0') { rtsp_src = av_mallocz(sizeof(*rtsp_src)); if (!rtsp_src) return; get_word(rtsp_src->addr, sizeof(rtsp_src->addr), &p); if (exclude) { if (s->nb_streams == 0) { dynarray_add(&s1->default_exclude_source_addrs, &s1->nb_default_exclude_source_addrs, rtsp_src); } else { rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; dynarray_add(&rtsp_st->exclude_source_addrs, &rtsp_st->nb_exclude_source_addrs, rtsp_src); } } else { if (s->nb_streams == 0) { dynarray_add(&s1->default_include_source_addrs, &s1->nb_default_include_source_addrs, rtsp_src); } else { rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; dynarray_add(&rtsp_st->include_source_addrs, &rtsp_st->nb_include_source_addrs, rtsp_src); } } } } else { if (rt->server_type == RTSP_SERVER_WMS) ff_wms_parse_sdp_a_line(s, p); if (s->nb_streams > 0) { rtsp_st = rt->rtsp_streams[rt->nb_rtsp_streams - 1]; if (rt->server_type == RTSP_SERVER_REAL) ff_real_parse_sdp_a_line(s, rtsp_st->stream_index, p); if (rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) rtsp_st->dynamic_handler->parse_sdp_a_line(s, rtsp_st->stream_index, rtsp_st->dynamic_protocol_context, buf); } } break; } }
1threat
How to replace punctations at the end and beginning of a string : How can I remove all punctuations except ' in the first character and last character of a string in java. I have tried using regex with replaceFirst() but didn't succeed.
0debug
How to set sql dialect in IntelliJ : <p>I'm working with IntelliJ 2017. I want to set the SQL dialect for an sql file. After I created the file, there is a message at the top saying the SQL dialect for the file is not set. When I click on the "Change Dialect to.." link, it opens an SQL Dialects menu. On the right, there is a pulldown link to select the dialect, but the pull down menu is empty. I went into Preferences > Languages and Frameworks > SQL Dialects to try to add some, but that menu is also empty and I can't seem to modify any of the fields. </p> <p>How do I add SQL dialects to IntelliJ, so I can select one for this file? Below is a photo of the menu I get when I select "Change Dialect to..." in the sql file </p> <p><a href="https://i.stack.imgur.com/ZN8FG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZN8FG.png" alt="enter image description here"></a></p> <p>Below is a photo of the menu I get from Perferences > Languages and Frameworks > SQL Dialects. I can't edit any of the fields.</p> <p><a href="https://i.stack.imgur.com/zdhoI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zdhoI.png" alt="enter image description here"></a></p>
0debug
static struct pxa2xx_fir_s *pxa2xx_fir_init(target_phys_addr_t base, qemu_irq irq, struct pxa2xx_dma_state_s *dma, CharDriverState *chr) { int iomemtype; struct pxa2xx_fir_s *s = (struct pxa2xx_fir_s *) qemu_mallocz(sizeof(struct pxa2xx_fir_s)); s->base = base; s->irq = irq; s->dma = dma; s->chr = chr; pxa2xx_fir_reset(s); iomemtype = cpu_register_io_memory(0, pxa2xx_fir_readfn, pxa2xx_fir_writefn, s); cpu_register_physical_memory(s->base, 0xfff, iomemtype); if (chr) qemu_chr_add_handlers(chr, pxa2xx_fir_is_empty, pxa2xx_fir_rx, pxa2xx_fir_event, s); register_savevm("pxa2xx_fir", 0, 0, pxa2xx_fir_save, pxa2xx_fir_load, s); return s; }
1threat
Any help please by code that lets the second video start after the first finish ? Or i must use scripts for this to work? : I have 2 links for videos coded in <div> . i need a help by code to let the second play automatically after the first video has ended ,i didn't post the code because I am facing troubles on this site (code is not properly formatted ) I am using CSS and HTML5 . Any help please ?
0debug
to represent signed value range in unsigned value range in C : how to convert a value in -128 to 127 range to 0 to 255 range. I have a value in a signed variable . I need to print the converted value with a unsigned variable.
0debug
moving html element from one page to another : I want to move some html code from one page to another page and dont want to retype that line of code again. how would I move it. example page1.html <div class="container"> <img src="img/img1.jpg" alt="image"> <div class="container_para"> <p>this is image tag</p> </div> </div> page2.html <div class="page2"> <img src="img/img2.jpg" alt="image"> </div> how could I move all content of class `container_para` to page2.html using javascript?
0debug
minimum no of swap of operator to compliment expression tree evaluation : we have a expression tree where leaf node contain 0 or 1 as value, and all the internal nodes contain "&" or "||" as operator.now we evaluate the tree the result will be either 0 or 1. The question is minimum no of swap of internal node required to compliment the result of original expression tree. we can flip any internal node e.g:if it is a "&" we can make it "||" and vice versa. To solve this I tried the following technique but I didn't succeeded in it: my approach was that I would check the root whether it is a "&" or "||" operator and what was the result of evaluation tree 0 or 1.depending on that we go forward.
0debug
static void check_suspend_mode(GuestSuspendMode mode, Error **errp) { SYSTEM_POWER_CAPABILITIES sys_pwr_caps; Error *local_err = NULL; if (error_is_set(errp)) { return; } ZeroMemory(&sys_pwr_caps, sizeof(sys_pwr_caps)); if (!GetPwrCapabilities(&sys_pwr_caps)) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "failed to determine guest suspend capabilities"); goto out; } switch (mode) { case GUEST_SUSPEND_MODE_DISK: if (!sys_pwr_caps.SystemS4) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "suspend-to-disk not supported by OS"); } break; case GUEST_SUSPEND_MODE_RAM: if (!sys_pwr_caps.SystemS3) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "suspend-to-ram not supported by OS"); } break; default: error_set(&local_err, QERR_INVALID_PARAMETER_VALUE, "mode", "GuestSuspendMode"); } out: if (local_err) { error_propagate(errp, local_err); } }
1threat
How to create progressbar like below screenshot? : <p>I want to create below type circular progressbar with drawable xml </p> <p><a href="https://i.stack.imgur.com/a1Uw6.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a1Uw6.gif" alt="enter image description here"></a></p>
0debug
Bar Chart with multiple labels : <p>The following code only shows the main category ['one', 'two', 'three', 'four', 'five', 'six'] as the x axis labels. Is there a way show subcategory ['A', 'B', 'C', 'D'] as secondary x axis labels? <a href="https://i.stack.imgur.com/du1my.png" rel="noreferrer"><img src="https://i.stack.imgur.com/du1my.png" alt="enter image description here"></a></p> <pre><code>df = pd.DataFrame(np.random.rand(6, 4), index=['one', 'two', 'three', 'four', 'five', 'six'], columns=pd.Index(['A', 'B', 'C', 'D'], name='Genus')).round(2) df.plot(kind='bar',figsize=(10,4)) </code></pre>
0debug
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) { BinkContext * const c = avctx->priv_data; GetBitContext gb; int blk; int i, j, plane, plane_idx, bx, by; uint8_t *dst, *prev, *ref, *ref_start, *ref_end; int v, col[2]; const uint8_t *scan; int xoff, yoff; DECLARE_ALIGNED_16(DCTELEM, block[64]); DECLARE_ALIGNED_16(uint8_t, ublock[64]); int coordmap[64]; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } init_get_bits(&gb, pkt->data, pkt->size*8); if (c->version >= 'i') skip_bits_long(&gb, 32); for (plane = 0; plane < 3; plane++) { const int stride = c->pic.linesize[plane]; int bw = plane ? (avctx->width + 15) >> 4 : (avctx->width + 7) >> 3; int bh = plane ? (avctx->height + 15) >> 4 : (avctx->height + 7) >> 3; int width = avctx->width >> !!plane; init_lengths(c, FFMAX(width, 8), bw); for (i = 0; i < BINK_NB_SRC; i++) read_bundle(&gb, c, i); plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3); ref_start = c->last.data[plane_idx]; ref_end = c->last.data[plane_idx] + (bw - 1 + c->last.linesize[plane_idx] * (bh - 1)) * 8; for (i = 0; i < 64; i++) coordmap[i] = (i & 7) + (i >> 3) * stride; for (by = 0; by < bh; by++) { if (read_block_types(avctx, &gb, &c->bundle[BINK_SRC_BLOCK_TYPES]) < 0) return -1; if (read_block_types(avctx, &gb, &c->bundle[BINK_SRC_SUB_BLOCK_TYPES]) < 0) return -1; if (read_colors(&gb, &c->bundle[BINK_SRC_COLORS], c) < 0) return -1; if (read_patterns(avctx, &gb, &c->bundle[BINK_SRC_PATTERN]) < 0) return -1; if (read_motion_values(avctx, &gb, &c->bundle[BINK_SRC_X_OFF]) < 0) return -1; if (read_motion_values(avctx, &gb, &c->bundle[BINK_SRC_Y_OFF]) < 0) return -1; if (read_dcs(avctx, &gb, &c->bundle[BINK_SRC_INTRA_DC], DC_START_BITS, 0) < 0) return -1; if (read_dcs(avctx, &gb, &c->bundle[BINK_SRC_INTER_DC], DC_START_BITS, 1) < 0) return -1; if (read_runs(avctx, &gb, &c->bundle[BINK_SRC_RUN]) < 0) return -1; if (by == bh) break; dst = c->pic.data[plane_idx] + 8*by*stride; prev = c->last.data[plane_idx] + 8*by*stride; for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) { blk = get_value(c, BINK_SRC_BLOCK_TYPES); if ((by & 1) && blk == SCALED_BLOCK) { bx++; dst += 8; prev += 8; continue; } switch (blk) { case SKIP_BLOCK: c->dsp.put_pixels_tab[1][0](dst, prev, stride, 8); break; case SCALED_BLOCK: blk = get_value(c, BINK_SRC_SUB_BLOCK_TYPES); switch (blk) { case RUN_BLOCK: scan = bink_patterns[get_bits(&gb, 4)]; i = 0; do { int run = get_value(c, BINK_SRC_RUN) + 1; i += run; if (i > 64) { av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { v = get_value(c, BINK_SRC_COLORS); for (j = 0; j < run; j++) ublock[*scan++] = v; } else { for (j = 0; j < run; j++) ublock[*scan++] = get_value(c, BINK_SRC_COLORS); } } while (i < 63); if (i == 63) ublock[*scan++] = get_value(c, BINK_SRC_COLORS); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct(block); c->dsp.put_pixels_nonclamped(block, ublock, 8); break; case FILL_BLOCK: v = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[0](dst, v, stride, 16); break; case PATTERN_BLOCK: for (i = 0; i < 2; i++) col[i] = get_value(c, BINK_SRC_COLORS); for (j = 0; j < 8; j++) { v = get_value(c, BINK_SRC_PATTERN); for (i = 0; i < 8; i++, v >>= 1) ublock[i + j*8] = col[v & 1]; } break; case RAW_BLOCK: for (j = 0; j < 8; j++) for (i = 0; i < 8; i++) ublock[i + j*8] = get_value(c, BINK_SRC_COLORS); break; default: av_log(avctx, AV_LOG_ERROR, "Incorrect 16x16 block type %d\n", blk); return -1; } if (blk != FILL_BLOCK) c->dsp.scale_block(ublock, dst, stride); bx++; dst += 8; prev += 8; break; case MOTION_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; if (ref < ref_start || ref > ref_end) { av_log(avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", bx*8 + xoff, by*8 + yoff); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); break; case RUN_BLOCK: scan = bink_patterns[get_bits(&gb, 4)]; i = 0; do { int run = get_value(c, BINK_SRC_RUN) + 1; i += run; if (i > 64) { av_log(avctx, AV_LOG_ERROR, "Run went out of bounds\n"); return -1; } if (get_bits1(&gb)) { v = get_value(c, BINK_SRC_COLORS); for (j = 0; j < run; j++) dst[coordmap[*scan++]] = v; } else { for (j = 0; j < run; j++) dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS); } } while (i < 63); if (i == 63) dst[coordmap[*scan++]] = get_value(c, BINK_SRC_COLORS); break; case RESIDUE_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; if (ref < ref_start || ref > ref_end) { av_log(avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", bx*8 + xoff, by*8 + yoff); return -1; } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); v = get_bits(&gb, 7); read_residue(&gb, block, v); c->dsp.add_pixels8(dst, block, stride); break; case INTRA_BLOCK: c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTRA_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 1); c->dsp.idct_put(dst, stride, block); break; case FILL_BLOCK: v = get_value(c, BINK_SRC_COLORS); c->dsp.fill_block_tab[1](dst, v, stride, 8); break; case INTER_BLOCK: xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); c->dsp.clear_block(block); block[0] = get_value(c, BINK_SRC_INTER_DC); read_dct_coeffs(&gb, block, c->scantable.permutated, 0); c->dsp.idct_add(dst, stride, block); break; case PATTERN_BLOCK: for (i = 0; i < 2; i++) col[i] = get_value(c, BINK_SRC_COLORS); for (i = 0; i < 8; i++) { v = get_value(c, BINK_SRC_PATTERN); for (j = 0; j < 8; j++, v >>= 1) dst[i*stride + j] = col[v & 1]; } break; case RAW_BLOCK: for (i = 0; i < 8; i++) memcpy(dst + i*stride, c->bundle[BINK_SRC_COLORS].cur_ptr + i*8, 8); c->bundle[BINK_SRC_COLORS].cur_ptr += 64; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown block type %d\n", blk); return -1; } } } if (get_bits_count(&gb) & 0x1F) skip_bits_long(&gb, 32 - (get_bits_count(&gb) & 0x1F)); } emms_c(); *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; FFSWAP(AVFrame, c->pic, c->last); return pkt->size; }
1threat
static void test_retry_flush(const char *machine) { QPCIDevice *dev; void *bmdma_base, *ide_base; uint8_t data; const char *s; prepare_blkdebug_script(debug_path, "flush_to_disk"); ide_test_start( "-vnc none " "-drive file=blkdebug:%s:%s,if=ide,cache=writeback,format=raw," "rerror=stop,werror=stop", debug_path, tmp_path); dev = get_pci_device(&bmdma_base, &ide_base); qtest_irq_intercept_in(global_qtest, "ioapic"); make_dirty(0); qpci_io_writeb(dev, ide_base + reg_device, 0); qpci_io_writeb(dev, ide_base + reg_command, CMD_FLUSH_CACHE); data = qpci_io_readb(dev, ide_base + reg_status); assert_bit_set(data, BSY | DRDY); assert_bit_clear(data, DF | ERR | DRQ); qmp_eventwait("STOP"); s = "{'execute':'cont' }"; qmp_discard_response(s); data = qpci_io_readb(dev, ide_base + reg_device); g_assert_cmpint(data & DEV, ==, 0); do { data = qpci_io_readb(dev, ide_base + reg_status); } while (data & BSY); assert_bit_set(data, DRDY); assert_bit_clear(data, BSY | DF | ERR | DRQ); ide_test_quit(); }
1threat
static void hextile_enc_cord(uint8_t *ptr, int x, int y, int w, int h) { ptr[0] = ((x & 0x0F) << 4) | (y & 0x0F); ptr[1] = (((w - 1) & 0x0F) << 4) | ((h - 1) & 0x0F); }
1threat
How to emit a Type in .NET Core : <p>In C#, how do I emit a new Type at runtime with .NET Core? All of the examples I can find for .NET 6 don't seem to work in .NET core (they all begin with getting the current AppDomain, which doesn't exist in .NET core any more).</p> <p>If possible I would appreciate an example that involves creating a Type and adding a property to the Type.</p>
0debug
Read or emulate nfc card with android 4.2.2 : Can I read or emulate with android 4.2.2(Galaxy s4) iso 14443b (nfc card) like `sri 512`? If yes what can I emulate ? all the card data? thank you
0debug
Python - How can I eliminate same characters with same index between two strings? : For example, two strings are given as "hello" and "sello" It removes the same characters with the same index between two strings. After the elimination loop, it should return "h" and "s" respectively. And for example, two strings are given as "sony" and "nani" then it should return "soy" and "nai"
0debug
Graph-tool surprisingly slow compared to Networkx : <p>After looking at the impressive <a href="https://graph-tool.skewed.de/performance" rel="noreferrer">performance comparison</a>, I decided that I would give a try to graph-tool. So for comparison, I wrote codes to generate a random tree using both packages. </p> <p>The graph-tool code:</p> <pre><code>import numpy as np import graph_tool.all as gt # construct an initial graph with two nodes and one link n = 5000 G = gt.Graph(directed = False) G.add_edge(0, 1) for t in range(2, n): # connect the new vertex to one of the old vertices randomly G.add_edge(np.random.choice(range(t)), t) </code></pre> <p>The Networkx code:</p> <pre><code>import networkx as nx import numpy as np n = 5000 # initial graph G = nx.Graph() G.add_edge(0, 1) for t in range(2, n): G.add_edge(t, np.random.choice(range(t))) </code></pre> <p>The graph-tool takes around 14 seconds on my 4-core machine whereas networkx takes less than 2 seconds on the same machine! Am I missing something obvious?</p> <p>Thanks in advance.</p>
0debug
pd.read_csv by default treats integers like floats : <p>I have a <code>csv</code> that looks like (headers = first row):</p> <pre><code>name,a,a1,b,b1 arnold,300311,arnld01,300311,arnld01 sam,300713,sam01,300713,sam01 </code></pre> <p>When I run:</p> <pre><code>df = pd.read_csv('file.csv') </code></pre> <p>Columns <code>a</code> and <code>b</code> have a <code>.0</code> attached to the end like so:</p> <pre><code>df.head() name,a,a1,b,b1 arnold,300311.0,arnld01,300311.0,arnld01 sam,300713.0,sam01,300713.0,sam01 </code></pre> <p>Columns <code>a</code> and <code>b</code> are integers or blanks so why does <code>pd.read_csv()</code> treat them like floats and how do I ensure they are integers on the read? </p>
0debug
Get device token with react native : <p>Is there any way to get the device token for notifications on demand with react native? It seems, from the docs, like the only time the token is exposed is on the PushNotification register event.</p> <p>More generally, what's the common practice for handling device tokens? </p> <p>If one user logs into my app, the app requests permissions from PushNotification, the register event is fired and I can associate that device with the logged in user. So far so good, but if that user logs out, and I break that association to stop the notifications, what do I do when another user logs in? The app already has permissions, so register won't fire again. How do I get the device token to associate it with the new user? </p> <p>Or am I thinking about this the wrong way?</p>
0debug
Create a temporary directory for specific steps in Jenkins pipeline : <p>Is there a Jenkins pipeline step that will create and run a block of steps in a directory?</p> <p>I know that the <code>dir</code> step runs the steps in the block in a specific directory:</p> <pre class="lang-java prettyprint-override"><code>// not in /tmp/jobDir dir ('/tmp/jobDir') { // these steps get run in /tmp/jobDir } // once again not in /tmp/jobDir </code></pre> <p>My question is if there is a step in Pipeline or in a plugin that let's me run this codeblock, but <code>/tmp/jobDir</code> is created at the start of the block, and is removed at the end of the block.</p> <p>Something like:</p> <pre class="lang-java prettyprint-override"><code>// /tmp/jobDir does not exist dir ('/tmp/jobDir') { // /tmp/jobDir now exists // these steps get run in /tmp/jobDir } // /tmp/jobDir has been removed </code></pre> <p>Does such a step or plugin exist?</p>
0debug
udp_listen(Slirp *slirp, uint32_t haddr, u_int hport, uint32_t laddr, u_int lport, int flags) { struct sockaddr_in addr; struct socket *so; socklen_t addrlen = sizeof(struct sockaddr_in); so = socreate(slirp); if (!so) { so->s = qemu_socket(AF_INET,SOCK_DGRAM,0); so->so_expire = curtime + SO_EXPIRE; insque(so, &slirp->udb); addr.sin_family = AF_INET; addr.sin_addr.s_addr = haddr; addr.sin_port = hport; if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) { udp_detach(so); socket_set_fast_reuse(so->s); getsockname(so->s,(struct sockaddr *)&addr,&addrlen); so->fhost.sin = addr; sotranslate_accept(so); so->so_lfamily = AF_INET; so->so_lport = lport; so->so_laddr.s_addr = laddr; if (flags != SS_FACCEPTONCE) so->so_expire = 0; so->so_state &= SS_PERSISTENT_MASK; so->so_state |= SS_ISFCONNECTED | flags; return so;
1threat
How to set the elevation of an AppBarLayout programmatically in the Android Support Library v24.0.0? : <p>When upgrading from the Android Support Library v23.4.0 to v24.0.0, setting the elevation to 0 programmatically to an AppBarLayout stopped working:</p> <pre><code>appBayLayout.setElevation(0); </code></pre> <p>It does work when setting the elevation in the XML.</p>
0debug
NullPointerException in Processing Please : I am making an animation in Processing it is a simulation of a ball going up and coming down, I have an error saying 'NullPointerException' it keeps appearing I will give the code and show the error place.: Obj[] objs = new Obj[100]; void setup(){ size(1000, 1000); } void draw(){ background(250); for(int i = 0; i < objs.length; i++){ objs[i].render(); objs[i].up(); objs[i].run(); } } the error is at objs[i].render(); here is the code for Obj: class Obj{ float x; float y; float speed; float pspeed; float velocity; void render(){ fill(0); ellipse(x, y, 5, 5); } void up(){ x = random(-1000, 1000); y = y-1010; } void run(){ speed = random(4, 6); pspeed = speed; velocity = 0.05; while(y<random(700, 1100)){ y=y-speed; speed=speed-velocity; } while(y>0){ y=y+pspeed; pspeed = pspeed - velocity; } } } Plz help!
0debug
Python, printing words from a list one at a time : <p>I have the following code that prints the 3 words in the list over and over again. I'm trying to figure out how to print one word from the list, then wait for user intervention (like a key press) then print the second word and so on. I think it is probably an easy solution, but I just can't seem to figure it out at this time. I'm new at this. Thanks in advance.</p> <pre><code>list = ["foo","bar", "baz"] i = 0 while i &lt; len(list): element = list [i] i += 1 print(element) if i == 3: i = 0 </code></pre>
0debug
How to create a hand shake effect in the png : I have a png in which i want the hands to shake.I am providing the link to the png.Kindly help me out and please prefer using css js html and jquery to do so Kind regards
0debug
Description of reactjs reducer related terms : <p>Please give a brief description of <strong>middleware</strong>,<strong>thunk</strong> &amp; <strong>redux-logger</strong> used in reactjs..</p>
0debug
static void listener_add_address_space(MemoryListener *listener, AddressSpace *as) { FlatRange *fr; if (listener->address_space_filter && listener->address_space_filter != as->root) { return; } if (global_dirty_log) { listener->log_global_start(listener); } FOR_EACH_FLAT_RANGE(fr, &as->current_map) { MemoryRegionSection section = { .mr = fr->mr, .address_space = as->root, .offset_within_region = fr->offset_in_region, .size = int128_get64(fr->addr.size), .offset_within_address_space = int128_get64(fr->addr.start), .readonly = fr->readonly, }; listener->region_add(listener, &section); } }
1threat
Is it safe to use ReactDOM.createPortal() with document.body? : <p>I understand that <a href="https://medium.com/@dan_abramov/two-weird-tricks-that-fix-react-7cf9bbdef375" rel="noreferrer">it's probably a bad idea</a> to <a href="https://reactjs.org/docs/react-dom.html#render" rel="noreferrer"><code>ReactDOM.render()</code></a> into <code>document.body</code>. But are there any issues with using <a href="https://reactjs.org/docs/portals.html" rel="noreferrer"><code>ReactDOM.createPortal()</code></a> with <code>document.body</code>?</p> <p>Tried looking for examples of React going bonkers when you render into body so I could test it out with createPortal but I wasn't able to find any.</p> <p>To put things into context, here's a sample usage I'm speaking about:</p> <pre><code>import React from 'react'; import ReactDOM from 'react-dom'; export default class Modal extends React.Component { render() { return ReactDOM.createPortal( &lt;div className='modalContainer'&gt; &lt;div className='modalBox'&gt; {this.props.children} &lt;/div&gt; &lt;/div&gt;, document.body ); } } </code></pre> <p>Haven't run into any issues with this pattern but I'd like to know if there are consequences as I start adding more libraries.</p>
0debug
Use 2D array in a function C++ : <p>I need to use a square 2D array (arr[n][n]) in a C++ void function that creates a latin square but the requirement is that the size of n is not given at the start of program. The user has to input the size of array. Example of my code (that is failing):</p> <pre><code> int n; void arrayz(int n , int arr[][]) { for (int i = 0; i &lt; n; i++) { for (int k = 0; k &lt; n; k++) { for (int e = 1; e &lt;= n; e++) { arr[i][k] = e; } } } } int main() { int arr[n][n]; cin &gt;&gt; n; void arrayz (n, arr[n][n]) } </code></pre> <p>Please help me with this problem!</p>
0debug
excel vba copy paste cells into respective columns : I have an excel 2007 sheet where column names with data are all placed in one single column and I need to shift one column name to the left or right with data so that I can have separate columns. Can you create a VBA function where it reads all rows of the column and shift those columns with certain keywords. such as: A1 B1 1 **Category1** Cat1 info here **cf** 45 34 34 Sf 542 234 234 2 **Category2** Cat2 info here **cf** 76 23 67 **Sf** 678 987 3476 I Need to move "**cf**" column + data to a different column and paste it to its relevant category. So Cf would shift right with data and move up along with its category. I would then delete the empty rows of B Column.
0debug
int omap_validate_tipb_mpui_addr(struct omap_mpu_state_s *s, target_phys_addr_t addr) { return addr >= 0xe1010000 && addr < 0xe1020004; }
1threat
Decrease SQL query : I need to Decrease emplyee salary by 15% that has completed a training course before 15-Nov-2012 and started after 5-Feb-2013
0debug
How to handle datecodes from excel in R with dplyr : <p>Hy everybody</p> <p>I already imported a excelsheet with stock data. The import changes the appearance of the date column. This means, imported in R the dataset has structure as seen in dummy_df2:</p> <pre><code>dates &lt;- as.tibble(c("32143","32146", "32147","32148")) Stock1 &lt;- as.tibble(c("NA", "NA", "NA", "NA")) Stock2 &lt;- as.tibble(c("NA", "NA", "NA", "NA")) Stock3 &lt;- as.tibble(c("NA", "NA", "NA", "NA")) dummy_df &lt;- bind_cols(dates,Stock1,Stock2,Stock3) dummy_df2 &lt;- dummy_df %&gt;% rename(Date ="value", Stock1 = "value1", Stock2 = "value2", Stock3 = "value3") </code></pre> <p>I tried convert the Date column variables via the convertToDate command but it seems not to be the right approach. Does anyone know a handy solution to solve this issue?</p> <p>Kind regards</p>
0debug
I am designing signup page, every time it displays your password dont match , please guide me : every time i submit it it displays your paswwords dont match , please guide me where i am wrong <?php session_start(); $localhost= 'localhost'; $username= 'SK'; $password="29336"; $db = "Internship"; $con= mysqli_connect($localhost,$username,$password,$db); if (isset($_POST['reg_user'])) { $name= $_POST['name']; $email= $_POST['email']; $psd= md5($_POST['psw']); $confirm_psd= $_POST['confirm_psw']; if ($psd == $confirm_psd) { $query = "INSERT INTO register (name, email, password) VALUES('.$name.', '$email', '$psd')"; mysqli_query($con, $query); echo 'inserted'; } else { echo "your password dont match "; } } ?>
0debug
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) { mm_flags = mm_support(); if (avctx->dsp_mask) { if (avctx->dsp_mask & FF_MM_FORCE) mm_flags |= (avctx->dsp_mask & 0xffff); else mm_flags &= ~(avctx->dsp_mask & 0xffff); } #if 0 av_log(avctx, AV_LOG_INFO, "libavcodec: CPU flags:"); if (mm_flags & MM_MMX) av_log(avctx, AV_LOG_INFO, " mmx"); if (mm_flags & MM_MMXEXT) av_log(avctx, AV_LOG_INFO, " mmxext"); if (mm_flags & MM_3DNOW) av_log(avctx, AV_LOG_INFO, " 3dnow"); if (mm_flags & MM_SSE) av_log(avctx, AV_LOG_INFO, " sse"); if (mm_flags & MM_SSE2) av_log(avctx, AV_LOG_INFO, " sse2"); av_log(avctx, AV_LOG_INFO, "\n"); #endif if (mm_flags & MM_MMX) { const int idct_algo= avctx->idct_algo; if(avctx->lowres==0){ if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){ c->idct_put= ff_simple_idct_put_mmx; c->idct_add= ff_simple_idct_add_mmx; c->idct = ff_simple_idct_mmx; c->idct_permutation_type= FF_SIMPLE_IDCT_PERM; #ifdef CONFIG_GPL }else if(idct_algo==FF_IDCT_LIBMPEG2MMX){ if(mm_flags & MM_MMXEXT){ c->idct_put= ff_libmpeg2mmx2_idct_put; c->idct_add= ff_libmpeg2mmx2_idct_add; c->idct = ff_mmxext_idct; }else{ c->idct_put= ff_libmpeg2mmx_idct_put; c->idct_add= ff_libmpeg2mmx_idct_add; c->idct = ff_mmx_idct; } c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; #endif }else if((ENABLE_VP3_DECODER || ENABLE_VP5_DECODER || ENABLE_VP6_DECODER || ENABLE_THEORA_DECODER) && idct_algo==FF_IDCT_VP3){ if(mm_flags & MM_SSE2){ c->idct_put= ff_vp3_idct_put_sse2; c->idct_add= ff_vp3_idct_add_sse2; c->idct = ff_vp3_idct_sse2; c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM; }else{ c->idct_put= ff_vp3_idct_put_mmx; c->idct_add= ff_vp3_idct_add_mmx; c->idct = ff_vp3_idct_mmx; c->idct_permutation_type= FF_PARTTRANS_IDCT_PERM; } }else if(idct_algo==FF_IDCT_CAVS){ c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM; }else if(idct_algo==FF_IDCT_XVIDMMX){ if(mm_flags & MM_SSE2){ c->idct_put= ff_idct_xvid_sse2_put; c->idct_add= ff_idct_xvid_sse2_add; c->idct = ff_idct_xvid_sse2; c->idct_permutation_type= FF_SSE2_IDCT_PERM; }else if(mm_flags & MM_MMXEXT){ c->idct_put= ff_idct_xvid_mmx2_put; c->idct_add= ff_idct_xvid_mmx2_add; c->idct = ff_idct_xvid_mmx2; }else{ c->idct_put= ff_idct_xvid_mmx_put; c->idct_add= ff_idct_xvid_mmx_add; c->idct = ff_idct_xvid_mmx; } } } c->put_pixels_clamped = put_pixels_clamped_mmx; c->put_signed_pixels_clamped = put_signed_pixels_clamped_mmx; c->add_pixels_clamped = add_pixels_clamped_mmx; c->clear_blocks = clear_blocks_mmx; #define SET_HPEL_FUNCS(PFX, IDX, SIZE, CPU) \ c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## SIZE ## _ ## CPU; \ c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## SIZE ## _x2_ ## CPU; \ c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## SIZE ## _y2_ ## CPU; \ c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## SIZE ## _xy2_ ## CPU SET_HPEL_FUNCS(put, 0, 16, mmx); SET_HPEL_FUNCS(put_no_rnd, 0, 16, mmx); SET_HPEL_FUNCS(avg, 0, 16, mmx); SET_HPEL_FUNCS(avg_no_rnd, 0, 16, mmx); SET_HPEL_FUNCS(put, 1, 8, mmx); SET_HPEL_FUNCS(put_no_rnd, 1, 8, mmx); SET_HPEL_FUNCS(avg, 1, 8, mmx); SET_HPEL_FUNCS(avg_no_rnd, 1, 8, mmx); c->gmc= gmc_mmx; c->add_bytes= add_bytes_mmx; c->add_bytes_l2= add_bytes_l2_mmx; c->draw_edges = draw_edges_mmx; if (ENABLE_ANY_H263) { c->h263_v_loop_filter= h263_v_loop_filter_mmx; c->h263_h_loop_filter= h263_h_loop_filter_mmx; } if ((ENABLE_VP3_DECODER || ENABLE_THEORA_DECODER) && !(avctx->flags & CODEC_FLAG_BITEXACT)) { c->vp3_v_loop_filter= ff_vp3_v_loop_filter_mmx; c->vp3_h_loop_filter= ff_vp3_h_loop_filter_mmx; } c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_rnd; c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx; c->put_no_rnd_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_nornd; c->h264_idct_dc_add= c->h264_idct_add= ff_h264_idct_add_mmx; c->h264_idct8_dc_add= c->h264_idct8_add= ff_h264_idct8_add_mmx; if (mm_flags & MM_SSE2) c->h264_idct8_add= ff_h264_idct8_add_sse2; if (mm_flags & MM_MMXEXT) { c->prefetch = prefetch_mmx2; c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2; c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2; c->avg_pixels_tab[0][0] = avg_pixels16_mmx2; c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2; c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2; c->put_pixels_tab[1][1] = put_pixels8_x2_mmx2; c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2; c->avg_pixels_tab[1][0] = avg_pixels8_mmx2; c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2; c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2; c->h264_idct_dc_add= ff_h264_idct_dc_add_mmx2; c->h264_idct8_dc_add= ff_h264_idct8_dc_add_mmx2; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2; c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2; c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2; c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2; c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2; c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2; } #define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU) \ c->PFX ## _pixels_tab[IDX][ 0] = PFX ## SIZE ## _mc00_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 1] = PFX ## SIZE ## _mc10_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 2] = PFX ## SIZE ## _mc20_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 3] = PFX ## SIZE ## _mc30_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 4] = PFX ## SIZE ## _mc01_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 5] = PFX ## SIZE ## _mc11_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 6] = PFX ## SIZE ## _mc21_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 7] = PFX ## SIZE ## _mc31_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 8] = PFX ## SIZE ## _mc02_ ## CPU; \ c->PFX ## _pixels_tab[IDX][ 9] = PFX ## SIZE ## _mc12_ ## CPU; \ c->PFX ## _pixels_tab[IDX][10] = PFX ## SIZE ## _mc22_ ## CPU; \ c->PFX ## _pixels_tab[IDX][11] = PFX ## SIZE ## _mc32_ ## CPU; \ c->PFX ## _pixels_tab[IDX][12] = PFX ## SIZE ## _mc03_ ## CPU; \ c->PFX ## _pixels_tab[IDX][13] = PFX ## SIZE ## _mc13_ ## CPU; \ c->PFX ## _pixels_tab[IDX][14] = PFX ## SIZE ## _mc23_ ## CPU; \ c->PFX ## _pixels_tab[IDX][15] = PFX ## SIZE ## _mc33_ ## CPU SET_QPEL_FUNCS(put_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(put_qpel, 1, 8, mmx2); SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmx2); SET_QPEL_FUNCS(avg_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(avg_qpel, 1, 8, mmx2); SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmx2); SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmx2); SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmx2); SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmx2); SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmx2); SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2); SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2); c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2_rnd; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2; c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_mmx2; c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_mmx2; c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_mmx2; c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_mmx2; c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_mmx2; c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_mmx2; c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_mmx2; c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_mmx2; c->h264_loop_filter_strength= h264_loop_filter_strength_mmx2; c->weight_h264_pixels_tab[0]= ff_h264_weight_16x16_mmx2; c->weight_h264_pixels_tab[1]= ff_h264_weight_16x8_mmx2; c->weight_h264_pixels_tab[2]= ff_h264_weight_8x16_mmx2; c->weight_h264_pixels_tab[3]= ff_h264_weight_8x8_mmx2; c->weight_h264_pixels_tab[4]= ff_h264_weight_8x4_mmx2; c->weight_h264_pixels_tab[5]= ff_h264_weight_4x8_mmx2; c->weight_h264_pixels_tab[6]= ff_h264_weight_4x4_mmx2; c->weight_h264_pixels_tab[7]= ff_h264_weight_4x2_mmx2; c->biweight_h264_pixels_tab[0]= ff_h264_biweight_16x16_mmx2; c->biweight_h264_pixels_tab[1]= ff_h264_biweight_16x8_mmx2; c->biweight_h264_pixels_tab[2]= ff_h264_biweight_8x16_mmx2; c->biweight_h264_pixels_tab[3]= ff_h264_biweight_8x8_mmx2; c->biweight_h264_pixels_tab[4]= ff_h264_biweight_8x4_mmx2; c->biweight_h264_pixels_tab[5]= ff_h264_biweight_4x8_mmx2; c->biweight_h264_pixels_tab[6]= ff_h264_biweight_4x4_mmx2; c->biweight_h264_pixels_tab[7]= ff_h264_biweight_4x2_mmx2; if (ENABLE_CAVS_DECODER) ff_cavsdsp_init_mmx2(c, avctx); if (ENABLE_VC1_DECODER || ENABLE_WMV3_DECODER) ff_vc1dsp_init_mmx(c, avctx); c->add_png_paeth_prediction= add_png_paeth_prediction_mmx2; } else if (mm_flags & MM_3DNOW) { c->prefetch = prefetch_3dnow; c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow; c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow; c->avg_pixels_tab[0][0] = avg_pixels16_3dnow; c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow; c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow; c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow; c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow; c->avg_pixels_tab[1][0] = avg_pixels8_3dnow; c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow; c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow; c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow; c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow; c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow; c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow; c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow; } SET_QPEL_FUNCS(put_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(put_qpel, 1, 8, 3dnow); SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, 3dnow); SET_QPEL_FUNCS(avg_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(avg_qpel, 1, 8, 3dnow); SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 3dnow); SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 3dnow); SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 3dnow); SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 3dnow); SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, 3dnow); SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow); SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow); c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow_rnd; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow; if (ENABLE_CAVS_DECODER) ff_cavsdsp_init_3dnow(c, avctx); } #define H264_QPEL_FUNCS(x, y, CPU)\ c->put_h264_qpel_pixels_tab[0][x+y*4] = put_h264_qpel16_mc##x##y##_##CPU;\ c->put_h264_qpel_pixels_tab[1][x+y*4] = put_h264_qpel8_mc##x##y##_##CPU;\ c->avg_h264_qpel_pixels_tab[0][x+y*4] = avg_h264_qpel16_mc##x##y##_##CPU;\ c->avg_h264_qpel_pixels_tab[1][x+y*4] = avg_h264_qpel8_mc##x##y##_##CPU; if((mm_flags & MM_SSE2) && !(mm_flags & MM_3DNOW)){ H264_QPEL_FUNCS(0, 0, sse2); } if(mm_flags & MM_SSE2){ H264_QPEL_FUNCS(0, 1, sse2); H264_QPEL_FUNCS(0, 2, sse2); H264_QPEL_FUNCS(0, 3, sse2); H264_QPEL_FUNCS(1, 1, sse2); H264_QPEL_FUNCS(1, 2, sse2); H264_QPEL_FUNCS(1, 3, sse2); H264_QPEL_FUNCS(2, 1, sse2); H264_QPEL_FUNCS(2, 2, sse2); H264_QPEL_FUNCS(2, 3, sse2); H264_QPEL_FUNCS(3, 1, sse2); H264_QPEL_FUNCS(3, 2, sse2); H264_QPEL_FUNCS(3, 3, sse2); } #ifdef HAVE_SSSE3 if(mm_flags & MM_SSSE3){ H264_QPEL_FUNCS(1, 0, ssse3); H264_QPEL_FUNCS(1, 1, ssse3); H264_QPEL_FUNCS(1, 2, ssse3); H264_QPEL_FUNCS(1, 3, ssse3); H264_QPEL_FUNCS(2, 0, ssse3); H264_QPEL_FUNCS(2, 1, ssse3); H264_QPEL_FUNCS(2, 2, ssse3); H264_QPEL_FUNCS(2, 3, ssse3); H264_QPEL_FUNCS(3, 0, ssse3); H264_QPEL_FUNCS(3, 1, ssse3); H264_QPEL_FUNCS(3, 2, ssse3); H264_QPEL_FUNCS(3, 3, ssse3); c->put_no_rnd_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_nornd; c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_ssse3_rnd; c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_ssse3_rnd; c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_ssse3; c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_ssse3; c->add_png_paeth_prediction= add_png_paeth_prediction_ssse3; } #endif #ifdef CONFIG_SNOW_DECODER if(mm_flags & MM_SSE2 & 0){ c->horizontal_compose97i = ff_snow_horizontal_compose97i_sse2; #ifdef HAVE_7REGS c->vertical_compose97i = ff_snow_vertical_compose97i_sse2; #endif c->inner_add_yblock = ff_snow_inner_add_yblock_sse2; } else{ if(mm_flags & MM_MMXEXT){ c->horizontal_compose97i = ff_snow_horizontal_compose97i_mmx; #ifdef HAVE_7REGS c->vertical_compose97i = ff_snow_vertical_compose97i_mmx; #endif } c->inner_add_yblock = ff_snow_inner_add_yblock_mmx; } #endif if(mm_flags & MM_3DNOW){ c->vorbis_inverse_coupling = vorbis_inverse_coupling_3dnow; c->vector_fmul = vector_fmul_3dnow; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->float_to_int16 = float_to_int16_3dnow; c->float_to_int16_interleave = float_to_int16_interleave_3dnow; } } if(mm_flags & MM_3DNOWEXT){ c->vector_fmul_reverse = vector_fmul_reverse_3dnow2; c->vector_fmul_window = vector_fmul_window_3dnow2; if(!(avctx->flags & CODEC_FLAG_BITEXACT)){ c->float_to_int16_interleave = float_to_int16_interleave_3dn2; } } if(mm_flags & MM_SSE){ c->vorbis_inverse_coupling = vorbis_inverse_coupling_sse; c->ac3_downmix = ac3_downmix_sse; c->vector_fmul = vector_fmul_sse; c->vector_fmul_reverse = vector_fmul_reverse_sse; c->vector_fmul_add_add = vector_fmul_add_add_sse; c->vector_fmul_window = vector_fmul_window_sse; c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse; c->float_to_int16 = float_to_int16_sse; c->float_to_int16_interleave = float_to_int16_interleave_sse; } if(mm_flags & MM_3DNOW) c->vector_fmul_add_add = vector_fmul_add_add_3dnow; if(mm_flags & MM_SSE2){ c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_sse2; c->float_to_int16 = float_to_int16_sse2; c->float_to_int16_interleave = float_to_int16_interleave_sse2; c->add_int16 = add_int16_sse2; c->sub_int16 = sub_int16_sse2; c->scalarproduct_int16 = scalarproduct_int16_sse2; } } if (ENABLE_ENCODERS) dsputilenc_init_mmx(c, avctx); #if 0 get_pixels = just_return; put_pixels_clamped = just_return; add_pixels_clamped = just_return; pix_abs16x16 = just_return; pix_abs16x16_x2 = just_return; pix_abs16x16_y2 = just_return; pix_abs16x16_xy2 = just_return; put_pixels_tab[0] = just_return; put_pixels_tab[1] = just_return; put_pixels_tab[2] = just_return; put_pixels_tab[3] = just_return; put_no_rnd_pixels_tab[0] = just_return; put_no_rnd_pixels_tab[1] = just_return; put_no_rnd_pixels_tab[2] = just_return; put_no_rnd_pixels_tab[3] = just_return; avg_pixels_tab[0] = just_return; avg_pixels_tab[1] = just_return; avg_pixels_tab[2] = just_return; avg_pixels_tab[3] = just_return; avg_no_rnd_pixels_tab[0] = just_return; avg_no_rnd_pixels_tab[1] = just_return; avg_no_rnd_pixels_tab[2] = just_return; avg_no_rnd_pixels_tab[3] = just_return; #endif }
1threat
How to keep iOS native call UI after answering the call with CallKit : <p>I am trying to achieve same results that can be seen on 29:52 second of <a href="https://developer.apple.com/videos/play/wwdc2016/230/" rel="noreferrer">Enhancing VoIP Apps with CallKit - WWDC 2016</a>. In that video it shows that after answering call the buttons are moved and changed by animation, and the screen stays in native in-call UI.</p> <p>I built the <a href="https://developer.apple.com/library/content/samplecode/Speakerbox/Introduction/Intro.html" rel="noreferrer">Speakerbox</a> and tried the "Simulate Incoming Call" function, but as soon as the call is answered by answer call button (the same action that is shown on video), the native call screen disappears and the application screen is shown with active calls shown in the list (which is different from what is shown in WWDC video):</p> <p><a href="https://i.stack.imgur.com/koHZB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/koHZB.png" alt="enter image description here"></a></p> <p>Though there is a native call UI screen for very short time during transition from Incoming Call native UI to the app, but I can't find how to force it to stay on that screen. Debugging the Speakerbox app there is no any delegate method called until all native screens are disappeared and the app is already opened.</p> <p>I have tested receiving incoming call when the screen is locked, in that case the native UI is shown:</p> <p><a href="https://i.stack.imgur.com/RuQTx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RuQTx.png" alt="enter image description here"></a></p> <p>I would like to achieve same result on non locked phone.</p>
0debug
How to check if chekcbox is checked : <p>I have a table where each row has a checkbox inside.</p> <pre><code>&lt;input type="checkbox" onclick="handleClickOnReduce(this)" checked=""&gt; </code></pre> <p>The handler works like this:</p> <pre><code>function handleClickOnReduce (dom) { console.log(dom) if (dom.checked === 'true') { console.log('checked') } if (dom.toString().includes('checked')) { console.log('checked') } if (stompClient) { var chatMessage = { sender: 'userRequest', content: [dom.parentElement.id], type: 'REDUCE' } stompClient.send('/app/chat.sendMessage', {}, JSON.stringify(chatMessage)) } } </code></pre> <p>You can see already what my question is about. I try to figure out if the checkbox of the caller of the handleClockOnReduce function is checked or unchecked.</p> <p>Any idea?</p>
0debug
want today's date output for my procedure : My Store procedure : WITH dates AS (SELECT (dt + level - 1) AS etadate FROM (SELECT TRUNC(DATE '2018-09-01', 'MM') - 1 AS dt FROM DUAL ) d CONNECT BY LEVEL <= sysdate - dt + 1 ) SELECT TO_CHAR(TO_DATE(d.etadate,'DD-MM-YYYY HH24:MI:SS'),'DD-MM-YY') AS DATEFORM, COALESCE(nsp.YNAME, LAG(nsp.YNAME IGNORE NULLS) OVER (ORDER BY d.etadate)) AS YNAME, COALESCE(nsp.CATEGORY, LAG(nsp.CATEGORY IGNORE NULLS) OVER (ORDER BY d.etadate)) AS CATEGORY, COALESCE(nsp.TYPE, LAG(nsp.TYPE IGNORE NULLS) OVER (ORDER BY d.etadate)) AS TYPE, COALESCE(nsp.STOCK_BALANCE, LAG(nsp.STOCK_BALANCE IGNORE NULLS) OVER (ORDER BY d.etadate)) AS STOCK_BALANCE FROM dates d LEFT JOIN VW_NET_STOCK_POSITION nsp ON d.etadate = TRUNC(nsp.LAST_UPD_IS) and ouput : [![output][1]][1] [1]: https://i.stack.imgur.com/CMeCM.png Now, i want only that output which contains today's date.not all date's records. so output should be last record of this output as todays date is 6th oct 2018.
0debug
Unable to use dynamic variable as column name in php mysql : <p>Am trying to use dynamic column name in php mysql update but am getting error Here is code</p> <pre><code> $time=date("H"); $video_view = 234 $update_query = "UPDATE videos SET ". $time . "= {$video_view} WHERE id={$id}"; </code></pre> <p>Here is the error</p> <pre><code> UPDATE videos SET 14= 200079 WHERE id=1Query failedYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '14= 200079 WHERE id=1' at line 1 </code></pre>
0debug
How to mock the imports of an ES6 module? : <p>I have the following ES6 modules:</p> <p><strong>network.js</strong></p> <pre><code>export function getDataFromServer() { return ... } </code></pre> <p><strong>widget.js</strong></p> <pre><code>import { getDataFromServer } from 'network.js'; export class Widget() { constructor() { getDataFromServer("dataForWidget") .then(data =&gt; this.render(data)); } render() { ... } } </code></pre> <p>I'm looking for a way to test Widget with a mock instance of <code>getDataFromServer</code>. If I used separate <code>&lt;script&gt;</code>s instead of ES6 modules, like in Karma, I could write my test like:</p> <pre><code>describe("widget", function() { it("should do stuff", function() { let getDataFromServer = spyOn(window, "getDataFromServer").andReturn("mockData") let widget = new Widget(); expect(getDataFromServer).toHaveBeenCalledWith("dataForWidget"); expect(otherStuff).toHaveHappened(); }); }); </code></pre> <p>However, if I'm testing ES6 modules individually outside of a browser (like with Mocha + babel), I would write something like: </p> <pre><code>import { Widget } from 'widget.js'; describe("widget", function() { it("should do stuff", function() { let getDataFromServer = spyOn(?????) // How to mock? .andReturn("mockData") let widget = new Widget(); expect(getDataFromServer).toHaveBeenCalledWith("dataForWidget"); expect(otherStuff).toHaveHappened(); }); }); </code></pre> <p>Okay, but now <code>getDataFromServer</code> is not available in <code>window</code> (well, there's no <code>window</code> at all), and I don't know a way to inject stuff directly into <code>widget.js</code>'s own scope.</p> <h1>So where do I go from here?</h1> <ol> <li><strong>Is there a way to access the scope of <code>widget.js</code>, or at least replace its imports with my own code?</strong></li> <li><strong>If not, how can I make <code>Widget</code> testable?</strong></li> </ol> <hr> <h2>Stuff I considered:</h2> <h3>a. Manual dependency injection.</h3> <p>Remove all imports from <code>widget.js</code> and expect the caller to provide the deps.</p> <pre><code>export class Widget() { constructor(deps) { deps.getDataFromServer("dataForWidget") .then(data =&gt; this.render(data)); } } </code></pre> <p>I'm very uncomfortable with messing up Widget's public interface like this and exposing implementation details. No go.</p> <hr> <h3>b. Expose the imports to allow mocking them.</h3> <p>Something like:</p> <pre><code>import { getDataFromServer } from 'network.js'; export let deps = { getDataFromServer }; export class Widget() { constructor() { deps.getDataFromServer("dataForWidget") .then(data =&gt; this.render(data)); } } </code></pre> <p>then:</p> <pre><code>import { Widget, deps } from 'widget.js'; describe("widget", function() { it("should do stuff", function() { let getDataFromServer = spyOn(deps.getDataFromServer) // ! .andReturn("mockData"); let widget = new Widget(); expect(getDataFromServer).toHaveBeenCalledWith("dataForWidget"); expect(otherStuff).toHaveHappened(); }); }); </code></pre> <p>This is less invasive but requires me to write a lot of boilerplate for each module, and there's still a risk of me using <code>getDataFromServer</code> instead of <code>deps.getDataFromServer</code> all the time. I'm uneasy about it, but that's my best idea so far.</p>
0debug
Can I somehow create a function that looks like .toUpperCase()? : <p>Instead of using</p> <pre><code>function functionName(arg){ arg = 1; } name(arg); </code></pre> <p>I want to use something like the .toUppercase() function</p> <pre><code>function functionName(){ this = 1; } arg.name(); </code></pre> <p>Is this possible?</p>
0debug
How to put two list of web element in HasMap? : Here is the details It is selenium List is web elements List WebElement header List WebElement headerValues Both List of WebElement contains string values how can I take them in has map and use it to verify if value is present there or not. I have write below code ` @FindBy(How =How.Xpath,using =“xpath to header”) private static List<WebElement> header; @FindBy(how =How.Xpath,using =“xpath to headerValue”) private static List<WebElement> headerValue; Public HasMap<String,String> verifyHeaderAndValue(){ HasMap<String,String> hedDetails = new HasMap<>(); for(int I=0; I<hedDetails.size();I++) { hedDetails.put(header.get(I).getText(),headerValue.get(I).getText()); } return hedDetails; } `
0debug
int dma_memory_set(DMAContext *dma, dma_addr_t addr, uint8_t c, dma_addr_t len) { if (dma_has_iommu(dma)) { return iommu_dma_memory_set(dma, addr, c, len); } do_dma_memory_set(addr, c, len); return 0; }
1threat
WPF. Is there a dialog window for selecting a font in WPF? : <p>Is there a dialog window for selecting a font in WPF? How to put the selected font to TextBox?</p>
0debug
Is it possible to add .css style to Jupyter notebook from separate file? : <p>I need to render some html tables in Jupyter Notebook and for this I have defined my own css styles. I want it to be reusable on any PC. </p> <p>For now I need to run code like this in one of Jupyter cells:</p> <pre><code>%%html &lt;style&gt; .output_wrapper, .output { height:auto !important; max-height: none; } .output_scroll { box-shadow:none !important; webkit-box-shadow:none !important; } .package_header { width: 100%; background-color: #0e2b59; color: #ffffff; font-size: 14px; text-align: center; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; } .placeholder { width: 100%; background-color: #ffffff; height: 6px; } .passed_test_table { display: table; width: 100%; background-color: #ebffd3; border-spacing: 5px; } # (...) rest of css classes omitted &lt;/style&gt; </code></pre> <p>Yet I don't want to store this <code>style</code> inside Jupyter Notebook but in other file like my_default_style.css and load it somehow so it doesn't take too much space in Notebook making it less readable.</p> <p>Is it possible to load .css style from some local file instead of running it in Jupyter Notebook cell directly?</p>
0debug
AioContext *aio_context_new(Error **errp) { int ret; AioContext *ctx; ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext)); aio_context_setup(ctx); ret = event_notifier_init(&ctx->notifier, false); if (ret < 0) { error_setg_errno(errp, -ret, "Failed to initialize event notifier"); goto fail; } g_source_set_can_recurse(&ctx->source, true); qemu_lockcnt_init(&ctx->list_lock); aio_set_event_notifier(ctx, &ctx->notifier, false, (EventNotifierHandler *) event_notifier_dummy_cb, event_notifier_poll); #ifdef CONFIG_LINUX_AIO ctx->linux_aio = NULL; #endif ctx->thread_pool = NULL; qemu_rec_mutex_init(&ctx->lock); timerlistgroup_init(&ctx->tlg, aio_timerlist_notify, ctx); ctx->poll_ns = 0; ctx->poll_max_ns = 0; ctx->poll_grow = 0; ctx->poll_shrink = 0; return ctx; fail: g_source_destroy(&ctx->source); return NULL; }
1threat
React-Native Keystore file not set for signing config release : <p>I'm trying to build a release .apk file in React Native without success. I followed all the instructions <a href="https://facebook.github.io/react-native/docs/signed-apk-android.html" rel="noreferrer">here</a>, but i always get the same result after running <code>gradlew assembleRelease</code> in /my-project/android path:</p> <pre><code>:app:validateSigningRelease FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:validateSigningRelease'. &gt; Keystore file not set for signing config release </code></pre> <p>I'm using Windows 10 and i suspect it's something with the edit of file ~/.gradle/gradle.properties</p> <p>From my understanding ~ is c:\Users\User I even got a c:\Users\User.gradle folder built-in.</p>
0debug
How to use R with Google Colaboratory? : <p>Google Colaboratory supports Python version 2.7 and 3.6</p> <p>I see an example how to use Swift in Colab a while ago.</p> <p>Today, I happened to run</p> <pre><code>!jupyter-kernelspec list </code></pre> <p>And found a new kernel: IRkernel</p> <pre><code>Available kernels: ir /usr/local/share/jupyter/kernels/ir python2 /usr/local/share/jupyter/kernels/python2 python3 /usr/local/share/jupyter/kernels/python3 swift /usr/local/share/jupyter/kernels/swift </code></pre> <p>Is it now possible to use R in Colab as well? No hassle in installing R kernel?</p>
0debug
static int find_large_solid_color_rect(VncState *vs, int x, int y, int w, int h, int max_rows) { int dx, dy, dw, dh; int n = 0; for (dy = y; dy < y + h; dy += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { if (dy - y >= max_rows) { n += send_rect_simple(vs, x, y, w, max_rows); y += max_rows; h -= max_rows; } dh = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (y + h - dy)); for (dx = x; dx < x + w; dx += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { uint32_t color_value; int x_best, y_best, w_best, h_best; dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, (x + w - dx)); if (!check_solid_tile(vs, dx, dy, dw, dh, &color_value, false)) { continue ; } find_best_solid_area(vs, dx, dy, w - (dx - x), h - (dy - y), color_value, &w_best, &h_best); if (w_best * h_best != w * h && w_best * h_best < VNC_TIGHT_MIN_SOLID_SUBRECT_SIZE) { continue; } x_best = dx; y_best = dy; extend_solid_area(vs, x, y, w, h, color_value, &x_best, &y_best, &w_best, &h_best); if (y_best != y) { n += send_rect_simple(vs, x, y, w, y_best-y); } if (x_best != x) { n += vnc_tight_send_framebuffer_update(vs, x, y_best, x_best-x, h_best); } n += send_sub_rect_solid(vs, x_best, y_best, w_best, h_best); if (x_best + w_best != x + w) { n += vnc_tight_send_framebuffer_update(vs, x_best+w_best, y_best, w-(x_best-x)-w_best, h_best); } if (y_best + h_best != y + h) { n += vnc_tight_send_framebuffer_update(vs, x, y_best+h_best, w, h-(y_best-y)-h_best); } return n; } } return n + send_rect_simple(vs, x, y, w, h); }
1threat
array inside array or nested array : I have 3 arrays like this. $a1 = array(array("val" => "Facebook"),array ("val" => "Instagram")); $a2 = array(array("expenses" => "84512"),array ("expenses" => "123")); $a3 = array(array("social_id" => "1"),array ("social_id" => "2")); and I want to output. $result = array(array("val" => "Facebook", "expenses" => "84512", "social_id" => 1),array("val" => "Instagram", "expenses" => "123", "social_id" => 2)); but this should be dynamic, the length of the above 3 array can be varies
0debug
Is DispatchSemaphore a good replacement for NSLock? : <p>I've been using <code>NSLock</code>s to synchronize touchy parts of code, but have been running into issues due to the fact that they must be unlocked from the same thread that they were locked from. Then I found that GCD's <code>DispatchSemaphore</code>s seem to do the same thing, with the added convenience that they can be signaled from any thread. I was wondering, though, if this convenience comes at the price of thread-safety. Is it advisable to replace</p> <pre><code>let lock = NSLock() lock.lock() // do things... lock.unlock() </code></pre> <p>with</p> <pre><code>let semaphore = DispatchSemaphore(value: 1) semaphore.wait() // do things... semaphore.signal() </code></pre> <p>or will I run into issues regarding thread-safety anyway?</p>
0debug
How to trim the end of a string after the first occurence of a char C# : I want to trim the end of a string after the first occurence of a given character, in this case '.' This character appears multiple times in the string. Input: 143.122.124.123 Output: 143 I can find multiple questions similar to this alhtough they all use LastIndexOf(); where as this requires the first occurence and remove the rest of the string.
0debug
rewrite query for mssql from oracle : I have query, help me rewrite it for mssql. insert into swi (co, na, ci, ac, id, version, add) select co, na, ci, acc, id, ?, address from swi_tmp where co||me not in (select co||me from swi)
0debug
readv_f(int argc, char **argv) { struct timeval t1, t2; int Cflag = 0, qflag = 0, vflag = 0; int c, cnt; char *buf; int64_t offset; int total; int nr_iov; QEMUIOVector qiov; int pattern = 0; int Pflag = 0; while ((c = getopt(argc, argv, "CP:qv")) != EOF) { switch (c) { case 'C': Cflag = 1; break; case 'P': Pflag = 1; pattern = atoi(optarg); break; case 'q': qflag = 1; break; case 'v': vflag = 1; break; default: return command_usage(&readv_cmd); } } if (optind > argc - 2) return command_usage(&readv_cmd); offset = cvtnum(argv[optind]); if (offset < 0) { printf("non-numeric length argument -- %s\n", argv[optind]); return 0; } optind++; if (offset & 0x1ff) { printf("offset %lld is not sector aligned\n", (long long)offset); return 0; } nr_iov = argc - optind; buf = create_iovec(&qiov, &argv[optind], nr_iov, 0xab); gettimeofday(&t1, NULL); cnt = do_aio_readv(&qiov, offset, &total); gettimeofday(&t2, NULL); if (cnt < 0) { printf("readv failed: %s\n", strerror(-cnt)); goto out; } if (Pflag) { void* cmp_buf = malloc(qiov.size); memset(cmp_buf, pattern, qiov.size); if (memcmp(buf, cmp_buf, qiov.size)) { printf("Pattern verification failed at offset %lld, " "%zd bytes\n", (long long) offset, qiov.size); } free(cmp_buf); } if (qflag) goto out; if (vflag) dump_buffer(buf, offset, qiov.size); t2 = tsub(t2, t1); print_report("read", &t2, offset, qiov.size, total, cnt, Cflag); out: qemu_io_free(buf); return 0; }
1threat
Which is better use static methods or create new instatnce each time? : I have about 15 methods i will use it so much in my application i put all in one class and i will call it each time i need which is better make all my methods static or make it non-static and call it like this way i am using java programming language to create mobile application in other way which is better new MethodHolder().myMethod(); or MethodHolder.myMethod(); which is better for performance or memory
0debug