problem
stringlengths
26
131k
labels
class label
2 classes
C# calculator to do n number of calculations : namespace MyCalculatorv1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button_Click_1(object sender, RoutedEventArgs e) { Button b = (Button) sender; tb.Text += b.Content.ToString(); } private void Result_click(object sender, RoutedEventArgs e) { try { result(); } catch (Exception exc) { tb.Text = "Error!"; } } private void result() { String op; int iOp = 0; if (tb.Text.Contains("+")) { iOp = tb.Text.IndexOf("+"); } else if (tb.Text.Contains("-")) { iOp = tb.Text.IndexOf("-"); } else if (tb.Text.Contains("*")) { iOp = tb.Text.IndexOf("*"); } else if (tb.Text.Contains("/")) { iOp = tb.Text.IndexOf("/"); } else { //error } op = tb.Text.Substring(iOp, 1); double op1 = Convert.ToDouble(tb.Text.Substring(0, iOp)); double op2 = Convert.ToDouble(tb.Text.Substring(iOp + 1, tb.Text.Length - iOp - 1)); if (op == "+") { tb.Text += "=" + (op1 + op2); } else if (op == "-") { tb.Text += "=" + (op1 - op2); } else if (op == "*") { tb.Text += "=" + (op1 * op2); } else { tb.Text += "=" + (op1 / op2); } } private void Off_Click_1(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } private void Del_Click(object sender, RoutedEventArgs e) { tb.Text = ""; } private void R_Click(object sender, RoutedEventArgs e) { if (tb.Text.Length > 0) { tb.Text = tb.Text.Substring(0, tb.Text.Length - 1); } } } } namespace MyCalculatorv1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button_Click_1(object sender, RoutedEventArgs e) { Button b = (Button) sender; tb.Text += b.Content.ToString(); } private void Result_click(object sender, RoutedEventArgs e) { try { result(); } catch (Exception exc) { tb.Text = "Error!"; } } private void result() { String op; int iOp = 0; if (tb.Text.Contains("+")) { iOp = tb.Text.IndexOf("+"); } else if (tb.Text.Contains("-")) { iOp = tb.Text.IndexOf("-"); } else if (tb.Text.Contains("*")) { iOp = tb.Text.IndexOf("*"); } else if (tb.Text.Contains("/")) { iOp = tb.Text.IndexOf("/"); } else { //error } op = tb.Text.Substring(iOp, 1); double op1 = Convert.ToDouble(tb.Text.Substring(0, iOp)); double op2 = Convert.ToDouble(tb.Text.Substring(iOp + 1, tb.Text.Length - iOp - 1)); if (op == "+") { tb.Text += "=" + (op1 + op2); } else if (op == "-") { tb.Text += "=" + (op1 - op2); } else if (op == "*") { tb.Text += "=" + (op1 * op2); } else { tb.Text += "=" + (op1 / op2); } } private void Off_Click_1(object sender, RoutedEventArgs e) { Application.Current.Shutdown(); } private void Del_Click(object sender, RoutedEventArgs e) { tb.Text = ""; } private void R_Click(object sender, RoutedEventArgs e) { if (tb.Text.Length > 0) { tb.Text = tb.Text.Substring(0, tb.Text.Length - 1); } } } } //Hi friends In this code calculator is counting only two values, and I need to do a calculator which can do n number of calculations such as division multiplication addition and subtraction..by using this code so please do help me `//
0debug
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; char color_parameter_type[5] = { 0 }; int color_primaries, color_trc, color_matrix; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; avio_read(pb, color_parameter_type, 4); if (strncmp(color_parameter_type, "nclx", 4) && strncmp(color_parameter_type, "nclc", 4)) { av_log(c->fc, AV_LOG_WARNING, "unsupported color_parameter_type %s\n", color_parameter_type); return 0; } color_primaries = avio_rb16(pb); color_trc = avio_rb16(pb); color_matrix = avio_rb16(pb); av_dlog(c->fc, "%s: pri %d trc %d matrix %d", color_parameter_type, color_primaries, color_trc, color_matrix); if (c->isom) { uint8_t color_range = avio_r8(pb) >> 7; av_dlog(c->fc, " full %"PRIu8"", color_range); if (color_range) st->codec->color_range = AVCOL_RANGE_JPEG; else st->codec->color_range = AVCOL_RANGE_MPEG; if (color_primaries >= AVCOL_PRI_FILM) color_primaries = AVCOL_PRI_UNSPECIFIED; if ((color_trc >= AVCOL_TRC_LINEAR && color_trc <= AVCOL_TRC_LOG_SQRT) || color_trc >= AVCOL_TRC_BT2020_10) color_trc = AVCOL_TRC_UNSPECIFIED; if (color_matrix >= AVCOL_SPC_BT2020_NCL) color_matrix = AVCOL_SPC_UNSPECIFIED; st->codec->color_primaries = color_primaries; st->codec->color_trc = color_trc; st->codec->colorspace = color_matrix; } else { switch (color_primaries) { case 1: st->codec->color_primaries = AVCOL_PRI_BT709; break; case 5: st->codec->color_primaries = AVCOL_PRI_SMPTE170M; break; case 6: st->codec->color_primaries = AVCOL_PRI_SMPTE240M; break; } switch (color_trc) { case 1: st->codec->color_trc = AVCOL_TRC_BT709; break; case 7: st->codec->color_trc = AVCOL_TRC_SMPTE240M; break; } switch (color_matrix) { case 1: st->codec->colorspace = AVCOL_SPC_BT709; break; case 6: st->codec->colorspace = AVCOL_SPC_BT470BG; break; case 7: st->codec->colorspace = AVCOL_SPC_SMPTE240M; break; } } av_dlog(c->fc, "\n"); return 0; }
1threat
START_TEST(qstring_from_str_test) { QString *qstring; const char *str = "QEMU"; qstring = qstring_from_str(str); fail_unless(qstring != NULL); fail_unless(qstring->base.refcnt == 1); fail_unless(strcmp(str, qstring->string) == 0); fail_unless(qobject_type(QOBJECT(qstring)) == QTYPE_QSTRING); g_free(qstring->string); g_free(qstring); }
1threat
Boot partition nearly full: how to clear or extend it? : <p>I got a warning message that my boot partition (<code>/</code>) is nearly full. I am running Ubuntu.</p> <p>Should I clear it or try to extend it ?</p> <p>To extend, my problem is that the next partition, which is the <code>/home</code> is already used.</p> <p>To clear it, I remove unused kernel, by listing them <code>sudo dpkg --list 'linux-image*'</code> and then removing <code>sudo apt-get remove linux-image-3.2.0-45-server</code>. I also cleared apt-cache <code>apt-get clean</code>.</p> <p>Is there other solutions or cleaning to do to win space on the boot partition ? </p> <p>Thanks for advices</p>
0debug
static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) { MpegEncContext *s = &v->s; DSPContext *dsp = &v->s.dsp; uint8_t *srcY; int dxy, mx, my, src_x, src_y; int off; int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; if ((!v->field_mode || (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && !v->s.last_picture.f.data[0]) mx = s->mv[dir][n][0]; my = s->mv[dir][n][1]; if (!dir) { if (v->field_mode) { if ((v->cur_field_type != v->ref_field_type[dir]) && v->second_field) srcY = s->current_picture.f.data[0]; else srcY = s->last_picture.f.data[0]; } else srcY = s->last_picture.f.data[0]; } else srcY = s->next_picture.f.data[0]; if (v->field_mode) { if (v->cur_field_type != v->ref_field_type[dir]) my = my - 2 + 4 * v->cur_field_type; } if (s->pict_type == AV_PICTURE_TYPE_P && n == 3 && v->field_mode) { int same_count = 0, opp_count = 0, k; int chosen_mv[2][4][2], f; int tx, ty; for (k = 0; k < 4; k++) { f = v->mv_f[0][s->block_index[k] + v->blocks_off]; chosen_mv[f][f ? opp_count : same_count][0] = s->mv[0][k][0]; chosen_mv[f][f ? opp_count : same_count][1] = s->mv[0][k][1]; opp_count += f; same_count += 1 - f; } f = opp_count > same_count; switch (f ? opp_count : same_count) { case 4: tx = median4(chosen_mv[f][0][0], chosen_mv[f][1][0], chosen_mv[f][2][0], chosen_mv[f][3][0]); ty = median4(chosen_mv[f][0][1], chosen_mv[f][1][1], chosen_mv[f][2][1], chosen_mv[f][3][1]); break; case 3: tx = mid_pred(chosen_mv[f][0][0], chosen_mv[f][1][0], chosen_mv[f][2][0]); ty = mid_pred(chosen_mv[f][0][1], chosen_mv[f][1][1], chosen_mv[f][2][1]); break; case 2: tx = (chosen_mv[f][0][0] + chosen_mv[f][1][0]) / 2; ty = (chosen_mv[f][0][1] + chosen_mv[f][1][1]) / 2; break; default: av_assert2(0); } s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->current_picture.f.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; for (k = 0; k < 4; k++) v->mv_f[1][s->block_index[k] + v->blocks_off] = f; } if (v->fcm == ILACE_FRAME) { int qx, qy; int width = s->avctx->coded_width; int height = s->avctx->coded_height >> 1; qx = (s->mb_x * 16) + (mx >> 2); qy = (s->mb_y * 8) + (my >> 3); if (qx < -17) mx -= 4 * (qx + 17); else if (qx > width) mx -= 4 * (qx - width); if (qy < -18) my -= 8 * (qy + 18); else if (qy > height + 1) my -= 8 * (qy - height - 1); } if ((v->fcm == ILACE_FRAME) && fieldmv) off = ((n > 1) ? s->linesize : 0) + (n & 1) * 8; else off = s->linesize * 4 * (n & 2) + (n & 1) * 8; if (v->field_mode && v->second_field) off += s->current_picture_ptr->f.linesize[0]; src_x = s->mb_x * 16 + (n & 1) * 8 + (mx >> 2); if (!fieldmv) src_y = s->mb_y * 16 + (n & 2) * 4 + (my >> 2); else src_y = s->mb_y * 16 + ((n > 1) ? 1 : 0) + (my >> 2); if (v->profile != PROFILE_ADVANCED) { src_x = av_clip(src_x, -16, s->mb_width * 16); src_y = av_clip(src_y, -16, s->mb_height * 16); } else { src_x = av_clip(src_x, -17, s->avctx->coded_width); if (v->fcm == ILACE_FRAME) { if (src_y & 1) src_y = av_clip(src_y, -17, s->avctx->coded_height + 1); else src_y = av_clip(src_y, -18, s->avctx->coded_height); } else { src_y = av_clip(src_y, -18, s->avctx->coded_height + 1); } } srcY += src_y * s->linesize + src_x; if (v->field_mode && v->ref_field_type[dir]) srcY += s->current_picture_ptr->f.linesize[0]; if (fieldmv && !(src_y & 1)) v_edge_pos--; if (fieldmv && (src_y & 1) && src_y < 4) src_y--; if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) || s->h_edge_pos < 13 || v_edge_pos < 23 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 8 - s->mspel * 2 || (unsigned)(src_y - (s->mspel << fieldmv)) > v_edge_pos - (my & 3) - ((8 + s->mspel * 2) << fieldmv)) { srcY -= s->mspel * (1 + (s->linesize << fieldmv)); s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9 + s->mspel * 2, (9 + s->mspel * 2) << fieldmv, src_x - s->mspel, src_y - (s->mspel << fieldmv), s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; if (v->rangeredfrm) { int i, j; uint8_t *src; src = srcY; for (j = 0; j < 9 + s->mspel * 2; j++) { for (i = 0; i < 9 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize << fieldmv; } } if (v->mv_mode == MV_PMODE_INTENSITY_COMP) { int i, j; uint8_t *src; src = srcY; for (j = 0; j < 9 + s->mspel * 2; j++) { for (i = 0; i < 9 + s->mspel * 2; i++) src[i] = v->luty[src[i]]; src += s->linesize << fieldmv; } } srcY += s->mspel * (1 + (s->linesize << fieldmv)); } if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); } else { dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); else dsp->put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); } }
1threat
Promise.all(...).spread is not a function when running promises in parallel : <p>I'm trying to run 2 promises in paralel with sequelize, and then render the results in a .ejs template, but I'm receiving this error:</p> <pre><code> Promise.all(...).spread is not a function </code></pre> <p>This is my code:</p> <pre><code>var environment_hash = req.session.passport.user.environment_hash; var Template = require('../models/index').Template; var List = require('../models/index').List; var values = { where: { environment_hash: environment_hash, is_deleted: 0 } }; template = Template.findAll(values); list = List.findAll(values); Promise.all([template,list]).spread(function(templates,lists) { res.render('campaign/create.ejs', { templates: templates, lists: lists }); }); </code></pre> <p>How can I solve thhis?</p>
0debug
Upgrade AzureRM Powershell on Hosted 2017 Agent (VSTS - Visual Studio Team Services) : <p>I am using release management through Visual Studio Teams Services (online). We use Hosted build Agents and I really want to avoid the overhead of managing custom agents. </p> <p>One item I do need is the AzureRM PowerShell module. Versions up to 5.1.1 are <a href="https://github.com/Microsoft/vsts-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md" rel="noreferrer">available on the agent</a> but I need 6.0.0. </p> <p>What I would like to do is use a step in my release process (PowerShell) to aquire version 6.0.0 and use thart instead, however I cant quite get it to work. I have tried a few approaches that have all come unstuck, the current one is: </p> <pre><code>Write-Output "------------------ Install package provider ------------------" Find-PackageProvider -Name "NuGet" | Install-PackageProvider -Scope CurrentUser -Force Write-Output "------------------ Remove Modules ------------------" Get-Module -ListAvailable | Where-Object {$_.Name -like 'AzureRM*'} | Remove-Module Write-Output "------------------ Install the AzureRM version we want - 6.0.1! ------------------" Install-Package AzureRM -RequiredVersion 6.0.1 -Scope CurrentUser -Force Write-Output "------------------ Import AzureRM 6.0.1 ------------------" Import-Module AzureRM -RequiredVersion 6.0.1 </code></pre> <p>This all works fine (i.e. does not crash...) but then when I try and use one of the 6.0.1 cmdlets I get an error. </p> <blockquote> <p>Get-AzureRmADGroup : The Azure PowerShell session has not been properly initialized. Please import the module and try again.</p> </blockquote> <p>Any idea of where I am going wrong or alternate strategies I can use to deploy AzureRM 6.0.1 and use it on a hosted agent?</p>
0debug
Does deep nesting flexbox layout cause performance issue? : <p>I have been working on a ReactJS project where I create most of the components using flexbox layout. Since with react, we can have deeply nested components, so my layout is having nested flexbox layout. </p> <p>Now my question is, does this have any issue with performance? On a single page, there are many components and each component have 3 to 4 level nested flexbox layout. Will that cause a performance issue?</p>
0debug
How to use bootstrap 4 in Laravel 5.4? : <p>I installed bootstrap 4 using npm on my laravel app. But I think bootstrap 3 working behind not bootstrap 4.<br> using command:</p> <ul>npm install</ul> <ul>npm install bootstrap@4.0.0-alpha.6 </ul> <p>Did I left something to do? Or do I need to manually import bootstrap to assets/sass/app.scss file or else?</p>
0debug
How to map an object as per key and value using Javascript : I want to group an array of objects by an object key then create a new array of objects based on the grouping. I am explaining my object below. var oldArr=[ { "id":"5c407834953d7f420d56f866", "allocated_to":"FIELD", "zone":"NORTH", "state":"DELHI", "location":"NEW DELHI", "customer_name":"REET INFOTECH" }, { "id":"5c407834953d7f420d56f867", "allocated_to":"FIELD", "zone":"NORTH", "state":"JK", "location":"Sree Nagar", "customer_name":"REET" }, { "id":"5c407834953d7f420d56f868", "allocated_to":"FIELD", "zone":"EAST", "state":"Odisha", "location":"Bhubaneswar", "customer_name":"REET" } ] I need to make new array which should be group by `zone,state,location` and format is given below. newdata={ zone_list: [{ zone: NORTH, state_list: [{ state: DELHI, location_list: [{ location: NEW DELHI, task_list: [{ user_pkId: 5c407834953d7f420d56f866, loan_accounts_assigned: [{ customer_name: REET INFOTECH, }] }] }] },{ state: JK, location_list: [{ location: Sree Nagar, task_list: [{ user_pkId: 5c407834953d7f420d56f867, loan_accounts_assigned: [{ customer_name: REET }] }] }] }] },{ zone: EAST, state_list: [{ state: Odisha, location_list: [{ location: Bhubaneswar, task_list: [{ user_pkId: 5c407834953d7f420d56f868, loan_accounts_assigned: [{ customer_name: REET }] }] }] }] }] } I need the above output format after grouping.
0debug
static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags) { BDRVRBDState *s = bs->opaque; char pool[RBD_MAX_POOL_NAME_SIZE]; char snap_buf[RBD_MAX_SNAP_NAME_SIZE]; char conf[RBD_MAX_CONF_SIZE]; int r; if (qemu_rbd_parsename(filename, pool, sizeof(pool), snap_buf, sizeof(snap_buf), s->name, sizeof(s->name), conf, sizeof(conf)) < 0) { return -EINVAL; } s->snap = NULL; if (snap_buf[0] != '\0') { s->snap = g_strdup(snap_buf); } r = rados_create(&s->cluster, NULL); if (r < 0) { error_report("error initializing"); return r; } if (strstr(conf, "conf=") == NULL) { r = rados_conf_read_file(s->cluster, NULL); if (r < 0) { error_report("error reading config file"); rados_shutdown(s->cluster); return r; } } if (conf[0] != '\0') { r = qemu_rbd_set_conf(s->cluster, conf); if (r < 0) { error_report("error setting config options"); rados_shutdown(s->cluster); return r; } } r = rados_connect(s->cluster); if (r < 0) { error_report("error connecting"); rados_shutdown(s->cluster); return r; } r = rados_ioctx_create(s->cluster, pool, &s->io_ctx); if (r < 0) { error_report("error opening pool %s", pool); rados_shutdown(s->cluster); return r; } r = rbd_open(s->io_ctx, s->name, &s->image, s->snap); if (r < 0) { error_report("error reading header from %s", s->name); rados_ioctx_destroy(s->io_ctx); rados_shutdown(s->cluster); return r; } bs->read_only = (s->snap != NULL); s->event_reader_pos = 0; r = qemu_pipe(s->fds); if (r < 0) { error_report("error opening eventfd"); goto failed; } fcntl(s->fds[0], F_SETFL, O_NONBLOCK); fcntl(s->fds[1], F_SETFL, O_NONBLOCK); qemu_aio_set_fd_handler(s->fds[RBD_FD_READ], qemu_rbd_aio_event_reader, NULL, qemu_rbd_aio_flush_cb, NULL, s); return 0; failed: rbd_close(s->image); rados_ioctx_destroy(s->io_ctx); rados_shutdown(s->cluster); return r; }
1threat
how to increase size of pointer array when code is running c++ : Right Off to topic: let's say I declared a pointer array like this Animal** animalsarr = new Animal*[10]; if in this array, x babies were born and I want to resize it to new Animal*[10+x] WHILE ITS RUNNING, how can i do it?
0debug
static void init_proc_970 (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); gen_tbl(env); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, POWERPC970_HID5_INIT); gen_low_BATs(env); spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_hior, &spr_write_hior, 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 32; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; ppc970_irq_init(env); vscr_init(env, 0x00010000); }
1threat
Android: Room: no encryption and security? : <p>For now I'am using OrmLite over SQLite with SQLCipher. Is it really no way to protect Room database from being read???</p>
0debug
how to close standford.exe in cmd after I open it ?? java : I open the cmd.exe by using following statement: public static void runStanfordCMD() throws IOException{ List<String> cmds = Arrays.asList("cmd.exe", "/C", "start", "java", "-mx4g", "-cp", "*", "edu.stanford.nlp.pipeline.StanfordCoreNLPServer"); ProcessBuilder builder = new ProcessBuilder(cmds); builder.directory(new File("D:/Desktop/stanford-corenlp-full-2015-12-09")); Process proc = builder.start(); } so how to close the cmd.exe after I finished some process?? how to write the statement according to my case?? public static void closeStanfordCMD() throws IOException{ try { Runtime.getRuntime().exec("command.exe /C" + "Your command"); ??????how to write the statement??? } catch (Exception e) { e.printStackTrace(); } }
0debug
how to retrive data from json response : I am trying to get data from json response,and the response format is mentioning below.I want to fetch "recipient" dictionary.Can anyone help me to get this dictionary to story in local dictionary.Thank in advance. "chat": [ { "id": 12, "status": 0, "created_at": "2019-02-22 04:57:12", "updated_at": "2019-02-22 04:57:12", "recipient": { "id": 26, "unique_id": "10024", "name": "Kaverinew", "avatar": "https://www.planetzoom.co.in/storage/user/avatar/1PyI4ceM3zPsG1fxbfatktWUT75sOE2Ttah8ctIp.png" }, "conversation": { "id": 65, "chat_id": 12, "user_id": 4, "type": 1, "message": "https://www.planetzoom.co.in/storage/chat/message/e759KWdSBegwXslAoS2xst0lohbbjNZMdpVnbxQG.png", "status": 0, "created_at": "2019-02-25 15:39:24" } }, { "id": 6, "status": 0, "created_at": "2019-02-20 07:16:35", "updated_at": "2019-02-20 07:16:35", "recipient": { "id": 7, "unique_id": "10006", "name": "Hema", "avatar": "https://www.planetzoom.co.in/img/default_avatar_female.png" }, "conversation": { "id": 44, "chat_id": 6, "user_id": 4, "type": 1, "message": "https://www.planetzoom.co.in/storage/chat/message/qJjOtCRcBKBuq3UKaKVuVOEIQhaVPeJr3Bd4NoLo.png", "status": 0, "created_at": "2019-02-22 10:17:49" } } ]
0debug
Segmentation Error in Matrix Multiplication (C programming) : My task is to multiply 2 Matrix using Function, Pointer and Arrays. Segmentation Error appears and debugger shows exit value -1. However, no errors and warnings in a console. Please help! int main(void) { int matrix1[3][3] = {{1,2,3}, {4,5,6}, {7,8,9}}; int matrix2[3][3] = {{9,8,7}, {6,5,4}, {3,2,1}}; int rowm1 = sizeof(matrix1)/sizeof(matrix1[0]); int colm1 = sizeof(matrix1[0])/sizeof(matrix1[0][0]); int rowm2 = sizeof(matrix2)/sizeof(matrix2[0]); int colm2 = sizeof(matrix2[0])/sizeof(matrix2[0][0]); int result[rowm1][colm2]; matmul(&matrix1, &matrix2, rowm1, rowm2, colm1, colm2, &result); return EXIT_SUCCESS; } void matmul(int **matrix1, int **matrix2, int rowm1, int rowm2, int colm1, int colm2, int **result) { int i,j,k,sum; for (i=0; i<rowm1; i++){ for(j=0;j<colm2;j++){ sum=0; for(k=0; k<colm1; k++) { //Hear comes a Segmentation Error printf("%d %d \n", matrix1[0][0], matrix2[0][0]); sum += matrix1[i][k] * matrix2[k][j]; result [i][j] = sum; printf("%d\n", sum); } } } }
0debug
How can i displays the output coz it keeps on looping. Can anyone help please? : please solve this. i cant display the output it keeps on looping, im a beginner on this guys hehe it suppose to check whether the input is alpha or digits and store it as identifier and if operator it will store as symbol and check the input for keywords. #include <stdio.h> #include <string.h> #include <ctype.h> void keyword(char str[10]) { if(strcmp("for",str)==0||strcmp("while",str)==0||strcmp("do",str)==0||strcmp("int",str)==0||strcmp("float",str)==0||strcmp("char",str)==0||strcmp("double",str)==0||strcmp("static",str)==0||strcmp("switch",str)==0||strcmp("case",str)==0) printf("\n%s is a keyword",str); else printf("\n%s is an identifier",str); } main() { FILE *f1,*f2,*f3; char c,str[10],st1[10]; int num[100], lineo=0,tokenvalue=0,i=0,j=0,k=0; printf("\nEnter the c program "); gets(st1); f1=fopen("input","w"); while((c=getchar())!=EOF) putc(c,f1); fclose(f1); f1=fopen("input","r"); f2=fopen("identifier","w"); f3=fopen("specialchar","w"); while((c=getc(f1))!=EOF) { if(isdigit(c)) { tokenvalue=c-'0'; c=getc(f1); while(isdigit(c)) { tokenvalue*=10+c-'0'; c=getc(f1); } num[i++]=tokenvalue; ungetc(c,f1); } else if(isalpha(c)) { putc(c,f2); c=getc(f1); while(isdigit(c)||isalpha(c)||c=='_'||c=='$') { putc(c,f2); c=getc(f1); } putc(c,f2); ungetc(c,f1); } else if(c==' '||c=='\t') printf(""); else if(c=='\n') lineo++; else putc(c,f3); } fclose(f2); fclose(f3); fclose(f1); printf("\nThe no. im the program are"); for(j=0;j<i;j++) printf("%d",num[j]); printf("\n"); f2=fopen("identifier","r"); k=0; printf("The keywords and identifiers are: "); while((c=getc(f2))!=EOF) { if(c!='\0') str[k++]=c; else { str[k]='\0'; keyword(str); k=0; } } fclose(f2); f3=fopen("specialchar","r"); printf("\nSpecial Characters are: "); while((c=getc(f3))!=EOF) printf("%c",c); printf("\n"); fclose(f3); printf("Total no. of lines are:%d",lineo); }
0debug
static int vnc_worker_thread_loop(VncJobQueue *queue) { VncJob *job; VncRectEntry *entry, *tmp; VncState vs; int n_rectangles; int saved_offset; vnc_lock_queue(queue); while (QTAILQ_EMPTY(&queue->jobs) && !queue->exit) { qemu_cond_wait(&queue->cond, &queue->mutex); } job = QTAILQ_FIRST(&queue->jobs); vnc_unlock_queue(queue); if (queue->exit) { return -1; } vnc_lock_output(job->vs); if (job->vs->csock == -1 || job->vs->abort == true) { vnc_unlock_output(job->vs); goto disconnected; } vnc_unlock_output(job->vs); vnc_async_encoding_start(job->vs, &vs); n_rectangles = 0; vnc_write_u8(&vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(&vs, 0); saved_offset = vs.output.offset; vnc_write_u16(&vs, 0); vnc_lock_display(job->vs->vd); QLIST_FOREACH_SAFE(entry, &job->rectangles, next, tmp) { int n; if (job->vs->csock == -1) { vnc_unlock_display(job->vs->vd); goto disconnected; } n = vnc_send_framebuffer_update(&vs, entry->rect.x, entry->rect.y, entry->rect.w, entry->rect.h); if (n >= 0) { n_rectangles += n; } g_free(entry); } vnc_unlock_display(job->vs->vd); vs.output.buffer[saved_offset] = (n_rectangles >> 8) & 0xFF; vs.output.buffer[saved_offset + 1] = n_rectangles & 0xFF; vnc_lock_output(job->vs); if (job->vs->csock != -1) { buffer_reserve(&job->vs->jobs_buffer, vs.output.offset); buffer_append(&job->vs->jobs_buffer, vs.output.buffer, vs.output.offset); qemu_bh_schedule(job->vs->bh); } else { } vnc_unlock_output(job->vs); disconnected: vnc_lock_queue(queue); QTAILQ_REMOVE(&queue->jobs, job, next); vnc_unlock_queue(queue); qemu_cond_broadcast(&queue->cond); g_free(job); return 0; }
1threat
static void mv88w8618_audio_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { mv88w8618_audio_state *s = opaque; switch (offset) { case MP_AUDIO_PLAYBACK_MODE: if (value & MP_AUDIO_PLAYBACK_EN && !(s->playback_mode & MP_AUDIO_PLAYBACK_EN)) { s->status = 0; s->last_free = 0; s->play_pos = 0; } s->playback_mode = value; mv88w8618_audio_clock_update(s); break; case MP_AUDIO_CLOCK_DIV: s->clock_div = value; s->last_free = 0; s->play_pos = 0; mv88w8618_audio_clock_update(s); break; case MP_AUDIO_IRQ_STATUS: s->status &= ~value; break; case MP_AUDIO_IRQ_ENABLE: s->irq_enable = value; if (s->status & s->irq_enable) { qemu_irq_raise(s->irq); } break; case MP_AUDIO_TX_START_LO: s->phys_buf = (s->phys_buf & 0xFFFF0000) | (value & 0xFFFF); s->target_buffer = s->phys_buf; s->play_pos = 0; s->last_free = 0; break; case MP_AUDIO_TX_THRESHOLD: s->threshold = (value + 1) * 4; break; case MP_AUDIO_TX_START_HI: s->phys_buf = (s->phys_buf & 0xFFFF) | (value << 16); s->target_buffer = s->phys_buf; s->play_pos = 0; s->last_free = 0; break; } }
1threat
static int atrac3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ATRAC3Context *q = avctx->priv_data; int result = 0; const uint8_t* databuf; float *samples = data; if (buf_size < avctx->block_align) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); *data_size = 0; return buf_size; } if (q->scrambled_stream) { decode_bytes(buf, q->decoded_bytes_buffer, avctx->block_align); databuf = q->decoded_bytes_buffer; } else { databuf = buf; } result = decodeFrame(q, databuf, q->channels == 2 ? q->outSamples : &samples); if (result != 0) { av_log(NULL,AV_LOG_ERROR,"Frame decoding error!\n"); return -1; } if (q->channels == 2) { q->fmt_conv.float_interleave(samples, (const float **)q->outSamples, 1024, 2); } *data_size = 1024 * q->channels * av_get_bytes_per_sample(avctx->sample_fmt); return avctx->block_align; }
1threat
How to directly write to CSV using PHP : <p>I'm trying to use 'for loop' and write directly to csv without inserting into database and export as csv file.</p> <pre><code>&lt;?php require_once('function.php'); for ($i=0; $i &lt; 6000; $i++) { # code... $colum1= generatePassword(5); $colum2 = serial_number(5); #write directly to csv file } </code></pre>
0debug
Unix Replace specific column with one value for another string : <p>I would like to change the fourth column of a file when I have the following description for it. I can not find how to solve it. When the string 1-8 appears I want to replace it with 01-08 but only in the 4 column separated by pipe.</p> <pre><code>SBMM01|CAM|22|01-08|NAP|VL|OPEN|1 CCSM01|CAM||1-8|NAP|CR|CLOSED|1 EZEM01|CAM|19|01-08|SPL|CC|OPEN|5 SPTD01|CAM|29|25-32|CDO|VG|OPEN|1 NRFL01|||1-8|NAP|CR|CLOSED|5 |||1-8|NAP|CR|CLOSED|5 </code></pre> <p>by </p> <pre><code>SBMM01|CAM|22|01-08|NAP|VL|OPEN|1 CCSM01|CAM||01-08|NAP|CR|CLOSED|1 EZEM01|CAM|19|01-08|SPL|CC|OPEN|5 SPTD01|CAM|29|25-32|CDO|VG|OPEN|1 NRFL01|||01-08|NAP|CR|CLOSED|5 |||01-08|NAP|CR|CLOSED|5 </code></pre> <p>How can change it with sed or awk in Unix?</p>
0debug
How to connect to VPC using AWS managed VPN without special hardware? : <p>I have created a VPN, customer gateway and VPN connection in AWS console to my VPC. Now I want to download the configuration file to use for my VPN client on my windows 10 computer or MAC. However each of the options seems to need special hardware to function. Is there not a software solution I can install on my windows or mac computer which will take in this configuration and connect to my VPN gateway into the VPC?</p>
0debug
static inline void h264_loop_filter_luma_c(uint8_t *pix, int xstride, int ystride, int alpha, int beta, int *tc0) { int i, d; for( i = 0; i < 4; i++ ) { if( tc0[i] < 0 ) { pix += 4*ystride; continue; } for( d = 0; d < 4; d++ ) { const int p0 = pix[-1*xstride]; const int p1 = pix[-2*xstride]; const int p2 = pix[-3*xstride]; const int q0 = pix[0]; const int q1 = pix[1*xstride]; const int q2 = pix[2*xstride]; if( ABS( p0 - q0 ) < alpha && ABS( p1 - p0 ) < beta && ABS( q1 - q0 ) < beta ) { int tc = tc0[i]; int i_delta; if( ABS( p2 - p0 ) < beta ) { pix[-2*xstride] = p1 + clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0[i], tc0[i] ); tc++; } if( ABS( q2 - q0 ) < beta ) { pix[xstride] = q1 + clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0[i], tc0[i] ); tc++; } i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-xstride] = clip_uint8( p0 + i_delta ); pix[0] = clip_uint8( q0 - i_delta ); } pix += ystride; } } }
1threat
uint64_t HELPER(neon_add_saturate_u64)(uint64_t src1, uint64_t src2) { uint64_t res; res = src1 + src2; if (res < src1) { env->QF = 1; res = ~(uint64_t)0; } return res; }
1threat
What does * and ** mean in a C++ function declaration? : <p>In this function declaration:</p> <pre><code>long * multiply(long ** numbers){ </code></pre> <p>What do the * and ** mean? I'm somewhat of a beginner and haven't come across this before, so any explanation would be appreciated.</p>
0debug
Type signature for function with possibly polymorphic arguments : <p>Can I, and if so, how do I, write the type signature for a function:</p> <pre><code>g f x y = (f x, f y) </code></pre> <p>Such that given:</p> <pre><code>f1 :: a -&gt; [a] f1 x = [x] x1 :: Int x1 = 42 c1 :: Char c1 = 'c' f2 :: Int -&gt; Int f2 x = 3 * x x2 :: Int x2 = 5 </code></pre> <p>Such that:</p> <pre><code>g f1 x1 c1 == ([42], ['c']) :: ([Int], [Char]) g f2 x1 x2 == (126, 15) :: (Int, Int) </code></pre>
0debug
av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp) { #if HAVE_YASM int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) c->rv34_idct_dc_add = ff_rv34_idct_dc_add_mmx; if (mm_flags & AV_CPU_FLAG_MMXEXT) { c->rv34_inv_transform_dc = ff_rv34_idct_dc_noround_mmx2; c->rv34_idct_add = ff_rv34_idct_add_mmx2; } if (mm_flags & AV_CPU_FLAG_SSE4) c->rv34_idct_dc_add = ff_rv34_idct_dc_add_sse4; #endif }
1threat
Android ViewModel for a custom view : <p>I would like to refactor my Custom View to use android architecture components. However, I see that </p> <pre><code>ViewModelProviders.of(...) </code></pre> <p>takes only Activity or fragment. Any idea how to make it work? Should I use fragment instead of Custom View?</p>
0debug
Mask ssn using regular expression : I want to mask ssn number. I tried this code but it is not working var r = new RegExp('?:\d{3})-(?:\d{2})-(\d{4}'); var str = '123-12-1234'; var result = str.replace(r,'#########'); Do i need to change the expression? Thanks in advance
0debug
int float32_le( float32 a, float32 b STATUS_PARAM ) { flag aSign, bSign; if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) ) || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) ) ) { float_raise( float_flag_invalid STATUS_VAR); return 0; } aSign = extractFloat32Sign( a ); bSign = extractFloat32Sign( b ); if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 ); return ( a == b ) || ( aSign ^ ( a < b ) ); }
1threat
How to use the loading property in a watchQuery when using the Apollo client for GraphQl : <p>So when i get the response from my query, i can see there is a loading property. But i don't really get why they would pass it along. Because when you get the response it means that the loading is finished, hence the loading will always be false.</p> <p>Is there a way that i can use this loading property so that i can for example make a loading icon appear when the call is still loading?</p> <p>I have the following code in an Angular 2 environment:</p> <pre><code>public apolloQuery = gql` query { apolloQuery }`; const sub = this.apollo.watchQuery&lt;QueryResponse&gt;({ query: this.apolloQuery }).subscribe(data =&gt; { console.log(data); sub.unsubscribe(); }); </code></pre> <p>And the log from the data object contains the loading property i was talking about, which is always false.</p> <p>I know i can make my own boolean property and check this way, but i was just wondering if i could use the built-in loading property that Apollo provides?</p>
0debug
npm install and build of forked github repo : <p>This is not a totally new question, but I've been looking around for a good while now and I'm having trouble finding a solution.</p> <p>I'm using a module for my angular app called angular-translate. However, I've had to make a few small modifications to the source code to get everything working the way I'd like, and now I want to persist those changes on <code>npm install</code>. A colleague suggested that I fork the repo of the source code and point to my forked repo as a dependency, which I've tried in these ways, e.g.</p> <pre><code>npm install https://github.com/myRepo/angular-translate npm install https://github.com/myRepo/angular-translate/archive/master.tar.gz </code></pre> <p>The first gives me a directory like this with no build. Just a package.json, .npmignore, and some markdown files</p> <pre><code>-angular-translate .npmignore .nvmrc CHANGELOG.md package.json etc </code></pre> <p>The second <code>npm install</code> gives me the full repo, but again I don't get a build like when I use the command <code>npm install angular-translate</code>. I've seen some dicussion of running the prepublish script, but I'm not sure how to do this when installing all the modules. I've also tried publishing the fork as my own module to the npm registry, but again I get no build, and I'm not sure that's the right thing to do...</p> <p>I apologise for my ignorance on the topic. I don't have a huge amount of experience with npm. Would love to get some feedback on this issue. It seems like it could be a common enough issue when modifications need to be made to a package's source code? Maybe there's a better solution? Thanks in advance for your help.</p>
0debug
Add identical string to each element, passed as function parameter : <pre><code>if (something1 == true) SomeFunction('a:link', 'a:visited', 'a:hover, a:focus, a:active'); </code></pre> <p>What's the clever way to add <code>*</code> after each element? That's mean;</p> <pre><code>else (something2 == true) SomeFunction('a:link *', 'a:visited *', 'a:hover *, a:focus *, a:active *'); </code></pre>
0debug
Search on GoogleMap in Android : I develope Android app.I want to create a search system on GoogleMap using SearchView. I want to get multiple place names from the entered string (as in the original search on Google Maps), but Geocoder always returns a List with a single Address. How I can solve this problem? ``` SearchView searchView=(SearchView)findViewById(R.id.search); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return true; } @Override public boolean onQueryTextChange(String s) { try { Geocoder geocoder=new Geocoder(getApplicationContext()); List<Address> addresses = geocoder.getFromLocationName(s, 10); String[] addresses_string = new String[addresses.size()]; for(int i=0;i<addresses.size();i++) { addresses_string[i]=addresses.get(i).getAddressLine(0); } ArrayAdapter<String> a=new ArrayAdapter<String>(getApplicationContext(),R.layout.record,addresses_string); ListView list=(ListView)findViewById(R.id.list); list.setAdapter(a); } catch (Exception e) { .... } return true; } }); ```
0debug
C# I have 2 questions. Quetion 1, how do I get 20 movies with highest rating? Question 2, how do I make a menu in this? : using System; using System.Collections.Generic; using System.Xml; using System.Linq; namespace XXSlutuppgift_Movie { class Program { static void Main(string[] args) { List<Movie> movieCollection = GetMovieCollection(); List<Movie> Orderedlist = movieCollection.OrderBy(Film => Film.name).ToList(); List<Movie> Top20MovieRating = movieCollection.OrderBy(Film => Film.rating).ToList(); List<Movie> MovieYear = movieCollection.OrderBy(Film => Film.year).ToList(); List<Movie> LetterSearch = movieCollection.OrderBy(Film => Film.name).ToList(); static List<Movie> GetMovieCollection() { List<Movie> list = new List<Movie>(); XmlDocument doc = new XmlDocument(); doc.Load(System.Environment.CurrentDirectory + "/moviecollection.xml"); XmlNode node = doc.DocumentElement.SelectSingleNode("/MovieCollection/Movies"); foreach(XmlNode row in node.ChildNodes) { Movie item = new Movie(); item.id = Int32.Parse(row.SelectSingleNode("Id").InnerText); item.name = row.SelectSingleNode("Name").InnerText; item.rating = Double.Parse(row.SelectSingleNode("Rating").InnerText.Replace(".", ",")); item.votes = Int32.Parse(row.SelectSingleNode("Votes").InnerText); item.year = Int32.Parse(row.SelectSingleNode("Year").InnerText); list.Add(item); } return list; } } } ------------------------------------------------------------------------
0debug
Concatenate word of a column with every other words from other column python : <p>Here is the dataset</p> <pre><code>pd.DataFrame({'Word':['Iron','copper','nickel'],'Sentence':['An Apple a day','Roses are red','Skies are blue']}) </code></pre> <p>I'm trying to concatenate one word with every other word and append that into a new column such that my output will look like</p> <pre><code> Word Sentence New_Sentence 0 Iron An Apple a day An_Iron Apple_Iron a_Iron day_Iron 1 copper Roses are red Roses_copper are_copper red_copper 2 nickel Skies are blue skies_nickel are_nickel blue_nickel </code></pre> <p>Any suggestions?</p>
0debug
NgStyle returns: ERROR Error: Cannot find a differ supporting object '{"background-color":"blue"}' : <p>With this in my template,</p> <pre><code>&lt;span [ngStyle]="myStyle()"&gt; HELLO &lt;/span&gt; </code></pre> <p>And this in my component,</p> <pre><code>myStyle(): string { return '{"background-color":"blue"}' } </code></pre> <p>I'm getting </p> <pre><code>ERROR Error: Cannot find a differ supporting object '{"background-color":"blue"}' at KeyValueDiffers.webpackJsonp.../../../core/@angular/core.es5.js.KeyValueDiffers.find (core.es5.js:8051) at NgStyle.set [as ngStyle] (common.es5.js:2441) at updateProp (core.es5.js:11114) at checkAndUpdateDirectiveInline (core.es5.js:10806) at checkAndUpdateNodeInline (core.es5.js:12349) at checkAndUpdateNode (core.es5.js:12288) at debugCheckAndUpdateNode (core.es5.js:13149) at debugCheckDirectivesFn (core.es5.js:13090) at Object.View_AppComponent_2.currVal_2 [as updateDirectives] (AppComponent.html:10) at Object.debugUpdateDirectives [as updateDirectives] (core.es5.js:13075) View_AppComponent_2 @ AppComponent.html:10 webpackJsonp.../../../core/@angular/core.es5.js.DebugContext_.logError @ core.es5.js:13415 </code></pre>
0debug
static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h) { HEVCLocalContext *lc = &s->HEVClc; uint8_t *src = ref->data[0]; ptrdiff_t srcstride = ref->linesize[0]; int pic_width = s->ps.sps->width; int pic_height = s->ps.sps->height; int mx = mv->x & 3; int my = mv->y & 3; int extra_left = ff_hevc_qpel_extra_before[mx]; int extra_top = ff_hevc_qpel_extra_before[my]; x_off += mv->x >> 2; y_off += mv->y >> 2; src += y_off * srcstride + (x_off << s->ps.sps->pixel_shift); if (x_off < extra_left || y_off < extra_top || x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] || y_off >= pic_height - block_h - ff_hevc_qpel_extra_after[my]) { const int edge_emu_stride = EDGE_EMU_BUFFER_STRIDE << s->ps.sps->pixel_shift; int offset = extra_top * srcstride + (extra_left << s->ps.sps->pixel_shift); int buf_offset = extra_top * edge_emu_stride + (extra_left << s->ps.sps->pixel_shift); s->vdsp.emulated_edge_mc(lc->edge_emu_buffer, src - offset, edge_emu_stride, srcstride, block_w + ff_hevc_qpel_extra[mx], block_h + ff_hevc_qpel_extra[my], x_off - extra_left, y_off - extra_top, pic_width, pic_height); src = lc->edge_emu_buffer + buf_offset; srcstride = edge_emu_stride; } s->hevcdsp.put_hevc_qpel[my][mx](dst, dststride, src, srcstride, block_w, block_h, lc->mc_buffer); }
1threat
void ff_put_h264_qpel8_mc30_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_8w_msa(src - 2, stride, dst, stride, 8, 1); }
1threat
void helper_mtc0_status(CPUMIPSState *env, target_ulong arg1) { MIPSCPU *cpu = mips_env_get_cpu(env); uint32_t val, old; uint32_t mask = env->CP0_Status_rw_bitmask; if (env->insn_flags & ISA_MIPS32R6) { if (extract32(env->CP0_Status, CP0St_KSU, 2) == 0x3) { mask &= ~(3 << CP0St_KSU); } mask &= ~(0x00180000 & arg1); } val = arg1 & mask; old = env->CP0_Status; env->CP0_Status = (env->CP0_Status & ~mask) | val; if (env->CP0_Config3 & (1 << CP0C3_MT)) { sync_c0_status(env, env, env->current_tc); } else { compute_hflags(env); } if (qemu_loglevel_mask(CPU_LOG_EXEC)) { qemu_log("Status %08x (%08x) => %08x (%08x) Cause %08x", old, old & env->CP0_Cause & CP0Ca_IP_mask, val, val & env->CP0_Cause & CP0Ca_IP_mask, env->CP0_Cause); switch (env->hflags & MIPS_HFLAG_KSU) { case MIPS_HFLAG_UM: qemu_log(", UM\n"); break; case MIPS_HFLAG_SM: qemu_log(", SM\n"); break; case MIPS_HFLAG_KM: qemu_log("\n"); break; default: cpu_abort(CPU(cpu), "Invalid MMU mode!\n"); break; } } }
1threat
C:\xampp\htdocs\web\system\database\DB_driver.php : A Database Error Occurred Error Number: 1054 Unknown column 'footer' in 'where clause' SELECT `submenus`.`text_ge` as sub_title, `staties`.`title_ge` as stat_title, `staties`.`id` as stat_id FROM (`submenus`) JOIN `staties` ON `staties`.`submenu_id` = `submenus`.`id` WHERE `footer` = 1 GROUP BY `staties`.`id` Filename: C:\xampp\htdocs\web\system\database\DB_driver.php Line Number: 330 I have some problems here, I dont know what to do , anyone help plz. tnx
0debug
Unsupportd operand type of an string index : I tried to run the code down below , but I couldn't because it launched the following error: unsupported operand type(s) for -: 'str' and 'int'. I've been searching and I found that it has somthing to do with the input, but not in this case. st = "text" for i in range(0, n): for j in st: if j == 0: st[j] = st[len(st)] else: st[j] = st[j - 1]
0debug
SDKApplicationDelegate Use of unresolved identifier : <p>I have two pods installed for facebook login</p> <pre><code>pod 'FacebookCore' pod 'FacebookLogin' </code></pre> <p>than imported FacebookCore in appdelegate. still it shows use of unresolved identifier error.</p> <p><a href="https://i.stack.imgur.com/eCxmf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eCxmf.png" alt="unresolved identifier error"></a></p> <p>I have also implemented tags in info.plist</p> <pre><code>&lt;array&gt; &lt;string&gt;fb---------&lt;/string&gt; &lt;/array&gt; &lt;key&gt;FacebookAppID&lt;/key&gt; &lt;string&gt;-----------&lt;/string&gt; &lt;key&gt;FacebookDisplayName&lt;/key&gt; &lt;string&gt;-----------&lt;/string&gt; </code></pre> <p>Still not able to get SDKApplicationDelegate.</p> <pre><code>func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -&gt; Bool { if SDKApplicationDelegate.shared.application(app, open: url, options: options) { return true } return false } </code></pre>
0debug
void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) { va_list ap; va_start(ap, fmt); error_setv(errp, err_class, fmt, ap); va_end(ap); }
1threat
uialertcontroler Xcode Obj C : My uialertcontroler diseppear automaticly, why ? -(void)marge_carburant{ NSString *quantite_carburant_reglementaire = [[NSUserDefaults standardUserDefaults] stringForKey:@"quantite_carburant_reglementaire"]; // PRISE EN CHARGE DU REGLAGE DE LA MARGE CARBU if ([quantite_carburant_reglementaire isEqual: @"2"]){ quantite_reglementaire = 21; } if ([quantite_carburant_reglementaire isEqual: @"1"]){ quantite_reglementaire = 0; UIAlertController *alert_carbu_reglementaire = [UIAlertController alertControllerWithTitle:@"ATTENTION" message:@"Le résultat ne prend pas en compte la quantité réglementaire" preferredStyle:UIAlertControllerStyleAlert]; [self presentViewController:alert_carbu_reglementaire animated:YES completion:nil]; [self performSelector:@selector(dismissTheAlert) withObject:nil afterDelay:3.0]; } } - (void) dismissTheAlert { [self dismissViewControllerAnimated:YES completion:^{}]; }
0debug
Azure Management REST API - "Authentication failed. The 'Authorization' header is provided in an invalid format." : <p>I am desperately trying to move 2 classic storage accounts from my old MSDN subscription to my MPN subscription and I keep hitting a brick wall as move is only supported for these through REST APIs.</p> <p>I have enabled the APIs following the instructions here....</p> <p><a href="https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/" rel="noreferrer">https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/</a></p> <p>and here...</p> <p><a href="https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx</a></p> <p>but am completely flummoxed. I have created a POST request as suggested to check status as the first call in the 'move resources' instructions...</p> <p>POST <a href="https://management.azure.com/subscriptions/" rel="noreferrer">https://management.azure.com/subscriptions/</a>{subscriptionId}/providers/Microsoft.ClassicCompute/validateSubscriptionMoveAvailability</p> <p>(with the subscriptionId replaced with the ID for each) and passing the appropriate source / target body in.</p> <p>I have also provided the Authorization header as follows...</p> <p>Authorization: {key as generated by the Azure portal}</p> <p>Completely lost now. I have tried using both Fiddler &amp; Postman. PowerShell isn't an option for me because I don't know it at all. I just want to move 2 items over and so far just having these management APIs running has cost me over £15 and my website is on the verge of going down as my credit will soon expire.</p> <p>Any help would be most appreciated.</p>
0debug
static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size, void *data) { DVVideoContext *s = c->priv_data; s->sys = dv_codec_profile(c); if (!s->sys) return -1; if(buf_size < s->sys->frame_size) return -1; c->pix_fmt = s->sys->pix_fmt; s->picture = *((AVFrame *)data); s->picture.key_frame = 1; s->picture.pict_type = FF_I_TYPE; s->buf = buf; c->execute(c, dv_encode_mt, (void**)&s->dv_anchor[0], NULL, s->sys->difseg_size * 27); emms_c(); return s->sys->frame_size; }
1threat
address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, hwaddr *xlat, hwaddr *plen) { MemoryRegionSection *section; AddressSpaceDispatch *d = cpu->cpu_ases[asidx].memory_dispatch; section = address_space_translate_internal(d, addr, xlat, plen, false); assert(!section->mr->iommu_ops); return section; }
1threat
Removing suffix from column names using rename_all? : <p>I have a data frame with a number of columns in a form var1.mean, var2.mean. I would like to strip the suffix ".mean" from all columns that contain it. I tried using rename_all in conjunction with regex in a pipe but could not come up with a correct syntax. Any suggestions? </p>
0debug
static DeviceState *sbi_init(target_phys_addr_t addr, qemu_irq **parent_irq) { DeviceState *dev; SysBusDevice *s; unsigned int i; dev = qdev_create(NULL, "sbi"); qdev_init(dev); s = sysbus_from_qdev(dev); for (i = 0; i < MAX_CPUS; i++) { sysbus_connect_irq(s, i, *parent_irq[i]); } sysbus_mmio_map(s, 0, addr); return dev; }
1threat
card-deck, "Deck not defined" node.js : <p>So, I am progressing in making a card game in Discord with Javascript/node.js. I have been messing with this (<a href="https://www.npmjs.com/package/card-deck" rel="nofollow noreferrer">https://www.npmjs.com/package/card-deck</a>) in the RunKit just to try and get a basic understanding before using it with my code. Perhaps call me totally inexperienced, but I get the result below when running the code displayed in the image.</p> <p><a href="https://i.gyazo.com/72da331f99b77afe425c132bacec8078.png" rel="nofollow noreferrer">https://i.gyazo.com/72da331f99b77afe425c132bacec8078.png</a></p> <p>I also tried it in VSC, after installing as they recommend, to get the same result. I noticed that card-deck is on the older side (3 years old on last update) so I don't know if something is outdated and that is why it isn't working, or I am completely missing something. </p> <p>Any advice? I need the card/deck handling to be able to require various piles/objects. Discard pile, active cards, hand, side decks, ect... and be able to move cards to and from them after originating in a "main deck". Any advice on what went wrong or advice on where to start would be great. Thanks.</p>
0debug
static DeviceState *slavio_intctl_init(target_phys_addr_t addr, target_phys_addr_t addrg, qemu_irq **parent_irq) { DeviceState *dev; SysBusDevice *s; unsigned int i, j; dev = qdev_create(NULL, "slavio_intctl"); qdev_init(dev); s = sysbus_from_qdev(dev); for (i = 0; i < MAX_CPUS; i++) { for (j = 0; j < MAX_PILS; j++) { sysbus_connect_irq(s, i * MAX_PILS + j, parent_irq[i][j]); } } sysbus_mmio_map(s, 0, addrg); for (i = 0; i < MAX_CPUS; i++) { sysbus_mmio_map(s, i + 1, addr + i * TARGET_PAGE_SIZE); } return dev; }
1threat
static void usbredir_put_bufpq(QEMUFile *f, void *priv, size_t unused) { struct endp_data *endp = priv; USBRedirDevice *dev = endp->dev; struct buf_packet *bufp; int i = 0; qemu_put_be32(f, endp->bufpq_size); QTAILQ_FOREACH(bufp, &endp->bufpq, next) { DPRINTF("put_bufpq %d/%d len %d status %d\n", i + 1, endp->bufpq_size, bufp->len, bufp->status); qemu_put_be32(f, bufp->len); qemu_put_be32(f, bufp->status); qemu_put_buffer(f, bufp->data, bufp->len); i++; } assert(i == endp->bufpq_size); }
1threat
Implement sudoku puzzel 9x9 by Graph : i have a sudoku puzzel 9x9 in a text file and i wondering how can we create a Graph from sudoku puzzel. Example puzzel 0 0 0 0 9 8 0 4 5 0 0 4 3 2 0 7 0 0 7 9 0 5 0 0 0 3 0 0 0 0 9 0 0 4 0 0 0 4 5 0 0 2 8 0 0 8 7 9 6 0 4 0 1 0 0 3 0 0 7 9 0 6 4 4 5 0 2 1 3 9 0 8 0 8 7 4 6 5 0 0 0 and class Graph class Graph { private int V; private LinkedList<Integer> adj[]; Graph(int v) { V = v; adj = new LinkedList[v]; for (int i=0; i<v; ++i) adj[i] = new LinkedList(); } void addEdge(int v,int w) { adj[v].add(w); adj[w].add(v); } public int getV() { return V; } public LinkedList<Integer> getListAdj(int u) { return adj[u]; } I write a function to read puzzel from a text file and implement it to graph public boolean readGraph(String input_name, int result[]) { return true; } But i stuck in this step.I hope someone can help me with this tks.
0debug
Time conversion in java of format 20170526T043000Z : <p>I have a time string in the following format 20170526T043000Z how can I convert it to milliseconds.</p>
0debug
Understanding the concept of Lifetime scope in Autofac : <p>Forgive me I just learned the <code>Autofac</code>. I have some problem to understand the <code>Lifetime scope</code> in <code>Autofac</code>. Please help to review below. </p> <p>Say we have the code below.</p> <pre><code>using(var scope = container.BeginLifetimeScope()) { // Resolve services from a scope that is a child // of the root container. var service = scope.Resolve&lt;IService&gt;(); // You can also create nested scopes... using(var unitOfWorkScope = scope.BeginLifetimeScope()) { var anotherService = unitOfWorkScope.Resolve&lt;IOther&gt;(); } } </code></pre> <p>As the <a href="http://autofac.readthedocs.io/en/latest/lifetime/working-with-scopes.html#creating-a-new-lifetime-scope" rel="noreferrer">Document</a> put. <code>Lifetime scopes are disposable and they track component disposal</code>. </p> <p>Does it mean <code>service</code> is disposable and can be recycled by the GC after the statement <code>using(var scope = container.BeginLifetimeScope())</code> finished?</p> <p>And so does it to the <code>anotherService</code> in the nested scope ? ?</p> <p>How can I testify it by some experiment?</p> <p>Thanks.</p>
0debug
How can I make a div take parent div's end as its zero position for start? : I created a profile dialog body like this: ` <div style="background-color: white;color: black;border-radius: 2px; position: absolute; top: 52px; right: 10px; padding: 2px"> <div style="width: 0; height: 0; border-style: solid; border-width: 0 10px 15px 10px; border-color: transparent transparent #ffffff transparent; position: relative; top: -10px; right: -165px"> </div>` I want to place child little triangle div always 10-20px far away from right end of parent div. How I can make second little triangle div take its start position on right from the end of parent div?
0debug
udp_listen(port, laddr, lport, flags) u_int port; u_int32_t laddr; u_int lport; int flags; { struct sockaddr_in addr; struct socket *so; int addrlen = sizeof(struct sockaddr_in), opt = 1; if ((so = socreate()) == NULL) { free(so); return NULL; } so->s = socket(AF_INET,SOCK_DGRAM,0); so->so_expire = curtime + SO_EXPIRE; insque(so,&udb); addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = port; if (bind(so->s,(struct sockaddr *)&addr, addrlen) < 0) { udp_detach(so); return NULL; } setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); getsockname(so->s,(struct sockaddr *)&addr,&addrlen); so->so_fport = addr.sin_port; if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr) so->so_faddr = alias_addr; else so->so_faddr = addr.sin_addr; so->so_lport = lport; so->so_laddr.s_addr = laddr; if (flags != SS_FACCEPTONCE) so->so_expire = 0; so->so_state = SS_ISFCONNECTED; return so; }
1threat
How to make a POST request using retrofit 2? : <p>I was only able to run the hello world example (GithubService) from the docs. </p> <p>The problem is when I run my code, I get the following Error, inside of <code>onFailure()</code></p> <blockquote> <p>Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $</p> </blockquote> <p>My API takes POST params value, so no need to encode them as JSON, but it does return the response in JSON.</p> <p>For the response I got ApiResponse class that I generated using tools.</p> <p>My interface:</p> <pre><code>public interface ApiService { @POST("/") Call&lt;ApiResponse&gt; request(@Body HashMap&lt;String, String&gt; parameters); } </code></pre> <p>Here is how I use the service:</p> <pre><code>HashMap&lt;String, String&gt; parameters = new HashMap&lt;&gt;(); parameters.put("api_key", "xxxxxxxxx"); parameters.put("app_id", "xxxxxxxxxxx"); Call&lt;ApiResponse&gt; call = client.request(parameters); call.enqueue(new Callback&lt;ApiResponse&gt;() { @Override public void onResponse(Response&lt;ApiResponse&gt; response) { Log.d(LOG_TAG, "message = " + response.message()); if(response.isSuccess()){ Log.d(LOG_TAG, "-----isSuccess----"); }else{ Log.d(LOG_TAG, "-----isFalse-----"); } } @Override public void onFailure(Throwable t) { Log.d(LOG_TAG, "----onFailure------"); Log.e(LOG_TAG, t.getMessage()); Log.d(LOG_TAG, "----onFailure------"); } }); </code></pre>
0debug
static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *dc = container_of(dcbase, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), 0); }
1threat
I was iterating over a List and print each element, why the code throws error? : <p>I was iterating over a List and print each element, the code is very simply, but the program throws error.</p> <p><a href="https://i.stack.imgur.com/Crjy0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Crjy0.png" alt="enter image description here"></a></p>
0debug
Free Offline Satellite photo : <p>I tested the leaflet library and it works. now I need to download FREE satellite photos of south america (Chile, Argentina and Uruguay). I prefer 10MB/px (150m aprox) approximately.</p> <p>Please help me download the images to complete my project.</p> <p>Tanks!</p> <p>Marcelo</p>
0debug
Php array of arrays get right result : <p>I wanna to iterate trought array of arrays. What i have:</p> <pre><code>$params = [ 'regs' =&gt; [156, 154, 138, 132, 142, 144], 'axis' =&gt; [0, 0, 0, 0, 0, 0], 'visible' =&gt; [1, 1, 0, 1, 0, 0], 'dependencies' =&gt; [1, 1, 1, 1, 1, 1], ]; </code></pre> <p>What i want to get: </p> <pre><code>foreach() { foreach() { render_element(reg = 156, axis = 0, visible = 1, dep = 1); *render_element(reg = 154, axis = 0, visible = 1, dep = 1); *render_element(reg = 138, axis = 0, visible = 0, dep = 1); etc } } </code></pre>
0debug
aria-expanded html attribute : <p>I am currently making a navbar and came accross the <code>aria-expanded</code> html attribute. I know of course that the element is used to let an element either expand or collapse. I could find very little information with regard to this and the <a href="https://www.w3.org/WAI/GL/wiki/Using_aria-expanded_to_indicate_the_state_of_a_collapsible_element" rel="noreferrer">W3C docs</a> aren't that clear IMO.</p> <h2>Question</h2> <p>How does this attribute work exactly?</p>
0debug
What do * (single star) and / (slash) do as independent parameters? : <p>In the following function definition, what do the <strong>*</strong> and <strong>/</strong> account for?</p> <pre><code>def func(self, param1, param2, /, param3, *, param4, param5): print(param1, param2, param3, param4, param5) </code></pre> <p><em>NOTE: Not to mistake with the single|double asterisks in *args | **kwargs (<a href="https://stackoverflow.com/questions/36901/what-does-double-star-asterisk-and-star-asterisk-do-for-parameters">solved here</a>)</em></p>
0debug
Android Data don't stored to SQLite Database : I would like to ask something about Store Android Data to SQLite Database (i am new to SQLite Database). I have been trying to store data to SQLite Database, but when i saw the database with SQLiteStudio the data was empty. This is my code : - DatabaseHelper.java package com.example.toolsmanager; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "btm.db"; private static final int DATABASE_VERSION = 1; public DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public static final String TABLE_1 = "oneroundsingle"; public static final String TABLE1_COLUMN1 = "_ID"; public static final String TABLE1_COLUMN2 = "GAMETYPE"; public static final String TABLE1_COLUMN3 = "PLAYER1"; public static final String TABLE1_COLUMN4 = "PLAYER2"; public static final String TABLE1_COLUMN5 = "SCORE"; public static final String TABLE1_COLUMN6 = "WINNER"; public static final String CREATE_TABLE_ORS = "create table" + TABLE_1 + " ( " + TABLE1_COLUMN1 + " integer primary key autoincrement, " + TABLE1_COLUMN2 + " text, " + TABLE1_COLUMN3 + " text, " + TABLE1_COLUMN4 + " text, " + TABLE1_COLUMN5 + " text, " + TABLE1_COLUMN6 + " text " + ");"; @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_ORS); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("drop table if exists" + TABLE_1); onCreate(db); } } - OR_SingleCount.java package com.example.toolsmanager; import android.content.ContentValues; import android.content.DialogInterface; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class OR_SingleCount extends AppCompatActivity { int player1_score, player2_score, final_score; TextView text_player1_name, text_player2_name; String score, winner; DatabaseHelper databaseHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_or_single_count); text_player1_name = (TextView)findViewById(R.id.player1_name); text_player1_name.setText(getIntent().getExtras().getString("player1")); text_player2_name = (TextView)findViewById(R.id.player2_name); text_player2_name.setText(getIntent().getExtras().getString("player2")); } public void singleCount(View v) { int id = v.getId(); if (id == R.id.player1_plus) { player1_score += 1; TextView text_player1_score = (TextView) findViewById(R.id.player1_score); text_player1_score.setText(String.valueOf(player1_score)); } else if (id == R.id.player1_minus && player1_score != 0) { player1_score -= 1; TextView text_player1_score = (TextView) findViewById(R.id.player1_score); text_player1_score.setText(String.valueOf(player1_score)); } else if (id == R.id.player2_plus) { player2_score += 1; TextView text_player2_score = (TextView) findViewById(R.id.player2_score); text_player2_score.setText(String.valueOf(player2_score)); } else if (id == R.id.player2_minus && player2_score != 0) { player2_score -= 1; TextView text_player2_score = (TextView) findViewById(R.id.player2_score); text_player2_score.setText(String.valueOf(player2_score)); } finalScore(); } public void finalScore(){ if ((player1_score == 21 && player2_score < 20) || (player2_score == 21 && player1_score < 20)) { final_score = 21; getWinner(); } else if (player1_score == 30 || player2_score == 30) { final_score = 30; getWinner(); } else if (player1_score >= 20 && player2_score >= 20) { if (player1_score == player2_score + 2) { final_score = player1_score; getWinner(); } else if (player2_score == player1_score + 2) { final_score = player2_score; getWinner(); } } } public void getWinner() { if (player1_score == final_score){ winner = text_player1_name.getText().toString(); String print_winner = winner + " is the winner"; Toast.makeText(getApplicationContext(),print_winner, Toast.LENGTH_LONG).show(); } else if(player2_score == final_score) { winner = text_player2_name.getText().toString(); String print_winner = winner + " is the winner"; Toast.makeText(getApplicationContext(), print_winner, Toast.LENGTH_LONG).show(); } score = player1_score + " - " + player2_score; String gametype = "Single"; addORSingleData(gametype, text_player1_name.getText().toString(), text_player2_name.getText().toString(), score, winner); AlertDialog repeatdialog= new AlertDialog.Builder(this) .setTitle("Game Finish") .setMessage("Do you want to repeat the game?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { player1_score = 0; player2_score = 0; recreate(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent i = new Intent(OR_SingleCount.this, OneRoundMatch.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); finish(); } }).create(); repeatdialog.show(); } public void addORSingleData(String gametype, String player1, String player2, String score, String winner){ databaseHelper = new DatabaseHelper(this); SQLiteDatabase db = databaseHelper.getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(DatabaseHelper.TABLE1_COLUMN2, gametype); contentValues.put(DatabaseHelper.TABLE1_COLUMN3, player1); contentValues.put(DatabaseHelper.TABLE1_COLUMN4, player2); contentValues.put(DatabaseHelper.TABLE1_COLUMN5, score); contentValues.put(DatabaseHelper.TABLE1_COLUMN6, winner); db.insert(DatabaseHelper.TABLE_1, null, contentValues); } /*public void insertHistory(){ score = player1_score + " - " + player2_score; SQLiteDatabase db = databaseHelper.getWritableDatabase(); db.execSQL("insert into oneroundsingle(GAMETYPE, PLAYER1, PLAYER2, SCORE, WINNER) values('" + "Single" + "','" + text_player1_name.getText().toString() + "','" + text_player2_name.getText().toString() + "','" + score + "','" + winner + "')" ); }*/ } What's wrong with my code? Please help me
0debug
-0.1.ToString("0") is "-0" in .NET Core and "0" in .NET Framework : <pre><code>(-0.1).ToString("0") </code></pre> <p>evaluates to "-0" in .NET Core and "0" in .NET Framework when value is double or float. On the other hand when value is decimal:</p> <pre><code>(-0.1M).ToString("0") </code></pre> <p>it evaluates to "0" in both frameworks.</p> <p>Does anyone have more details on this change and which one is correct?</p>
0debug
Remove \ From String : I can not remove \ from query string in swift Language. I am using multiple option but it didn't work so please help me. The sting is : > "INSERT OR REPLACE INTO List VALUES(NULL,\'RS\',\'PRODUCTI > FO\',\'AX[Demo]\',\'abc\',\'All\',\'Sk\')"
0debug
static void *migration_thread(void *opaque) { MigrationState *s = opaque; int64_t initial_time = qemu_get_clock_ms(rt_clock); int64_t initial_bytes = 0; int64_t max_size = 0; int64_t start_time = initial_time; bool old_vm_running = false; DPRINTF("beginning savevm\n"); qemu_savevm_state_begin(s->file, &s->params); while (s->state == MIG_STATE_ACTIVE) { int64_t current_time; uint64_t pending_size; if (!qemu_file_rate_limit(s->file)) { DPRINTF("iterate\n"); pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size && pending_size >= max_size) { qemu_savevm_state_iterate(s->file); } else { int ret; DPRINTF("done iterating\n"); qemu_mutex_lock_iothread(); start_time = qemu_get_clock_ms(rt_clock); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); old_vm_running = runstate_is_running(); ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); if (ret >= 0) { qemu_file_set_rate_limit(s->file, INT_MAX); qemu_savevm_state_complete(s->file); } qemu_mutex_unlock_iothread(); if (ret < 0) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } if (!qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_COMPLETED); break; } } } if (qemu_file_get_error(s->file)) { migrate_finish_set_state(s, MIG_STATE_ERROR); break; } current_time = qemu_get_clock_ms(rt_clock); if (current_time >= initial_time + BUFFER_DELAY) { uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes; uint64_t time_spent = current_time - initial_time; double bandwidth = transferred_bytes / time_spent; max_size = bandwidth * migrate_max_downtime() / 1000000; s->mbps = time_spent ? (((double) transferred_bytes * 8.0) / ((double) time_spent / 1000.0)) / 1000.0 / 1000.0 : -1; DPRINTF("transferred %" PRIu64 " time_spent %" PRIu64 " bandwidth %g max_size %" PRId64 "\n", transferred_bytes, time_spent, bandwidth, max_size); if (s->dirty_bytes_rate && transferred_bytes > 10000) { s->expected_downtime = s->dirty_bytes_rate / bandwidth; } qemu_file_reset_rate_limit(s->file); initial_time = current_time; initial_bytes = qemu_ftell(s->file); } if (qemu_file_rate_limit(s->file)) { g_usleep((initial_time + BUFFER_DELAY - current_time)*1000); } } qemu_mutex_lock_iothread(); if (s->state == MIG_STATE_COMPLETED) { int64_t end_time = qemu_get_clock_ms(rt_clock); s->total_time = end_time - s->total_time; s->downtime = end_time - start_time; runstate_set(RUN_STATE_POSTMIGRATE); } else { if (old_vm_running) { vm_start(); } } qemu_bh_schedule(s->cleanup_bh); qemu_mutex_unlock_iothread(); return NULL; }
1threat
static int decode_mb_info(IVI4DecContext *ctx, IVIBandDesc *band, IVITile *tile, AVCodecContext *avctx) { int x, y, mv_x, mv_y, mv_delta, offs, mb_offset, blks_per_mb, mv_scale, mb_type_bits, s; IVIMbInfo *mb, *ref_mb; int row_offset = band->mb_size * band->pitch; mb = tile->mbs; ref_mb = tile->ref_mbs; offs = tile->ypos * band->pitch + tile->xpos; blks_per_mb = band->mb_size != band->blk_size ? 4 : 1; mb_type_bits = ctx->frame_type == FRAMETYPE_BIDIR ? 2 : 1; mv_scale = (ctx->planes[0].bands[0].mb_size >> 3) - (band->mb_size >> 3); mv_x = mv_y = 0; if (((tile->width + band->mb_size-1)/band->mb_size) * ((tile->height + band->mb_size-1)/band->mb_size) != tile->num_MBs) { av_log(avctx, AV_LOG_ERROR, "num_MBs mismatch %d %d %d %d\n", tile->width, tile->height, band->mb_size, tile->num_MBs); return -1; } for (y = tile->ypos; y < tile->ypos + tile->height; y += band->mb_size) { mb_offset = offs; for (x = tile->xpos; x < tile->xpos + tile->width; x += band->mb_size) { mb->xpos = x; mb->ypos = y; mb->buf_offs = mb_offset; if (get_bits1(&ctx->gb)) { if (ctx->frame_type == FRAMETYPE_INTRA) { av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n"); return AVERROR_INVALIDDATA; } mb->type = 1; mb->cbp = 0; mb->q_delta = 0; if (!band->plane && !band->band_num && ctx->in_q) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } mb->mv_x = mb->mv_y = 0; if (band->inherit_mv) { if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } } else { if (band->inherit_mv && ref_mb) { mb->type = ref_mb->type; } else if (ctx->frame_type == FRAMETYPE_INTRA) { mb->type = 0; } else { mb->type = get_bits(&ctx->gb, mb_type_bits); } mb->cbp = get_bits(&ctx->gb, blks_per_mb); mb->q_delta = 0; if (band->inherit_qdelta) { if (ref_mb) mb->q_delta = ref_mb->q_delta; } else if (mb->cbp || (!band->plane && !band->band_num && ctx->in_q)) { mb->q_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mb->q_delta = IVI_TOSIGNED(mb->q_delta); } if (!mb->type) { mb->mv_x = mb->mv_y = 0; } else { if (band->inherit_mv) { if (mv_scale) { mb->mv_x = ivi_scale_mv(ref_mb->mv_x, mv_scale); mb->mv_y = ivi_scale_mv(ref_mb->mv_y, mv_scale); } else { mb->mv_x = ref_mb->mv_x; mb->mv_y = ref_mb->mv_y; } } else { mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_y += IVI_TOSIGNED(mv_delta); mv_delta = get_vlc2(&ctx->gb, ctx->mb_vlc.tab->table, IVI_VLC_BITS, 1); mv_x += IVI_TOSIGNED(mv_delta); mb->mv_x = mv_x; mb->mv_y = mv_y; } } } s= band->is_halfpel; if (mb->type) if ( x + (mb->mv_x >>s) + (y+ (mb->mv_y >>s))*band->pitch < 0 || x + ((mb->mv_x+s)>>s) + band->mb_size - 1 + (y+band->mb_size - 1 +((mb->mv_y+s)>>s))*band->pitch > band->bufsize -1) { av_log(avctx, AV_LOG_ERROR, "motion vector %d %d outside reference\n", x*s + mb->mv_x, y*s + mb->mv_y); return AVERROR_INVALIDDATA; } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } align_get_bits(&ctx->gb); return 0; }
1threat
how can i enter manually iee 754 to a float? : Helly guys, i recive 3 arguments NaN, +infinity and -infinity and i want to genrate manually NaN,+inf,-inf by changing the exponent and the mantisa of the iee 754 number how can i do it and save it after in to a float array. #include<stdio.h> #include<stdlib.h> int main(int argc,char*argv[]){ int n=argc; float array[n]; int i; for(i=0;i<n;i++){ array[i]=argv[i]; float number = argv[i] printf("the array[%f] is : %f",i,number); } return 0; }
0debug
void s390_init_cpus(MachineState *machine) { int i; gchar *name; if (machine->cpu_model == NULL) { machine->cpu_model = "host"; } cpu_states = g_malloc0(sizeof(S390CPU *) * max_cpus); for (i = 0; i < max_cpus; i++) { name = g_strdup_printf("cpu[%i]", i); object_property_add_link(OBJECT(machine), name, TYPE_S390_CPU, (Object **) &cpu_states[i], object_property_allow_set_link, OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); g_free(name); } for (i = 0; i < smp_cpus; i++) { cpu_s390x_init(machine->cpu_model); } }
1threat
Need Help Making An Upside Down Pattern With Nested For Loops in Python : I am a beginner to python and programming in general, going on about a month now. I need to make a pattern with a function, which given an integer(n) will print out a particular pattern of size n. It should look like this at size 4, for example: !!!!!!!!!!!!!! \\!!!!!!!!!!// \\\\!!!!!!//// \\\\\\!!////// Here is my code thus far. I don't know how to invert the pyramid shape, and I don't know how to get the slashes to work with the exclamation points to create the desired pattern as you can see: def slashFigure(): width = int(input("Enter a number: ")) for i in range(0, width): for j in range(0, width - i): print("\\", end="") for k in range (0, 2*i + 1): print("!!", end="") print("/") slashFigure()
0debug
TypeScrypt oneliner to PHP : I'm translating a code from TypeScrypt to PHP and that's going well so far. In TypeScrypt there are some oneliners that I need to translate but I don't seem te get it right. The TypeScrypt code is: `const InContent: string = subclass.Ins .map((In: In) => In.OutId + In.OutIndex) .reduce((a, b) => a + b, '');` Now I know that PHP 7 has functions like `array_map`, `array_reduce` and `array_column`. I think it is possible to create this TypeScript oneliner also in PHP as a oneliner, but I can't see how. Is there someone that can help me with this? Thanks in advanced!
0debug
int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) { int frame_size_code; memset(hdr, 0, sizeof(*hdr)); hdr->sync_word = get_bits(gbc, 16); if(hdr->sync_word != 0x0B77) return AAC_AC3_PARSE_ERROR_SYNC; hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F; if(hdr->bitstream_id > 16) return AAC_AC3_PARSE_ERROR_BSID; hdr->num_blocks = 6; hdr->center_mix_level = 1; hdr->surround_mix_level = 1; if(hdr->bitstream_id <= 10) { hdr->crc1 = get_bits(gbc, 16); hdr->sr_code = get_bits(gbc, 2); if(hdr->sr_code == 3) return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; frame_size_code = get_bits(gbc, 6); if(frame_size_code > 37) return AAC_AC3_PARSE_ERROR_FRAME_SIZE; skip_bits(gbc, 5); hdr->bitstream_mode = get_bits(gbc, 3); hdr->channel_mode = get_bits(gbc, 3); if(hdr->channel_mode == AC3_CHMODE_STEREO) { skip_bits(gbc, 2); } else { if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) hdr->center_mix_level = get_bits(gbc, 2); if(hdr->channel_mode & 4) hdr->surround_mix_level = get_bits(gbc, 2); } hdr->lfe_on = get_bits1(gbc); hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; hdr->substreamid = 0; } else { hdr->crc1 = 0; hdr->frame_type = get_bits(gbc, 2); if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED) return AAC_AC3_PARSE_ERROR_FRAME_TYPE; hdr->substreamid = get_bits(gbc, 3); hdr->frame_size = (get_bits(gbc, 11) + 1) << 1; if(hdr->frame_size < AC3_HEADER_SIZE) return AAC_AC3_PARSE_ERROR_FRAME_SIZE; hdr->sr_code = get_bits(gbc, 2); if (hdr->sr_code == 3) { int sr_code2 = get_bits(gbc, 2); if(sr_code2 == 3) return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2; hdr->sr_shift = 1; } else { hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)]; hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code]; hdr->sr_shift = 0; } hdr->channel_mode = get_bits(gbc, 3); hdr->lfe_on = get_bits1(gbc); hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate / (hdr->num_blocks * 256.0)); hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; } hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode]; if (hdr->lfe_on) hdr->channel_layout |= AV_CH_LOW_FREQUENCY; return 0; }
1threat
Input sanitization in ReactJS : <p>I am using ReactJS do develop a simple chat application. Could someone help me to sanitize the input . There is only one input text box to send chat messages. How to sanitize it?. </p> <pre><code>&lt;input type="text" className="chat" value={this.state.name} /&gt; </code></pre> <p>Based on the documentations HTML escapes html by default. Is it enough?. Do I need to add any other sanitization methods. If yes, please let me know how to do that?.</p>
0debug
Can not remove images even though no container is running : <p>I had multiple stopped containers and images in my machine.<br> I wanted to clean up and removed all containers:<br> <code>docker ps -a</code> returns nothing.<br> I run <code>docker rmi $(docker images -q)</code> to remove the cached images but I get: </p> <blockquote> <p>Error response from daemon: conflict: unable to delete ... (must be forced) - image is referenced in multiple repositories </p> </blockquote> <p>What repositories is it talking about? </p>
0debug
virt-manager guest resize not working : <p>Installed virt-manager, target virtual machine is debian jessie with spice-vdagent installed shared clipboard, and latency-free mouse input works</p> <p>Display: Spice Video: QXL Channel spice: spicevmc, virtio, com.redhat.spice.0 (confirmed /dev devices exist in target vm)</p>
0debug
How to sort cell array in one column : I have a cell array `(mxn)` of different data type values and I am not able to sort it in defined rows and one column. For Example: Considering a cell array of `(2x1)` `MyValues={'HI, HOW ARE YOU, NICE TO MEET YOU, 1.32, -0.54BC, AUF WIEDERSEHEN' 'HELLO, YES I am fine, Thank you for asking, 0.666HG, 67@#, 84'}` `NewValues={'HI' 'HOW ARE YOU' 'NICE TO MEET YOU' '1.32' '-0.54BC' 'AUF WIEDERSEHEN' 'HELLO' 'YES I am fine' 'Thank you for asking' '0.66HG' '67@#' '84'}`
0debug
Jquery get html content within h1 : <p>I've got this html:</p> <pre><code>&lt;h1&gt; &lt;span&gt; &lt;span&gt; Sony &lt;/span&gt; &lt;/span&gt; Televisies &lt;/h1&gt; </code></pre> <p>How do I get all content within the <code>h1</code> so with the <code>span html</code> as as wel?</p>
0debug
static void add_device_config(int type, const char *cmdline) { struct device_config *conf; conf = qemu_mallocz(sizeof(*conf)); conf->type = type; conf->cmdline = cmdline; TAILQ_INSERT_TAIL(&device_configs, conf, next); }
1threat
How to cast Int to Char in Kotlin : <p>With Java primitives it was easy to cast char code to symbol</p> <pre><code>int i = 65; char c = (char) i; // 'A' </code></pre> <p>How to do the same with Kotlin?</p>
0debug
program that will display all numbers multiple of 7 which are between 1 and 100 C++ : How to write this program with 'switch' condition statement instead of 'if'? #include <iostream> using namespace std; int main() { int i; for (i = 1; i<=100; i++) { if ((i % 7 == 0) && (i > 0)) { cout << i <<endl; } } return 0; }
0debug
static void v9fs_stat(void *opaque) { int32_t fid; V9fsStat v9stat; ssize_t err = 0; size_t offset = 7; struct stat stbuf; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "d", &fid); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { goto out; } err = stat_to_v9stat(pdu, &fidp->path, &stbuf, &v9stat); if (err < 0) { goto out; } offset += pdu_marshal(pdu, offset, "wS", 0, &v9stat); err = offset; v9fs_stat_free(&v9stat); out: put_fid(pdu, fidp); out_nofid: trace_v9fs_stat_return(pdu->tag, pdu->id, v9stat.mode, v9stat.atime, v9stat.mtime, v9stat.length); complete_pdu(s, pdu, err); }
1threat
How can I do a line break (line continuation) in Kotlin : <p>I have a long line of code that I want to break up among multiple lines. What do I use and what is the syntax?</p> <p>For example, adding a bunch of strings:</p> <pre><code>val text = "This " + "is " + "a " + "long " + "long " + "line" </code></pre>
0debug
Support v7 MenuPopupHelper is now hidden and restricted to LIBRARY_GROUP : <p>Recently i've been getting a lint error on my usage of <code>android.support.v7.view.menu.MenuPopupHelper</code> which is now hidden and restricted to be only used within its library group.</p> <p><strong>Exact message:</strong></p> <p><code>MenuPopupHelper constructor can only be called from within the same library group (groupId=com.android.support)</code></p> <p><strong>Excerpt from the <code>MenuPopupHelper.java</code> class:</strong></p> <pre><code>/** * Presents a menu as a small, simple popup anchored to another view. * * @hide */ @RestrictTo(LIBRARY_GROUP) public class MenuPopupHelper implements MenuHelper { </code></pre> <p><strong>Question:</strong> Any idea when and why this happened ? or whats the workaround that I should look for ?</p>
0debug
static int evrc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; AVFrame *frame = data; EVRCContext *e = avctx->priv_data; int buf_size = avpkt->size; float ilspf[FILTER_ORDER], ilpc[FILTER_ORDER], idelay[NB_SUBFRAMES]; float *samples; int i, j, ret, error_flag = 0; frame->nb_samples = 160; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; samples = (float *)frame->data[0]; if ((e->bitrate = determine_bitrate(avctx, &buf_size, &buf)) == RATE_ERRS) { warn_insufficient_frame_quality(avctx, "bitrate cannot be determined."); goto erasure; } if (e->bitrate <= SILENCE || e->bitrate == RATE_QUARTER) goto erasure; if (e->bitrate == RATE_QUANT && e->last_valid_bitrate == RATE_FULL && !e->prev_error_flag) goto erasure; init_get_bits(&e->gb, buf, 8 * buf_size); memset(&e->frame, 0, sizeof(EVRCAFrame)); unpack_frame(e); if (e->bitrate != RATE_QUANT) { uint8_t *p = (uint8_t *) &e->frame; for (i = 0; i < sizeof(EVRCAFrame); i++) { if (p[i]) break; } if (i == sizeof(EVRCAFrame)) goto erasure; } else if (e->frame.lsp[0] == 0xf && e->frame.lsp[1] == 0xf && e->frame.energy_gain == 0xff) { goto erasure; } if (decode_lspf(e) < 0) goto erasure; if (e->bitrate == RATE_FULL || e->bitrate == RATE_HALF) { if (e->frame.pitch_delay > MAX_DELAY - MIN_DELAY) goto erasure; e->pitch_delay = e->frame.pitch_delay + MIN_DELAY; if (e->frame.delay_diff) { int p = e->pitch_delay - e->frame.delay_diff + 16; if (p < MIN_DELAY || p > MAX_DELAY) goto erasure; } if (e->frame.delay_diff && e->bitrate == RATE_FULL && e->prev_error_flag) { float delay; memcpy(e->pitch, e->pitch_back, ACB_SIZE * sizeof(float)); delay = e->prev_pitch_delay; e->prev_pitch_delay = delay - e->frame.delay_diff + 16.0; if (fabs(e->pitch_delay - delay) > 15) delay = e->pitch_delay; for (i = 0; i < NB_SUBFRAMES; i++) { int subframe_size = subframe_sizes[i]; interpolate_delay(idelay, delay, e->prev_pitch_delay, i); acb_excitation(e, e->pitch + ACB_SIZE, e->avg_acb_gain, idelay, subframe_size); memcpy(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float)); } } if (fabs(e->pitch_delay - e->prev_pitch_delay) > 15) e->prev_pitch_delay = e->pitch_delay; e->avg_acb_gain = e->avg_fcb_gain = 0.0; } else { idelay[0] = idelay[1] = idelay[2] = MIN_DELAY; for (i = 0; i < NB_SUBFRAMES; i++) e->energy_vector[i] = pow(10, evrc_energy_quant[e->frame.energy_gain][i]); e->prev_energy_gain = e->frame.energy_gain; } for (i = 0; i < NB_SUBFRAMES; i++) { float tmp[SUBFRAME_SIZE + 6] = { 0 }; int subframe_size = subframe_sizes[i]; int pitch_lag; interpolate_lsp(ilspf, e->lspf, e->prev_lspf, i); if (e->bitrate != RATE_QUANT) interpolate_delay(idelay, e->pitch_delay, e->prev_pitch_delay, i); pitch_lag = lrintf((idelay[1] + idelay[0]) / 2.0); decode_predictor_coeffs(ilspf, ilpc); if (e->frame.lpc_flag && e->prev_error_flag) bandwidth_expansion(ilpc, ilpc, 0.75); if (e->bitrate != RATE_QUANT) { float acb_sum, f; f = exp((e->bitrate == RATE_HALF ? 0.5 : 0.25) * (e->frame.fcb_gain[i] + 1)); acb_sum = pitch_gain_vq[e->frame.acb_gain[i]]; e->avg_acb_gain += acb_sum / NB_SUBFRAMES; e->avg_fcb_gain += f / NB_SUBFRAMES; acb_excitation(e, e->pitch + ACB_SIZE, acb_sum, idelay, subframe_size); fcb_excitation(e, e->frame.fcb_shape[i], tmp, acb_sum, pitch_lag, subframe_size); for (j = 0; j < subframe_size; j++) e->pitch[ACB_SIZE + j] += f * tmp[j]; e->fade_scale = FFMIN(e->fade_scale + 0.2, 1.0); } else { for (j = 0; j < subframe_size; j++) e->pitch[ACB_SIZE + j] = e->energy_vector[i]; } memcpy(e->pitch, e->pitch + subframe_size, ACB_SIZE * sizeof(float)); synthesis_filter(e->pitch + ACB_SIZE, ilpc, e->synthesis, subframe_size, tmp); postfilter(e, tmp, ilpc, samples, pitch_lag, &postfilter_coeffs[e->bitrate], subframe_size); samples += subframe_size; } if (error_flag) { erasure: error_flag = 1; av_log(avctx, AV_LOG_WARNING, "frame erasure\n"); frame_erasure(e, samples); } memcpy(e->prev_lspf, e->lspf, sizeof(e->prev_lspf)); e->prev_error_flag = error_flag; e->last_valid_bitrate = e->bitrate; if (e->bitrate != RATE_QUANT) e->prev_pitch_delay = e->pitch_delay; samples = (float *)frame->data[0]; for (i = 0; i < 160; i++) samples[i] /= 32768; *got_frame_ptr = 1; return avpkt->size; }
1threat
how to insert record using dropdownlist asp.net mvc : the controller: [HttpPost] public ActionResult Index(Account account, FormCollection fc) { using (accountgoEntities entities = new accountgoEntities()) { entities.Account.Add(account); entities.SaveChanges(); int id = account.Id; } //return View(Account); return RedirectToAction("Account_details"); } the:view: <div class="form-group"> <strong class="strong">company name </strong> <div class="col-md-10"> @Html.DropDownList("CompanyName", (IEnumerable<SelectListItem>)ViewBag.CompanyName, "chose", new { @class = "form-control" }) @Html.ValidationMessageFor(model => model.Company.Name, "", new { @class = "text-danger" }) </div> </div>
0debug
static void pci_pcnet_cleanup(NetClientState *nc) { PCNetState *d = qemu_get_nic_opaque(nc); pcnet_common_cleanup(d); }
1threat
change the date format in laravel view page : <p>I want to change the date format which is fetched from database. now I got 2016-10-01<code>{{$user-&gt;from_date}}</code> .I want to change the format 'd-m-y' in laravel 5.3</p> <pre><code>{{ $user-&gt;from_date-&gt;format('d/m/Y')}} </code></pre>
0debug
How to rename a dataframe with a list : <p>I have this dataset:</p> <pre><code>library(tidyverse) DF &lt;- tribble( ~District, ~Income, "District 1", 1610, "district2", 4906, "DISTRICT1", 12082, "DISTRICT 1", 13791, "district1", 21551, "District 2", 35126, ) DF </code></pre> <p>And I have a list with new variable names (in real life, I have a lot of variables).</p> <pre><code>Nombres &lt;- list(c("Distrito" , "Ingreso")) </code></pre> <p>I want to rename the dataset and my expective outcome is:</p> <pre><code># A tibble: 6 x 2 Distrito Ingreso &lt;chr&gt; &lt;dbl&gt; 1 District 1 1610 2 district2 4906 3 DISTRICT1 12082 4 DISTRICT 1 13791 5 district1 21551 6 District 2 35126 </code></pre> <p>Thank you very much for your help. Greetings!</p>
0debug
Vuejs get old value when on change event : <p>Please refer to my snippet below. How can I get the old value of the changed model, in this case is the age in vuejs?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = new Vue({ el:"#table1", data:{ items:[{name:'long name One',age:21},{name:'long name Two',age:22}] }, methods:{ changeAge:function(item,event){ alert(item.age); } } });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://unpkg.com/vue/dist/vue.js"&gt;&lt;/script&gt; &lt;table class="table table-cart" id="table1"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Age&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr v-for="(item,index) in items"&gt; &lt;td&gt;{{item.name}} :&lt;/td&gt; &lt;td&gt; &lt;input type="text" name="qty" v-model="item.age" @change="changeAge(item,$event)"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;</code></pre> </div> </div> </p> <p>I am trying to use watch, but I am not able to find any help in watching the age an array of items. </p>
0debug
def check_Consecutive(l): return sorted(l) == list(range(min(l),max(l)+1))
0debug
Can't figure out what is wrong wi th my merge sort code : I went over it multiple times and I am not sure what I am doing wrong. The logic seems ok but it is printing out the first number only. I left out the main method. Thank you. public class MergeSort { public static void main(String[] args) { // TODO Auto-generated method stub int[] bob = {4,7,99,8,12,6}; Mergesort(bob); for(int i=0; i< bob.length; i++){ System.out.print(bob[i]+","); } } public static int[] Mergesort(int[] bob){ int length = bob.length; int mid = bob.length/2; if(length <= 1){ return bob; } int[] left = new int[mid]; int[] right = new int[length-left.length]; for(int i=0; i< mid; i++){ left[i]=bob[i]; } for(int j=mid; j< length; j++){ right[j-mid]=bob[j]; } Mergesort(left); Mergesort(right); merge(left,right, bob); return bob; }
0debug
my sql database with many tables : i want to create some number of tables (lets say as sub tables) and make all sub tables to point to one main table. If i query with main table i should be able get details from all sub tables together or even from individual subtable table details. I am using python interface for querying. This is my requirement. Kindly suggest me some ideas. Thanks in advance.
0debug
Sparse matrix addition condition : <p>I was reading code for addition of sparse matrix and came across this condition</p> <pre><code>if( sp1[0][0] != sp2[0][0] || sp1[0][1] != sp2[0][1] ) { printf("Invalid matrix size "); exit(0); } </code></pre> <p>Couldn't understand why the number of non-zero rows and columns should be same ? Sorry I am a newbie.</p> <p>The whole code is <a href="http://www.cprograms.in/Array/sparse-matrix-addition.html" rel="nofollow noreferrer">here</a></p>
0debug
What is the .vs folder used for in Visual Studio solutions? : <p>What is the .vs folder used for exactly? It gets created at the base folder of my solution. I can see some hidden files and different files appear for different projects. I'm having a hard time chasing up official documentation on it.</p>
0debug
Why can't browsers use a virtual dom internally as an optimisation? : <p>There are lots of SO questions and blogs on the internet attempting to explain <em>what virtual dom is</em>, but this question is about why this kind of optimisation has to be to implemented in JavaScript/as part of a framework, rather than by the browser itself.</p> <p>Virtual DOM, as I understand it, is a tree composed of Javascript Objects, with parents/children etc. but without most of the "heavy" features of the real DOM. Frameworks (e.g. React/Vue) respond to changes of model state by creating a virtual DOM from scratch and then do a diff on the last version of their virtual DOM to work out what real DOM to change.</p> <p>Many of the things I have read, claim that virtual DOM is faster because real DOM has to re-layout (or even re-paint) every time there is a change, but this isn't true - re-layouts are only needed when some piece of JS code explicitly asks for some style/text-flow dependant value (such as a height/width etc.). And presumably most of the frameworks that use virtual DOMs cannot do any better at this - except ensuring developers don't accidentally do it.</p> <p>Also, at some point recently browsers were considering providing event hooks for DOM-mutation, but that idea has been abandoned, meaning there shouldn't need to be any events fired at the point DOM is mutated.</p> <p>So my question is, what does that leave in terms of benefits? What extra information, or extra freedom, does the JS framework have that gives it the "logical" power to perform the virtual DOM optimisation?</p>
0debug