Posts

Showing posts from February, 2015

swift - How to add fields to existing records in CloudKit -

i have function input users name new recordname in cloudkit (shown below), need add users 'score' same record. is there way insert field "usersscore" referencing unique 'recordname' value? /// insert new entry db. func insertname(nameentry: string) -> ckrecordid { // connects user database table. let usertable = ckrecord(recordtype: "user") // connects database public container. let publicdata = ckcontainer.default().publicclouddatabase // adds users entry "name" field. usertable["name"] = nameentry nsstring // if record has saved or error has occurred. publicdata.save(usertable) { (record, error) in if let saveerror = error { //error. print("an error occurred in \(saveerror)") }else { // success. print("saved record!") } } // recordname (id) of current user. recordnameid = usertabl

java - Display Hindi Characters on android App -

i have created document in hindi language using google indic keyboard ( not sure font characters in) i want create property files various language , want display content is. suppose have following file hindi.properties kabir=समाज सुधारक english.properties kabir=socoal activist now want display these texts irrespective of font whether installed or not. i got answers on stackoverflow setting hindi font - textview.settypeface(typeface.createfromasset(getassets(),"fonts/hindi.ttf")); but donesn't work me don't know font google indic keyboard uses. anyway looking generic solution not require fonts. for hindi make new folder inside res – values-hi/strings.xml put hindi content in , default values/string.xml support english language. call changelocale(lang) method whenever want change language for hindi changelocale("hi");//change locale on selection basis for english changelocale("en");//change locale on selecti

ionic framework - How to use the timeout() in angular 2 -

