problem
stringlengths
26
131k
labels
class label
2 classes
static void vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], const uint8_t *map, unsigned size, VLC *vlc) { Node nodes[2*size], *tmp = &nodes[size]; int a, b, i; tmp[0].count = 256; for (i=0; i<size-1; i++) { a = tmp[i].count * coeff_model[i] >> 8; b = tmp[i].count * (255 - coeff_model[i]) >> 8; nodes[map[2*i ]].count = a + !a; nodes[map[2*i+1]].count = b + !b; } ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, FF_HUFFMAN_FLAG_HNODE_FIRST); }
1threat
Convert YYYY-YY to Year(date) in R : I have a data frame with year column as financial year Year 2001-02 2002-03 2003-04 How can I convert this to as.Date keeping either the whole thing or just the second year i.e 2002,2003,2004. On converting with %Y, I inevitably get 2001-08-08, 2002-08-08, 2003-08-08 etc. Thanks
0debug
static coroutine_fn int qcow_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BDRVQcowState *s = bs->opaque; int index_in_cluster; int ret = 0, n; uint64_t cluster_offset; struct iovec hd_iov; QEMUIOVector hd_qiov; uint8_t *buf; void *orig_buf; if (qiov->niov > 1) { buf = orig_buf = qemu_try_blockalign(bs, qiov->size); if (buf == NULL) { return -ENOMEM; } } else { orig_buf = NULL; buf = (uint8_t *)qiov->iov->iov_base; } qemu_co_mutex_lock(&s->lock); while (nb_sectors != 0) { cluster_offset = get_cluster_offset(bs, sector_num << 9, 0, 0, 0, 0); index_in_cluster = sector_num & (s->cluster_sectors - 1); n = s->cluster_sectors - index_in_cluster; if (n > nb_sectors) { n = nb_sectors; } if (!cluster_offset) { if (bs->backing) { hd_iov.iov_base = (void *)buf; hd_iov.iov_len = n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_readv(bs->backing, sector_num, n, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { goto fail; } } else { memset(buf, 0, 512 * n); } } else if (cluster_offset & QCOW_OFLAG_COMPRESSED) { if (decompress_cluster(bs, cluster_offset) < 0) { goto fail; } memcpy(buf, s->cluster_cache + index_in_cluster * 512, 512 * n); } else { if ((cluster_offset & 511) != 0) { goto fail; } hd_iov.iov_base = (void *)buf; hd_iov.iov_len = n * 512; qemu_iovec_init_external(&hd_qiov, &hd_iov, 1); qemu_co_mutex_unlock(&s->lock); ret = bdrv_co_readv(bs->file, (cluster_offset >> 9) + index_in_cluster, n, &hd_qiov); qemu_co_mutex_lock(&s->lock); if (ret < 0) { break; } if (bs->encrypted) { assert(s->crypto); if (qcrypto_block_decrypt(s->crypto, sector_num, buf, n * BDRV_SECTOR_SIZE, NULL) < 0) { goto fail; } } } ret = 0; nb_sectors -= n; sector_num += n; buf += n * 512; } done: qemu_co_mutex_unlock(&s->lock); if (qiov->niov > 1) { qemu_iovec_from_buf(qiov, 0, orig_buf, qiov->size); qemu_vfree(orig_buf); } return ret; fail: ret = -EIO; goto done; }
1threat
Adjust Single Value within Tensor -- TensorFlow : <p>I feel embarrassed asking this, but how do you adjust a single value within a tensor? Suppose you want to add '1' to only one value within your tensor?</p> <p>Doing it by indexing doesn't work:</p> <pre><code>TypeError: 'Tensor' object does not support item assignment </code></pre> <p>One approach would be to build an identically shaped tensor of 0's. And then adjusting a 1 at the position you want. Then you would add the two tensors together. Again this runs into the same problem as before.</p> <p>I've read through the API docs several times and can't seem to figure out how to do this. Thanks in advance! </p>
0debug
Unwrap a list of list : <p>I have this list:</p> <pre><code>fxrate = [[['9.6587'], ['9.9742'], ['9.9203'], ['10.1165'], ['10.1087']], [['10.7391'], ['10.8951'], ['11.1355'], ['11.561'], ['11.7873']], [['8.61'], ['8.9648'], ['9.0155'], ['9.153'], ['9.1475']]] </code></pre> <p>I would like to make a list like this by using Python:</p> <pre><code>[[9.6587, 9.9742, 9.9203, 10.1165, 10.1087], [10.7391, 10.8951, 11.1355, 11.561, 11.7873], [8.61, 8.9648, 9.0155, 9.153, 9.1475]] </code></pre> <p>Needless to say I'm fairly new to Python and programming in general. However all I end up with is either one list of values but not at three sets of lists</p>
0debug
static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p, uint8_t ep) { AsyncURB *aurb = async_alloc(dev, p); struct usb_redir_bulk_packet_header bulk_packet; DPRINTF("bulk-out ep %02X len %zd id %u\n", ep, p->iov.size, aurb->packet_id); bulk_packet.endpoint = ep; bulk_packet.length = p->iov.size; bulk_packet.stream_id = 0; aurb->bulk_packet = bulk_packet; if (ep & USB_DIR_IN) { usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id, &bulk_packet, NULL, 0); } else { uint8_t buf[p->iov.size]; usb_packet_copy(p, buf, p->iov.size); usbredir_log_data(dev, "bulk data out:", buf, p->iov.size); usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id, &bulk_packet, buf, p->iov.size); } usbredirparser_do_write(dev->parser); return USB_RET_ASYNC; }
1threat
static char *doubles2str(double *dp, int count, const char *sep) { int i; char *ap, *ap0; int component_len = 15 + strlen(sep); if (!sep) sep = ", "; ap = av_malloc(component_len * count); if (!ap) return NULL; ap0 = ap; ap[0] = '\0'; for (i = 0; i < count; i++) { unsigned l = snprintf(ap, component_len, "%f%s", dp[i], sep); if(l >= component_len) return NULL; ap += l; } ap0[strlen(ap0) - strlen(sep)] = '\0'; return ap0; }
1threat
Angular 5: Lazy-loading of component without routing : <p>In my web application I have a "Terms and Conditions" popup that opens by link click in the footer (so it's a core component). Popup comprises of several tabs, each of them is a pretty big template file.</p> <p>I wonder if it's possible to move tab templates to separate chunk and organize their lazy-loading? I'm not sure if default Angular lazy-loading is acceptable for me because I don't want to have separate route for the popup.</p>
0debug
void qio_channel_socket_listen_async(QIOChannelSocket *ioc, SocketAddressLegacy *addr, QIOTaskFunc callback, gpointer opaque, GDestroyNotify destroy) { QIOTask *task = qio_task_new( OBJECT(ioc), callback, opaque, destroy); SocketAddressLegacy *addrCopy; addrCopy = QAPI_CLONE(SocketAddressLegacy, addr); trace_qio_channel_socket_listen_async(ioc, addr); qio_task_run_in_thread(task, qio_channel_socket_listen_worker, addrCopy, (GDestroyNotify)qapi_free_SocketAddressLegacy); }
1threat
How to pass container ip as ENV to other container in docker-compose file : <p>this is my docker-compose file: </p> <pre><code>version: '3.0' services: app-web: restart: always build: ./web environment: PG_HOST: $(APP_DB_IP) PG_PORT: 5432 ports: - "8081:8080" links: - app-db app-db: build: ./db expose: - "5432" volumes: - /var/lib/postgresql/data </code></pre> <p>I want to pass to app-web the ip of app-db (Postgresql in this case) as ENV var so it can connect to the DB smoothly... any idea on how to achieve it?</p>
0debug
I am trying to make an app that needs to get the current gps location. The app crashes everytime i try. Kindly look into this : I am following this tutorial:I am following this tutorial: https://developer.android.com/training/location/retrieve-current.html. I have tried following youtube videos which ultimately failed. The app works fine when i comment out the code that implements locationlistener,locationcallbacks, and all the code that runs for getting location. This is my manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tc.elicz.roadpal"> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> This is my main_activity.java file: package tc.elicz.roadpal; import android.Manifest; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Build; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import android.widget.TextView; import com.google.android.gms.common.api.GoogleApi; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; import org.xml.sax.helpers.LocatorImpl; import java.util.Map; import static com.google.android.gms.location.LocationServices.FusedLocationApi; public abstract class MainActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ private Button button; private TextView textView1; private LocationManager locationManager; private LocationListener locationListener; private GoogleApiClient mapo = null; private Location lastloc = null; private String lat = null; private String lon = null; private LocationRequest locreq= new LocationRequest(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); System.out.println("sosll"); setContentView(R.layout.activity_main); textView1 = (TextView) findViewById(R.id.textView); if (mapo == null) { mapo = new GoogleApiClient.Builder(this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(LocationServices.API) .build(); } } protected void onStart() { super.onStart(); mapo.connect(); } protected void onStop() { super.onStop(); mapo.disconnect(); } @Override public void onConnected(Bundle connectionHint) { if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { textView1.append("No permission"); System.out.println("No perm"); return; } lastloc = LocationServices.FusedLocationApi.getLastLocation( mapo); if (lastloc != null) { lat=(String.valueOf(lastloc.getLatitude())); lon=(String.valueOf(lastloc.getLongitude())); textView1.append("Lat:" + lat +"lon:" +lon); } } } I also made some changes to the gradle file as per the tutorial. So her it is: apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "tc.elicz.roadpal" minSdkVersion 22 targetSdkVersion 24 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:24.2.1' testCompile 'junit:junit:4.12' compile 'com.google.android.gms:play-services:11.0.4' }
0debug
void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], int is_mpeg12) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ ff_xvmc_decode_mb(s); return; } if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { int i,j; DCTELEM *dct = &s->current_picture.f.dct_coeff[mb_xy * 64 * 6]; av_log(s->avctx, AV_LOG_DEBUG, "DCT coeffs of MB at %dx%d:\n", s->mb_x, s->mb_y); for(i=0; i<6; i++){ for(j=0; j<64; j++){ *dct++ = block[i][s->dsp.idct_permutation[j]]; av_log(s->avctx, AV_LOG_DEBUG, "%5d", dct[-1]); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } s->current_picture.f.qscale_table[mb_xy] = s->qscale; if (!s->mb_intra) { if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) { if(s->mbintra_table[mb_xy]) ff_clean_intra_table_entries(s); } else { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } } else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) s->mbintra_table[mb_xy]=1; if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==AV_PICTURE_TYPE_B) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; const int linesize = s->current_picture.f.linesize[0]; const int uvlinesize = s->current_picture.f.linesize[1]; const int readable= s->pict_type != AV_PICTURE_TYPE_B || s->encoding || s->avctx->draw_horiz_band; const int block_size = 8; if(!s->encoding){ uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy]; if (s->mb_skipped) { s->mb_skipped= 0; assert(s->pict_type!=AV_PICTURE_TYPE_I); *mbskip_ptr = 1; } else if(!s->current_picture.f.reference) { *mbskip_ptr = 1; } else{ *mbskip_ptr = 0; } } dct_linesize = linesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? linesize : linesize * block_size; if(readable){ dest_y= s->dest[0]; dest_cb= s->dest[1]; dest_cr= s->dest[2]; }else{ dest_y = s->b_scratchpad; dest_cb= s->b_scratchpad+16*linesize; dest_cr= s->b_scratchpad+32*linesize; } if (!s->mb_intra) { if(!s->encoding){ if(HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_FRAME) { if (s->mv_dir & MV_DIR_FORWARD) { ff_thread_await_progress(&s->last_picture_ptr->f, ff_MPV_lowest_referenced_row(s, 0), 0); } if (s->mv_dir & MV_DIR_BACKWARD) { ff_thread_await_progress(&s->next_picture_ptr->f, ff_MPV_lowest_referenced_row(s, 1), 0); } } op_qpix= s->me.qpel_put; if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ op_pix = s->dsp.put_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.f.data, op_pix, op_qpix); } } if(s->avctx->skip_idct){ if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || s->avctx->skip_idct >= AVDISCARD_ALL) goto skip_idct; } if(s->encoding || !( s->msmpeg4_version || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){ add_dequant_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); add_dequant_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if (s->chroma_y_shift){ add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_linesize >>= 1; dct_offset >>=1; add_dequant_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } } else if(is_mpeg12 || (s->codec_id != CODEC_ID_WMV2)){ add_dct(s, block[0], 0, dest_y , dct_linesize); add_dct(s, block[1], 1, dest_y + block_size, dct_linesize); add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if(s->chroma_y_shift){ add_dct(s, block[4], 4, dest_cb, uvlinesize); add_dct(s, block[5], 5, dest_cr, uvlinesize); }else{ dct_linesize = uvlinesize << s->interlaced_dct; dct_offset = s->interlaced_dct ? uvlinesize : uvlinesize*block_size; add_dct(s, block[4], 4, dest_cb, dct_linesize); add_dct(s, block[5], 5, dest_cr, dct_linesize); add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize); add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize); if(!s->chroma_x_shift){ add_dct(s, block[8], 8, dest_cb+block_size, dct_linesize); add_dct(s, block[9], 9, dest_cr+block_size, dct_linesize); add_dct(s, block[10], 10, dest_cb+block_size+dct_offset, dct_linesize); add_dct(s, block[11], 11, dest_cr+block_size+dct_offset, dct_linesize); } } } } else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) { ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr); } } else { if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){ put_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if(s->chroma_y_shift){ put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_offset >>=1; dct_linesize >>=1; put_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } }else{ s->dsp.idct_put(dest_y , dct_linesize, block[0]); s->dsp.idct_put(dest_y + block_size, dct_linesize, block[1]); s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]); s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if(s->chroma_y_shift){ s->dsp.idct_put(dest_cb, uvlinesize, block[4]); s->dsp.idct_put(dest_cr, uvlinesize, block[5]); }else{ dct_linesize = uvlinesize << s->interlaced_dct; dct_offset = s->interlaced_dct? uvlinesize : uvlinesize*block_size; s->dsp.idct_put(dest_cb, dct_linesize, block[4]); s->dsp.idct_put(dest_cr, dct_linesize, block[5]); s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]); s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]); if(!s->chroma_x_shift){ s->dsp.idct_put(dest_cb + block_size, dct_linesize, block[8]); s->dsp.idct_put(dest_cr + block_size, dct_linesize, block[9]); s->dsp.idct_put(dest_cb + block_size + dct_offset, dct_linesize, block[10]); s->dsp.idct_put(dest_cr + block_size + dct_offset, dct_linesize, block[11]); } } } } } skip_idct: if(!readable){ s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); } } }
1threat
Ajax not goin to url method : **this is the code for ajax request it always goes to error function** **the url is correct all data is there but it still goes to the error it doesn't posting value** $(".quote-update-notify").click(function () { // e.preventDefault(); // alert('hi'); var id = $(this).attr('data-id'); // alert(id); $.ajax({ type: "POST", url: "<?php echo base_url(); ?>Admin/qoute_Notification", // // dataType: 'json', data: {"id": id}, success: function () { alert('success'); }, error: function () { alert('error while requeting'); // console.log(); } }); // e.preventDefault(); // return false; });
0debug
static unsigned int dec_swap_r(DisasContext *dc) { TCGv t0; #if DISAS_CRIS char modename[4]; #endif DIS(fprintf (logfile, "swap%s $r%u\n", swapmode_name(dc->op2, modename), dc->op1)); cris_cc_mask(dc, CC_MASK_NZ); t0 = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_reg(t0, dc->op1); if (dc->op2 & 8) tcg_gen_not_tl(t0, t0); if (dc->op2 & 4) t_gen_swapw(t0, t0); if (dc->op2 & 2) t_gen_swapb(t0, t0); if (dc->op2 & 1) t_gen_swapr(t0, t0); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op1], cpu_R[dc->op1], t0, 4); tcg_temp_free(t0); return 2; }
1threat
flying image into basket using javascript instead of JQUERY : <p>I am trying to do the flying cart which means when ever Add to cart button is clicked, the product image should be taken as clone and fly into the basket. The same as this video </p> <p><a href="https://www.youtube.com/watch?v=ZQhR5RbJ2sk" rel="nofollow noreferrer">you tube video</a></p> <p><strong>The video has the code as</strong> </p> <pre><code>$("button").on("click",function(){ $(this).closest("li") .find("img") .clone() .addClass("zoom") .appendTo("body"); setTimeout(function(){ $(".zoom").remove(); },1000); }); </code></pre> <blockquote> <p>The same I should do in javascript / html without Jquery.</p> </blockquote> <p>My trying </p> <pre><code> var itm1 = document.getElementById("one"); // HEre I can take the clone of the image. var cln1 = itm1.cloneNode(true); // Here I need to add the css to this image as per the video. </code></pre>
0debug
static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs, int num_reqs, MultiwriteCB *mcb) { int i, outidx; qsort(reqs, num_reqs, sizeof(*reqs), &multiwrite_req_compare); outidx = 0; for (i = 1; i < num_reqs; i++) { int merge = 0; int64_t oldreq_last = reqs[outidx].sector + reqs[outidx].nb_sectors; if (reqs[i].sector <= oldreq_last) { merge = 1; } if (!merge && bs->drv->bdrv_merge_requests) { merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]); } if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) { merge = 0; } if (merge) { size_t size; QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov)); qemu_iovec_init(qiov, reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1); size = (reqs[i].sector - reqs[outidx].sector) << 9; qemu_iovec_concat(qiov, reqs[outidx].qiov, size); if (reqs[i].sector > oldreq_last) { size_t zero_bytes = (reqs[i].sector - oldreq_last) << 9; uint8_t *buf = qemu_blockalign(bs, zero_bytes); memset(buf, 0, zero_bytes); qemu_iovec_add(qiov, buf, zero_bytes); mcb->callbacks[i].free_buf = buf; } qemu_iovec_concat(qiov, reqs[i].qiov, reqs[i].qiov->size); reqs[outidx].nb_sectors += reqs[i].nb_sectors; reqs[outidx].qiov = qiov; mcb->callbacks[i].free_qiov = reqs[outidx].qiov; } else { outidx++; reqs[outidx].sector = reqs[i].sector; reqs[outidx].nb_sectors = reqs[i].nb_sectors; reqs[outidx].qiov = reqs[i].qiov; } } return outidx + 1; }
1threat
def previous_palindrome(num): for x in range(num-1,0,-1): if str(x) == str(x)[::-1]: return x
0debug
static void simple_dict(void) { int i; struct { const char *encoded; LiteralQObject decoded; } test_cases[] = { { .encoded = "{\"foo\": 42, \"bar\": \"hello world\"}", .decoded = QLIT_QDICT(((LiteralQDictEntry[]){ { "foo", QLIT_QINT(42) }, { "bar", QLIT_QSTR("hello world") }, { } })), }, { .encoded = "{}", .decoded = QLIT_QDICT(((LiteralQDictEntry[]){ { } })), }, { .encoded = "{\"foo\": 43}", .decoded = QLIT_QDICT(((LiteralQDictEntry[]){ { "foo", QLIT_QINT(43) }, { } })), }, { } }; for (i = 0; test_cases[i].encoded; i++) { QObject *obj; QString *str; obj = qobject_from_json(test_cases[i].encoded, NULL); g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1); str = qobject_to_json(obj); qobject_decref(obj); obj = qobject_from_json(qstring_get_str(str), NULL); g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1); qobject_decref(obj); QDECREF(str); } }
1threat
Finding repeated lines in Python : <p>I've got a txt file which has some lines, I want to find out: <br>Does this file have the same lines?</p> <p>For example, These are my lines:</p> <pre> 7924265e2024daa24f801290d070a519 f1cbfec6b396152da87e6a4279a4ad81 8d1a705ed05f734a03e890db5467ea0a 021128daa2fb3dc8b7c5af9e49e24439 e2ec22e390c5910eb4e952208bb1c47d 8d1a705ed05f734a03e890db5467ea0a 7f65a7f8a160431cc8f69cd1f04b0aba d8e5f74f296cd47a30915bbbd2418d66 005f8b973ebe30fd19b1bf802ffb6b32 </pre>
0debug
How to update record using entity framework core? : <p>What is the best approach to update a database table data in entity frame work core ?</p> <ol> <li>Retrive the table row , do the changes and save</li> <li>Use Key word <strong>Update</strong> in db context and handle exception for item not exist </li> </ol> <p>What are the improved feature we can use over EF6 ? </p>
0debug
How to view DNS cache in OSX? : <p>To list the entries of DNS cache in <strong>OSX 10.11.6</strong>, I tried <code>dscacheutil -statistics</code> but that didn't work.</p> <pre><code>$ sudo dscacheutil -statistics Unable to get details from the cache node </code></pre> <p>How can I just print what is there in the DNS cache without flushing it?</p>
0debug
How to learn golang quickly and efficiently? : <p>How to learn golang quickly and efficiently? I have learned C/C++/Java, any documentation about the syntax diff among these languages? Any classic and popular books high recommended?</p>
0debug
Can we declare private constructor in abstract class? When this situation occurs? : <p>Need to know can we declare private construct in abstract class and how to access it in Java.</p>
0debug
Is there something like a jasmine `toNotContain` acceptance criteria for tests? : <p><em>Jasmin comes with many functions for checking the expected values for validating specifications and tests.</em></p> <p>Is there besides </p> <pre><code>getJasmineRequireObj().toContain = function() { ... }; </code></pre> <p>somthing like a </p> <pre><code>getJasmineRequireObj().toNotContain = function() { ... }; </code></pre> <p>?</p> <blockquote> <p>If not, how to add an extension or plugin to deliver this feature also to our community of developers?</p> </blockquote>
0debug
I got an error in a code which is related to NumPy Array please help me with the code : I am working with NumPy Array but I got error I am running that code with Pycharm and getting error IndexError: invalid index to scalar variable. ''' python import numpy as np arr = np.array([1,2,5,8,3]) l1 = arr.argsort()[-3][::-1] print(l1) '''
0debug
static int au_read_header(AVFormatContext *s) { int size; unsigned int tag; AVIOContext *pb = s->pb; unsigned int id, channels, rate; enum AVCodecID codec; AVStream *st; tag = avio_rl32(pb); if (tag != MKTAG('.', 's', 'n', 'd')) return -1; size = avio_rb32(pb); avio_rb32(pb); id = avio_rb32(pb); rate = avio_rb32(pb); channels = avio_rb32(pb); codec = ff_codec_get_id(codec_au_tags, id); if (!av_get_bits_per_sample(codec)) { av_log_ask_for_sample(s, "could not determine bits per sample\n"); return AVERROR_PATCHWELCOME; } if (channels == 0 || channels > 64) { av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels); return AVERROR_INVALIDDATA; } if (size >= 24) { avio_skip(pb, size - 24); } st = avformat_new_stream(s, NULL); if (!st) return -1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_tag = id; st->codec->codec_id = codec; st->codec->channels = channels; st->codec->sample_rate = rate; avpriv_set_pts_info(st, 64, 1, rate); return 0; }
1threat
Why input() always return str? : **Here is my code:** age = input("How old are you?: ") print (age) print (type(age)) **Result:** How old are you?: 35 35 **class 'str'** <<--- This is problem! **But, If I use..** age = int(input("How old are you?: ")) print (age) print (type(age)) **and entered "Alex"** How old are you?: alex Traceback (most recent call last): File "/Users/kanapatgreenigorn/Desktop/test.py", line 1, in <module> age = int(input("How old are you?: ")) ValueError: invalid literal for int() with base 10: 'alex'
0debug
static int parse_read_interval(const char *interval_spec, ReadInterval *interval) { int ret = 0; char *next, *p, *spec = av_strdup(interval_spec); if (!spec) return AVERROR(ENOMEM); if (!*spec) { av_log(NULL, AV_LOG_ERROR, "Invalid empty interval specification\n"); ret = AVERROR(EINVAL); goto end; } p = spec; next = strchr(spec, '%'); if (next) *next++ = 0; if (*p) { interval->has_start = 1; if (*p == '+') { interval->start_is_offset = 1; p++; } else { interval->start_is_offset = 0; } ret = av_parse_time(&interval->start, p, 1); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid interval start specification '%s'\n", p); goto end; } } else { interval->has_start = 0; } p = next; if (p && *p) { int64_t us; interval->has_end = 1; if (*p == '+') { interval->end_is_offset = 1; p++; } else { interval->end_is_offset = 0; } if (interval->end_is_offset && *p == '#') { long long int lli; char *tail; interval->duration_frames = 1; p++; lli = strtoll(p, &tail, 10); if (*tail || lli < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid or negative value '%s' for duration number of frames\n", p); goto end; } interval->end = lli; } else { ret = av_parse_time(&us, p, 1); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid interval end/duration specification '%s'\n", p); goto end; } interval->end = us; } } else { interval->has_end = 0; } end: av_free(spec); return ret; }
1threat
How can I use ComponentRef to destroy my Component from within? : <p>I want to be able to destroy my component from within itself. (Not from parent since it's dynamically created in multiple areas). </p> <p>I've read from angular's api that they have a ComponentRef object. I've tried including it in the constructor but it says it needs an argument and I'm not sure what to pass to it.</p> <p>Link: <a href="https://angular.io/api/core/ComponentRef" rel="noreferrer">https://angular.io/api/core/ComponentRef</a></p> <p>How can use ComponentRef in my component to destroy it?</p> <pre><code>import { Component, ComponentRef, OnInit } '@angular/core'; export class MyComponent implements OnInit { constructor(private ref: ComponentRef) {} ngOnInit() { this.ref.destroy() } } </code></pre>
0debug
SCSS variable class name : <p>On my website, I'm constantly doing style="font-size: #ofpx;". However, I was wondering if there's a way to do it with scss so that, when I declare a class, it would also change the font size. For example:</p> <pre><code>&lt;div class='col-lg-4 font-20'&gt;whatever here&lt;/div&gt; </code></pre> <p>and this would change my font-size to 20. If I did font-30, it would change my font-size to 30 and etc...</p> <p>What I have so far:</p> <pre><code>.font-#{$fontsize} { font-size: $fontsize; } </code></pre>
0debug
uint64_t HELPER(neon_abdl_u64)(uint32_t a, uint32_t b) { uint64_t result; DO_ABD(result, a, b, uint32_t); return result; }
1threat
Integration of Kubernetes with Apache Airflow : <p>We are building workflow scheduling application. We found Airflow as a good option for workflow manager and Kubernetes as good option for Cluster manager. Thus, flow would be, </p> <ol> <li>We will submit workflow DAG to Airflow.</li> <li>Airflow should submit the tasks of a given DAG to Kubernetes by specifying docker image.</li> <li>Kubernetes should execute the task by running docker container on an available EC2 worker node of a cluster. </li> </ol> <p>On searching, we found, Airflow has Operators for integrating with ECS, Mesos but not for Kubernetes. However, we found a request for Kubernetes Operator on <a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=71013666" rel="noreferrer">Airflow wiki</a>, but not any further update on it. </p> <p>So, the question to be simply put is, how to integrate Airflow with Kubernetes?</p>
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
ReplaceOne throws duplicate key exception : <p>My app receives data from a remote server and calls <code>ReplaceOne</code> to either insert new or replace existing document with a given key with <code>Upsert = true</code>. (the key is made anonymous with <code>*</code>) The code only runs in a single thread.</p> <p>However, occasionally, the app crashes with the following error:</p> <pre><code>Unhandled Exception: MongoDB.Driver.MongoWriteException: A write operation resulted in an error. E11000 duplicate key error collection: ****.orders index: _id_ dup key: { : "****-********-********-************" } ---&gt; MongoDB.Driver.MongoBulkWriteException`1[MongoDB.Bson.BsonDocument]: A bulk write operation resulted in one or more errors. E11000 duplicate key error collection: ****.orders index: _id_ dup key: { : "****-********-********-************" } at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken) at MongoDB.Driver.MongoCollectionBase`1.ReplaceOne(FilterDefinition`1 filter, TDocument replacement, UpdateOptions options, CancellationToken cancellationToken) --- End of inner exception stack trace --- at MongoDB.Driver.MongoCollectionBase`1.ReplaceOne(FilterDefinition`1 filter, TDocument replacement, UpdateOptions options, CancellationToken cancellationToken) at Dashboard.Backend.AccountMonitor.ProcessOrder(OrderField&amp; order) at Dashboard.Backend.AccountMonitor.OnRtnOrder(Object sender, OrderField&amp; order) at XAPI.Callback.XApi._OnRtnOrder(IntPtr ptr1, Int32 size1) at XAPI.Callback.XApi.OnRespone(Byte type, IntPtr pApi1, IntPtr pApi2, Double double1, Double double2, IntPtr ptr1, Int32 size1, IntPtr ptr2, Int32 size2, IntPtr ptr3, Int32 size3) Aborted (core dumped) </code></pre> <p>My question is, why is it possible to have dup key when I use <code>ReplaceOne</code> with <code>Upsert = true</code> options?</p> <p>The app is working in the following environment and runtime:</p> <pre><code>.NET Command Line Tools (1.0.0-preview2-003121) Product Information: Version: 1.0.0-preview2-003121 Commit SHA-1 hash: 1e9d529bc5 Runtime Environment: OS Name: ubuntu OS Version: 16.04 OS Platform: Linux RID: ubuntu.16.04-x64 </code></pre> <p>And <code>MongoDB.Driver 2.3.0-rc1</code>.</p>
0debug
Any chance to minify this snippet of code? : Any chance to minify the snippet of code below? Something like `if (!$('body#pagina_blog_1 **TO** body#pagina_blog_10).length)....` On-line javascript minifires tools do not help... jQuery(function($){ if (!$('body#pagina_blog_1, body#pagina_blog_2, body#pagina_blog_3, body#pagina_blog_4, body#pagina_blog_5, body#pagina_blog_6, body#pagina_blog_7, body#pagina_blog_8, body#pagina_blog_9, body#pagina_blog_10).length) return; // do stuff });
0debug
Format strings vs concatenation : <p>I see many people using format strings like this:</p> <pre><code>root = "sample" output = "output" path = "{}/{}".format(root, output) </code></pre> <p>Instead of simply concatenating strings like this:</p> <pre><code>path = root + '/' + output </code></pre> <p>Do format strings have better performance or is this just for looks?</p>
0debug
Can anyone help me ? How to access this json data using Angularjs? : [{"_id":"5693413efc055b0011ac7891","attribute":[{"Size":"asd","Brand":"asds","product_id":"1"}]},{"_id":"569cb82c079bfa80094dc936","attribute":[{"Size":"SA","Brand":"123","product_id":"2"}]}]
0debug
void address_space_read(AddressSpace *as, target_phys_addr_t addr, uint8_t *buf, int len) { address_space_rw(as, addr, buf, len, false); }
1threat
The right way to kill a process in Java : <p>What's the best way to kill a process in Java ?</p> <p>Get the PID and then killing it with <code>Runtime.exec()</code> ?</p> <p>Use <code>destroyForcibly()</code> ? </p> <p>What's the difference between these two methods, and is there any others solutions ?</p>
0debug
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h) { DisplaySurface *surface = qemu_console_surface(xenfb->c.con); int line, oops = 0; int bpp = surface_bits_per_pixel(surface); int linesize = surface_stride(surface); uint8_t *data = surface_data(surface); if (!is_buffer_shared(surface)) { switch (xenfb->depth) { case 8: if (bpp == 16) { BLT(uint8_t, uint16_t, 3, 3, 2, 5, 6, 5); } else if (bpp == 32) { BLT(uint8_t, uint32_t, 3, 3, 2, 8, 8, 8); } else { oops = 1; } break; case 24: if (bpp == 16) { BLT(uint32_t, uint16_t, 8, 8, 8, 5, 6, 5); } else if (bpp == 32) { BLT(uint32_t, uint32_t, 8, 8, 8, 8, 8, 8); } else { oops = 1; } break; default: oops = 1; } } if (oops) xen_pv_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n", __FUNCTION__, xenfb->depth, bpp); dpy_gfx_update(xenfb->c.con, x, y, w, h); }
1threat
JavaScript get day numbers of the month as array : <p>Hello guys how is it possible get the day numbers till today and write them in an array : the result should be look like:</p> <pre><code>daysNum = ['1','2','3','4','5','6','7','8','9','10','11','12','13','14']; </code></pre>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
static int alsa_init_out (HWVoiceOut *hw, audsettings_t *as) { ALSAVoiceOut *alsa = (ALSAVoiceOut *) hw; struct alsa_params_req req; struct alsa_params_obt obt; snd_pcm_t *handle; audsettings_t obt_as; req.fmt = aud_to_alsafmt (as->fmt); req.freq = as->freq; req.nchannels = as->nchannels; req.period_size = conf.period_size_out; req.buffer_size = conf.buffer_size_out; req.size_in_usec = conf.size_in_usec_out; req.override_mask = !!conf.period_size_out_overridden | (!!conf.buffer_size_out_overridden << 1); if (alsa_open (0, &req, &obt, &handle)) { return -1; } obt_as.freq = obt.freq; obt_as.nchannels = obt.nchannels; obt_as.fmt = obt.fmt; obt_as.endianness = obt.endianness; audio_pcm_init_info (&hw->info, &obt_as); hw->samples = obt.samples; alsa->pcm_buf = audio_calloc (AUDIO_FUNC, obt.samples, 1 << hw->info.shift); if (!alsa->pcm_buf) { dolog ("Could not allocate DAC buffer (%d samples, each %d bytes)\n", hw->samples, 1 << hw->info.shift); alsa_anal_close (&handle); return -1; } alsa->handle = handle; return 0; }
1threat
Gradien Transparent Background Image : [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/pkucO.jpg Is it absolutly impossible make transparent gradien on part of background image by coords as by picture?
0debug
Accessing `selector` from within an Angular 2 component : <p>I'm trying to figure out how I can access the <code>selector</code> that we pass into the <code>@Component</code> decorator.</p> <p>For example </p> <pre><code>@Component({ selector: 'my-component' }) class MyComponent { constructor() { // I was hoping for something like the following but it doesn't exist this.component.selector // my-component } } </code></pre> <p>Ultimately, I would like to use this to create a directive that automatically adds an attribute <code>data-tag-name="{this.component.selector}"</code> so that I can use Selenium queries to reliably find my angular elements by their selector.</p> <p>I am not using protractor</p>
0debug
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const long chromWidth= width>>1; for(y=0; y<height; y++) { #ifdef HAVE_MMX asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" ASMALIGN16 "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm0, %%mm4 \n\t" "movq %%mm2, %%mm6 \n\t" "punpcklbw %%mm3, %%mm0 \n\t" "punpckhbw %%mm3, %%mm4 \n\t" "punpcklbw %%mm5, %%mm2 \n\t" "punpckhbw %%mm5, %%mm6 \n\t" MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else #if __WORDSIZE >= 64 int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i += 2){ uint64_t k, l; k = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); l = uc[1] + (yc[2] << 8) + (vc[1] << 16) + (yc[3] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for(i = 0; i < chromWidth; i++){ #ifdef WORDS_BIGENDIAN *idst++ = (uc[0] << 24)+ (yc[0] << 16) + (vc[0] << 8) + (yc[1] << 0); #else *idst++ = uc[0] + (yc[0] << 8) + (vc[0] << 16) + (yc[1] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) ) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
1threat
static void kvm_getput_reg(__u64 *kvm_reg, target_ulong *qemu_reg, int set) { if (set) *kvm_reg = *qemu_reg; else *qemu_reg = *kvm_reg; }
1threat
static void pc_dimm_check_memdev_is_busy(Object *obj, const char *name, Object *val, Error **errp) { MemoryRegion *mr; Error *local_err = NULL; mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), &local_err); if (local_err) { goto out; } if (memory_region_is_mapped(mr)) { char *path = object_get_canonical_path_component(val); error_setg(&local_err, "can't use already busy memdev: %s", path); g_free(path); } else { qdev_prop_allow_set_link_before_realize(obj, name, val, &local_err); } out: error_propagate(errp, local_err); }
1threat
Big O notation for Following Loops : <p>What will be the Big Oh of these portion of codes: </p> <pre><code>int sum = 0; for(int i = 1; i &lt; N; i *= 2) for(int j =0; j &lt;i; j++) sum++; </code></pre> <p>And</p> <pre><code>int sum = 0; for(int i = 0; i &lt; N; i *= 2) for(int j =0; j &lt;i; j++) sum++; </code></pre> <p>My Attempt: According to me both have time complexity equal to O(n^2), because here we will multiply n with n which is equal to n^2. Am I correct? Or doing some mistake?</p>
0debug
int av_opencl_init(AVDictionary *options, AVOpenCLExternalEnv *ext_opencl_env) { int ret = 0; AVDictionaryEntry *opt_build_entry; AVDictionaryEntry *opt_platform_entry; AVDictionaryEntry *opt_device_entry; LOCK_OPENCL if (!gpu_env.init_count) { opt_platform_entry = av_dict_get(options, "platform_idx", NULL, 0); opt_device_entry = av_dict_get(options, "device_idx", NULL, 0); gpu_env.usr_spec_dev_info.platform_idx = -1; gpu_env.usr_spec_dev_info.dev_idx = -1; if (opt_platform_entry) { gpu_env.usr_spec_dev_info.platform_idx = strtol(opt_platform_entry->value, NULL, 10); } if (opt_device_entry) { gpu_env.usr_spec_dev_info.dev_idx = strtol(opt_device_entry->value, NULL, 10); } ret = init_opencl_env(&gpu_env, ext_opencl_env); if (ret < 0) goto end; } opt_build_entry = av_dict_get(options, "build_options", NULL, 0); if (opt_build_entry) ret = compile_kernel_file(&gpu_env, opt_build_entry->value); else ret = compile_kernel_file(&gpu_env, NULL); if (ret < 0) goto end; av_assert1(gpu_env.kernel_code_count > 0); gpu_env.init_count++; end: UNLOCK_OPENCL return ret; }
1threat
hide the first response once the the yes button is pressed : back again. Managed to get the words to appear when a certain button is pressed thanks to you guys. Just need help with one more thing. I've tried using google, only found some ideas, but wasn't working well. This is just something simple. <article> <!-- insert clickable box here --> <p id="q1">Want to play a game?</p> <br> <button type="button" onclick="buttonYes1()" id="byes1">Yes</button> <button type="button" onclick="buttonNo1()" id="bno1">No</button> <script type="text/javascript"> function buttonYes1() { document.getElementById("yes").style.display = "block"; } // code to hide first question after yes button is pressed var button = document.getElementById('byes1') button.addEventListener('click',hideshow,false); function byes1() { document.getElementById('byes1').style.display = 'block'; this.style.display = 'none' } function buttonNo1() { document.getElementById("no").style.display = "block"; } </script> <!-- if yes, show detailed message --> <p id="yes" style="display: none;">random words</p> <!-- if no, show thanks for playing --> <p id="no" style="display: none;">no words</p> <!-- if yes, followed by detailed message, insert question #2 here --> <p id="q2">Qusetion number 2 goes here</p> <button type="button" onclick="buttonYes2()">Yes</button> <button type="button" onclick="buttonNo2()">No</button> <script type="text/javascript"> function buttonYes2() { document.getElementById("yes2").style.display = "block"; } function buttonNo2() { document.getElementById("no2").style.display = "block"; } </script> <!-- if yes to question #2, give instructions on what to do --> <p id="yes2" style="display: none;">random words 2</p> <!-- if no to question #2, order soda, game ends --> <p id="no2" style="display: none;">no words 2</p> </article> So my question here is, how can I get the first question to disappear once the "yes" button is pressed? On top of that, I want to hide the second question until the user clicks on the "yes" button and that's when the question appears. Thanks in advance!
0debug
Unable to access nested class. Invalid use of class : <p>I'm getting error when I'm trying to create a nested class and access a function in it. I've been trying to fix it for hours but to no success.</p> <blockquote> <p>error: invalid use of 'class sqlInterface::connectToSQL' fhm.connectToSQL.connect();</p> </blockquote> <p>Here is my code:</p> <p>sqlTest.cpp:</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;iostream&gt; #include "mySQLinterface.h" sqlInterface fhm; int main(int argc, char const *argv[]) { fhm.connectToSQL.connect(); return 0; } </code></pre> <p>mySQLinterface.h:</p> <pre><code>#ifndef MYSQLINTERFACE_H #define MYSQLINTERFACE_H #include &lt;mysql_connection.h&gt; class sqlInterface { public: class connectToSQL{ public: void connect(void); }; }; #endif </code></pre> <p>mySQLinterface.cpp:</p> <pre><code>#include "mySQLinterface.h" #include &lt;mysql_connection.h&gt; #include &lt;mysql_driver.h&gt; #include &lt;exception.h&gt; #include &lt;resultset.h&gt; #include &lt;statement.h&gt; #include &lt;iostream&gt; void sqlInterface::connectToSQL::connect(void){ sql::mysql::MySQL_Driver *driver; sql::Connection *con; try{ driver = sql::mysql::get_mysql_driver_instance(); con = driver-&gt;connect("tcp://172.17.0.2:3306", "USERNAME", "PASSWORD"); } catch(std::exception &amp;e){ cout &lt;&lt; "CONNECTION ERROR: " &lt;&lt; e.what() &lt;&lt; endl; } bool alive = con-&gt;isValid(); std::cout &lt;&lt; "Valid connection: " &lt;&lt; alive &lt;&lt; std::endl; delete con; } </code></pre>
0debug
How to make a Notification with different phone? : <p>i want to make an application about how to receive Notification from other phone but i don't know how to do it,i'm already search the keyword still didn't have a match with my problem, please can u give me an advice or tell me how i'm gonna do it?thank you</p>
0debug
Validating access token with at_hash : <p>I'm trying to validate access tokens against at_hash. Token header is like this</p> <p><code>{ "typ": "JWT", "alg": "RS256", "x5t": "MclQ7Vmu-1e5_rvdSfBShLe82eY", "kid": "MclQ7Vmu-1e5_rvdSfBShLe82eY" }</code></p> <p>How do I get from my access token to the Base64 encoded at_hash claim value that is in the id token? Is there an online tool that could help me with this? Is SHA256 hash calculator not a correct tool for this?</p> <p>Thanks</p>
0debug
Set default CardView to show Android : I have been working with android CardView lately and as far as I can see CardView will only display the first card first and then you can see the other cards after swiping down. My question is how can we make so that the activity displays cards in other position initially. For example the display will show the card in the middle and you can swipe to see the other cards. In other words can we set a card in another position other than the first one to be the one shown on the screen initially. p.s. Sorry about my English, feel free to edit or ask me about the question if I did not clarified it enough.
0debug
How to insert image to Sqlite in android? and get for profile : <p>I have an app it can get image from my phone gallery but how I can store that image into SQLite database and get that image for user profile from the SQLite database.</p>
0debug
Custom 404 page in Lumen : <p>I'm new to Lumen and want to create an app with this framework. Now I have the problem that if some user enters a wrong url => <a href="http://www.example.com/abuot" rel="noreferrer">http://www.example.com/abuot</a> (wrong) => <a href="http://www.example.com/about" rel="noreferrer">http://www.example.com/about</a> (right), I want to present a custom error page and it would be ideal happen within the middleware level.</p> <p>Furthermore, I am able to check if the current url is valid or not, but I am not sure how can I "make" the view within the middleware, the response()->view() won't work.</p> <p>Would be awesome if somebody can help.</p>
0debug
Navigator pass arguments with pushNamed : <p>Might have been asked before but I can't find it but how do you pass a arguments to a named route?</p> <p>This is how I build my routes</p> <pre><code>Widget build(BuildContext context) { return new Navigator( initialRoute: 'home/chooseroom', onGenerateRoute: (RouteSettings settings) { WidgetBuilder builder; switch (settings.name) { case 'home/chooseroom': // navigates to 'signup/choose_credentials'. builder = (BuildContext _) =&gt; new ChoosePage(); break; case 'home/createpage': builder = (BuildContext _) =&gt; new CreateRoomPage(); break; case 'home/presentation': builder = (BuildContext _) =&gt; new Presentation(); break; default: throw new Exception('Invalid route: ${settings.name}'); } return new MaterialPageRoute(builder: builder, settings: settings); }, ); </code></pre> <p>This is how you call it <code>Navigator.of(context).pushNamed('home/presentation')</code></p> <p>But what if my widget is <code>new Presentation(arg1, arg2, arg3)</code>?</p>
0debug
laravel 5.2 - Model::all() order by : <p>I get the full collection of a Model with the following:</p> <p><code>$posts = Post::all();</code></p> <p>However I want this is reverse chronological order.</p> <p>What is the best way to get this collection in the desired order?</p>
0debug
void ff_ivi_process_empty_tile(AVCodecContext *avctx, IVIBandDesc *band, IVITile *tile, int32_t mv_scale) { int x, y, need_mc, mbn, blk, num_blocks, mv_x, mv_y, mc_type; int offs, mb_offset, row_offset; IVIMbInfo *mb, *ref_mb; const int16_t *src; int16_t *dst; void (*mc_no_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type); offs = tile->ypos * band->pitch + tile->xpos; mb = tile->mbs; ref_mb = tile->ref_mbs; row_offset = band->mb_size * band->pitch; need_mc = 0; 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; mb->type = 1; mb->cbp = 0; if (!band->qdelta_present && !band->plane && !band->band_num) { mb->q_delta = band->glob_quant; mb->mv_x = 0; mb->mv_y = 0; } if (band->inherit_qdelta && ref_mb) mb->q_delta = ref_mb->q_delta; 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; } need_mc |= mb->mv_x || mb->mv_y; } mb++; if (ref_mb) ref_mb++; mb_offset += band->mb_size; } offs += row_offset; } if (band->inherit_mv && need_mc) { num_blocks = (band->mb_size != band->blk_size) ? 4 : 1; mc_no_delta_func = (band->blk_size == 8) ? ff_ivi_mc_8x8_no_delta : ff_ivi_mc_4x4_no_delta; for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) { mv_x = mb->mv_x; mv_y = mb->mv_y; if (!band->is_halfpel) { mc_type = 0; } else { mc_type = ((mv_y & 1) << 1) | (mv_x & 1); mv_x >>= 1; mv_y >>= 1; } for (blk = 0; blk < num_blocks; blk++) { offs = mb->buf_offs + band->blk_size * ((blk & 1) + !!(blk & 2) * band->pitch); mc_no_delta_func(band->buf + offs, band->ref_buf + offs + mv_y * band->pitch + mv_x, band->pitch, mc_type); } } } else { src = band->ref_buf + tile->ypos * band->pitch + tile->xpos; dst = band->buf + tile->ypos * band->pitch + tile->xpos; for (y = 0; y < tile->height; y++) { memcpy(dst, src, tile->width*sizeof(band->buf[0])); src += band->pitch; dst += band->pitch; } } }
1threat
static void decode_clnpass(Jpeg2000DecoderContext *s, Jpeg2000T1Context *t1, int width, int height, int bpno, int bandno, int seg_symbols, int vert_causal_ctx_csty_symbol) { int mask = 3 << (bpno - 1), y0, x, y, runlen, dec; for (y0 = 0; y0 < height; y0 += 4) { for (x = 0; x < width; x++) { int flags_mask = -1; if (vert_causal_ctx_csty_symbol) flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if (y0 + 3 < height && !((t1->flags[y0 + 1][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 2][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 3][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG)) || (t1->flags[y0 + 4][x + 1] & (JPEG2000_T1_SIG_NB | JPEG2000_T1_VIS | JPEG2000_T1_SIG) & flags_mask))) { if (!ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_RL)) continue; runlen = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); runlen = (runlen << 1) | ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); dec = 1; } else { runlen = 0; dec = 0; } for (y = y0 + runlen; y < y0 + 4 && y < height; y++) { int flags_mask = -1; if (vert_causal_ctx_csty_symbol && y == y0 + 3) flags_mask &= ~(JPEG2000_T1_SIG_S | JPEG2000_T1_SIG_SW | JPEG2000_T1_SIG_SE | JPEG2000_T1_SGN_S); if (!dec) { if (!(t1->flags[y+1][x+1] & (JPEG2000_T1_SIG | JPEG2000_T1_VIS))) { dec = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ff_jpeg2000_getsigctxno(t1->flags[y+1][x+1] & flags_mask, bandno)); } } if (dec) { int xorbit; int ctxno = ff_jpeg2000_getsgnctxno(t1->flags[y + 1][x + 1] & flags_mask, &xorbit); t1->data[y][x] = (ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + ctxno) ^ xorbit) ? -mask : mask; ff_jpeg2000_set_significance(t1, x, y, t1->data[y][x] < 0); } dec = 0; t1->flags[y + 1][x + 1] &= ~JPEG2000_T1_VIS; } } } if (seg_symbols) { int val; val = ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); val = (val << 1) + ff_mqc_decode(&t1->mqc, t1->mqc.cx_states + MQC_CX_UNI); if (val != 0xa) av_log(s->avctx, AV_LOG_ERROR, "Segmentation symbol value incorrect\n"); } }
1threat
static inline uint32_t celt_icwrsi(uint32_t N, uint32_t K, const int *y) { int i, idx = 0, sum = 0; for (i = N - 1; i >= 0; i--) { const uint32_t i_s = CELT_PVQ_U(N - i, sum + FFABS(y[i]) + 1); idx += CELT_PVQ_U(N - i, sum) + (y[i] < 0)*i_s; sum += FFABS(y[i]); } av_assert0(sum == K); return idx; }
1threat
uint64_t helper_st_virt_to_phys (uint64_t virtaddr) { uint64_t tlb_addr, physaddr; int index, mmu_idx; void *retaddr; mmu_idx = cpu_mmu_index(env); index = (virtaddr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); redo: tlb_addr = env->tlb_table[mmu_idx][index].addr_write; if ((virtaddr & TARGET_PAGE_MASK) == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) { physaddr = virtaddr + env->tlb_table[mmu_idx][index].addend; } else { retaddr = GETPC(); tlb_fill(virtaddr, 1, mmu_idx, retaddr); goto redo; } return physaddr; }
1threat
i need to convert array value to json in jquery : <p>i have array value. need to convert this array value into json format. example is given bleow</p> <p>Sample Array</p> <pre><code>[Management Portal!@!@Production Issue Handling!@!@/IONSWeb/refDataManagement/searchDynamicScripts.do, Management Portal!@!@ Event Browser!@!@/IONSWeb/orderManagement/eventBrowser.do, Management Portal!@!@ Order Workflow!@!@/IONSWeb/orderManagement/SearchOrdersWorkflow.do, ADMINISTRATION!@!@Admin Message!@!@/IONSWeb/userManagement/getMessageForBroadcast.do, ADMINISTRATION!@!@Audit!@!@/IONSWeb/userManagement/auditManagement.do, ADMINISTRATION!@!@Locks!@!@/IONSWeb/userManagement/lockSearch.do, ADMINISTRATION!@!@Queue!@!@/IONSWeb/GroupManagement/begin.do, ADMINISTRATION!@!@Role!@!@/IONSWeb/userManagement/goToRolePage.do, ADMINISTRATION!@!@Routing Rule!@!@/IONSWeb/ruleManagement/showRules.do, ADMINISTRATION!@!@Task Code!@!@/IONSWeb/ManageTaskCode/begin.do, ADMINISTRATION!@!@Trigger OutEvent!@!@/IONSWeb/triggerOutEvent.jsp, ADMINISTRATION!@!@User!@!@/IONSWeb/userManagement/begin.do, ADMINISTRATION!@!@Refresh Application Cache!@!@/IONSWeb/userManagement/refreshApplnCache.do] </code></pre> <p>sample Json</p> <pre><code>{ "name": "Administration", "sub": [ { "name": "Add Order", "url": "/IONSWeb/userManagement/auditManagement.do" }, { "name": "Infrastructure sonet Add Order ", "url": "/IONSWeb/userManagement/auditManagement.do" }, { "name": "fGNS Add Order", "url": "/IONSWeb/userManagement/auditManagement.do" } ] } </code></pre> <p>Please anyone help on this</p>
0debug
int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) { BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; if (!drv->bdrv_get_info) return -ENOTSUP; memset(bdi, 0, sizeof(*bdi)); return drv->bdrv_get_info(bs, bdi); }
1threat
Nginx : SSL_CTX_use_PrivateKey_file (..) failed : <p>I self generated 2 self-signed certificates with openssl for testing purposes using :</p> <pre><code> $ sudo openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=FR/ST=Charente/L=Mornac/O=Office/CN=api.cockpit.yves" -keyout /usr/local/etc/nginx/ssl/api.cockpit.yves.key -out /usr/local/etc/nginx/ssl/api.cockpit.yves.crt Generating a 4096 bit RSA private key ..........................................................................++ ...................++ writing new private key to '/usr/local/etc/nginx/ssl/api.cockpit.yves.key' ----- $ sudo openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=FR/ST=Charente/L=Mornac/O=Office/CN=admin.cockpit.yves" -keyout /usr/local/etc/nginx/ssl/admin.cockpit.yves.key -out /usr/local/etc/nginx/ssl/admin.cockpit.yves.crt Generating a 4096 bit RSA private key ..................................................................................................................................................++ ..............................++ writing new private key to '/usr/local/etc/nginx/ssl/admin.cockpit.yves.key' ----- </code></pre> <p>and in my nginx.conf file , I set up the Https servers with :</p> <pre><code>server { listen 8444 ssl; server_name admin.cockpit.yves; ssl_certificate ssl/admin.cockpit.yves.crt; ssl_certificate_key ssl/admin.cockpit.yves.crt; ... } server { listen 8445 ssl; server_name api.cockpit.yves; ssl_certificate ssl/api.cockpit.yves.crt; ssl_certificate_key ssl/api.cockpit.yves.crt; ... } </code></pre> <p>however testing the nginx config, I get the following error :</p> <pre><code> sudo nginx -t nginx: [emerg] SSL_CTX_use_PrivateKey_file("/usr/local/etc/nginx/ssl/admin.cockpit.yves.crt") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: ANY PRIVATE KEY error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib) nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed </code></pre> <p>what could be wrong ? is it because I try to setup 2 certificates for 2 different subdomains (admin. and api. ) for the same domain cockpit.yves ?</p> <p>thanks for your feedback</p>
0debug
static int handle_buffered_iopage(XenIOState *state) { buffered_iopage_t *buf_page = state->buffered_io_page; buf_ioreq_t *buf_req = NULL; ioreq_t req; int qw; if (!buf_page) { return 0; } memset(&req, 0x00, sizeof(req)); for (;;) { uint32_t rdptr = buf_page->read_pointer, wrptr; xen_rmb(); wrptr = buf_page->write_pointer; xen_rmb(); if (rdptr != buf_page->read_pointer) { continue; } if (rdptr == wrptr) { break; } buf_req = &buf_page->buf_ioreq[rdptr % IOREQ_BUFFER_SLOT_NUM]; req.size = 1UL << buf_req->size; req.count = 1; req.addr = buf_req->addr; req.data = buf_req->data; req.state = STATE_IOREQ_READY; req.dir = buf_req->dir; req.df = 1; req.type = buf_req->type; req.data_is_ptr = 0; xen_rmb(); qw = (req.size == 8); if (qw) { if (rdptr + 1 == wrptr) { hw_error("Incomplete quad word buffered ioreq"); } buf_req = &buf_page->buf_ioreq[(rdptr + 1) % IOREQ_BUFFER_SLOT_NUM]; req.data |= ((uint64_t)buf_req->data) << 32; xen_rmb(); } handle_ioreq(state, &req); atomic_add(&buf_page->read_pointer, qw + 1); } return req.count; }
1threat
How to use \ in a string in python : <p>When I try to use </p> <pre><code> print variable + "\filename" </code></pre> <p>the slash isn't recognized as a string character, however if I were to do </p> <pre><code> print variable + "\Filename" </code></pre> <p>capitalizing the first letter proceeding the slash... then the slash is recognized as a string character </p> <p>The only thing I was able to find online is that in some cases a \ with a letter preceding it may be used to end a string of raw characters but I don't understand this.</p> <p>So my question is why does this happen? And more importantly what is a way around this or a fix for this. Thank you.</p>
0debug
Calling an AJAX function in jQuery using the Enter Key : <p>I have a textbox in HTML:</p> <pre><code>&lt;input id="myInfo"&gt; </code></pre> <p>I would like to run an AJAX function as soon as the user enters in some value into the textbox using jQuery. I want the function to be called as soon as the user presses the "Enter"</p> <p>Can someone please provide a very simple illustration as to how this would be accomplished?</p> <p>Thank you</p>
0debug
static void fd_put_notify(void *opaque) { QEMUFileFD *s = opaque; qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); qemu_file_put_notify(s->file); }
1threat
void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { MpegEncContext * const s = &h->s; int mb_xy; int mb_type, left_type, top_type; int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY)); int chroma444 = CHROMA444; mb_xy = h->mb_xy; if(!h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); return; } assert(!FRAME_MBAFF); left_type= h->left_type[LTOP]; top_type= h->top_type; mb_type = s->current_picture.mb_type[mb_xy]; qp = s->current_picture.qscale_table[mb_xy]; qp0 = s->current_picture.qscale_table[mb_xy-1]; qp1 = s->current_picture.qscale_table[h->top_mb_xy]; qpc = get_chroma_qp( h, 0, qp ); qpc0 = get_chroma_qp( h, 0, qp0 ); qpc1 = get_chroma_qp( h, 0, qp1 ); qp0 = (qp + qp0 + 1) >> 1; qp1 = (qp + qp1 + 1) >> 1; qpc0 = (qpc + qpc0 + 1) >> 1; qpc1 = (qpc + qpc1 + 1) >> 1; qp_thresh = 15+52 - h->slice_alpha_c0_offset; if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) return; if( IS_INTRA(mb_type) ) { int16_t bS4[4] = {4,4,4,4}; int16_t bS3[4] = {3,3,3,3}; int16_t *bSH = FIELD_PICTURE ? bS3 : bS4; if(left_type) filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h); if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h); } filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h); } else { filter_mb_edgev( &img_y[4*1], linesize, bS3, qp, h); filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h); filter_mb_edgev( &img_y[4*3], linesize, bS3, qp, h); if(top_type){ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h); } filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, h); filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h); filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h); } if(chroma){ if(chroma444){ if(left_type){ filter_mb_edgev( &img_cb[4*0], linesize, bS4, qpc0, h); filter_mb_edgev( &img_cr[4*0], linesize, bS4, qpc0, h); } if( IS_8x8DCT(mb_type) ) { filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); } filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); } else { filter_mb_edgev( &img_cb[4*1], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*1], linesize, bS3, qpc, h); filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h); filter_mb_edgev( &img_cb[4*3], linesize, bS3, qpc, h); filter_mb_edgev( &img_cr[4*3], linesize, bS3, qpc, h); if(top_type){ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h); filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h); } filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cb[4*3*linesize], linesize, bS3, qpc, h); filter_mb_edgeh( &img_cr[4*3*linesize], linesize, bS3, qpc, h); } }else{ if(left_type){ filter_mb_edgecv( &img_cb[2*0], uvlinesize, bS4, qpc0, h); filter_mb_edgecv( &img_cr[2*0], uvlinesize, bS4, qpc0, h); } filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h); filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h); if(top_type){ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h); } filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h); filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h); } } return; } else { LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]); int edges; if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) { edges = 4; AV_WN64A(bS[0][0], 0x0002000200020002ULL); AV_WN64A(bS[0][2], 0x0002000200020002ULL); AV_WN64A(bS[1][0], 0x0002000200020002ULL); AV_WN64A(bS[1][2], 0x0002000200020002ULL); } else { int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); int step = 1+(mb_type>>24); edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); } if( IS_INTRA(left_type) ) AV_WN64A(bS[0][0], 0x0004000400040004ULL); if( IS_INTRA(top_type) ) AV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL); #define FILTER(hv,dir,edge)\ if(AV_RN64A(bS[dir][edge])) { \ filter_mb_edge##hv( &img_y[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qp : qp##dir, h );\ if(chroma){\ if(chroma444){\ filter_mb_edge##hv( &img_cb[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ filter_mb_edge##hv( &img_cr[4*edge*(dir?linesize:1)], linesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ } else if(!(edge&1)) {\ filter_mb_edgec##hv( &img_cb[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ filter_mb_edgec##hv( &img_cr[2*edge*(dir?uvlinesize:1)], uvlinesize, bS[dir][edge], edge ? qpc : qpc##dir, h );\ }\ }\ } if(left_type) FILTER(v,0,0); if( edges == 1 ) { if(top_type) FILTER(h,1,0); } else if( IS_8x8DCT(mb_type) ) { FILTER(v,0,2); if(top_type) FILTER(h,1,0); FILTER(h,1,2); } else { FILTER(v,0,1); FILTER(v,0,2); FILTER(v,0,3); if(top_type) FILTER(h,1,0); FILTER(h,1,1); FILTER(h,1,2); FILTER(h,1,3); } #undef FILTER } }
1threat
Why facebook like button(use iframe) not showing when url is a fan page's post, thanks a lot~ : may I ask why when facebook like button href is a fan page, it's working perfectly. [enter image description here][1] <iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FOscarPet.tw%2F%3Ffref%3Dts&width=450&layout=standard&action=like&show_faces=false&share=true&height=35&appId=PleaseChange2ARealAppId" width="450" height="35" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe> [1]: http://i.stack.imgur.com/aMLRH.png But when href change to a fan page's "post", the like button not showing any more. <iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FOscarPet.tw%2Fposts%2F1076964629016757&width=0&layout=standard&action=like&show_faces=false&share=true&height=35&appId=PleaseChange2ARealAppId" width="450" height="35" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe> Thanks a lot~ :D
0debug
How to pass flags to nodejs application through npm run-script? : <p>I've a NodeJS file that I run via an "npm" command. I've been trying to list all arguments (including flags). If I run it by directly calling the node exe, it works fine but if I use the <code>npm</code> command, I cannot access the flags.</p> <p>Code:</p> <pre><code>console.dir(process.argv); </code></pre> <p>When I run the file like this,</p> <pre><code>node file.js arg1 arg2 -f --flag2 </code></pre> <p>I can get all of the arguments.</p> <pre><code>[ '/usr/local/bin/node', '/.../file.js', 'arg1', 'arg2', '-f', '--flag2' ] </code></pre> <p>But if I add an npm runner to the package.json file and try to run with it, I can only get the arguments but not the flags.</p> <pre><code>npm run test arg1 arg2 -f --flag2 </code></pre> <p>The result:</p> <pre><code>[ '/usr/local/bin/node', '/.../file.js', 'arg1', 'arg2' ] </code></pre> <p>package.json file:</p> <pre><code>{ "name": "name", "version": "1.0.0", "description": "", "main": "test.js", "scripts": { "test": "echo \"Error: no test specified\" &amp;&amp; exit 1", "test" : "node test.js" }, "keywords": [], "author": "", "license": "ISC" } </code></pre> <p>Basically, node won't pass flags to the running script. Is there a solution for this? My real project has a long path with a lot of arguments so I want to use a shortcut to test it.</p>
0debug
static bool write_header(FILE *fp) { static const TraceRecord header = { .event = HEADER_EVENT_ID, .timestamp_ns = HEADER_MAGIC, .x1 = HEADER_VERSION, }; return fwrite(&header, sizeof header, 1, fp) == 1; }
1threat
static void monitor_qmp_event(void *opaque, int event) { QObject *data; Monitor *mon = opaque; switch (event) { case CHR_EVENT_OPENED: mon->qmp.in_command_mode = false; data = get_qmp_greeting(); monitor_json_emitter(mon, data); qobject_decref(data); mon_refcount++; break; case CHR_EVENT_CLOSED: json_message_parser_destroy(&mon->qmp.parser); json_message_parser_init(&mon->qmp.parser, handle_qmp_command); mon_refcount--; monitor_fdsets_cleanup(); break; } }
1threat
Can't figure out whats wrong in the javascript portion of code. : document.getElementById('go').onclick = function() { var data = document.getElementById('number1').value; data = parseFloat(number1); var data = document.getElementById('number2').value; data = parseFloat(number2); var total = number1 + number2; document.getElementById('result').value = total; };
0debug
uart_write(void *opaque, hwaddr addr, uint64_t val64, unsigned int size) { XilinxUARTLite *s = opaque; uint32_t value = val64; unsigned char ch = value; addr >>= 2; switch (addr) { case R_STATUS: hw_error("write to UART STATUS?\n"); break; case R_CTRL: if (value & CONTROL_RST_RX) { s->rx_fifo_pos = 0; s->rx_fifo_len = 0; } s->regs[addr] = value; break; case R_TX: if (s->chr) qemu_chr_fe_write(s->chr, &ch, 1); s->regs[addr] = value; s->regs[R_STATUS] |= STATUS_IE; break; default: DUART(printf("%s addr=%x v=%x\n", __func__, addr, value)); if (addr < ARRAY_SIZE(s->regs)) s->regs[addr] = value; break; } uart_update_status(s); uart_update_irq(s); }
1threat
transforming JSON into patent child relation : I am tring to convert `JSON vm.scholasticlist` into `JSON vm.parentList2`. In `JSON vm.scholasticlist`, ***s_gid*** is unique key, and ***parent_id*** point to parent ***s_gid***. I am trying following code, but unable to build it. vm.scholasticlist = []; vm.parentList = []; vm.parentList2 = []; for (var i in vm.scholasticlist) { if(vm.scholasticlist[i]['parent_id'] == 0 ){ vm.parentList.push(vm.scholasticlist[i]) } } vm.parentList2 = vm.parentList; for (var i in vm.parentList) { console.log(vm.parentList[i]['s_gid']) for (var x in vm.scholasticlist) { if(vm.scholasticlist[x]['parent_id'] === vm.parentList[i]['s_gid'] ){ console.log(vm.parentList[i]['s_gid']) vm.parentList2.push(vm.scholasticlist[x]) } } } vm.scholasticlist = [{ "s_gid": "10", "m_s_p_id": "1", "subject_group_name": "Foundation of Information Technology", "parent_id": "0", "sname": "" }, { "s_gid": "11", "m_s_p_id": "2", "subject_group_name": "Life Skills", "parent_id": "0", "sname": "" }, { "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }, { "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }] want to build new JSON with parent child relation vm.parentList2 = [{ "s_gid": "10", "m_s_p_id": "1", "subject_group_name": "Foundation of Information Technology", "parent_id": "0", "sname": "" }, { "s_gid": "11", "m_s_p_id": "2", "subject_group_name": "Life Skills", "parent_id": "0", "sname": "", "child": [{ "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }, { "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }] }]
0debug
filter method on multidimensional array in javascript : i have an `id` and i to filter a multidimensional array with these. my code is like this : service.fakedata.map(f=>{ f.results.map(r=>{ r = r.filter(m=> m.rId !== id) }) }) and my array is : "services": [ { "id": "1839f72e-fa73-47de-b119-49fb971a5730", "name": "In I/O Route", "url": "http://wwww.in.io/[param1]/[param2]", "inputParams": [ { "id": "e74a6229-4c08-43a1-961f-abeb887fa90e", "name": "in1", "datatype": "string" }, { "id": "e74a6229-4c08-43a1-961f-abeb887fa90o", "name": "in2", "datatype": "string" } ], "isArrayResult": false, "results": [ { "id": "ef7c98db-9f12-45a8-b3fb-7d09a82abe3d", "name": "out1", "datatype": "string", "fakedatatype": [ "address", "city" ] }, { "id": "9b178ded-af27-43df-920f-daab5ad439b9", "name": "out2", "datatype": "string", "fakedatatype": [ "internet", "url" ] } ], "routeParameters": [ "param1", "param2" ], "fakedata": [ { "id": "b0376694-9612-43d2-93ed-c74264df962e", "url": "http://wwww.in.io/wood/good", "params": [ { "key": "param1", "value": "wood" }, { "key": "param2", "value": "good" } ], "inputParams": [ { "iId":"e74a6229-4c08-43a1-961f-abeb887fa90e", "key": "in1", "value": "m" }, { "iId":"e74a6229-4c08-43a1-961f-abeb887fa90o", "key": "in2", "value": "z" } ], "results": [ { "rId": "ef7c98db-9f12-45a8-b3fb-7d09a82abe3d", "key": "out1", "value": "result1", "fakedatatype": [ "address", "city" ] }, { "rId": "9b178ded-af27-43df-920f-daab5ad439b9", "key": "out2", "value": "result2", "fakedatatype": [ "internet", "url" ] } ] } ] } ] in this case filter is working (when i check with console.log) but it doesn't change `fakedata` array? what was wrong with my code ?
0debug
How can I execute if statements from a text file in c# : <p>I was wondering if anyone knows how I can run if statements from a text file in c#. Thank you.</p>
0debug
Tkinter real time clock display : I want to create real time clock using Tkinter and time library. I have created a class but somehow i am not able to figure out my problem...can anyone help me out with this??? from tkinter import * import time root = Tk() class Clock: def __init__(self): self.time1 = '' self.time2 = time.strftime('%H:%M:%S') self.mFrame = Frame() self.mFrame.pack(side=TOP,expand=YES,fill=X) self.watch = Label (self.mFrame, text=self.time2, font=('times',12,'bold')) self.watch.pack() self.watch.after(200,self.time2) obj1 = Clock() root.mainloop() This is my code....
0debug
How to insert/copy in excel base on number of another column in excel VBA or not : Basically, I would like a simple way to the following example scenario : Number of times of A,B and C copied based on lines of numbers. Number of lines are much more than below example in real cases of course. From A 1 B 2 C 3 6 7 to A 1 A 2 A 3 A 6 A 7 B 1 B 2 B 3 B 6 B 7 C 1 C 2 C 3 C 6 C 7 Any quick way?
0debug
Python won't recognize object parameter : <pre><code> def function(objectA_list): for objectA in objectA_list: str = objectA.attr1 </code></pre> <p>objectA.attr1 is not recognized. objectA is an instance of a class in another file that I have imported. How do I "cast" objectA variable as an objectA so I could use access the underlying attribute?</p>
0debug
static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) { VideoData *s = s1->priv_data; char filename[1024]; int ret; ByteIOContext f1, *f; if (!s->is_pipe) { if (get_frame_filename(filename, sizeof(filename), s->path, s->img_number) < 0) return -EIO; f = &f1; if (url_fopen(f, filename, URL_RDONLY) < 0) return -EIO; } else { f = &s1->pb; if (url_feof(f)) return -EIO; } av_new_packet(pkt, s->img_size); pkt->stream_index = 0; s->ptr = pkt->data; ret = av_read_image(f, filename, s->img_fmt, read_packet_alloc_cb, s); if (!s->is_pipe) { url_fclose(f); } if (ret < 0) { av_free_packet(pkt); return -EIO; } else { pkt->pts = av_rescale((int64_t)s->img_number * s1->streams[0]->codec.frame_rate_base, s1->pts_den, s1->streams[0]->codec.frame_rate) / s1->pts_num; s->img_number++; return 0; } }
1threat
int qcrypto_cipher_setiv(QCryptoCipher *cipher, const uint8_t *iv, size_t niv, Error **errp) { QCryptoCipherNettle *ctx = cipher->opaque; if (niv != ctx->niv) { error_setg(errp, "Expected IV size %zu not %zu", ctx->niv, niv); return -1; } memcpy(ctx->iv, iv, niv); return 0; }
1threat
Importxml into Google Sheet automatically : I want to know how to import data using the Importxml function in Google spreadsheets. https://www.tigeretf.com/front/products/product.do?ksdFund=KR7305080004&fundTypeCode=01000800 Above <기준가격(원)> I want to import data. importxml(I2,I3) I2 = https://www.tigeretf.com/front/products/product.do?ksdFund=KR7305080004&fundTypeCode=01000800 I3 = //*[@id="container"]/div[2]/div[2]/div[1]/div/table/tbody/tr/td[2]/strong/text() Data is being loaded and can not be refreshed. importxml(I2,I3) I2 = https://www.tigeretf.com/front/products/product.do?ksdFund=KR7305080004&fundTypeCode=01000800 I3 = //*[@id="container"]/div[2]/div[2]/div[1]/div/table/tbody/tr/td[2]/strong/text() I want the <기준가격(원)> data to be loaded automatically every time the sheet is refreshed.
0debug
bool virtio_disk_is_scsi(void) { if (guessed_disk_nature) { return (blk_cfg.blk_size == 512); } return (blk_cfg.geometry.heads == 255) && (blk_cfg.geometry.sectors == 63) && (blk_cfg.blk_size == 512); }
1threat
av_cold int ffv1_init_slice_contexts(FFV1Context *f) { int i; f->slice_count = f->num_h_slices * f->num_v_slices; av_assert0(f->slice_count > 0); for (i = 0; i < f->slice_count; i++) { FFV1Context *fs = av_mallocz(sizeof(*fs)); int sx = i % f->num_h_slices; int sy = i / f->num_h_slices; int sxs = f->avctx->width * sx / f->num_h_slices; int sxe = f->avctx->width * (sx + 1) / f->num_h_slices; int sys = f->avctx->height * sy / f->num_v_slices; int sye = f->avctx->height * (sy + 1) / f->num_v_slices; f->slice_context[i] = fs; memcpy(fs, f, sizeof(*fs)); memset(fs->rc_stat2, 0, sizeof(fs->rc_stat2)); fs->slice_width = sxe - sxs; fs->slice_height = sye - sys; fs->slice_x = sxs; fs->slice_y = sys; fs->sample_buffer = av_malloc(3 * MAX_PLANES * (fs->width + 6) * sizeof(*fs->sample_buffer)); if (!fs->sample_buffer) } return 0; }
1threat
Pyspark 'PipelinedRDD' object has no attribute 'show' : <p>I I want to find out what all the items in df which are not in df1 , also items in df1 but not in df</p> <pre><code> df =sc.parallelize([1,2,3,4 ,5 ,6,7,8,9]) df1=sc.parallelize([4 ,5 ,6,7,8,9,10]) df2 = df.subtract(df1) df2.show() df3 = df1.subtract(df) df3.show() </code></pre> <p>Just want to check the result to see if I understand the function well. But got this error 'PipelinedRDD' object has no attribute 'show' any suggestion?</p>
0debug
add new layouts for RTL smartphones : <p>in android studio, when i'm coding a application, i use a lot of layout for english layout, actualy for LTR, how can i add new layouts for RTL smartphones? because in smartphones that their language is designed for RTL user, my buttons and textviews and their location will change!</p>
0debug
static ram_addr_t ram_save_remaining(void) { return ram_list.dirty_pages; }
1threat
How to reverse direction of motor without using IC driver module : Please help me here.I am quite on leash with an arduino project and the IC module which i ordered from Amazon is not working and i have to represent it on 26/7.If you have any idea how to reverse direction of motor without using IC driver module,please help me.
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
How to use DynamoDB fine grained access control with Cognito User Pools? : <p>I'm having trouble understanding how to use fine-grained access control on DynamoDB when logged in using Cognito User Pools. I've followed the docs and googled around, but for some reason I can't seem to get it working.</p> <p>My AWS setup is listed below. If I remove the condition in the role policy, I can get and put items no problem, so it seems likely that the condition is the problem. But I can't figure out how or where to debug policies that depend on authenticated identities - what variables are available, what are their values, etc etc.</p> <p>Any help would be greatly appreciated!</p> <p><strong>DynamoDB table</strong></p> <ul> <li>Table name: documents</li> <li>Primary partition key: userID (String)</li> <li>Primary sort key: docID (String)</li> </ul> <p><strong>DynamoDB example row</strong></p> <pre><code>{ "attributes": {}, "docID": "0f332745-f749-4b1a-b26d-4593959e9847", "lastModifiedNumeric": 1470175027561, "lastModifiedText": "Wed Aug 03 2016 07:57:07 GMT+1000 (AEST)", "type": "documents", "userID": "4fbf0c06-03a9-4cbe-b45c-ca4cd0f5f3cb" } </code></pre> <p><strong>Cognito User Pool User</strong></p> <ul> <li>User Status: Enabled / Confirmed</li> <li>MFA Status: Disabled</li> <li>sub: 4fbf0c06-03a9-4cbe-b45c-ca4cd0f5f3cb</li> <li>email_verified: true</li> </ul> <p><strong>Role policy for "RoleName"</strong></p> <pre><code>{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "dynamodb:GetItem", "dynamodb:PutItem" ], "Resource": [ "arn:aws:dynamodb:ap-southeast-2:NUMBER:table/documents" ], "Condition": { "ForAllValues:StringEquals": { "dynamodb:LeadingKeys": [ "${cognito-identity.amazonaws.com:sub}" ] } } } ] } </code></pre> <p><strong>Login information returned from cognitoUser.getUserAttributes()</strong></p> <pre><code>attribute sub has value 4fbf0c06-03a9-4cbe-b45c-ca4cd0f5f3cb attribute email_verified has value true attribute email has value ****@****com </code></pre> <p><strong>Error message</strong></p> <pre><code>Code: "AccessDeniedException" Message: User: arn:aws:sts::NUMBER:assumed-role/ROLE_NAME/CognitoIdentityCredentials is not authorized to perform: dynamodb:GetItem on resource: arn:aws:dynamodb:ap-southeast-2:NUMBER:table/documents </code></pre>
0debug
static void ioapic_class_init(ObjectClass *klass, void *data) { IOAPICCommonClass *k = IOAPIC_COMMON_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); k->realize = ioapic_realize; * If APIC is in kernel, we need to update the kernel cache after * migration, otherwise first 24 gsi routes will be invalid. k->post_load = ioapic_update_kvm_routes; dc->reset = ioapic_reset_common; dc->props = ioapic_properties; }
1threat
window.location.href = 'http://attack.com?user=' + user_input;
1threat
How to save Viewer Pane as image through command line? : <p>Let's say I have the following HTML viewed in the Viewer Pane</p> <pre><code>tempDir &lt;- tempfile() dir.create(tempDir) htmlFile &lt;- file.path(tempDir, "index.html") write('&lt;h1&gt; Content&lt;/h1&gt;', htmlFile, append = TRUE) write('&lt;h2&gt; Content&lt;/h2&gt;', htmlFile, append = TRUE) write('lorem ipsum...', htmlFile, append = TRUE) viewer &lt;- getOption("viewer") viewer(htmlFile) </code></pre> <p>When I have this html in the Viewer Pane, I can click on the "Save as image" button:</p> <p><a href="https://i.stack.imgur.com/ZzyKr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZzyKr.png" alt="enter image description here"></a></p> <p>And I have the html content as a png, for example : </p> <p><a href="https://i.stack.imgur.com/SwyhO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SwyhO.png" alt="enter image description here"></a></p> <p>Is there a way to do this with the command line? I know about <code>rstudioapi::savePlotAsImage()</code>, so I'm looking for a kind of <code>saveViewerAsImage</code>. </p> <p><strong>Edit</strong>: I know we can do this with the {webshot} package, but I'm looking for the RStudio function that does that. </p>
0debug
Order dataframe in R : <p>I want to order de following sequence code</p> <pre><code> cereal2[Cereal$Calories &amp; Cereal$Carbs &lt;27.5,] Name Calories Carbs 1 AppleJacks 117 27 2 Boo Berry 118 27 6 Cocoa Puffs 117 26 7 Cookie Crisp 117 26 8 Corn Flakes 101 24 10 Crispix 113 26 12 Froot Loops 118 26 17 King Vitaman 80 17 18 Kix 87 20 20 Lucky Charms 114 25 21 Multi-Grain Cheerios 108 24 22 Product 19 100 25 25 Rice Chex 94 22 28 Special K 117 22 30 Wheaties 107 24 </code></pre> <p>How can I sort the calories in ascending order?</p>
0debug
List is printing oddly in python? : <p>so I am trying to make tictactoe and i'm having trouble with the board. when I make 3 list of the 1-9 spots they print out as a whole list including the brackets and commas, for example ex = [1, 2] and it would print that full thing. I've never had this problem before. Can anyone help and is it because im using an Online IDE because of chromebook? Thanks :)</p> <pre><code>board1 = ["|1|", "2|", "3|"] board2 = ["|4|", "5|", "6|"] board3 = ["|7|", "8|", "9|"] print(board1) print(board2) print(board3) #Output '|1|', '2|', '3|'] ['|4|', '5|', '6|'] ['|7|', '8|', '9|'] </code></pre>
0debug
tensorflow: efficient feeding of eval/train data using queue runners : <p>I'm trying to run a tensorflow graph to train a model and periodically evaluate using a separate evaluation dataset. Both training and evaluation data is implemented using queue runners.</p> <p>My current solution is to create both inputs in the same graph and use a <code>tf.cond</code> dependent on an <code>is_training</code> placeholder. My issue is highlighted by the following code:</p> <pre><code>import tensorflow as tf from tensorflow.models.image.cifar10 import cifar10 from time import time def get_train_inputs(is_training): return cifar10.inputs(False) def get_eval_inputs(is_training): return cifar10.inputs(True) def get_mixed_inputs(is_training): train_inputs = get_train_inputs(None) eval_inputs = get_eval_inputs(None) return tf.cond(is_training, lambda: train_inputs, lambda: eval_inputs) def time_inputs(inputs_fn, n_runs=10): graph = tf.Graph() with graph.as_default(): is_training = tf.placeholder(dtype=tf.bool, shape=(), name='is_training') images, labels = inputs_fn(is_training) with tf.Session(graph=graph) as sess: coordinator = tf.train.Coordinator() threads = tf.train.start_queue_runners(sess=sess, coord=coordinator) t = time() for i in range(n_runs): im, l = sess.run([images, labels], feed_dict={is_training: True}) dt = time() - t coordinator.request_stop() coordinator.join(threads) return dt / n_runs print('Train inputs: %.3f' % time_inputs(get_train_inputs)) print('Eval inputs: %.3f' % time_inputs(get_eval_inputs)) print('Mixed inputs: %.3f' % time_inputs(get_mixed_inputs)) </code></pre> <p>I also had to comment out the <code>image_summary</code> line <code>133</code> of <code>tensorflow/models/image/cifar10/cifar10_inputs.py</code>.</p> <p>This yielded the following results:</p> <pre><code>Train inputs: 0.055 Eval inputs: 0.050 Mixed inputs: 0.105 </code></pre> <p>It would seem in the mixed case both inputs are being read/parsed, even though only 1 is used. Is there a way of avoiding this redundant computation? Or is there a nicer way of switching between training/evaluation data that still leverages the queue-runner setup?</p>
0debug