Posts

Showing posts from May, 2015

javascript - Chrome web speech recognition api results returning repeated words? -

i trying web speech recognition api speech text. there online demo here https://www.google.com/intl/en/chrome/demos/speech.html but if try or implement myself, there problem of repeating words. if test comes testtest . ive seen @ least 2 other people comment on same issue on other forums. known issue/bug? thanks

html - PHP include text file and format -

i have simple text file. file name kpop.txt - want include contents of file in webpage. using php includes (header / footer stuff). i contents of kpop.txt file remain formatted similar it's current form. real difference make increase font size. i using <?php include("kpop.txt"); ?> i have tried <pre> <font size ="12"> <?php include("kpop.txt"); ?> </font> </pre> what want see text larger font. ftus43 kggw 271140 taf kp01 271140z 2706/2806 08010kt p6sm sct140 fm271500 12011kt p6sm sct110 fm271900 14011kt p6sm bkn120 fm280000 14008kt p6sm vcsh bkn100 fm280300 13006kt p6sm vcsh sct100 amd not sked. unfl= taf km75 271140z 2706/2806 07008kt p6sm sct110 fm271500 11008kt p6sm few150 amd not sked. unfl= another solution did not work <?php myfilename = "kpop.txt"; $taf = file_get_contents(myfilename); $taflines = explode("\n", ...

user interface - Python Tkinter. Best Fit Ellipse from Data Points -

Image
i working on python gui w/ tkinter. trying save 4 specified point locations bmp image variables, , create best-fit ellipse more or less passes through saved points. still beginner working w/ tkinter , gui's please bear w/ me! so far, code able mark points , print out position/coordinates. should use matplotlib kind of situation? able use w/ tkinter well? here code: from tkinter import * pil import image, imagetk class window(frame): def __init__(self, master=none): frame.__init__(self, master) self.master = master self.pos = [] self.master.title("gui") self.pack(fill=both, expand=1) self.counter = 0 menu = menu(self.master) self.master.config(menu=menu) file = menu(menu) file.add_command(label="exit", command=self.client_exit) menu.add_cascade(label="file", menu=file) analyze = menu(menu) analyze.add_command(label="region of...

excel - Use VBA to replace sporadic #N/A cells with a formula -

i have data comes different sources via data/connections goes sheet/table called rawdata. have created macro linked button user must click fill in of data in rawdata index/match function points workbook reservation number rawdata matched other workbook determine length of stay. i not appending said workbook rawdata table different reasons. can go route if need figured there easier route before cross bridge. issue have once macro ran, other workbook, @ times, may not have reservation data. in these cases, had manually determine data. this new data can placed within main workbook [but have in it's own workbook (losnaintoactuallos.xlsm) i've been running tests on making work]. , formula has pasted table because when table refreshes, row of data have length of stay removes formula , replaces it's original value, blank cell. what need code loop through cells within f column of table, determine cells #n/a errors, paste formula in error cell. have done research , can...

arrays - strstr() function in C -

