Categories
CMS Mastering Development Wordpress

Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT

I hope someone can shed some light into this problem that i cannot find a solution for! (I have been searching the www for days). WHAT I HAVE DONE: I created a CPT: “service” and a Custom taxonomy: “service_cat”, which contains 4 $terms: corporate events, fundraisers, private events and weddings. I also created two files: […]

Categories
Linux Mastering Development

Timeout for sticky keys

Context I use xkbset to enable sticky keys: xkbset sticky -twokey latchlock ## set sticky keys, don’t disable via twokey xkbset exp 1 =sticky ## don’t expire sticky keys That does exactly what I want, allowing me to tap and release the shift key, and then press another key and get the ‘shifted’ value. Double-tapping […]

Categories
CMS Development Wordpress

WP Coding standards – escaping the inescapable?

How do you escape these two examples? wc_price() wraps the already escaped $product_price in p and span tags with currency symbol. $product_price = $product->get_price(); <p><?php echo wc_price( esc_html( $product_price ) ); ?></p> The next one outputs the complete image with all attributes: src, srcset, alt, etc. $product_img = $product->get_image(); <?php echo $product_img; ?>

Categories
CMS Development Wordpress

WP Coding standards – escaping the inescapable?

How do you escape these two examples? wc_price() wraps the already escaped $product_price in p and span tags with currency symbol. $product_price = $product->get_price(); <p><?php echo wc_price( esc_html( $product_price ) ); ?></p> The next one outputs the complete image with all attributes: src, srcset, alt, etc. $product_img = $product->get_image(); <?php echo $product_img; ?>

Categories
Development

Function inside an array php

So I have a web crawler that I am working on. And I have a CSV file that have about one million websites that I want to pass to be crawled. My problem is that I am able to save the CSV file in an array but when I pass it to the method that […]

Categories
Development

Browser-friendly way of drawing rectangles on top of image R Shiny

I have written a shiny app that allows the user to draw rectangles on top of an image (minimal reproducible example below). The problem with my current approach is that every time a rectangle is added, a new image is created, written to disk, and rendered (sent to the user’s browser). This takes quite some […]

Categories
Development Linux Ubuntu

Changing the format of files in linux