am setting timeout in code keep getting error: typescript error property 'timeout' not exist on type 'observable'. how can solve this? in advance. this code: this.http.post(this.global.api_url + '/cancel_order', {id: product._id}) .timeout(10000) .map(res => res.json()) .subscribe((data) => { if (data.result.id != null && data.result.rev != null && data.result.ok == true && data.status == 201) { this.global.toast("order canceled", "toast-error"); let del_data = [{_id: product._id, _rev: product._rev}]; this.orders.delcart(del_data); loader_send_1.dismiss(); this.ngoninit(); } else { this.global.toast("failed cancel order", "toast-error"); loader_send_1.dismiss(); } you either add import 'rxjs/add/operator/timeout' or you use standard javascrip

Which is the correct command to update all anaconda python packages? -

i using python anaconda. confused correct command update anaconda packages latest version. there seems 2 commands can used; $ conda update --all or $ conda update anaconda after running latter, anaconda upgraded ver4.4. subsequently, run former asked if wanted downgrade packages. confused me. correct command use? the anaconda package "meta"-package, means doesn't contain packages itself, merely sets specific version of number of packages continuum include "anaconda distribution". therefore, when type conda update anaconda you telling conda update recent version of anaconda package, , install dependencies specific versions specified in anaconda package. has advantage continuum have tested packages , making assurance there won't conflicts. when type conda update --all conda uses internal algorithm try , resolve versions of dependencies. i'm not sure of details, may result in packages being upgraded, others being downgraded

python - How to use join with many conditions in pyspark? -

i able use dataframe join statement single on condition ( in pyspark) but, if try add multiple conditions, failing. code : summary2 = summary.join(county_prop, ["category_id", "bucket"], how = "leftouter"). the above code works. if add other condition list like, summary.bucket == 9 or something, fails. please me fix issue. error statement summary2 = summary.join(county_prop, ["category_id", (summary.bucket)==9], how = "leftouter") error : typeerror: 'column' object not callable edit : adding full working example. schema = structtype([structfield("category", stringtype()), structfield("category_id", stringtype()), structfield("bucket", stringtype()), structfield("prop_count", stringtype()), structfield("event_count", stringtype()), structfield("accum_prop_count",stringtype())]) bucket_summary = sqlcontext.createdataframe([],schema)

javascript - Access to ES6 array element index inside for-of loop -

we can access array elements using for-of loop: for (const j of [1, 2, 3, 4, 5]) { console.log(j); } how can modify code access current index too? want achieve using for-of syntax, not foreach or for-in. use array.prototype.keys : for (const index of [1, 2, 3, 4, 5].keys()) { console.log(index); } if want access both key , value, can use array.prototype.entries() destructuring : for (const [index, value] of [1, 2, 3, 4, 5].entries()) { console.log(index, value); } wiki

lumen/laravel Eloquent hasManyThrough 3 models relation -

i try acomplish relation 3 models: cities.php //table cities id name neighbourhoods.php //table neighbourhoods id name city_id blocks.php //table blocks id name neighbourhood_id my models looks this: cities.php public function neighbourhoods() { return $this->hasmanythrough('app\neighbourhoods', 'app\blocks', 'neighbourhood_id', 'city_id', 'id'); } neighbourhoods.php public function blocks() { return $this->hasmany('app\blocks', 'neighbourhood_id', 'id'); } blocks.php public function neighbourhoods() { return $this->belongstomany('app\neighbourhoods', 'neighbourhood_id', 'id'); } the result shoud be: results city1: neighbourhoods: neighbourhood1: block1 block2 block3 neighbourhood2 block1 block2 city2: neighbourhoods: neighbourhood1: blocks: block1 block2 block3 neighbourhood2: blocks: bloc

html - Offsetting columns in Bootstrap v4 -

this question has answer here: offsetting columns not working (bootstrap v4.0.0-beta) 2 answers what used be: <div class="row"> <div class="col-sm-2 col-sm-offset-3"> ... </div> </div> became: <div class="row"> <div class="col-xs-2 offset-xs-3"> ... </div> </div> in bootstrap v4 alpha. now, i've updated website v4 beta offset-xs-3 doesn't seem working anymore: https://getbootstrap.com/docs/4.0/layout/grid/#offsetting-columns . how offset specified amount of columns in v4 beta? https://codepen.io/deka87/pen/prvlye i know not pretty, since bootstrap v4-beta took offsetting number out of game, can add empty column before , making many columns want offset next one. [class*="col-"] { background-color: #eee; } .row { background-c

objective c - FCM Notification Method is not called in background mode -

Image
i have made 1 sample demo push notification fcm. able received notification in ground mode foreground mode. question is:- when application in background mode notification received not called single method can action. i agreed when have clicked on method call 1 method not in background. method have used - (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo fetchcompletionhandler:(void (^)(uibackgroundfetchresult))completionhandler { } - (void)usernotificationcenter:(unusernotificationcenter *)center willpresentnotification:(unnotification *)notification withcompletionhandler:(void (^)(unnotificationpresentationoptions options))completionhandler { } please me guys got stuck.i need in advance. have read many links not able solved problem. note:- please keep in mind have used google clouding messaging:- fcm i have used in objective c as per our discussion in comments under question. here few more things done a

ruby - Calculate number of significant digits -

i need convert floating point number 5-significant digits format. means 5 first non-zero digits (with last digit not rounded up). example float("%.#{5}g" % 0.007425742694) => 0.0074257 float("%.#{5}g" % 3852.574257425742694) => 3852.6 the problem approach me 3852.574257425742694 rounded 3852.6, , need 3852.5. i understand numbers non-negative. 1 can following: code def floor_it(f, sig_digits=5) pow = sprintf("%e", f)[-3..-1].to_i (f *= 10**(-pow)).floor(sig_digits-1) * 10**(pow) end examples floor_it 0.007425742694 #=> 0.0074257 floor_it 3852.574257425742694 #=> 3852.5 explanation for f = 385.74957425742694 sig_digits = 5 the steps follows. first express number in scientific notation (as string). see kernel#sprintf . a = sprintf("%e", f) #=> "3.857496e+02" we wish extract last 2 digits. b = a[-3..-1] #=> "02" convert integer. pow = b.to_i #=>

solr - SolrCloud Indexing issue -

we facing 1 indexing issue in solr cloud. solr version: 6.3.0 solr cloud configuration: 3 node zookeeper 3 solr instance. 1 collection 3 shards , 2 replicas. indexing 10000 document indexed docs shard1=3393, shard2=3351, shard3=3256 testing: down leader replica when indexing running. connection refuse exception generated continuously in sendupdatestream method of class concurrentupdatesolrclient in log. display 10000 records indexed, while execute docs ( : ) query, solr return 6607 documents other 3393 documents not return in result. example: gave dataimport command machine1:8091, machine1:8091 solr instance responsible document routing have indexed of document in local index , of them send dedicated shards. suppose down machine2:8092 solr instance, contains 1 leader replica of shard1.so select machine3:8093 leader replica. data import screen display 10000 documents indexed/processed. while searching 6607 document indexed. , while searching in shard1 0 documents index

java - Get form's multiple inputs with the same name in spring mvc -

i have input fields in jsp page, , fields can dynamically created or removed. have map input fields spring mvc's @modelattributes. not know how map input fields. i want submit form composed of: <form enctype="multipart/form-data"> <!-- code omitted --> <div> <input type="text" name="content"> <input type="file" name="file"> </div> <div> <input type="text" name="content"> <input type="file" name="file"> </div> <div> <input type="text" name="content"> <input type="file" name="file"> </div> </form> and fields should guided java classe(@modelattribute): package com.musicovery12.cookingstep.web.command; import java.util.arrays; import java.util.list; public class addrecipecommand

ios - App too big? Crashlytics: Archive Distribution Error: -3 (413) -

i've trying upload new version of ios app beta (crashlytics) fabric app on mac i'm getting next error: crashlytics: archive distribution error: -3 not upload distribution. operation couldn't completed. (http error 413.) http error 413 says request entity large. app has size of 1.6 gb. knows max size can upload beta? is there way upload big apps without getting error? todd fabric here. limit determined connection speed hard limit not publicly disclose. recommend stay under 400mb. is, app above our maximum limit. wiki

javascript - Adding fade function to JS script? -

so have basic script alternates between 3 images , i'd add simple fadein/fadeout/fadeto or whatever looks best it's not clunky. how can achieve this? or, there better way? function displaynextimage() { x = (x === images.length - 1) ? 0 : x + 1; document.getelementbyid("img").src = images[x]; } function displaypreviousimage() { x = (x <= 0) ? images.length - 1 : x - 1; document.getelementbyid("img").src = images[x]; } function starttimer() { setinterval(displaynextimage, 3000); } var images = [], x = -1; images[0] = "assets/img/logo1.png"; images[1] = "assets/img/logo2.png"; images[2] = "assets/img/logo3.png"; you can set opacity of images before change src: function displaynextimage() { x = (x === images.length - 1) ? 0 : x + 1; var imgvar = document.getelementbyid("img"); imgvar.classlist.add("fadeout"); settimeout(function()

node.js - how to run script in brackets extension package.json? -

i want run script in brackets extension manager when install extension. found code in brackets default extension 'javascriptcodehints'. { "name": "brackets-javascript-code-hints", "dependencies": { "acorn": "3.3.0", "tern": "0.20.0" }, "scripts": { "postinstall": "node ./fix-acorn" } } same using "postinstall": "node ./test", displayed error message. npm-stderr: sh: node: command not found npm warn testextensioninstaller@1.0.1 no description npm warn testextensioninstaller@1.0.1 no repository field. npm warn testextensioninstaller@1.0.1 no license field. npm err! darwin 16.7.0 npm err! argv "/applications/brackets.app/contents/macos/brackets-node" "/applications/brackets.app/contents/www/node_modules/npm/bin/npm-cli.js" "install" "--production" npm err! node v6.3.1 npm err! npm v3.10.9 n

In Azure, how to deploy to production slot using Visual Studio? -

Image
i'm trying learn how deploy web application azure using visual studio 2015. deploy simple web application (without creating slot). moved arm portal , found there isn't slot. however, when try swap, can see "production" option in source & destination drop down lists. i created slot , tried publish web application again, see 1 slot, newly created slot (please see screen shot) i'm bit confused. according understanding, there should default slot can deploy , swap to/from it. any ideas? as far know, "testwithdb20170822062605" application default application. directly select web app. if publish application this. regard production app. if select testwithdbslot2, publish application newly created slot. firstly, if select "testwithdb20170822062605" application, vs publish application testwithdb20170822062605.azurewebsites.net. this according url not slot or else. but if swap web app. it testwithdb20170822062605.a

Convert the code in twig from PHP -

i have tried convert templates plain php twig code , i'm not sure looking @ code how write following examples out in twig code. can point me in right direction? my following php code. <?php } if ($body_font != '' ) { $fontpre = $body_font; $font = str_replace("+", " ", $fontpre); ?> body {font-family:<?php echo $font ?>;} <?php } ?> i have tried following in twig. {% if body_font != '' %} {% set fontpre = 'body_font' %} {% set font = fontpre|replace("+", " ") %} body {font-family:{{ font }}; } {% endif %} but, doesn't work. can please help? do wrong here? the replace filter different php function str_replace . accepts mapping keys strings should replaced values: {% set font = fontpre|replace({"+": " "}) %} wiki

android - Does Hockeyapp sends log when app is running as service (no Activity)? -

is hockeyapp able send logs correctly in context of android 6 network restrictions? i tracking device location using fusedlocationproviderapi , pendingintent , there no activity created. android 6 , app restricts network access when app not running in foreground. also, app runs battery optimization turned off. wiki

python 3.x - How to run python3 on google's dataproc pyspark -

i want run pyspark job through google cloud platform dataproc, can't figure out how setup pyspark run python3 instead of 2.7 default. the best i've been able find adding these initialization commands however, when ssh cluster then (a) python command still python2, (b) job fails due python 2 incompatibility. i've tried uninstalling python2 , aliasing alias python='python3' in init.sh script, alas, no success. alias doesn't seem stick. i create cluster this cluster_config = { "projectid": self.project_id, "clustername": cluster_name, "config": { "gceclusterconfig": gce_cluster_config, "masterconfig": master_config, "workerconfig": worker_config, "initializationactions": [ [{ "executablefile": executable_file_uri, "executiontimeout": execution_timeout, }] ], }

c - How can I save a structure which contains allocated memory to file? -

// headers struct address{ int id; char *name; char *email; }; struct database{ struct address *rows; int max_size; int max_data; }; struct connection{ file *file; struct database *db; }; int main(int argc, char *argv[]){ int i; struct connection *conn; conn->file = fopen(argv[3], "w+"); conn->db->max_size = atoi(argv[1]); conn->db->max_data = atoi(argv[2]); conn->db->rows = malloc(sizeof(struct address) * (db->max_size)); for(i=0; i<db->max_size; i++){ struct address adr = {.id = i}; adr.name = malloc(conn->db->max_data); adr.email = malloc(conn->db->max_data); conn->db->rows[i] = addr; } /* other code(s) here * * */ } now, according these snipped code, how can save conn->db structure conn->file contents? after that, must able read file, again. i can't use stack type structure, because " max_data " , " max_size " typed us

tinymce - Post content not showing in the edit post textarea. (Wordpress) -

i’m building plugin requires me remove tinymce editor , replace text area. the following code helps me remove tinymce editor admin area: function wpdocs_remove_post_type_support() { remove_post_type_support( 'post', 'editor' ); } add_action('init' ,'wpdocs_remove_post_type_support' ); then add own textarea following code: function myprefix_edit_form_advanced() { require('texteditor.html'); } add_action( 'edit_form_after_title', 'myprefix_edit_form_advanced' ); my texteditor.html looks this: <html> <head> </head> <body> <div> <textarea id="text" name="post_content" data-placeholder="start writing..."> </textarea> </div> </body> </html> after above code, able save content using textarea when got edit post area, no post content showing in textarea field. question is, there function can call make sur

apache - 411 error during http post request in java -

i'am facing 411 error during http post request here code. unable find made mistake.i have set content-length though giving same error. public map<string, string> getaccesstokens(string yahclientid, string yahclientsceret, string yahredirecturl, string authorizationcode) { map<string, string> accesstokens = new hashmap(); string url = "https://api.login.yahoo.com/oauth2/get_token"; final string authinfo = yahclientid + ":" + yahclientsceret; byte[] encodedbytes = base64.decodebase64(authinfo.getbytes()); string postdata = "grant_type=authorization_code&redirect_uri=" + yahredirecturl + "&code=" + authorizationcode; byte[] ascii = postdata.getbytes(standardcharsets.utf_8); try{ httpsurlconnection uc = null; inputstream = null; outputstream osw = null; url u = new url(url); uc = (httpsurlconnection) u.openconnection(); uc.setdoinput(true); uc.setrequestmethod(&quo

java - Google Guice Assisted Inject object is null -

i need create objects user defined data @ runtime.to have used google guice assisted inject.but when run test throws null pointer exception.please let me know made mistake. iartifacts interface public interface iartifacts { mavenmetadataxmldto getartifactsversions(); } artifactsservice.java public class artifactsservice implements iartifacts { private productprofile productprofile; @inject public artifactsservice(@assisted productprofile productprofile){ system.out.println(productprofile.getartifactmanagementurl()); this.productprofile=productprofile; } @override public mavenmetadataxmldto getartifactsversions() { system.out.println(productprofile.getartifactmanagementurl()); return null; } } artifactsfactory interface public interface artifactsfactory { iartifacts create(productprofile productprofile); } module class @override protected void configure() { install(new factorymoduleb

Change order of keys/properties of an object in a function in javascript? -

this question has answer here: does javascript guarantee object property order? 8 answers i trying change order of properties or keys of object according definition. find although changes remain within function, reverted outside. wrote simple code show this: function changeorder(obj) { let keys = object.keys(obj); let reversedobj = new object; (let key = keys.length; key >0; key--) { reversedobj[keys[key-1]] = obj[keys[key - 1]]; } console.log("revered object: "); console.log(reversedobj) obj = reversedobj; console.log("reversing original object: ");console.log(obj) } = { u: { x: 1, y: 2}, v : { x: 3, y: 4} } changeorder(a); console.log("original object outside function: "); console.log(a) this result get: revered object: object { v: object, u: object } reversing original object: o

typescript - Dynamic Component Click event Binding - Angular 2 -

Image
there chance of possible duplicate scenario bit different. i want perform click event dynamic component. here structure : <razor> <mvc-partial> <dynamic-html> // buttonpress(){console.log("function called in dynamichtml) // output() call function in razor.ts </dynamic-html> </mvc-partial> <razor> renderingviewdynamic.ts file import { component, directive, ngmodule, input, output, eventemitter, viewcontainerref, compiler, componentfactory, modulewithcomponentfactories, componentref, reflectiveinjector, oninit, ondestroy, viewchild } '@angular/core'; import { routermodule } '@angular/router'; import { commonmodule } '@angular/common'; import { http } "@angular/http"; import 'rxjs/add/operator/map'; export function createcomponentfactory(compiler: compiler, metadat

c++ - Using inner class with CRTP -

is there possibility use inner class or enum crtp? ex. template<typename container> struct containerbase { std::map<typename container::enum, int> _; }; struct concretecontainer : containerbase<concretecontainer> { enum class enum { left, right }; }; no. within class template derived class isn't defined yet (that's not complete object in standardese ). in fact (working draft): a class considered completely-defined object type (or complete type) @ closing } therefore cannot expect able access 1 of members or whatever declared in derived class within class template. you can work around passing enum separately, requires define enum somewhere else (another base class? outer scope? whatever...). can work around using traits classes. , on. there several alternatives that, cannot access directly enum defined in derived class. here example of viable solution: #include <map> template<typename>

chatbot - How can I show a dynamic welcome message using Amazon lex bot? -

i developing chatbot using amazon lex. going integrated facebook messenger in facebook page. when user opens bot first time, says nothing. listens user intents. bot initiate conversation , provide user few options(configured in mysql database in backend). best way this? there get_started event can subscribe fb messenger see docs when triggered, hit db whatever response appropriate based on context have event, , in db. wiki

permissions - docker container unable to create directory in volume -

i installed docker on raspberry pi. created docker group , added current user (pi) in new group don't have sudo my docker commands a volume want use created docker volume create appdemaon_config created in /var/lib/docker/volumes/appdaemon_config/_data (root:root perms created default) then when start container docker run --rm --name=appdaemon -v appdaemon_config:/conf -p 5050:5050\ -e ha_url="http://192.168.1.105:8123"\ -e ash_url="http://$hostname:5050" 76d1dca80fdad` (i tried docker run sudo, same result) the script executed in container supposed create 2 directories in conf dir (which mounted volume) throws permission error. i'm not allowed ls the volume pi user, have sudo. what missing perms or perms execution of docker container ? wiki

ios - How to test a method with XCTestCase in Objective C which does not return a value -

i practicing unit test cases in xcode. have method in controller class has lines of code method not return value. confusion how can write test case function type of method. below method need write test case function. can please me understand how this? in advance. _bool isvalid = true; _struseremailedited = @"abc@test.com"; _strpasswordedited = @"123456789"; if ([_strpasswordedited isequaltostring:@""] || [_struseremailedited isequaltostring:@""]){ if ([_strpasswordedited isequaltostring:@""]) { _lblerrorpassword.text = @"password required."; }else{ _lblerroremail.text = @"email required."; } isvalid = false; } if ([_strpasswordedited isequaltostring:@""] && [_struseremailedited isequaltostring:@""]){ nslog(@"please,enter values"); _lblerrorpassword.text = @"password required."; _lblerroremail.text = @"email r

Python: How can I use input to receive a function to integrate from the user in scipy? -

it program calculates continuous uniform distribution. example enter x^2, = 0, b = 1. program evaluate x^2 0 1. coefficient 1/(b-a) part of rules of continuous uniform distribution. formula = input( "what formula? use x variables.") = input("what value of a?") b = input("what value of b?") formula = formula.replace("^", "**") coefficient = 1 / (float(b) - float(a)) coefficient = float(coefficient) ans,err = quad(formula, a, b) print(ans * coefficient) it telling me can't convert formula string float. problem formula string has variable 'x' in it. if float(formula) gives me error can't convert string float. there way around this? if understand correctly, user able input formula using variables a , b . example be: formula = 'a*b' , a = 3 , b = 5 , yield 15 . perhaps use python exec(string) method execute code given in formula. wiki

javascript - how to make tooltip using displaytag -

so our project using displaytag on frontend display our tables , such. <display:table id="xxx" style="width:100%; border-bottom: 0; border-right: 0; border-left: 0;" name="ref_results" defaultsort="2" defaultorder="ascending" requesturi="flow.action?_flowexecutionkey=${flowexecutionkey}" excludedparams="*" export="true" sort="list"> .... <span class="tooltip"><display:column property="status" title="status" style="width:7%" sortable="true" sortproperty="status" sortname="status" media="html csv excel xml pdf"><span class="tooltiptext">this tooltip text displayed when hovering on column<span> regardless of how wrap display:column tooltip , tooltiptext classes (whether labe

Oracle SQL syntax issue -

i trying come oracle view , ok first part see below. (only pasting part of syntax here ease). issue , in order sales manger info, have extract cust_knvp table there sql syntax using. problem combine both these syntax below one. can please guide me on this. see tables deliver , orders appear in both syntax. thanks ** /*main view sql syntax*/ select d.gate_entry_date k.account_exec_name, o.load_start_date, o.local_end_date, d.local_arrival_date, p.freight, d.actual_gate_entry_date, m.shipm_start, m.shipment_end deliver d, ship_pickup_date o, key_customer k, reel_date m, orders p, d.item = m.order_item , d.sold_to = k.sold_to , d.shipment_number = o.ship_id , d.sales_doc = p.sales_doc , d.item = p.item /* sql syntax sales manager below, need combine both final product.*/ select sales_manager ( select distinct d.sold_to, p.sales_district, d.sales_office, d.sales_rep deliver d, orders p

themes - Unity3d Sprite change with prefabs -

ive question how change spirte images during runtime bunch of objects. so made tiny racer 2d game, , therefore can choose differend themes. have option in integraded menu (not seperate scene). my question: can switch sprites easy during runtime? ive made prefabs each track element - , changed sprites of prefabs, change gets visible, after scene reloaded. need avoid this. has solution or hint how that? thanks in advance! code: public class background_controller : monobehaviour { public camera maincamera; public color colornormal; public gameobject[] prefabs; public sprite[] normalsprites; public sprite[] tronsprites; // use initialization void awake () { switchbackgroundfunction(); } public void switchbackground(string theme) { switch(theme) { case "greenhell": playerprefs.setstring("theme", "normal"); break; case "neoncity": playerprefs.setstring("th

kubernetes - Accessing Service which is located in another namespace in OpenShift -

i using openshift paas implementation. and, facing below error while trying access service in namespace. "503 service unavailable, no server available handle request" below sample setup have tried: have 2 namespace called defaulta , defaultb. in defaulta namespace, have service named servicea,serviceab , route named routea , routeab. in defaultb namespace, have service named serviceb , route named routeb . serviceab in defaulta namespace externalname type service mapped serviceb (defaultb namespace) below name serviceb.defaultb.svc.cluster.local when test routeb in browser, getting expected web page. but, when test routeab mapped serviceb indirectly (through serviceab), getting ""503 service unavailable, no server available handle request" error. please share thoughts or ideas fix issue , please let me know if need more information side. wiki

python 2.7 - Clarify tag distinction in Python2.7, NLP Chapter5 -

i started learn python know more nlp. using steven bird's online book. in chapter 5, >>>wsj = nltk.corpus.treebank.tagged_words(tagset='universal') >>>word_tag_fd = nltk.freqdist(wsj) [wt[0] (wt, _) in word_tag_fd.most_common() if wt[1] == 'verb'] ['is', 'said', 'are', 'was', 'be', 'has', 'have', 'will', 'says', 'would', 'were', 'had', 'been', 'could', "'s", 'can', 'do', 'say', 'make', 'may', 'did', 'rose', 'made', 'does', 'expected', 'buy', 'take', 'get', 'might', 'sell', 'added', 'sold', 'help', 'including', 'should', 'reported', ...] >>>cfd1 = nltk.conditionalfreqdist(wsj) >>> cfd1['yield'].most_common() [('verb',

javascript - Phonegap-contact plugin. How to pick a contact number and show it in the input field? -

i have hybrid application based on phone-gap have pick 1 contact native contact api , show number in input field. i using following function: pickcontact: function() { navigator.contacts.pickcontact(function(contact) { alert('the following contact has been selected:' + json.stringify(contact)); }, function(err) { alert('error: ' + err); }); } problems: how show phone number in input field? when 1 contact has multiple numbers, how show numbers while selecting , select 1 particular number on click? wiki

itext - Itexpdf PdfContentByte special character -

i'm using itextpdf 5. how can add special characters document via pdfcontentbyte ? there code : public void addflag(pdfwriter writer, basefont basefont, font font) { string mytext = "my flag : \u2691"; pdfcontentbyte cb = writer.getdirectcontent(); cb.setfontandsize(basefont, font.getsize()); cb.begintext(); cb.showtextaligned(element.align_left, mytext, 10, 50, 0f); cb.endtext(); cb.stroke(); } wiki

ios - How to Debug Universal Link from App installed from Xcode -

i'm trying test universal links opens app doesn't link right screen. app installed xcode doesn't work @ all, 1 installed store makes impossible debug break points. how can make universal link work app installed xcode on device can debug it? here how did it. debugging procedure found out if app installed xcode , testflight 1 able test universal links, couldn't when installed app device xcode. archived app , exported testflight after had added alert show @ points in code. installing app testflight able test why universal link opened app didn't go specific screen. don't know if there easier way this. , might useful to, here found: code written in objective-c , discovered this if ([useractivity.activitytype isequaltostring:nsuseractivitytypebrowsingweb]) { // stuffs } is somehow not same if (useractivity.activitytype == nsuseractivitytypebrowsingweb) { // stuffs } in objective-c. wiki

java - Convert an loop (while and for) to stream -

i have started working java 8 , trying convert loops , old syntax in code lambdas , streams. so example, i'm trying convert while , loop stream, i'm not getting right: list<string> list = new arraylist<>(); if (!oldlist.isempty()) {// old list<string> iterator<string> itr = oldlist.iterator(); while (itr.hasnext()) { string line = (string) itr.next(); (map.entry<string, string> entry : map.entryset()) { if (line.startswith(entry.getkey())) { string newline = line.replace(entry.getkey(),entry.getvalue()); list.add(newline); } } } } i wanted know if it's possible convert above example single stream there while loop inside of loop. as stated above, using streams here doesn't add value since makes code harder read/understand. you're doing more learning exercise. being said, doing more functional-style approach doesn't have side effect

java - Parse exception when overriding annotation sequence generator with generic generator in orm file -

i have entity mapped jpa annotations , sequence generator. it's external component don't have permission change, so, tried change using orm.xml file. when put 'generic-generator' tag, have parse exception. here entity @id @sequencegenerator(name = "name", sequencename = "seq", allocationsize = 1) @generatedvalue(strategy = generationtype.sequence, generator = "name") @column(name = "seq") private long id; this entity mapped in orm.xml file <entity class="entity" > <table name="test"/> <attributes> <id name="ido"> <column name="seq" /> <generated-value generator="teste"/> <generic-generator name="teste" strategy="org.hibernate.id.sequencegenerator"/> </id> </attributes>

haskell - Why can I use pure function to convert to applicative -

i have following type definition: data hello b = hi | sali b deriving (show, eq) and isn't instance of applicative can still use pure convert applicative why? *exercisestraversable data.monoid control.applicative> :t pure $ hi 34 pure $ hi 34 :: (num a, applicative f) => f (hello b) *exercisestraversable data.monoid control.applicative> pure $ hi 34 hi 34 and when try: *exercisestraversable data.monoid control.applicative> (sali (*2)) <*> (sali 4) <interactive>:23:1: error: * non type-variable argument in constraint: applicative (hello a) (use flexiblecontexts permit this) * when checking inferred type :: forall b a. (num b, applicative (hello a)) => hello b that clear, because isn't applicative instance. since aren't specifying applicative type in particular, ghci defaulting io , i.e. pure $ hi 34 returns value of type num => io (hello b) .

css - Bootstrap row height option -

first post - gentle :) i've run issue row height in bootstrap (i think). i'm brand new bootstrap , i'm trying basic edits wordpress site , want further knowledge. had 4 items equally distributed across page , looked great. well, i've added fifth item , it's been dropped next row below first 4 isn't low enough on page , blocks content of 1 of original 4 items. how can adjust height of offending row(s) drop bottom item low enough accommodate upper row? link actual page: here please see image , code below. offending item html entire page: <?php /* template name:home page */ get_header(); ?> <!-- banner starts --> <div class="banner"> <div data-ride="carousel" class="carousel slide" id="carousel-example-captions"> <ol class="carousel-indicators"> <li class="" data-slide-to="0" data-target="#carousel-example-captions">&l

slf4j - When trying to initiate Shiro SecurityManager from INI resource, encountered java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory -

i've started trialling shiro , trying code securitymanager ini resource when encountered java.lang.classnotfoundexception: org.apache.commons.logging.logfactory extended message: exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/logging/logfactory @ org.apache.commons.beanutils.convertutilsbean.<init>(convertutilsbean.java:154) @ org.apache.commons.beanutils.beanutilsbean.<init>(beanutilsbean.java:113) @ org.apache.commons.beanutils.beanutilsbean$1.initialvalue(beanutilsbean.java:64) @ org.apache.commons.beanutils.beanutilsbean$1.initialvalue(beanutilsbean.java:60) @ org.apache.commons.beanutils.contextclassloaderlocal.get(contextclassloaderlocal.java:154) @ org.apache.commons.beanutils.beanutilsbean.getinstance(beanutilsbean.java:76) @ org.apache.commons.beanutils.propertyutilsbean.getinstance(propertyutilsbean.java:107) @ org.apache.commons.beanutils.propertyutils.getpropertydescriptor(pr

In VSTS, how can I reference a variable in the name of another variable? -

i have variable group contains deployment credentials environment, test_host , test_token etc. want able use values of these variables in release task don't want type in environment name (test) can change between environments. how can reference test_host variable using current environment name? i've tried $($(release.environmentname)_host) results in string $(test_host) being passed script. how resolve $(test_host) ? note - trying pass these values powerhsell script in arguments field have -deployhost $($(release.environmentname)_host) results in -deployhost $(test_host) being executed. update 1 whilst values passed powershell script, script within task group. if outside task group (just regular powershell task in release) works. when pass value task group parameter, fails. see logs below. 2017-08-24t12:58:50.5643742z generating script. 2017-08-24t12:58:50.7206133z formatted command: . 'c:\agent_work\r5\a\rcv\deploys\uxforms\deploy-touxforms.ps1' -tar

android - react-native-video Undefined is not an object (evaluating '_reactNative ...) -

hi trying use module react-native-video (or video player) video play on app, running error: undefined not object (evaluating '_reactnative.nativemodules.uimanager.rctvideo.constants') ![1]: https://image.ibb.co/nft2cq/screen_shot_2017_08_23_at_3_47_18_am.png "full error image" in index.android.js: import react, { component } 'react'; import { appregistry, stylesheet, text, view } 'react-native'; import video 'react-native-video'; export default class demodigpocv3 extends component { constructor(props){ super(props); } render() { return ( <view style={styles.container}> <text>hello world</text> <video source={require('./videotrack.mp4')} repeat={false} /> </view> ); } } appregistry.registercomponent('demodigpocv3', () => demodigpocv3); i have ran: react-native link react-native-video if rerun it