Posts

Showing posts from July, 2014

Facebook share button for Android not enabled, stays faded -

Image
i trying add facebook share in android. have added button in xml this <com.facebook.share.widget.sharebutton android:id="@+id/ivshare" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_margintop="5dp" /> in java have tried implement this @onclick(r.id.ivshare) public void onshareclick() { sharelinkcontent linkcontent = new sharelinkcontent.builder() .setcontenttitle("hello there") .setcontentdescription( "the 'hello facebook' sample showcases simple facebook integration") .setcontenturl(uri.parse("market://details?id=" + getpackagename())) .build(); sharebutton.setsharecontent(linkcontent); sharebutton.registercallback(callbackmanager, new facebookcallback<shar

c++ - chai3d. Make a xml file using cFileXML -

i'm working on chai3d application , i'm using visual studio 2013. compiled chai3d library using cmake , using 1 of templates chai3d provides (qt) created application. compiled template using cmake. the template works correctly problem arises when create instance of cfilexml class in application.cpp file: cfilexml xmlfile = new cfilexml("log.xml");* after write when compile solution 24 errors. errors "lnk2019" unresolved external symbol errors. related cfilexml class methods/functions. can see many times class pugi::xml_node... thanks lot pd: tried tag post chai3d seems tag doesn't exist , can't create it. :(

c - Getrusage inline assembly -

i trying implement getrusage function client server program using sockets , of running on freebsd. want print out processor time usage , memory usage. i have tried implement following code getting output illegal instrucion (core dumped) int getrusage(int who, struct rusage *usage){ int errorcode; __asm__( "syscall" : "=a" (errorcode) : "a" (117), "d" (who), "s" (usage) //const sysgetrusage : scno = 117 : "memory" ); if (errorcode<0) { printf("error"); } return 1; } update: have tried run 0 values or random number value or negative number values. ideas missing? int getrusage(int who, struct rusage *usage){ int errorcode; __asm__("push $0;" "push %2;" "push %1;" "movl $117, %%eax;" "int $0x80;" :"=r"(e

c# - At least one radio button should be checked through custom validation in asp.net mvc -

Image
i new mvc framework. have 2 radio buttons , want @ least 1 should checked. want through custom validation, need help? the field "usworkpermit": my view code: do have work visa ? @html.radiobuttonfor(m => m.usworkpermit,"true") yes have @html.radiobuttonfor(m => m.usworkpermit, "false") no don't my model code: [usworkpermitvalidation] public boolean usworkpermit { get; set; } my controller code: [httppost] public actionresult index(models.jobapplication jobapplication) { if (modelstate.isvalid) { } return view(); } i created custom validator incomplete. want ask how can force @ least 1 radio button checked ?? public class usworkpermitvalidation : validationattribute { protected override validationresult isvalid(object value, validationcontext validationcontext) { // check @ least 1 radio button checked. } } how values of each radio buttons on custom validator? if know then can checking ??

gpu - Is there is a gradient descent implementation that uses matrix matrix multiplication? -

i'm using below gradient descent implementation in octave ml . i tried first increase number of cpu cores , run octave multithreaded using openblas still didn't results i'm looking for, tried using nvidia's toolkit , tesla k80 gpu i'm loading octave using drop in nvblas following instructions in article: drop-in acceleration of gnu octave when checked nvidia-smi found gpu idle although testing using matrix matrix multiplication yielding ~9 teraflops later came understand matrix vector multiplication used above mentioned implementation not supported per nvblas documentation so question there gradient descent implementation uses matrix matrix multiplication or equivalent can replace gradient descent implementation have?

java - Which File contains the Bytecode Instruction Set of the OpenJDK 8 -

i new openjdk8, want locate file(s) bytecode instruction set present used generate bytecode of source .java file. secondly need basic knowledge of bytecode generation , execution process. i research student , working on openjdk bytecode. can please guide? the question seems conflating/mixing number of different things. if creating new bytecode there's several things need do. specify/define bytecode modify compiler generate bytecode modify runtime understand bytecode the java bytecodes specified in java virtual machine specification . if need define new one, need specify similar degree, though don't have publish there. the part of java sdk responsible taking java source code , producing java bytecode java compiler ( javac ). source code openjdk's javac available here . source code eclipse's java compiler available, don't know where. once have java compiler generating custom bytecode, have teach jvm how interpret it. the openjdk vm (ho

c# - ASP.Net Identity “Invalid token” on password reset with * in password -

we invalid token error messages when user tries reset password on reset password screen after entering new password. works fine special character #. have case puts in * in new password on reset pw screen, gets error message because of special character. i've tried hours of research find solution why happens no luck. i've found this solution here has issue special characters in username don't have issue. there issue special character in password. in production can't disallow character in passwords. someone got clue? generating token controller method: [httppost] [allowanonymous] public async task<actionresult> forgotpassword(forgotpasswordviewmodel model) { if (modelstate.isvalid) { var user = await _usermanager.findbynameasync(model.email.tolower()); if (user == null || !(await _usermanager.isemailconfirmedasync(user.username))) { // don't reveal user not exist or not confirmed return view(&

c - nested loops with pragma omp parallel for, jumbling up -

i trying parallelize code run simulations on spiking neuron network. involves 1 double loop, put statement '#pragma omp parallel for' outside main loop. here's code: int main(void){ int i,j,count[200]; #pragma omp parallel for(i=0;i<200;i++){ count[i] = 0; (j=0;j<200;j++){ if (j!=i){ count[i]++; printf("i: %d j: %d count[i]:%d, count[i]-j:%d\n",i,j,count[i], count[i]-j); } } } return 0; } looking @ results, of values of count[i] exceed 200, though loop goes 1 200. count[i]-j can either 0,1 or -1, values differ widely, thought each thread work on 1 value of i, , count array depends on current value of i. how rewrite code can safely increment count? you must declare j private . can explicitly via: #pragma omp parallel private(j) i implicitly private being loop variable of worksharing loop. count implicitly shared because it defined

i want to get path of selected image from gridview in android ? i'm using recycler for this gridview -

i'm developing app in selected images can upload server @ time...for need path of selected images in array , have pass array upload activity...so images can uploaded server 1 one automatically.... here adapter class package com.akshay.nmiua; import android.content.context; import android.support.v7.widget.recyclerview; import android.util.sparsebooleanarray; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.checkbox; import android.widget.compoundbutton; import android.widget.imageview; import com.bumptech.glide.glide ; import com.technotalkative.multiphotoselect.r; import java.util.arraylist; public class imageadapter extends recyclerview.adapter<imageadapter.myviewholder> { private arraylist<string> mimageslist; private context mcontext; private sparsebooleanarray msparsebooleanarray; public imageadapter(context context, arraylist<string> imagelist) { mcont

tensorflow - 'Model' object has no attribute 'load_model' keras -

i'm trying load model saved with: model.save('mymodel.h5') the model defined this: self.model = vggface(input_tensor=input_tensor, include_top=true) layer in self.model.layers: layer.trainable = false self.model.get_layer('fc7').trainable = true last_layer = self.model.get_layer('fc7').output out = batchnormalization()(last_layer) out = dense(self.n_outputs, activation='softmax', name='fc8')(out) self.model = model(input=self.model.input, output=out) when try load mymodel.h5 model.load_model('mymodel.h5') throws me following error: attributeerror: 'model' object has no attribute 'load_model' i supose it's because i'm not working sequential models. how can load model then? since model.save('mymodel.h5') seems work. thanks!!!! load_model() isn't attribute of model obejct indeed. load_model() function imported keras.models takes file name , returns model obejct.

stanford nlp - Quote Annotator get author -

in following text: john said, "there's elephant outside window." is there simple way figure out quote "there's elephant outside window." belongs john? we've added module handling this. you'll need latest code github. here sample code: package edu.stanford.nlp.examples; import edu.stanford.nlp.coref.*; import edu.stanford.nlp.coref.data.*; import edu.stanford.nlp.ling.coreannotations; import edu.stanford.nlp.util.*; import edu.stanford.nlp.pipeline.*; import java.util.*; public class quoteattributionexample { public static void main(string[] args) { annotation document = new annotation("john said, \"there's elephant outside window.\""); properties props = new properties(); props.setproperty("annotators", "tokenize,ssplit,pos,lemma,ner,entitymentions,quote,quoteattribution"); stanfordcorenlp pipeline = new stanfordcorenlp(props); pipeline.annotate

go - Early or late argument evaluation in golang? -

in program series of sequential checks in manner: var value int if !(parseorfail(inputstrval, &value) && validate(value)) { return someerr } i know validate called if parseorfail returns true, i'm not sure whether in such scenarios updated value. is correct so? or must pass pointer validate ? playground link: https://play.golang.org/p/l6xhbgqjfs the go programming language specification expressions an expression specifies computation of value applying operators , functions operands. operands operands denote elementary values in expression. operand may literal, (possibly qualified) non-blank identifier denoting constant, variable, or function, method expression yielding function, or parenthesized expression. order of evaluation at package level, initialization dependencies determine evaluation order of individual initialization expressions in variable declarations. otherwise, when eval

filter - Filtering excel rows in hidden mode (VB Code) -

i want filter extensive range of rows in excel , copy values without filter running in excel, in vb code without visual action in excel. procedure slow, want more agile alternative: ' xlsheet.range("a1:z100000").autofilter(1, "criteria", , , false) xlsheet.range("c1:f100000").copy() xlsheet2.range("a1").pastespecial(paste:=xlpastetype.xlpastevalues, operation:=xlpastespecialoperation.xlpastespecialoperationnone, skipblanks:=false, transpose:=false) application.cutcopymode = ctype(false, xlcutcopymode) xlsheet.range("a1:z100000").autofilter(false) ' any suggestions? ! i suggest code issue,, sub exception_review() application.screenupdating = false dim filtercriteria dim currentsheetname string dim newfilename string 'get current sheets's name currentsheetname = activesheet.name range("a2:k25").select selection.autofilter selection.autofilter fie

javascript - How to launch bootstrap modal only if one of two options is checked followed by a button submit -

i have standard bootstrap modal http://getbootstrap.com/javascript/ html code : <!-- button trigger modal --> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mymodal"> launch demo modal </button> <!-- modal --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="mymodallabel">modal title</h4> </div> <div class=&quo

Symfony : Issue with routing -

Image
i'm new symfony, follow tutorial, part security , user management i'm stucked problem seems come routing. i created login form working, when go on /app_dev.php/login , form shows up, can fill it, when submit it, got following error : no route found "get /" (from "http://dev-05/antoine/symfony/web/app_dev.php/login") 404 not found - notfoundhttpexception 1 linked exception: resourcenotfoundexception » after getting error, if go on home page, can see connected, it's working, redirection not . according documentation, comes routing might wrongly configured, don't know made mistake. here's form, security.yml , routing.yml files : {% extends "akmuserbundle::layout.html.twig" %} {% block akmuser_body %} {% if error %} <div class="alert alert-danger">{{ error.message }}</div> {% endif %} <form action="{{ path('login_check') }}" method="post"> <label for=&quo

asp.net core - Infinite loop when using disabled attribute binding to a function -

the pre rendering not working when bind "disabled" directive function contains console.log() . <button [disabled]="!isvalid()"></button> my function public isvalid(){ console.log("isvalid"); return true; } from visual studio output console, got : microsoft.aspnetcore.nodeservices: information: isvalid microsoft.aspnetcore.nodeservices: information: isvalid microsoft.aspnetcore.nodeservices: information: isvalid ..... (the same infinite loop message) ............ if remove console.log, pre-rendering works, suppose proccess keep on checking if button isvalid or not. my package versions "angular2-platform-node": "2.1.0-rc.1", "angular2-universal": "2.1.0-rc.1", "angular2-universal-patch": "0.2.1", "angular2-universal-polyfills": "2.1.0-rc.1", "aspnet-prerendering": "2.0.3", microsoft.aspnetcore.spaservices : 1.1.

html - How do I make an image appear on desktops and tablets, but not on phones, using bootstrap? -

i working on small project of mine. it's website booking tours. i'm still in stages, looks like: homepage as can see, each tour has own "div" divided in 3 columns: preview image, short description , button book tour. can add image background, if shrink page size mobile, second div appears above first 1 image in it, this: homepage mobile size i have no idea why occurs. of have idea how make div image disappear on mobile or how solve problem? html , css code provided below, using bootstrap. ps: ignore white-space around button. body { margin: 0px; padding: 0px; } .jumbotron { border-radius: 0px; margin-bottom: 0px; } .options { margin-top: 30px; } .tours { padding: 0px; margin-bottom: 25px; border-radius: 5px; border: 1px solid grey; max-width: 100%; height: 20vh; } .preview-img { height: 100%; } .short-descr { padding-top: 2vh; height: 100%; background-color: red; } .more-info { height: 100%; pad

arrays - How to do a split in java? -

i have done string.split , called first position of array reason of array result appear. code try { string xx = ""; (int = 0; < row; i++) { (int c = 0; c < col; c++) { cell z = s.getcell(c, i); xx = xx + z.getcontents() + "\n"; } xx = xx + "\n"; } //i split here result[0] = information string result[] = xx.split(","); textview.settext(result[0]); } catch (exception e) { } and image of output: description of output try splitting \\\\ . string examplestring = "a\\b\\c\\d"; //escaping "\" character string array[] = examplestring.split("\\\\");

php - Modify Held-Karp TSP algorithm so we do not need to go back to the origin -

i have solve problem had find shortest path link points starting distance matrix. it's traveling salesman problem except not need close path returning starting point. found held-karp algorithm (python) solves tsp computes distances returning starting point. leaves me 3 questions : could @ least 1 situation have different result if modify function not starting point? if answer 1 yes, how alter held_karp() function fit needs? it there no way in 2, should next? i have translated held_karp() function python php, , solution i'd happy use either language. function held_karp($matrix) { $nb_nodes = count($matrix); # maps each subset of nodes cost reach subset, # node passed before reaching subset. # node subsets represented set bits. $c = []; # set transition cost initial state for($k = 1; $k < $nb_nodes; $k++) $c["(".(1 << $k).",$k)"] = [$matrix[0][$k], 0]; # iterate subsets of increasing length , store in

css - trying to center html divs on a page -

Image
i trying center div tags on page (content inside irrelevant). able , page looks great, it's hacked arbitrary margins everywhere things align correctly. can point me simple .css solution pull of page structure looks attached image? you can use plain css without flex or grid layout. here example using bootstrap: <div class="container"> <div class="block row"></div> <div class="clearfix row row2"> <div class="col-sm-6 col"><div class="block"></div></div> <div class="col-sm-6 col"><div class="block"></div></div> </div> <div class="block row"></div> <div class="clearfix row row4"> <div class="col-sm-4 col"><div class="block"></div></div> <div class="col-sm-4 col"><div class="block">&l

c++ - Opening a GStreamer pipeline from OpenCV with VideoWriter -

i capturing , processing video frames opencv, , write them h265 video file. struggling proper gstreamer pipeline work opencv. gstreamer works fine itself. in particular, able run command, encodes video (thanks gpu acceleration) , saves mkv file: gst-launch-1.0 videotestsrc num-buffers=90 ! 'video/x-raw, format=(string)i420, width=(int)640, height=(int)480' ! omxh265enc ! matroskamux ! filesink location=test.mkv now same thing within opencv application. code like: mat img_vid = mat(1024, 1024, cv_8uc3); videowriter video; video.open("appsrc ! autovideoconvert ! omxh265enc ! matroskamux ! filesink location=test.mkv", 0, (double)25, cv::size(1024, 1024), true); if (!video.isopened()) { printf("can't create writer\n"); return -1; } while ( ... ) { // capture frame img_vid => works fine video.write(img_vid); ... } at first sight, seems work, creates file named "appsrc ! autovideoconvert ! omxh265enc ! matroskamux !

python - Tkinter Forgetting Widgets made inside another function -

i want know how forget widget made instead function? code quiet messy. def page2(cur1): label2 = label(root, text="how convert?") entry1 = entry(root) buttonsubmit = button(root, text="submit", command=lambda: get_entry(entry1, cur1)) label2.grid(row=1, columnspan=5) entry1.grid(row=2, sticky="w") buttonsubmit.grid(row=2, column=1) i want able forget these widgets function so: def forget(): label2.grid_forget() entry1.grid_forget() thanks in advance. if find needing lot, should re-structure program using classes . you can move creation of widgets global scope , grid/forget them whenever needed. #create widgets in global scope can reach them in function label2 = label(root, text="how convert?") entry1 = entry(root) def page2(cur1): buttonsubmit = button(root, text="submit", command=lambda: get_entry(entry1, cur1)) label2.grid(row=1, columnspan=5) entry1.grid(row=2, s

c# - Xamarin: How to get a phone number? -

i'm writing test application, on xamarin android. need know phone number. tried lot of options. last: [assembly: xamarin.forms.dependency(typeof(phonenumberservice))] public string getmyphonenumber() { telephonymanager mgr = application.context.getsystemservice(context.telephonyservice) telephonymanager; return mgr.line1number; } assemblyinfo.cs: <`uses-permission android:name="android.permission.read_phone_state"/>` androidmanifest.xml: [assembly: usespermission(android.manifest.permission.readphonestate)] on emulator works on phone not work. returns empty string. how phone number? to solve these problems,this link might you try that: telephonymanager mtelephonymgr; mtelephonymgr = (telephonymanager)getsystemservice(telephonyservice); var number = mtelephonymgr.line1number;

r - Error Deploying Shiny App: Unhandled Exception: Invalid control character -

i have app works on local computer. however, when trying deploy shiny app shinyapps.io, doesn't work. following error: > deployapp() preparing deploy application...done uploading bundle application: 172259...done deploying bundle: 789393 application: 172259 ... waiting task: 373077993 error: parsing manifest ################################ begin task log ################################ ################################# end task log ################################# error: unhandled exception: child task 373077994 error: unhandled exception: invalid control character at: line 1495 column 8 (char 103196) i not sure do. i have tried installing rcpp in question, an error in deploying shiny app shinyapps.io , didn't work. i have 2 other files besides ui.r , server.r in directory, 1 csv file read , 1 r object file (i used save save , load r using load - save time). have tried , without these files in directory , gives same error either way. i have mac , r ve

How to make jenkins job unstable from a bash script? -

in of jenkins jobs, have bash script . in conditions, want make build instable. when exit script code 0, build finish in success (green color) , when exit code job failed (red color). is there way make jenkins job unstable (yellow color) bash script ? if use pipeline plugin , write jobs in groovy pipline dsl, yes: try { sh "yourscript.sh" } catch(exception e) { currentbuild.result = 'unstable' }

php - Decouple user information and authentication information in Symfony -

first off, new symfony, don't know exact functionality of bundles fosuserbundle etc., terminology. i looking way use symfony security component in way enables me decouple user's login credentials (say, login name , password, maybe roles) actual user meta data (like first name, last name, groups, birth date, etc.). the idea user can login different sets of login name/password , still recognized same user (in end means, getting same user object). to me, comes handy in combination multiple authentication providers. example, if wanted enable users login via oauth2 service as alternative logging in locally-hosted login name/password-combination (like stackexchange does, instance), how that? i have read multiple pages of documentation of symfony, e.g.: https://symfony.com/doc/current/security.html https://symfony.com/doc/current/security/entity_provider.html#create-your-user-entity this latter 1 says @ 1) create user entity , password field of user .

pointers - C++ std::array to vector of shared_ptr -

what idiomatic way convert it? std::array<sometype,size> arr; std::vector<shared_ptr<sometype>> vec; // <--- want fill pointers // items in arr second question - possible create shared_ptr objects in stack-allocated array ? pointer targets "freed" once vec destroyed? edit i need this class element { element *next; } class group { std::vector<element*> elems; } int main() { ... std::array<element,10> elems = {...}; std::array<group,4> groups = {...}; // shuffle elems , assign groups; set next-pointers in elems: // group1: &elem10 // group2: &elem8 &elem5 // group3: &elem2 &elem7 &elem3 // group4: &elem4 &elem9 &elem1 &elem6 // @ point: // save or load elems , groups, // preserving pointers elem->elem, group->elem } if want shared_ptr object, should ensure object managed shared_ptr .

python - getting error to save the Matrix in txt file using numpy numpy -

i have written code make array=> import numpy np = np.array([[[1,3],[1,4]],[[1,4],[6,9]]]) np.savetxt('test.txt',a,fmt='%d') and getting error => traceback (most recent call last): file "/usr/local/lib/python3.4/dist-packages/numpy-1.11.2-py3.4-linux-x86_64.egg/numpy/lib/npyio.py", line 1158, in savetxt fh.write(asbytes(format % tuple(row) + newline)) typeerror: %d format: number required, not numpy.ndarray during handling of above exception, exception occurred: traceback (most recent call last): file "", line 1, in file "/usr/local/lib/python3.4/dist-packages/numpy-1.11.2-py3.4-linux-x86_64.egg/numpy/lib/npyio.py", line 1162, in savetxt % (str(x.dtype), format)) typeerror: mismatch between array dtype ('int64') , format specifier ('%d %d') how save array integer in file using numpy? there old thread on problem saving numpy array csv produces typeerror

Unable to start jenkins slave -

when try start jenkins slave, slave exists error: [04/14/17 17:22:06] [ssh] checking java version of java [04/14/17 17:22:06] [ssh] java -version returned 1.7.0_121. [04/14/17 17:22:06] [ssh] starting sftp client. [04/14/17 17:22:06] [ssh] copying latest slave.jar... [04/14/17 17:22:06] [ssh] copied 719,269 bytes. expanded channel window size 4mb [04/14/17 17:22:06] [ssh] starting slave process: cd "/home/jenkins" && java -jar slave.jar -text <===[jenkins remoting capacity]===><===[hudson transmission begins]===channel started slave jvm has not reported exit code. still running? [04/14/17 17:22:11] launch failed - cleaning connection error: connection terminated java.io.eofexception @ java.io.objectinputstream$peekinputstream.readfully(objectinputstream.java:2625) @ java.io.objectinputstream$blockdatainputstream.readshort(objectinputstream.java:3100) @ java.io.objectinputstream.readstreamheader(objectinputstream.java:854) @ java.io.objectinputstream

ruby on rails - Rspec test helper -

i having hard time figuring out how test helper because current_group not defined in test case , not sure how can stub it. module admin module employeeshelper def upload_access policy(current_group).can_bulk_create_employees? end def dashboard_params download_employee_url = upload_access ? download_admin_group_employees_import_csv_index_path(current_group) : nil upload_employee_url = upload_access ? admin_group_employees_import_csv_index_path(current_group) : nil make_hash(upload_employee_url, download_employee_url) end private def make_hash(upload_url, download_url) { employees: @employees, addemployeeurl: new_admin_group_employee_path(current_group), terminated_employees: @terminated_employees, new_employees: @new_employees, test_employees: @test_employees, group_id: current_group.id, downloademployeeurl: download_url, uploademployeeurl: u

java - My program works as intended I am removing a record from a data base and it works except for an Invalid column index exception -

this sql statement. error shows "pstat.setstring(2, rp.getlegaldescription());" private static final string remove_object = "delete res id = ?"; this method removing row. private boolean deletepreparedstatement(residentialproperty rp) { try { /* * (long id, java.lang.string legaldescription, java.lang.string address, java.lang.string quadrant, java.lang.string zone, double askingprice, java.lang.string comments, double area, double bathrooms, int bedrooms, char garage) */ preparedstatement pstat = conn.preparestatement(remove_object); pstat.setlong(1, rp.getid()); pstat.setstring(2, rp.getlegaldescription()); pstat.setstring(3, rp.getaddress()); pstat.setstring(4, rp.getquadrant()); pstat.setstring(5, rp.getzone()); pstat.setdouble(6, rp.getaskingprice()); pstat.setstring(7, rp.getcomments()); pstat.setdouble(8, rp.getarea()); pstat.setdoubl

How to display a table of images in R output in a Jupyter notebook? -

how take list of image urls, , display them in html table in jupyter notebook r kernel? here's list of urls: image_urls = c('https://i.stack.imgur.com/wdqnm.jpg', 'https://i.stack.imgur.com/8oysp.jpg') here's code display 1 image image_url : library(jpeg) library(rcurl) img <- rcurl::getbinaryurl(image_url) jj <- jpeg::readjpeg(img,native=true) plot(0:1,0:1,type="n",ann=false,axes=false) rasterimage(jj,0,0,1,1) edit : way think of is, there functionality ipython's display ? looks there might in https://github.com/irkernel/repr . have read more. i’m maintainer of irkernel-related projects. irdisplay package you’re searching for, display_jpeg : library(irdisplay) display_jpeg(file = 'filename.jpg') sadly file parameter doesn’t work urls (yet), have manually pass data it: jpeg_data <- rcurl::getbinaryurl(image_url) display_jpeg(jpeg_data)

javascript - Copying text from one google Doc, to another active google Doc -

i have body of text in master document(google doc) located in admin folder, copy active google doc working on (that blank, if helps). i quite new @ js, , have been trying use getfilebyid(fileid).makecopy, struggling. any pointers tutorials should @ or how go doing of great help. thank you! open script.google.com document: tools -> script editor use function: function textcopy() { var doc = documentapp.openbyid('id_of_doc_to_be_copied').gettext(); var body = documentapp.getactivedocument().getbody(); var text = body.editastext(); // insert text @ beginning of document. text.inserttext(0, doc); } run it. permissions asked, sure allow it. more info doc text manipulation can found in class text .

css - Safari giving precedence to installed font -

some of designers working @ workplace noticed on safari font of our website appeared 1 installed on machine , not 1 serving. we noticed in 2 different occasions , 2 different fonts: montserrat , open sans. the first time (with montserrat) user had newer version of font, , saw newest on safari, because had installed on local machine (this wasn't happening on chrome). the second time (with open sans) saw bolder font on particular machine: discovered on machine user had installed bolder weight (700) 1 serving (600). , rule font-weight: bold; so suppose browser picked boldest (700) installed fonts. i did research didn't find evidence of this. know if there evidence/documentation on safari giving precedence installed fonts instead of ones serving? we not using google fonts google's cdn, decided download them , serve them our own server. edit: i'm adding code use load font (generated using google webfonts helper ): @font-face { font-family: 'open s

java - Use KeyListener in a loop -

i don't have lot of experience keylisteners used 1 in application , works fine except need wait input before program can continue. made while loop loops until string temp not null (which mean there input). the problem there no way type in jtextfield (called input). below code 2 methods supposed work text in jtextfield (input) can returned (as temp). i'm not sure why doesn't work or how fix it. the keypressed method keylistener: public void keypressed(keyevent e) { //only sends text if enter key pressed if (e.getkeycode()==keyevent.vk_enter) { //if there text if (!input.gettext().equals("")) { //string temp changed null input temp=input.gettext(); //text sent jtextfield output.append(temp+"\n"); //input no longer has text input.settext(""); } } } the method thats trying text, in keylistener class public string ge

Excel: Determining which argument to MAX() was the maximum -

is there way check argument in =max(1,3,2) maximum? example should return 2 (or 1 if index starts @ 0). i have different sources of data , display 1 selected. thanks! bernhard you use: =match(max(c37*2,b23*4,d4),choose({1,2,3},c37*2,b23*4,d4),0) if 1 or more of 3 expressions being passed max in reality quite lengthy and/or resource-heavy, may worth avoiding repetition, e.g.: =match(1,0/frequency(0,1/(1+choose({1,2,3},c37*2,b23*4,d4)))) though should note latter valid if results of 3 expressions being passed max non-negative. regards

objective c - iOS: NSLogger not writing to file on disk -

i'm trying implement nslogger framework framework. add nslogger project , configure project. here implementation: #import "appdelegate.h" #import <nslogger/nslogger.h> @interface appdelegate () @end @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { nsurl *pathdirectory = [[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; cfstringref path = (__bridge cfstringref)[pathdirectory.path stringbyappendingstring:@"/logs.txt"]; logger *logger = loggerinit(); loggersetoptions(logger,kloggeroption_bufferlogsuntilconnection | kloggeroption_capturesystemconsole | kloggeroption_browsebonjour | kloggeroption_browseonlylocaldomain); loggersetupbonjour(logger, null, null);

python - Segmentation fault when training SpaCy NER model -

when trained spacy own annotations, randomly crash python probability. training data 50000 records , each of them unicode text , ner annotations. nlp = spacy.load('en', entity=false, parser=false) ner = entityrecognizer(nlp.vocab, entity_types=entity_types) itn in range(5): random.shuffle(train_data) raw_text, entity_offsets in train_data: doc = nlp.make_doc(raw_text) gold = goldparse(doc, entities=entity_offsets) nlp.tagger(doc) ner.update(doc, gold) ner.model.end_training() return ner the error message like: enter image description here

javascript - Twitter exclude_replies=true count=5 not returning 5 tweets -

how return specific number of tweets without replies? https://github.com/thujohn/twitter/issues/4 i found answer on github not helpful @ all. should make request api in while loop until 5 tweets? really? thank help. these params: const params = { lang: 'en', count: 5, // want 5 tweets user_id: 12312312, screen_name: 'somescreenname', tweet_mode: 'extended', // need media exclude_replies: true, // not want replies include_rts: 1, // want retweets user } in twitter api timeline requests, example user timeline , replies removed after count tweets selected. using exclude_replies count parameter mean receive up-to count tweets — because count parameter retrieves many tweets before filtering out retweets , replies. i suggest use larger count (upto 200 allowed) , select first 5 tweets response.

c# - Most efficient way to populate DropDownLists in a GridView? -

i've got code, , works. takes forever . ok, maybe 40 seconds, that's forever in online application. protected void datagrid_open_rowdatabound(object sender, gridviewroweventargs e) { oracleconnection conn = getconnection(); try { if (e.row.rowtype == datacontrolrowtype.datarow) { datarowview drv = e.row.dataitem datarowview; //********************************************** //************* auditor names **************** //********************************************** oraclecommand cmd4 = new oraclecommand(); cmd4.commandtype = commandtype.storedprocedure; cmd4.commandtext = "cstapp_o.cst_amr_auditornames"; cmd4.connection = conn; cmd4.parameters.add("cursor_", oracletype.cursor).direction = parameterdirection.output; var searchadapter4 = new oracledataadapter(cmd4); var ds4 = new datatab