I have a bunch of files with .vcf suffixes, comma separated and containing ” like below “”,”CHROM”,”POS”,”ID”,”REF”,”ALT”,”QUAL”,”FILTER”,”INFO”,”FORMAT”,”NORMAL”,”TUMOR”,”Depth”,”DistanceToAlignmentEnd”,”DistanceToAlignmentEndMAD”,”DistanceToAlignmentEndMedian”,”HomopolymerLength”,”LowMapQual”,”MMQSDiff”,”MapQualDiff”,”MapQualDiffMedian”,”NT”,”QSS”,”QSS_NT”,”ReadCount”,”ReadCountControl”,”Repeat”,”SGT”,”SNVCluster10″,”SNVCluster100″,”SNVCluster20″,”SNVCluster5″,”SNVCluster50″,”SOMATIC”,”StrandBias”,”TQSS”,”TQSS_NT”,”VariantAlleleCount”,”VariantAlleleCountControl”,”VariantAlleleFrequency”,”VariantBaseQual”,”VariantBaseQualMedian”,”VariantMMQS”,”VariantMapQual”,”VariantMapQualMedian”,”VariantStrandBias”,”normal”,”tumour”,”N_DP”,”N_FDP”,”N_SDP”,”N_SUBDP”,”T_DP”,”T_FDP”,”T_SDP”,”T_SUBDP”,”T_REF_COUNT”,”T_ALT_COUNT”,”N_REF_COUNT”,”N_ALT_COUNT”,”T_VAF”,”N_VAF”,”N_AU_1″,”N_AU_2″,”N_CU_1″,”N_CU_2″,”N_GU_1″,”N_GU_2″,”N_TU_1″,”N_TU_2″,”T_AU_1″,”T_AU_2″,”T_CU_1″,”T_CU_2″,”T_GU_1″,”T_GU_2″,”T_TU_1″,”T_TU_2″ “1”,”chr1″,”11195689″,”.”,”C”,”G”,”.”,”PASS”,”Depth=83;DistanceToAlignmentEnd=38.75;DistanceToAlignmentEndMAD=9.00;DistanceToAlignmentEndMedian=37.50;HomopolymerLength=2;LowMapQual=0.00;MMQSDiff=136.94;MapQualDiff=-8.750e-01;MapQualDiffMedian=0.00;NT=ref;QSS=16;QSS_NT=16;ReadCount=83;ReadCountControl=49;Repeat=0;SGT=CC->CG;SNVCluster10=0;SNVCluster100=2;SNVCluster20=1;SNVCluster5=0;SNVCluster50=2;SOMATIC;StrandBias=0.482;TQSS=1;TQSS_NT=1;VariantAlleleCount=4;VariantAlleleCountControl=1;VariantAlleleFrequency=0.048;VariantBaseQual=40.00;VariantBaseQualMedian=41.00;VariantMMQS=157.25;VariantMapQual=59.00;VariantMapQualMedian=60.00;VariantStrandBias=0.250″,”DP:FDP:SDP:SUBDP:AU:CU:GU:TU”,”49:1:0:0:0,0:47,48:1,1:0,0″,”82:0:0:0:0,0:78,79:4,4:0,0″,”83″,”38.75″,”9″,”37.5″,”2″,”0″,”136.94″,”-0.875″,”0″,”ref”,”16″,”16″,”83″,”49″,”0″,”CC->CG”,”0″,”2″,”1″,”0″,”2″,”SOMATIC”,”0.482″,”1″,”1″,”4″,”1″,”0.048″,”40″,”41″,”157.25″,”59″,”60″,”0.25″,”list(DP = “”49″”, FDP = “”1″”, SDP = “”0″”, SUBDP = “”0″”, AU = “”0,0″”, CU = “”47,48″”, GU = “”1,1″”, TU = “”0,0″”)”,”list(DP = “”82″”, FDP = “”0″”, SDP = “”0″”, SUBDP = “”0″”, AU = “”0,0″”, […]

Categories
Development

Browser-friendly way of drawing rectangles on top of image R Shiny

Minimal reproducible example of a shiny app that draws rectangles on top of an image: library(shiny) library(png) library(RCurl) myurl = ‘https://raw.githubusercontent.com/Tixierae/deep_learning_NLP/master/CNN_IMDB/cnn_illustration.png’ my_img = readPNG(getURLContent(myurl)) img_height = dim(my_img)[1] img_width = dim(my_img)[2] server = function(input, output) { observe({ outfile = tempfile(tmpdir=’./’, fileext=’.png’) png(filename=outfile,width=img_width,height=img_height) par(mar=c(0,0,0,0),xaxs=’i’, yaxs=’i’) plot(NA,xlim=c(0,img_width),ylim=c(0,img_height)) rasterImage(my_img,0,0,img_width,img_height) if (!is.null(input$image_brush)){ b_in = lapply(input$image_brush,as.numeric) if (!is.null(b_in$xmin)){ rect(b_in$xmin,img_height-b_in$ymax,b_in$xmax,img_height-b_in$ymin,border=’green’,lwd=5) } } […]

Categories
Ask Development Programming & Design

[ Programming & Design ] Open Question : What would be the funniest way to hack someone without damaging their computer?

I think it’d be funny to install hidden autoclickers on someone’s computer. Make space, escape, ctrl, alt, and delete trigger buttons. It would render their computer useless until they guessed the right keys, then they could delete the files and they basically get a temporary payload without damage to their system.

Categories
Development

How to create a program where data input is requested first, then the menu after? [closed]

I am a C++ beginner programmer. I had an assigned homework last week under the topic of Modularity. Problem states: Create a program to calculate the areas and perimeters of some geometric figures. A main menu containing the following options will be programmed: Areas Perimeters Exit In the first option you will have a submenu […]