i new learner , want output fill truth array use strstr() in c. there 3 keyword groups in lists different size need compare. keywords group 1: foo1,foo2. stored in truth[0],truth[1]. keywords group 2: bar1,bar2,bar3,bar4.stored in truth[2] truth[5]. keywords group 3: baz1,baz2,baz3,baz4,....stored in truth[6] truth[k-1]. all members in truth array set mask number (like -1) @ beginning assuming input not have keywords. if input matches keyword in keyword group, element in group should set 1 , other elements in same keywords group need set 0. want check there @ 1 keyword each keyword group. for example: input:"bar1"; output:[-1,-1, 1,0,0,0, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,....]; input:"foo1_baz5"; output:[1,0, -1,-1,-1,-1, 0,0,0,0,1,0,0,0,0,0,...]; input:"foo1_bar1_baz1"; output:[1,0, 1,0,0,0, 1,0,0,0,0,0,0,0,0,0,...]; input:"foo1_foo2"; output:"too many keywords". this code have worked far (let's total 100 keywor...

jenkins - Automatically removing feature branches on GitHub once they're merged to master -

we have on 100 repos follow github workflow https://guides.github.com/introduction/flow/ . ideally, when people merging code, they'll click delete branch button, unfortunately, step gets missed pretty often. i'm looking way automatically delete branches have been merged master branch. i'm thinking should either organizational level webhook or integrated our existing jenkins system. i'm hoping has written tool. anyone?

javascript - Google Maps API v3 unable to center a map with a polyline marker -

i unable center google maps containing polyline marker after using setting display: none map container. initially, map displayed correctly, after toggle hide() / show() map centered polyline marker on bottom-left corner. i've tried suggested solutions use google.maps.event.trigger(map, "resize"); didn't solve it. the snippet. note initmap triggered on input change: function initmap() { mapcontainer = $("#mapcontainer"); mapobject = document.getelementbyid('map'); if (substance === "no2") { mapcontainer.show(); var center = new google.maps.latlng(lat, lng); map = new google.maps.map(mapobject, { center: center, zoom: 12, maptypecontrol: false, streetviewcontrol: false }); const point = new google.maps.latlng( parsefloat(lat), parsefloat(lng) ); var marker = new markerwithlabel({ ...

How to set environment variables in Amazon Elastic Beanstalk when running a cron job (Node.js)? -

i have been working on configuring cron job while deploying environment on elastic beanstalk. purpose of job run every 30 minutes , execute node.js script processes sms schedules in our system; when schedule ready, sms message sent via twilio api. unfortunately, node.js environments don't have file /opt/elasticbeanstalk/support/envvars containing environment variables defined (maybe missing something?) . to work around issue, loading environment variables /opt/elasticbeanstalk/bin/get-config in python , executing node.js script. everything working expected can in same situation; however, i wondering if there better way accomplish this... open suggestions. in .ebextensions folder have config file cron: files: "/etc/cron.d/process-sms-schedules": mode: "000644" owner: root group: root content: | */30 * * * * root /usr/local/bin/process-sms-schedules.sh "/usr/local/bin/process-sms-schedules....

How to convert sample in AWS Lambda from javascript to Java? -

i trying convert javascript sample: javascript 'use strict'; exports.handler = (event, context, callback) => { callback(null, {"speech": "hello lambda js"}); }; output hitting test button in aws lambda { "speech": "hello lambda js" } now want convert in simplest way java program. this tried: public class sample implements requesthandler<string, string> { @override public string handlerequest(string s, context context) { return "{\"speech\": \"hello lambda java\"}"; } } but hitting test button in aws lamda complains: { "errormessage": "an error occurred during json parsing", "errortype": "java.lang.runtimeexception", "stacktrace": [], "cause": { "errormessage": "com.fasterxml.jackson.databind.jsonmappingexception: can not deserialize instance of java.lang.string out of start...

asp.net mvc - ASPNETBOILERPLATE - MVC Bundle out of memory error -

i added following method mpabundleconfig.cs file. added similar method js files. private static void exlntaddmpacsslibs(bundlecollection bundles, bool isrtl) { bundles.add( new stylebundle("~/bundles/common/exlnt/css" + (isrtl ? "rtl" : "")) .include(stylepaths.bootstrap_datepicker) .include(stylepaths.bootstrap_datetimepicker) .include(stylepaths.bootstrap_datatables) .include(stylepaths.datatables) .include(stylepaths.select2) .include(stylepaths.select2_bootstrap) .forceordered() ); } soon run application, after login, error: exception of type 'system.outofmemoryexception' thrown. all i'm trying add js/css files added solution, after getting solution aspnetzero download. ideas on how can resolve error? @hikalkan - response, looked little closer @ issue ...

firebase - Database doesn't write even though no "Fault" is returned -

i'm trying firebase database component working ios project, , when code (included below) executes output "succeeded" message, database not modified. i've included "error" i'm receiving in xcode logs. thank help! public ienumerator getprofile() { task < datasnapshot > task = firebasedatabase.defaultinstance.getreference("users/" + _currentuser.userid).getvalueasync(); while (!task.isfaulted && !task.iscanceled && !task.iscompleted) yield return null; if (task.iscompleted) { //set data debug.log("has data"); datasnapshot snapshot = task.result; if (snapshot.value == null) { debug.log("no value"); task postnew = firebasedatabase.defaultinstance.rootreference.child("users").child(_currentuser.userid) .setrawjsonvalueasync(jsonconvert.serializeobject(new user())); while (!postnew.isfaulted && !postnew.iscan...

java - Groovy Digest authentication -

i trying write groovy script (java code welcome ;)) should allow me perform digest authentication. need being able use digest auth in soapui becauer soap doesn't support native kind of authentication. to test script used url: https://postman-echo.com/digest-auth first access page via web browser www-authenticate header. digest realm="users", nonce="81leqmjgxrb3us9jvjpyldpjw11on7zw", qop="auth" then type correct user+password , check authorization header computed web browser. here result: digest username="postman", realm="users", nonce="81leqmjgxrb3us9jvjpyldpjw11on7zw", uri="/digest-auth", response="82884fe7c55a19e80e8c8dea7ba1aece", qop=auth, nc=00000001, cnonce="89aa538367b9069a" then used same data perform computation of response data using script. here result: digest username="postman", realm="users", nonce="81leqmjgxrb3us9jvjpyldpjw11on7zw...

go - docker-compose oci runtime error executable file not found (in linked container) -

i'm trying setup docker & compose running integration tests i have following docker-compose.yml version: '3' services: tests: build: context: . dockerfile: dockerfile.tests links: - web - maindb web: build: context: . dockerfile: dockerfile.web ports: - "8080:8080" volumes: - .:/code - logvolume01:/var/log links: - maindb maindb: image: postgres environment: postgres_password: example volumes: logvolume01: {} web container works pretty fine $ docker-compose -p wh run web starting wh_maindb_1 ... done 2017/07/27 22:05:34 [i] http server running on http://:8080 but when run tests container, error $ docker-compose -p wh run tests starting wh_maindb_1 ... done starting 6faff07f7671_6faff07f7671_wh_web_1 ... starting 6faff07f7671_6fa...

rest - Extracting data from json in JavaScript -

i have ajax connection controller function changeemail() { $.ajax({ ... contenttype: "application/json", datatype: "json", ... error: function (error) { var obj = error.responsetext; console.log('error: ' + obj); console.log('obj length: ' + obj.fielderrors.length); } }); } which in case of error returns list of errors in json. however, not able refer list. https://zapodaj.net/e6354b8c71f4c.png.html not know, example, how refer first element of list message variable depending on content-type response server, default response type text/html or other incorrect content-type. you have 2 ways fix this. first, can set obj = json.parse(error.responsetext) or, can make sure server sets correct content-type on errors well.

.htaccess - How to change the name of the directory in url in php using htaccess? -

how can change name of url of site is: www.example.com/user/panel.php www.example.com/username/panel.php "username" unique each user , , each login name of user database, in jsfiddle.net, me? personally not use .htaccess ( ) that said time people way rewriteengine on rewriterule ^users/([-a-za-z0-9_]+)/?$ index.php?user=$1 [l] so if had url like www.yoursite.com/users/someguy then pass apache ( , php ) www.yoursite.com/index.php?user=someguy then in php access using $_get[user] . now ignoring security concerns may have ( shouldn't rely on user input tell are, can lie it) use call uri method ( not url ) uri imaginary path. method employed many mvc systems. start uri www.yoursite.com/index.php/users/someguy notice index.php ( in middle ). .htaccess this rewriteengine on rewritecond %{request_filename} !-f #if not real file rewritecond %{request_filename} !-d #if not real folder rewriterule ^(.*)$ index.php/$1 [l] #hide index....

timer - clearTimeout setInterval not working. But does in other script? -

i wish animation loop on , on throughout page duration, reason cleartimer not fulfilling job. or have got looping wrong thinking clearing timers produce loop function granted. <script> (function () { var a1; a1 = settimeout(anim1,9000); var a2; a2 = settimeout(anim2,10000); var a3; a3 = settimeout(anim3,11000); var a4; a4 = settimeout(anim4,12000); function anim1() { document.getelementbyid("tx1").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim2() { document.getelementbyid("tx2").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, { transform: "translatey(0px)"} ], { duration: 1000, }) } function anim3() { document.getelementbyid("tx3").animate([ { transform: "translatey(0px)"}, { transform: "translatey(-10px)"}, ...

r - How do I extract the first number that occurs after a matching pattern -

consider these examples: examples <- c( "abc foo", "abc foo 17", "0 abc defg foo 5 121", "abc 12 foo defg 11" ) here return first number occurs after "foo". in case: na, 17, 5, 11. how can this? tried using look-behind, no luck. library(stringr) str_extract(examples, "(?<=foo.*)[0-9]+") error in stri_extract_first_regex(string, pattern, opts_regex = opts(pattern)) : look-behind pattern matches must have bounded maximum length. (u_regex_look_behind_limit) this seems work: str_match(examples, "foo.*?(\\d+)") [,1] [,2] [1,] na na [2,] "foo 17" "17" [3,] "foo 5" "5" [4,] "foo defg 11" "11" from ?regex : by default repetition greedy, maximal possible number of repeats used. can changed ‘minimal’ appending ? quantifier. from ?str_extract : see also ?str_match ext...

r - How do pipes work with purrr map() function and the "." (dot) symbol -

Image
when using both pipes , map() function purrr, confused how data , variables passed along. instance, code works expect: library(tidyverse) cars %>% select_if(is.numeric) %>% map(~hist(.)) yet, when try similar using ggplot, behaves in strange way. cars %>% select_if(is.numeric) %>% map(~ggplot(cars, aes(.)) + geom_histogram()) i'm guessing because "." in case passing vector aes(), expecting column name. either way, wish pass each numeric column ggplot function using pipes , map(). in advance! cars %>% select_if(is.numeric) %>% map2(., names(.), ~{ggplot(data_frame(.x), aes(.x)) + geom_histogram() + labs(x = .y) }) there's few steps. use map2 instead of map . first argument dataframe you're passing it, , second argument vector of names of dataframe, knows map over. you need explicitly enframe data, since ggplot works on dataframes , coercible ob...

database - IF STATEMENT IN MYSQL INSERT is not working -

please, not understand why not working: set @key = (select customer.key_stamp customer customer.key_stamp = "0000"); case when (@key > 0) insert transaction (transaction.to, transaction.key, transaction.type, transaction.cost_bitcoin, transaction.quantity) values ("0000", "f5rwsd", 2, 0.0075, (500000 + ( (select bonus.amount bonus 500000 between bonus.min_quantity , bonus.max_quantity ) / 500000 ) * 100)) end; i tried case statement, still not work, , can't understand issue. please help. case not valid mysql statement. (it...

unix - sed command to find a pattern and replace with quotes -

how fina pattern below replace using sed command find (examples) "students": 98, "students": 17, "students": 200, "students": 21, replace "students": "98", "students": "17", "students": "200", "students": "21", if want put quotes around numbers, can use sed -e 's/([0-9]+)/"\1"/g' if want after "students": , can use sed -e 's/("students": )([0-9]+)/\1"\2"/g' -e means extended regular expression follows. s/ means substitution being made, / delimiter. \1 matches first parenthesized part of regex, , /2 matches second parenthesized part, etc. -g applies substitution every match found

inheritance - Receive class inherited from WCF Service when KnownType Class is in another project? -

i need receive class inherited through wcf service. <datacontract()> <knowntype(gettype(a))> public class base ... end class <datacontract()> public class inherits base ... end class the problem class in business logic project , references base class in project (util project). can't do: <knowntype(gettype(a))> in base class because need add reference business logic project util project know class a, throws cyclic reference error. and well, wcf project references business logic project send data. well, created class called 'pack' in business logic project , extends base in util project, 'pack class' can know class in business logic project , 'a class' extends 'pack class', , 'pack class' 1 send through wcf services.

html - django password_reset can not submit form -

i can not submit forms if extends top html,if delete {% extends 'accounting/password_reset_base.html' %}, form can submit , send email, please fix this, thanks {% extends 'accounting/password_reset_base.html' %} {% load static%} {% block headertitle_password %} forgot password ? {% endblock %} {% block passwordbase %} <div class="container"> <md-card> <div class="container_password"> <form method="post">{% csrf_token %} <div> <input id="id_email" maxlength="254" name="email" type="email" /> </div> <button type="submit" >reset password</button> </form> </div> </md-card> </div> {% endblock %}

pandas - python find columns whose values are approximately some values in a csv -

i have csv file looks following: coord,score 0.09,1.0 0.21,0.8 0.30,0.7 0.39,0.9 where 1st column represents coordinates in float, , 2nd kind of score. wonder if there way retrieve above scores @ specified coordinates, [0.1, 0.2, 0.3, 0.4]. notice there kind of fuzzy matching @ coordinates here. can assume such coordinates valid. is there python or pandas method capable of achieving this? code snippets helpful. thanks! update: manually checking 'coord' against expected coordinates, wonder if there python/pandas function doing so.

python - PyQt5 Matplotlib figure- update with user input -

Image
i new gui devolopment , trying develop app using pyqt5 in python. want show figure , few user widgets update figure through user input. below code: import sys pyqt5.qtwidgets import qapplication, qmainwindow, qsizepolicy, qwidget, qcombobox, qlabel, qradiobutton, qcheckbox, qgridlayout, qlineedit matplotlib.backends.backend_qt5agg import figurecanvasqtagg figurecanvas matplotlib.figure import figure import matplotlib mpl import matplotlib.pyplot plt import random import numpy np class app(qwidget): def __init__(self): super().__init__() self.left = 0 self.top = 800 self.title = 'chip2 torque data' self.width = 800 self.height =800 self.initui() def initui(self): self.setwindowtitle(self.title) self.setgeometry(self.left, self.top, self.width, self.height) l = qgridlayout(self) #hbox = mymplcanvas(self.main_widget, width=50, height=40, dpi=100) self.figure = plt.fig...

Python Post - keep getting response 400, but curl works -

i have simple python 3 script send post request delete project in sonarqube. while keep getting in python script, simple curl commands works... idea wrong python script? import requests headers = { 'authorization': 'basic ywrtaw46ywrtaw4=', } files = [ ('key', 'com.eclipseoptions.viewserver:viewserver:feature_vs-313-add-an-instruction-event-and-view'), ] r = requests.post('http://devsonar/api/projects/delete', headers=headers, files=files) print(r) the following curl command works fine: curl -x post -h "authorization: basic ywrtaw46ywrtaw4=" -f "key=com.eclipseoptions.viewserver:viewserver:feature_vs-313-add-an-instruction-event-and-view" "http://devsonar/api/projects/delete" python requests library. files option in post used upload file , don't think com.eclipseoptions.viewserver:viewserver:feature_vs-313-add-an-instruction-event-and-view file if so, have read file in binary mode ...

python - Try/Except Block causing ValueError -

for coding assignment create file read csv file, offer different attributes analysis on (determined column values. had code working perfectly, after added first try/except block started getting following error: traceback (most recent call last): file "/users/annerussell/dropbox/infotec 1040/module 8/csval.py", line 49, in row1=next(reader, 'end')[0:] valueerror: i/o operation on closed file. here link file can test if desired. guessed class assignment, , working on learning python gradschool anyway suggestions appreciated. import csv print('welcome csv analytics!') # file name , open file while true: try: file_name = input('enter name of file process: ') open(file_name, "rt") infile: # select attribute analyzed reader=csv.reader(infile) headers=next(reader)[0:] max=len(headers) except filenotfounderror: print('the file entered not found. please' \ ...

javascript - Meteor and React not output data correctly. -

so trying output data paint , getting [object,object]. tried adding .tostring() no luck. appreciated. i know means there objects inside of arrays don't know generating array and/or how reformat that. class paintpage extends component { constructor(props) { super(props); this.state = {}; this.handlesubmit = this.handlesubmit.bind(this); //brads cool } handlesubmit(e) { e.preventdefault(); paint.insert({ brand: this.refs.brand.value, color: this.refs.color.value, sheen: this.refs.sheen.value, room: this.refs.room.value }); } render() { var paintarr = paint.find().fetch(); paintarr.map((room, index) => <div classname="row"> <div classname="col-xs-2"> <li classname="list-group-item text-center" key={room}> {paintarr} </li> </div> </div> ); ...

node.js - Can I run VueJS and NodeJS or related apps on Server that doesn't have NodeJS installed? -

so i'm new vuejs , doesn't know npm, node, , other javascript apps. i wanted switch vuejs can take away jquery. been using adminlte projects before. i wanted use vue-admin since seems address of needs. however, have specific work area situations seems hinder learning vue , other js apps, these are: the workspace folder (development) i'm creating applications hosted in production server (windows server). i think nodejs isn't installed in server adobe coldfusion used. don't have local server, production server used when developing. question: will production server run app built vue-admin if production server doesn't have nodejs installed? (i have nodejs locally). i need use coldfusion logic of application, i'm using cfwheels right , vue-admin frontend , ux. possible? application i'm making closely related parts of erp system. any pointers on how this? yes can. need nodejs locally make development life bit easier. you can i...

ios - Get back to a view with the same directions that existed before -

well, guess 1 kinda big... i'm making app in there mapkit , button. when user clicks button, he/she open new viewcontroller several options of destinations go. after confirming 1 wants go, mapkit view reopen directions specific place. this, created function on viewcontroller linked mapkit view: func createmap(latit: double, longit: double){ //set what's going show in map mapview.delegate = self mapview.showsscale = true mapview.showspointsofinterest = true mapview.showsuserlocation = true //request authorization user location data storage locationmanager.requestalwaysauthorization() locationmanager.requestwheninuseauthorization() //if authorization given, use user location if cllocationmanager.locationservicesenabled(){ locationmanager.delegate = self locationmanager.desiredaccuracy = kcllocationaccuracybest locationmanager.startupdatinglocation() } //set source , destination coordinates of di...

command line - How do I use Headless Chrome in Chrome 60 on Windows 10? -

i've been looking @ following article headless chrome: https://developers.google.com/web/updates/2017/04/headless-chrome i upgraded chrome on windows 10 version 60, when run either of following commands command line, nothing seems happen: chrome --headless --disable-gpu --dump-dom https://www.google.com/ chrome --headless --disable-gpu --print-to-pdf https://www.google.com/ and i'm running of these commands following path (the default installation path chrome on windows): c:\program files (x86)\google\chrome\application\ when run commands, seems process second, don't see anything. doing wrong? thanks. edit: as noted mark rajcok, if add --enable-logging --dump-dom command, works. also, --print-to-pdf command works in chrome 61.0.3163.79, you'll have specify different path output file in order have necessary permissions save it. as such, following 2 commands worked me: "c:\program files (x86)\google\chrome\application\chrome" --headl...

numpy - Is there a built-in method for checking individual list indices in Python -

python has built in functionality checking validity of entire slices: slice.indices . there similar built-in individual indices? specifically, have index, a = -2 wish normalize respect 4-element list. there method equivalent following built in? def check_index(index, length): if index < 0: index += length if index < 0 or index >= length: raise indexerror(...) my end result able construct tuple single non- none element. using list.__getitem__ check me, seems little awkward/overkill: items = [none] * 4 items[a] = 'item' items = tuple(items) i able do a = check_index(a, 4) items = tuple('item' if == else none in range(4)) everything in example pretty negotiable. things fixed getting a in way can have of problems arbitrary index can have , final result has tuple . i more happy if solution used numpy , applied numpy arrays instead of python sequences. either 1 perfect application have in mind. if understand co...

solidity - How to detect if an ethereum address is an ERC20 token contract? -

if ethereum address input, there anyway find out whether match erc20? there many possible ways achieve this. 1 possible quick , dirty solution check if erc20 function exists on contract address calling following: eth.call({to:contractaddress, data:web3.sha3("balanceof(address)")}) a non-erc20 return 'null' 0x hex response whereas erc20 give 32byte uint , in case 0 if provide address in data give actual token balance address. this not guaranteed way of determining contract erc20 since other contracts may expose same function, quick , easy check. add additional calls on totalsupply() etc. more confirmation.

emacs - c-mode single quote fontification -

i noticed single quotes being font-locked warning face, throwing off fontification of entire buffer. know why is happening? example, #include <stdio.h> int main(int argc, char *argv[]) { if ( getc( stdin ) == '\n' ) //why ^ getting font-lock-warning-face? ; return 0; } version info: emacs 26.0.50, semantic version 2.2. started emacs -q , enabling semantic mode, m-x semantic-mode in buffer.

c# - Searching for fields that contains the search term -

i did studies on lucene search queries , searched internet answers on how this... couldn't find method works , attempts failed, not returning want. basically, i've field on database, ids concatenated comma, these fields umbraco document properties. for instance, let's i've these entries these fields: entry 1: relatedcontents: 500,700 entry 2: relatedcontents: 500 my search query fields have value 500, of now, returns entry 2, when use wildcard term using value 500*, returns both of them. fine, problem when searching not begging of value. when search 700, doesn't return entry 1 , wildcard searches on lucene doesn't allow * @ begging of search term. it looks query searching values has search term. if there way make query, in analogy, 1 use .contains() search substring in string solve problem, think. the leading wildcard not supported in lucene design ( reference ) if website not complicated , can sure performance not issue, can enab...

javascript - Smooth scrolling from one page to a specific section in another page -

i building website in homepage has contact form section , other pages don't have it. using jquery, made sure when user click on contact link in navbar on homepage, page scroll down contact form section. let's user on page , clicks on contact link, want website take user homepage , scroll down contact form section. possible?? thanks answers. you can scroll down target using id's , scroll function script below. <script> $(document).ready(function(){ // add smooth scrolling links $("a").on('click', function(event) { if (this.hash !== "") { // prevent default anchor click behavior event.preventdefault(); var hash = this.hash; $('html, body').animate({ scrolltop: $(hash).offset().top }, 800, function(){ // add hash (#) url when done scrolling (default click behavior) window.location.hash = hash; }); } }); }); </script> you can scroll do...

NetInfo in react-native is returning isConnected as false even when network is connected -

we using react-native netinfo in following way. export default class networkstatus extends react.purecomponent { constructor(props){ super(props); netinfo.addeventlistener( 'change', this.onconnectivitychange ); } onconnectivitychange = (status) => { netinfo.isconnected.fetch().then(isconnected => { console.log('*********network status ' + (isconnected ? 'online' : 'offline')); }); } launched app in offline mode. got following console. *********network status offline. then turned on wifi , connected. got offline console twice. *********network status offline. *********network status offline. is bug in netinfo library. there way fix it. versions used : "react": "16.0.0-alpha.6" "react-native": "0.44.0", i had given answer in else's question the link here:- here please refer if like.

statistics - SAS stdi output clarification -

Image
i'm attempting convert old sas macros python, , bit unclear of terminology used in sas. in macro, proc statement is proc reg data=model_file; model &y = &x; output out=&outfile r=resid stdi=resid_error; i understand r means individual residual per data point, unclear stdi meant. according sas manual, stdi means "standard error of individual predicted value", there 1 stdi each row in dataset. searched around bit , found lecture slide university of wisconsin believe explains how calculate stdi : however, 2 (edit: one) questions remain: is method calculating standard error of individual prediction in lecture slide indeed correct? i've never seen method before still have doubts. i've looked sas manual, definition stdi bit confusing: . specifically, h(i) defined don't know bar after [x'x] supposed mean. the way standard error of individual predictions calculated here utilizes x . however, happens if have run regress...

data file is not including the last line in python -

when run code dumps 'values.dat' file after when try load these data variable can proceed further calculation....the variable c loading data the last line. fs=glob.glob('*all_strain_rate_data_files/srate*.txt') fil in fs: sr=float(fil.split('srate')[1].split('.txt')[0]) xy=loadtxt(fil) y=xy[:,1] avg=mean(y) n_f= open('values.dat' , 'a') n_f.writelines(str(sr)+'\t'+str(avg)+'\n') n_f.close c = loadtxt('values.dat') print c the .dat file has following data 0.001 -0.000476901658291 0.005 -0.000459584857803 0.01 -0.000455371401619 0.02 -0.000454457184105 0.03 -0.000363427058283 0.04 -0.000425998443982 0.05 -0.000479518449808 0.06 -0.00044039265987 0.07 -0.000428992925364 0.08 -0.000479521006314 0.09 -0.000346052124686 0.5 -0.000419424003512 , print of c ........gives [[ 0.001 -0.0004769 ] [ 0.005 -0.00045958] [ 0.01 -0.00045537...

git - Why Youtrack is not closing an issue by commit message? -

i have installed youtrack standalone pc. , added gitlab project it. created issue testing id #bdx-1 in youtrack. when pushed commit message "youtrack test commit #bdx-1 fixed" youtrack didn't closed issue automatically. attached gitlab commit in vcs changes section manually. didn't worked. then installed upsource too, , wanted connect youtrack. try failed. tried install external hub , connect both upsource , youtrack it. upsource failed error http 403 , youtrack not migrated because of: hub provides single sign-on , shared user management in jetbrains web-based products.youtrack uses hub authentication, authorization, , user management, when installed alone. if hub integration disabled, following features not available: ldap/oauth/google authentication, captcha, , part of user registration settings. the following deployment models supported: — preconfigured hub instance embedded in youtrack distribution works right away after in...

VSFTPD, same user account, different behavior -

Image
i set vsftpd on centos 6.9 machine. username: mp100d home directory: /home/mp100d/ftp in vsftpd.conf , set local_root as: local_root=/home/mp100d/ftp and created tow subdirectories: /home/mp100d/ftp/inbox , /home/mp100d/ftp/outbox , , assigned rwx right: chmod -r 777 /home/mp100d/ftp first, used ftp in cmd.exe test ftp, , looks fine, switch different directories, here vsftpd.log connect: client "172.18.0.210" ftp response: client "172.18.0.210", "220 (vsftpd 2.2.2)" ftp command: client "172.18.0.210", "opts utf8 on" ftp response: client "172.18.0.210", "200 in utf8 mode." ftp command: client "172.18.0.210", "user mp100d" [mp100d] ftp response: client "172.18.0.210", "331 please specify password." [mp100d] ftp command: client "172.18.0.210", "pass <password>" [mp100d] ok login: client "172.18.0.210" [mp100d] ftp response:...

osx - How to fix node.js on macOS write to file permission denied error? -

i set node.js write file on local folder such: note: have use sudo chmod 755 req.txt , sudo chmod 755 bodyhead.txt set permission of file writable. fs.writefile('/req.txt', req + '\r\n!ended!\r\n', function(err) { if(err) { return console.log(err); } }); fs.writefile('/bodyhead.txt', bodyhead + '\r\n!ended!\r\n', function(err) { if(err) { return console.log(err); } }); and received: { error: eacces: permission denied, open '/req.txt' errno: -13, code: 'eacces', syscall: 'open', path: '/req.txt' } as as { error: eacces: permission denied, open '/bodyhead.txt' errno: -13, code: 'eacces', syscall: 'open', path: '/bodyhead.txt' } i set node.js write file on local folder... but you're not writing local folder, you're writing root of filesystem: fs.writefile('/req.txt', ... ^ root of filesystem instead, remo...

python 3.x - PyPDF2 returns only empty lines for some files -

i working on script "reads" pdf files , and automatically renames files recognizes dictionary. pypdf2 returns empty lines pdfs, while working fine others. code reading files: import pypdf2 # file name file = 'sample.pdf' # open file open(file, "rb") f: # read in file pdfreader = pypdf2.pdffilereader(f) # check number of pages number_of_pages = pdfreader.numpages print(number_of_pages) # first page pageobj = pdfreader.getpage(0) # extract text page 1 text = pageobj.extracttext() print(text) it number of pages correctly, able open pdf. if replace print(text) repr(text) files doesn't read, like: "'\\n\\n\\n\\n\\n\\n\\n\\nn\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n'" weirdly enough, when enhance (ocr) files adobe, script performs worse. recognized 140 out of 800 files , after enhancing 110. the pdfs machine readable/searchable, because able copy/paste text notepad. tested files "...

python - Django: Is there a way to move from a GET request to a POST request if the requested data is not found? -

i making weather api using django user calls like: http://127.0.0.1:8000/weather/<latitude>,<longitude> my application supposed query database , return data if found. if data not present or outdated, app create or modify entry accessing 3rd party weather api pull relevant data. right now, i'm using get_or_create() function within get function in views.py accomplish this. i've read, doing bad practice , database modification should done post or put. i'm uncertain if can or if approaching problem in wrong direction. app doesn't said should do, create entries if don't exist. what want app jump post/put after determining entry needs created or updated. views.py def get(self, request, *args, **kwargs): # process latitude , longitude coordinates url coordinates = kwargs.pop('location', none).split(",") latitude = coordinates[0] longitude = coordinates[1] # retrieve location latitude , longitude #...

pycaffe - Getting different accuracies using different caffe classes(98.65 vs 98.1 vs 98.20) -

when train , test model using caffe's command line interface, e.g. 98.65% whereas when myself write code(given below) calculate accuracy same pre-trained model, e.g 98.1% using caffe.net . straight forward , have no idea causing issue. tried using caffe.classifier , predict method, , yet lesser accuracy(i.e. 98.20% !) here snippet of code wrote: import sys import caffe import numpy np import lmdb import argparse collections import defaultdict sklearn.metrics import classification_report sklearn.metrics import confusion_matrix import matplotlib.pyplot plt import itertools sklearn.metrics import roc_curve, auc import random if __name__ == "__main__": parser = argparse.argumentparser() parser.add_argument('--proto', help='path network prototxt file(deploy)', type=str, required=true) parser.add_argument('--model', help='path caffemodel file', type=str, required=true) parser.add_argument('--mean', hel...