Posts

Showing posts from February, 2012

go - In golang how do I encode an xml parameter containing a space? -

i have xml api construct need use (this construct not defined me , cannot change it): <path><farmer id="me7"/></path> in go have: type path struct { xmlname xml.name `xml:"path"` farmerid string `xml:"farmer id,attr"` } pmux := &path{farmerid: "me7"} however go encodes pmux , prints this: <path xmlns:farmer="farmer" farmer:id="me7" </path> what want this: <path><farmer id="me7"/> </path> how can achieve this? thx the xml invalid, if need come out that, use regular expression fix afterward. here example. i assuming want open tag valid <path farmer id="me7"></path> , instead of not having open tag valid posted <path farmer id="me7" </path> , either way doable regex. btw, question inconsistent want. start wanting <path><farmer id="me7"></path> , @eugenioy 's an

Magento child theme style-m.less, etc not found -

i'm learning magento 2 , creating child theme based off blank. in web/css folder have source/_extend.less , source/lib/variables/_colors.less it should pulling else parent theme understanding. it's saying /mytheme/en_us/css/styles-m.css , /mytheme/en_us/css/styles-l.css not found. how can be? doing wrong? i had _theme.less in addition _extend.less deleted after realized misunderstood use. i've cleared cache , deleted files out of pub/static/frontend , var/view_preprocessed

Xcode 8.3: how to install multiple custom "Project Templates" in Xcode 8.3? -

i trying install 2 custom "project templates" in xcode 8.3.3. more specific, i'm trying install cocos2d-obj templates v2.1 , v2.2. (cocos2d v3 or higher no longer use xcode templates, v2.x does.) during installation, each cocos2d v2.1 , v2.2 creates own xcode template folders , folders copied xcode's custom template folder: ~user/library/developer/xcode/templates/cocos2d v2.2 ~user/library/developer/xcode/templates/cocos2d v2.1 i hoping see there 2 separated templates (cocos2d v2.2 , cocos2d v2.1) available in template menu when new xcode project being created. 1 (either v2.2 or v2.1) appears in template menu. (interesting thing last modified 1 appears.) basically seems xcode doesn't allow have more 1 custom template in menu. (however, "file template" menu shows both v2.2 , v2.1 "file template" correctly in xcode, project template doesn't.) as far know related xcode's custom template related behavior, cannot find official

android - how can i add multiple click on back pressed button -

how can add multiple backpressed button when press button show me press double click exit after toast message when click double on press button app exit... did method twice exit app want implement 3 times if (doublebacktoexitpressedonce){ super.onbackpressed(); doublebacktoexitpressedonce = false; } else { doublebacktoexitpressedonce = true; toast.maketext(this, "double press exit", toast.length_short).show(); } i suggest way: int counter = 0; .... public void onbackpressed() { counter++; if(counter > 2){ system.exit(0); }else{ toast.maketext(this, "triple click exit!", toast.length_short).show(); } final long delay_time = 3000l; new thread(new runnable() {

azure - Unable to read message from Service bus. it is returning null -

i trying read stream on azure service bus. getting null bytes. file size getting created same size of bytes being sent, contains nulls. have added code used converting stream byte array function name readallbytes(stream source) below code reference: static void main(string[] args) { memorystream largemessagestream = new memorystream(); #region receivemessage var msg = microsoft.servicebus.namespacemanager.createfromconnectionstring(configurationsettings.appsettings["microsoft.servicebus.connectionstring"].tostring()); var numofmessages = msg.getqueue(accountdetails.queuename).messagecountdetails.activemessagecount.tostring(); if (msg.getqueue(accountdetails.queuename).requiressession) { var queueclient1 = queueclient.createfromconnectionstring(configurationsettings.appsettings["microsoft.servicebus.connectionstring"].tostring(), accountdetails.queuenam

android - Why does FCM return a 400 error code when I send the JSON message below via a custom Java client -

i sending multiple topics. { "condition": "'used_cars' in topics || 'entertainment' in topics || 'shopping' in topics || 'real_estate' in topics || 'jobs' in topics || 'news' in topics ", "notification": { "body": "details test", "title": "title test", "icon": "ic_stat_name", "sound": "default" }, "data": { "title": "title test", "body": "details test" } } if send 3 topics works fine , can receive notifications on device. json valid. i think maximum number of terms in condition 5, , have 6. can remove 1 , see if works? btw: maximum number of terms used 3, if i'm wrong being increased indeed can have no more 3.

angular - Angular2 application using webpack is extremely slow in Edge browser -

my angular2 application extremely slow in edge browser. chrome , firefox comparably faster. when enabled production mode, faster in edge, there workaround rather using production mode. figured has "style loader". suggestions? have been trying figure out since 2 days. my webpack.config file var webpack = require('webpack'); var htmlwebpackplugin = require('html-webpack-plugin'); var extracttextplugin = require('extract-text-webpack-plugin'); var helpers = require('./helpers'); module.exports = { entry: { 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'app': './src/main.ts' }, // resolves extensionless files looking matching files .ts or .js extensions resolve: { extensions: ['.ts', '.js'] }, module: { rules: [ { test: /\.ts$/, use: [

javascript - AngularJS - translate the url of ui-router (StateProvider) -

i translated url path in application. translation working in every places in application. besides url of stateprovider. code: .state('about', { url: '/'+'{{"path.about.main" | translate}}', templateurl: 'views/about.html', controller: 'aboutcontroller', activetab: 'about', ncybreadcrumb: { label: '{{"path.about.main" | translate}}', parent: 'home' } }) translation in ncybreadcrumb working fine not in url. have tried: '/'+'{{"path.about.main" | translate}}' but doesnt work. has idea how make url translated? thanks!!

Can't ping host network by name from Docker bridged container -

06.1-ce i have container running in bridge newtork "ipam": { "driver": "default", "options": null, "config": [ { "subnet": "172.18.0.0/16", "gateway": "172.18.0.1" } ] } i can access containers no problem, need connect machine on host network. when docker exec -ti bash inside container, can ping i.p not name. how docker bridge network works? update i can ping full name. there way set search domain containers? ok can set dns settings when using docker run such as: --dns-search=mydomain.com https://docs.docker.com/engine/userguide/networking/default_network/configure-dns/

html - bootstrap dialog esc key not working -

this dialog, esc key not working, have ideas might wrong ? <div *ngif="visible" class="overlay"> <div role="dialog" class="overlay-content" tabindex="-1"> <div class="modal-dialog" [ngclass]="{'wide-modal-dialog': widecontent}" > <!-- modal content--> <div class="modal-content"> <div class="modal-header" *ngif="header.length > 0"> <button type="button" class="close" (click)="close()" data-dismiss="modal">&times;</button> <h4 class="modal-title">{{ header }}</h4> </div> <div class="modal-body"> <ng-content></ng-content> </div> <div class="m

scala - What causes a NullPointerException when a SharedSparkContext (sc) is used outside a test function in FunSuite? -

the following scala code works fine, , test runs: import org.scalatest._ import com.holdenkarau.spark.testing._ class dummytest extends funsuite sharedsparkcontext { test("shared context works inside test functions.") { val myrdd = sc.parallelize(list(1,2,3,4)) } } however, following scala code results in java.lang.nullpointerexception on line sc.parallelize: import org.scalatest._ import com.holdenkarau.spark.testing._ class dummytest extends funsuite sharedsparkcontext { val myrdd = sc.parallelize(list(1,2,3,4)) test("shared context works inside test functions.") { assert(true) } } what causes nullpointerexception when sparkcontext used outside of test function? the sparkcontext declared within sharedsparkcontext not initialized part of trait's initialization. rather initialized in trait's beforeall() method, called test framework after suite has been instantiated. source here: https://github.com/holdenk/sp

How do I write to a .csv file with python -

i writing simple script python3.6 , using csv module create csv file. code attached below, , carbon copy of multiple examples have found online, when run code, error message typeerror: bytes-like object required, not 'str' . import csv file_name = test.csv open(file_name, 'wb') csvfile: filewriter = csv.writer(csvfile,delimiter=',') filewriter = writerow(['paul','mary']) if don't need binary mode, can use : with open(file_name, 'w') csvfile: filewriter = csv.writer(csvfile,delimiter=',') filewriter.writerow(['paul','mary']) check table here see details different modes available.

android - How do I add a sudo password to JSch? -

i'm writing simple android program, let me run programs on ubuntu device phone. legit want program, send command, tell me output. looking other answers gave me insight on how run sudo, if 1 command run. idea why no output either? connect, since using false credentials gives me error. appreciated. command i'm running is: sudo transmission-gtk. command "ls" works. i'm assuming it's way sudo? package david.sshapplication; import android.os.asynctask; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.support.v7.widget.recyclerview; import android.view.view; import android.widget.edittext; import com.jcraft.jsch.channelexec; import com.jcraft.jsch.jsch; import com.jcraft.jsch.session; import java.util.properties; public class loginactivity extends appcompatactivity { private edittext pw; private edittext uname; private edittext hostname; private edittext port; private edittext command; private edittext response; @o

Background / border behind and below text (CSS) -

i looking create effect css: https://i.stack.imgur.com/zpzvc.png since don't know how effect called, haven't been able find solution online , can't make work on own unfortunately. the effect repeats few times on different titles different sizes. border should begin on half of first letter. who can me? i'd use :after pseudo class on span element accomplish this. body { background: #3e9ce2; color: white; font-family: sans-serif; } /* looks */ h1 span { position: relative; display: inline-block; } h1 span:after { position: relative; display: block; content: ""; background: #de2f2d; z-index: -5; height: 22px; top: -19px; left: 7px; } <h1>this our <span class="offset-background">showcase</span></h1> the position , display attributes on span make sure :after element positioned (directly underneath span ) , has same

pca - Need to perform Principal component analysis on a dataframe collection in python using numpy or sklearn -

i having 'dataframe collection' df data below. trying perform principal component analysis(pca) on dataframe collection using sklearn. getting typeerror from sklearn.decomposition import pca df # dataframe collection pca = pca(n_components=5) pca.fit(x) how convert dataframe collection array matrix sequence. think if convert array matrix, able pca data: {'ussp2 cmpn curncy': 0 0.297453 1 0.320505 2 0.345978 3 0.427871 name: (ussp2 cmpn curncy, px_last), length: 1747, dtype: float64, 'margdebt index': 0 0.095478 1 0.167469 2 0.186317 3 0.203729 name: (margdebt index, px_last), length: 79, dtype: float64, 'sl% smt% index': 0 0.163636 1 0.000000 2 0.000000 3 0.363636 name: (sl% smt% index, px_last), dtype: float64, 'ffsraiws index': 0 0.157234 1 0.278174 2 0.530603 3 0.526519 name: (ffsraiws index, px_last), dtype: float64, 'usph

c# - WPF action befor exit -

on wpf want know when user press on x exit. then want functions. how can on wpf c#? public partial class mainwindow { public mainwindow() { initializecomponent(); this.closing += (sender, args) => ...; // occurs after x pressed. can cancel closure here. this.closed += (sender, args) => ...; // occurs when window closed. } }

python - Django on mod_wsgi syntaxError -

i installed django 1.11.5 virtualenv on mod_wsgi. python version 2.7.13. i error in /var/log/httpd/error_log : [wed sep 13 16:41:00 2017] [error] [client 5.125.70.26] mod_wsgi (pid=9606): target wsgi script '/var/www/html/memit/memit/wsgi.py' cannot loaded python module. [wed sep 13 16:41:00 2017] [error] [client 5.125.70.26] mod_wsgi (pid=9606): exception occurred processing wsgi script '/var/www/html/memit/memit/wsgi.py'. [wed sep 13 16:41:00 2017] [error] [client 5.125.70.26] traceback (most recent call last): [wed sep 13 16:41:00 2017] [error] [client 5.125.70.26] file "/var/www/html/memit/memit/wsgi.py", line 13, in <module> [wed sep 13 16:41:00 2017] [error] [client 5.125.70.26] django.core.wsgi import get_wsgi_application [wed sep 13 16:41:00 2017] [error] [client 5.125.70.26] file "/var/www/html/memit/env/lib/python2.7/site-packages/django/__init__.py", line 3, in <module> [wed sep 13 16:41:00 2017] [error] [clie

regression - Forecasting model for longitudinal data with multiple explanatory variables -

i new stats, forgive me if didn't phrase question right. subject 1: y ~ x1 x2 x3 x4 x5 @ t=1 subject 1: y ~ x1 x2 x3 x4 x5 @ t=2 subject 1: y ~ x1 x2 x3 x4 x5 @ t=3 subject 1: y ~ x1 x2 x3 x4 x5 @ t=4 subject 2: y ~ x1 x2 x3 x4 x5 @ t=1 subject 2: y ~ x1 x2 x3 x4 x5 @ t=2 subject 2: y ~ x1 x2 x3 x4 x5 @ t=3 subject 2: y ~ x1 x2 x3 x4 x5 @ t=4 i have longitudinal data set (repeated measures each subject taken 4 time periods) dichotomous response variable. wish build predictive model helps predict y @ t=5. basically, need regression+time series forecasting model tells me variables significant in explaining variability in response, while accounting within subject correlation/dependence structure on time, , forecasts y or probability of y taking on 1 of 2 binary outcomes, @ time t=5, regressing on predictors until t=4. i have feeler has mixed models/transition models. but, not sure how structure problem in tool r/sas , package/procedure use.

sql - How to get most recent data? -

i have table 3 pieces of data, facilityname, datelastverified, & intensity. want able pull records recent datelastverified. when datelastverified same, want select record highest intensity. |facilityname | datelastverified | intensity |nemours/alfred i. dupont hospital children | 2014-03-01 | 16 |boston children's hospital | 2015-11-29 | 6 |boston children's hospital | 2017-04-01 | 3 |tufts medical center | 2017-04-01 | 3 |tufts medical center | 2017-04-01 | 6 so above table i'd want return second entry boston children's hospital , second entry tufts medical center. how write this? i want able pull records recent datelastverified. when datelastverified same, want select record highest intensity. based on description, can 1 record using order by , fetch first 1 row only : select t

jquery - Google Map fails to load on the first time and sometimes on refresh -

so added google map website. on first page load - not load. when refreshing - not load well. code: html: <div id="map"> </div> <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgfzhoseeamdoygbf13fyquitwlaqgxvsngt4=" crossorigin="anonymous"></script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=aizasydkxmtyiezepn8e6eulm9efzcixv960j2s&callback=initmap"> </script> <script src="script.js"></script> jquery: function initmap() {}; $(document).ready(function () { initmap = function() { var mylatlng = { lat: 40.1511, lng: -2.150609 }; var map = new google.maps.map(document.getelementbyid('map'), { zoom: 16, center: mylatlng, disabledefaultui: true, styles: [ .... ] })

node.js - NodeJS + MongoDB - simplifying functions -

i learning nodejs + mongodb. not want use mongoose of now. have below functions work fine. however, question how further this? both functions same except highlighted *** statement. //for returning records var resultsquery = function(search, select, callback) { mongo.connect(mongourl, function(err, db) { if (err){ throw err; } *** db.collection("coll").find(search, select).toarray(function(err, result) { if (err) { throw err; } callback(result); db.close(); }); }); }; // updating records var resultsupdate = function(filter, set, callback) { mongo.connect(mongourl, function(err, db) { if (err){ throw err; } *** db.collection("coll").update(filter, set, function(err, result) { if (err) { throw err; } callback(result); db.close(); }); }); }; put common things in 1 function , pass in callback: var resultsquery = fun

Android changes color of pixels while decoding an Image -

i have .png image ant load app. shape colored in specific color, every pixel has same rgb-value. difference alpha value, decreases @ edges of shape. my problem is, if load image bitmapfactory.decoderesource() pixels on edge rgb-value. it's not big change, it's -+4 red/green/blue value, me big change, because pixels have exact color. i want mask them out , replace them color. specific color indicator, find pixels want change. if change color edge still colored differently , thats annoying. is there way load drawables without them being changed? you should try using variant: decoderesource(resources res, int id, bitmapfactory.options opts) with configured opts. play params inpreferredcolorspace , outcolorspace , inpreferredconfig , outconfig

javascript - Materialize Slider jQuery next slide on .click event trouble -

i'm having trouble getting class or id element go next slide when clicked. not sure i'm doing wrong. hope guys can help! i have button want tell slider go next slide when clicked. <a class="nextbutton waves-effect waves-light btn right">next</a> i made sure initialize , create .click event function following initialization. $(document).ready(function(){ $('.slider').slider({ }); }); $('.slider').slider('pause'); $(".nextbutton").click(function(){ $('.slider').slider('next'); }); i'm not sure i'm doing wrong. please?

javascript - Displaying secondry menu in handheld mobile veiw storefront -

their 2 menu locations: primary - main navigation secondary - smaller navigation adjacent search bar the secondary menu hidden screens smaller 768px , full primary menu displayed. drawbacks obvious; potentially important content in secondary navigation isn't available . dedicated 'handheld' or 'mobile' location allow folks create menu specific mobile complete control of contents...but increase menus n submenus if having menus according category. looking forward if can display secondry menu along primary handheld menu in storefront theme.woocommerce.

javascript - How to integrate Angular into my current Firebase node.js project? -

i have web app have coded in bare javascript , has firebase backend. how can add angular current project use mvc? you can use official library: https://github.com/angular/angularfire2

parsing - Javascript functions or methods that take radix? -

these functions take radix argument: num.tostring(radix); parseint("123", radix); is there other function or method takes radix (number base), because want use parsefloat("1a.b4",radix) . but since don't imagine there lot of them, please name of them if know, useful, thanks. edit: yes parsefloat("1a.b4",16)should 26.703125. if @ , num.tostring(radix) supports bases 2 36 in firefox console (333.444).tostring(36) equals "99.fzf9i56mi" generalizing @paulpro's comment function, redefine parsefloat() so: parsefloat = function parsefloat (string, radix = 10) { if (radix == 10) { return this(string) } const [istring, fstring = '0'] = string.split('.') const inumber = parseint(istring, radix) const fnumber = parseint(fstring, radix) const flength = math.max(fnumber.tostring(radix).length, fstring.length) const sign = infinity / inumber === infinity ? 1 : -1 r

Unable to assign IP addresses to server/client in Python Socket Programming -

i'm working on socket level chat assignment requires me have server stores usernames , ip addr&port numbers , give out client needs enable chat between them. new socket programming in python i'm having tough time assigning ip addresses , pickle serializing lists sent server client, server side: import pickle import socket udp_ip = '127.0.0.1' udp_port = 8014 fd = socket.socket(socket.af_inet, socket.sock_dgram) fd.bind((udp_ip,udp_port)) x=[] while true: r = fd.recvfrom(2048) x.append(r) print x datas=pickle.dumps(x) reply = r[0] client_address = r[1] #fd.sendto(bytearray(reply,"utf-8"), client_address) fd.sendto(datas,client_address) client side: import pickle import socket fd = socket.socket(socket.af_inet, socket.sock_dgram ) fd.getsockname() udp_ip = '127.0.0.1' udp_port = 8014 b=[] print "sign-in" message= raw_input("username :") fd.sendto(message, (udp_ip, udp_port)) while(

ios - How do you get different random images from the `CIRandomGenerator` filter? -

Image
it appears me output of cifilter(name: "cirandomgenerator") same, regardless of whether 1 references outputimage of instance multiple times or whether 1 instantiates new filter: import coreimage let randomfilter = cifilter(name: "cirandomgenerator") let outputimage = randomfilter!.outputimage!.cropped(to: (cgrect(x: 0, y: 0, width: 100, height: 100))) let outputimage2 = randomfilter!.outputimage!.cropped(to: (cgrect(x: 0, y: 0, width: 100, height: 100))) // pause amount of time it's not // instantiating prng same timestamp let rf2 = cifilter(name: "cirandomgenerator") rf2!.outputimage!.cropped(to: (cgrect(x: 0, y: 0, width: 100, height: 100))) leads to: which, if examine pixels, same. i not see kind of seed parameter can passed in initialize pseudo-random number generator properly. since cifilter has infinite extent, can randomly offset location in call cropped , appears work, seems hack. missing proper way initialize / getnext ra

winforms - C# - Communicate between two projects without two-way references -

i have 2 projects: project , and external project b (added via "add existing project in visual studio). project has reference project b, project b not have reference project a. have winform textbox in project project b able write text to. because project b doesn't have reference project a, can't call method created in project adds text textbox. my question: possible have project b call method or write textbox without adding project reference? circular references, while allowed in c#, symptom of poor architecture decisions. possible? void myeventfunction(object sender, eventargs e) { string txt = myclassfromb.getstringfromb(); textbox1.text = txt; } ideally, you'd want b's code give string want when need it, can control when gets updated. alternatively, can delegates involved. in b: public class myclass { public delegate void updatestringvar(string x); private updatestringvar usv; myclass(updatestringvar v) {

web services - SoapUi RawXml to c# -

i developing c# library witch have send xml data through web service. consumed web service "add service reference" option in vs. same web service: " https://test.puesc.gov.pl/seap_wschannel/documenthandlingport?wsdl ". not able send xml data through it's client. know it's working, because checked through soapui application, don't know how achieve in c#. in soapui xml looks this: post https://test.puesc.gov.pl/seap_wschannel_direct/documenthandlingport http/1.1 accept-encoding: gzip,deflate content-type: text/xml;charset=utf-8 soapaction: "acceptdocument" http://www.w3.org/2005/08/addressing: ns1 http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd: c http://schemas.xmlsoap.org/soap/envelope: content-length: 4611 host: test.puesc.gov.pl connection: keep-alive user-agent: apache-httpclient/4.5.2 (java/1.8.0_131)<soapenv:envelope xmlns:_v2="http://www.mf.gov.pl/uslugibiznesowe/wspull/usluga/2014/01_v2_0

.net - C# AppSettings array -

i have string constants need access multiple files. since values of these constants might change time time, decided put them in appsettings rather constants class don't have recompile every time change constant. sometimes need work individual strings , need work of them @ once. i'd this: <?xml version="1.0" encoding="utf-8"?> <configuration> <appsettings> <add key="const1" value="hi, i'm first constant." /> <add key="const2" value="i'm second." /> <add key="const3" value="and i'm third." /> <add key="const_arr" value=[const1, const2, const3] /> </appsettings> </configuration> the reasoning being i'll able stuff like public dictionary<string, list<double>> getdata(){ var ret = new dictionary<string, list<double>>(); foreach(string key in

installation - CMake resources in source code for build and install -

this has been on mind years. using resource files cmake in code such can accessed when running in build directory , when installed. say have files necessary run program in top-level directory called res. contains res/file1.txt , res/file2.txt. build program , resources copied build directory program can run during development. then, program installed resources /usr/share/my_program or , program runs accessing files. question in source code same code works when running build directory , when installed. i've seen several different answers how handle resources each seems have flaw: the program searches in preconfigured absolute directory such cmake_install_prefix/share/my_program , must installed first run, not ideal easy use during development. finding way use relative paths binary don't see how work since build tree not mirror installed file paths, being installed bin , share directories. differentiating between 2 cmake variable searches relative path in 1 scenario or

c - Split/Parse a String after reading a Text File? -

i trying read in basic text file, split each line separate strings , rearrange/copy them onto new text file. there simple way split , identify these strings added new file @ end of processing lines? my code far: #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { file *pfilecust fpointer = fopen("athletes.txt", "r"); char singleline[150]; while (!feof(pfilecust)){ fscanf(singleline, 150); int id, name, sport; fprintf(%d[0,6], %s[8,15], %s[16,22], id, name, sport); } fclose(fpointer); return 0; } example text file read program: 88888 john doe tennis 99999 jane smith softball example output trying achieve. tennis 88888 john doe softball 99999 jane smith each line in file corresponds record. each series of consecutive non-whitespace characters corresponds field in current record. accordingly, /* getrecord: read next record on fp */ char *getrecord(fil

xml - Android: Getting device location during runtime -

i'm developing app want lat,lng of user's device.i found need access_fine_location permission access_coarse_location, know should ask them during runtime including them in androidmanifest.xml, app asks me permission access_coarse_location, , ignores asking access_fine_location. here's code private boolean checkandrequestpermissions(){ int permissionreadcontacts = contextcompat.checkselfpermission(this, manifest.permission.read_contacts); int locationpermission = contextcompat.checkselfpermission(this, manifest.permission.access_coarse_location); int locationpermission2 =contextcompat.checkselfpermission(this, manifest.permission.access_fine_location); list<string> listpermissionsneeded = new arraylist<string>(); if (locationpermission != packagemanager.permission_granted) { listpermissionsneeded.add(manifest.permission.access_coarse_location); } if (locationpermission2 != packagemanager.permission_granted) { l

bash - Fully disable mouse in console vim - Vi and Vim Stack Exchange

i saw completely disable mouse in console vim on stack overflow. sounded wanted, there problem related cygwin, title misnomer. i want know how completely disable all mouse interactions in vim on console. don't want scrolling, selecting, clicking, or otherwise looking @ mouse have effect within vim. i having mouse in console, not when i'm using vim. possible? i have laptop ubuntu installed on , when type, touch pad mouse decides randomly click or drag between random coordinates on screen, when try hardest not touch damned thing. has effect of me typing code in wrong places time, , it's getting old because introduces subtle irreversible bugs code. i've been able rid of scrolling , visual select using commands below in .vimrc , still relocate cursor when click. " disable mouse interactions " set mouse=nicr map <scrollwheelup> <nop> map <s-scrollwheelup> <nop> map <c-scrollwheelup> <nop> map <scrollwheeld

wso2esb - Temporary Storage in wso2 esb -

i have come across 1 requirement in have use 1 token, getting 3rd party , need reuse token different transaction until gets expired. don't want keep token in database. there way can keep token in temporary storage of wso2 esb , and reuse , whenever required, need update wso2 esb logic anytime. thanks in advance! regards, shri you can use js script save global value , reuse in different transactions : <script language="js"><![cdata[ var curvalue = mc.getenvironment().getservercontextinformation().getproperty("myvalue"); if (curvalue == null) { curvalue = 0; } else { curvalue++; } mc.getenvironment().getservercontextinformation().addproperty("myvalue",curvalue); mc.setproperty("currentvalue",curvalue); ]]></script> you can current value inside mediation get-property('currentvalue') value lost when shutdown /

React-Native-Maps onRegionChangeComplete Breaks & Returns (0,0) and Obscure Lat/LngDeltas -

some serious head-banging-on-desk action going on over here. we're using react-native-maps , it's 50/50 chance jumps map (0,0) when refreshing. we're using onregionchangecomplete prop, , after diving deeper, we've can see it's returning incorrect lat/long/latdelta/lngdelta so.... latitude: 0 longitude: 0 latdelta: 102.73569069743314 lngdelta: 72.32139609754086 when works properly, coordinates it's bringing more like... latitude: 35.78307468033585 longitude: 99.8066698028755 latdelta: .072463719198538 lngdelta: .051887668669237996 the person working on me having same issue same dev, with incorrect results being ... latitude: 0 longitude: 0 latdelta: 148.03909769956485 lngdelta: 126.56251475214958 when coordinates should getting like... latitude: 45.06256685043254 longitude: -103.290462680161 latdelta: .0724636120368487 lngdelta: .056723691523089315 i've heard react-native-maps can quite buggy, can't possibly one

java - while loop: while sentence does not contain a word -

i'm getting user input , checking see if word 'java' in sentence. did while loop when word 'java' in sentence, tells me it's not , continues while loop. if remove while loop, else want program works. here code: import java.util.scanner; public class main { public static void main(string[] args) { //declare variables string sentence; int java_index_number; string stop_program; string java; string java; string java; string java_capital_first_letter; string java_all_caps; //scanner user input scanner user_input = new scanner(system.in); //prompt user sentence system.out.print("enter line of text containing word 'java' somewhere within it: "); sentence = user_input.nextline(); java = "java"; java = "java"; java = "java"; while(!sentence.contains(java) ||

javascript - Is it bad security to save jwt in cookie to pass it to local storage? -

in order twitter sign in work jwt sessions , angularjs, have created jwt twitter username , display name, passed cookie , saved local storage. here's relevant code: log in users , save cookie: app.get('/login/twitter', passport.authenticate('twitter')); app.get('/login/twitter/callback', function(req, res) { passport.authenticate('twitter' , {session: false} , function(err, user, info) { if(err) { console.log(err); } var token; token = user.generatetwitterjwt(); // res.status(200); // res.json({ // "token" : token // }); res.cookie('jwt' , token); res.render('login.jade'); })(req, res); }); save local storage , remove cookie: $scope.twittertest = function() { var jwtcookie = $cookies.get('jwt'); authenticationservice.savetoken(jwtcookie).e

html - Displaying Math with MathJax -

i trying learn how display math equations mathjax. tweaked code codepen , works fine: `<!doctype html> <head> <script src='https://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-ams-mml_htmlormml'></script> <style> p { font-size: 22px; } </style> </head><body> <script type="text/x-mathjax-config"> mathjax.hub.config({ tex2jax: { inlinemath: [['$', '$']] }, elements: ['math'] }); </script> <p id="math"> find value of: $\huge{\frac {3.41 \times 10^3}{1.80 \times 10^2}}$ , enter answer within box. </p> ` however, when add 1 more paragraph , enter math in there, not display math. displays text. suggestions? thank you. include next paragraph id in elements: ['math'] array in mathjax config.

c++ - How can I add items to the output file? -

i newbie c++ , i've got first assignment. we've got text file contains 5 employee names, wages, , hours worked. and code program read it. #include <iostream> #include <fstream> #include <iomanip> #include <string> #include <vector> using namespace std; int main() { ifstream input; ofstream output; string name; int h; float w; int numeployee = 0; double maxpay, minpay, avgpay; int gross, adjgross; //input/output file document path input.open("/users/jmduller/documents/xcode/lab1/lab1/employees.txt"); output.open("/users/jmduller/documents/xcode/lab1/lab1/employeesoutput.txt"); //checks if input file working if (input.fail()) { cout << "input file failed open." << endl; system("pause"); exit(0); } //checks if output file working if (output.fail()) { cout << "output file fa

Eclipse has an error upon loading, today -

eclipse has problem today. an internal error occurred during: "load https://raw.githubusercontent.com/jankoehnlein/fxdiagram/master/de.fxdiagram.docs/fxdiagram.setup". java.lang.nullpointerexception if fix needed, fix, please? version: eclipse neon.

windows - mpiexec - Credentials for user rejected connecting host -

to exercise more familiar mpi, installed ms-mpi on windows 10 machine, , mpi4py (python mpi). tried hello_world code: from mpi4py import mpi def main (): comm = mpi. comm_world rank = comm . get_rank () size = comm . get_size () print " hello " + str( rank ) + " in " + str( size ) if __name__ == " __main__ ": main () then, windows command admin executed following command: mpiexec -n 8 python mpi_test.py i get: user credentials needed launch processes: account (domain\user) [desktop-3cfsbj8\hazem]: i did registration, mpiexec - register username/pwd, execute again command, , following error: credentials user rejected connecting host. the problem comes when executing command mpiexec.

ios - Lazy load CoreData relationship -

what correct approach lazy loading coredata relationships? say have project object , projectfilter object may or may not exist, work expected? - (projectfilter *)filter { [self willaccessvalueforkey:@"filter"]; projectfilter *filter = [self primitivevalueforkey:@"filter"]; [self didaccessvalueforkey:@"filter"]; if (!filter) { filter = [nsentitydescription insertnewobjectforentityforname:@"projectfilter" inmanagedobjectcontext:self.managedobjectcontext]; self.filter = filter; } return filter; } this terrible idea , shouldn't it. in simple core data stack can have running on main thread. app gets more complex need have background context. if have multiple context writing core-data @ same time can merge conflicts. can tell core-data auto-resolve merged conflicts - isn't great solution because guaranteed lose data way. common solution have single queue writing , use main thread

How to get the objects from superclass to subclass in java? -

a class person has several subclasses including employee . there method supposed return list consists of employee objects original list of person . how accomplish in java? simple example you: public class test { public static void main(string[] args) { list<person> lst = new arraylist<person>() { { add(new person()); add(new person()); add(new employee()); add(new employee()); add(new anotherperson()); add(new anotherperson()); } }; list<person> employes = lst.stream().filter(item -> item instanceof employee).collect(collectors.tolist()); system.out.println(employes.size()); } class person { } class employee extends person { } class anotherperson extends person { } }

python - Practical example of Polymorphism -

can please give me real life, practical example of polymorphism? professor tells me same old story have heard + operator. a+b = c , 2+2 = 4 , polymorphism. can't associate myself such definition, since have read , re-read in many books. what need real world example code, can associate with. for example, here small example, in case want extend it. >>> class person(object): def __init__(self, name): self.name = name >>> class student(person): def __init__(self, name, age): super(student, self).__init__(name) self.age = age check wikipedia example: helpful @ high level: class animal: def __init__(self, name): # constructor of class self.name = name def talk(self): # abstract method, defined convention raise notimplementederror("subclass must implement abstract method") class cat(animal): def talk(self): return 'meow!' class dog(animal):

Firebase: Registering users based on their phone numbers added by admin -

newbie here. trying allow users register via phone number, when phone numbers have been added earlier admin. or link resources helpful. thanks! basically via admin account, need add "good" numbers inside node let's call "white_list" , reference whitelistref. then need 2 essential firebase methods register user via phone number, first 1 : phoneauthprovider.provider().verifyphonenumber(phone_number) { } it send verification code user. then need add method : auth.auth().signin(with: credential) { } credential created using verificationid got first method, , verification code user received phone number if number correct : let credential = phoneauthprovider.provider().credential( withverificationid: verificationid, verificationcode: verificationcode) in case, need check phone number user typed in among white list (that admin added white_list node). depending on database structure, example, use method 1 : func checknumbe

css - HTML "style" tag doesn't work -

i tried following code in both online editor in w3schools & pen editor in codepen. here code. body { background-color: lavenderblush } .red-text { color: red; } h1 { font-family: tangerine, times new roman; font-size: 55px; } p { font-size : 18px; font-family: inconsolata; }  .thick-salmon-border { border-color: salmon; border-width: 5px; border-style: solid; border-radius: 50%; } .smaller-image { width: 120px; height: 120px; } .thick-royalblue-border { border-color: royalblue; border-width: 5px; border-style: solid; border-radius: 50%; } .thick-green-border { border-color: green; border-width: 5px; border-style: solid; border-radius: 50%; } .thick-sandybrown-border { border-color: sandybrown; border-width: 5px; border-style: solid; border-radius: 50%; } .thick-lightpink-border { border-color: lightpink; border-width: 5px; border-style: solid; border-radius: 50%; } .