Posts

Showing posts from February, 2012

javascript - Syntax for retrieving data from GET, Host: function using APIs -

i using price api. on developer guide, request example iphone 6 shown : get /api/v1/compare/search?product=iphone%207&api_key=your_api_key http/1.1 host: https://price-api.datayuge.com i have api key, how should use in order retrieve data (json format). use $.ajax() , $.getjson() or else completely? this website explains different formats, not understanding how put together:

android - How do I change the position of my new Activity (Display Metrics) -

edit: application's interface i've created pop-up window , class when click oninfowindowclick in google maps, pop-up window appear or next activity appear. used display metrics shows in center screen. what want happen is: when activity shows up, show in upper-top or @ least have power change position of activity in part of window. my problem: display metrics shows activity in center. my codes in pop-up window: public class popup extends appcompatactivity { @override protected void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.pop_layout); displaymetrics dm = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(dm); int width = dm.widthpixels; int height = dm.heightpixels; getwindow().setlayout((int)(width*.8),(int)(height*.5)); } } note: there method this? can give me link on how it. (only if there method it)

Serilog Appsettings and setting filters -

using serilog.settings.appsettings project having difficulty setting filter exclude namespaces configured sink. in code this: [...].filter.byexcluding(matching.fromsource<mynamespace>()) however don't seem able using app settings. is supported , if how can achieve using configuration? thanks vincent

c# - Entity framework excluding list of objects -

i have object , should exclude values before showing search result. iqueryable<tbperson> dataset =context.tbperson; if (!includeirrelevant) { dataset = dataset.where(p => p.tbinfo.relevant); //here have result including column relevant 'true' } else if(enumvalue =! 3)//if not 3 exclude search result { list<tbperson> sellerlist = dataset.where(p=>p.enumcolumn == 3); //here records has enum type 3 var ids = sellerlist.select(x => x.id).toarray(); dataset = dataset.where(x => !ids.contains(x.id)); //trying this, dont know if works, come result //it works!! other elegant solutions expected! } i tried not figure out exact query exclude 'sellerlist' 'dataset' has search results. want dataset-sellerlist. in advance. else if(enumvalue =! 3)//if not 3 exclude search result { dataset = dataset.where(x => x.enumcolumn != 3); }

Apache Multiple Domains 1 IP Multiple Certificates -

i have multiple domains (about 200) pointing server (1 ip). of these domains have ssl certificate. however, problem in vhost config file. i can redirect http https , have relative long host config our webapp , need take certificate host name. i've read there no way because hostname posted in ssl post , need handshake before getting hostname. how can apache pick right vhost specified hostname? there must way take hostname dynamically , put in file_path of ssl certificate? any body suggestions?

rabbitmq - why I need to add hostname to docker when creating a volume -

i'm creating rabbitmq container -v option add volume, weird part if don't add --hostname container no getting information of volume, example: i create volume this: docker volume create --name rabbit later verify volume created docker volume ls then create container this: docker run --name rabbitprueba -p -p 55555:15672 -d -v rabbit:/var/lib/rabbitmq rabbitmq:3.6.10-management i enter localhost:55555 , enter user , password, create simple queue, return machine , stop , remove container: docker stop rabbitprueba docker rm rabbitprueba when run same command: docker run --name rabbitprueba -p -p 55555:15672 -d -v rabbit:/var/lib/rabbitmq rabbitmq:3.6.10-management the queue created gone if repeat same steps (stop container , remove it) , add command --hostname queue not removed: docker run --hostname rabbitprueba --name rabbitprueba -p -p 55555:15672 -d -v rabbit:/var/lib/rabbitmq rabbitmq:3.6.10-management why happening?, doing wrong?, thanks in adv

How does sciter let python open firefox? -

i know sciter. have sciter-python tutorial here. so can me simple example? i wrote code in python. if __name__ == '__main__': frame = sciter.window(ismain=true, uni_theme=true) frame.load_file("minimal.html") frame.run_app() then have html <!doctype html> <html> <head></head> <body> <input type="checkbox" name="boll" value="">check </body> </html> if checkbox selected, python opens firefox. should do? thankyou

mysql - Is there an optimal/efficient way to compare multiple rows for similarity/difference? -

i trying compare list of values - objective work out total difference/similarity between items, , grade items how similar each other along several criteria, measured swing default (0). the criteria value ever varies between -8 , +8 (or null if not specified). example: colour: flavour: temperature: item a: -4 2 5 item b: 3 0 3 item c: 2 -3 1 so work out difference between items , c: colour (2 - -4) = -6, flavour (-3 - 2) = -5, , temperature (1 - 5)=-4. -6 + -5 + -4 = gives score of 15. assume abs() used standardise differences before getting item total / score. i'll simplify problem bit leaving off of maths - main issue here score, , number of criteria matched, each row. please give problem thought before looking @ current solution, avoid preconceptions: http://sqlfiddle.com/#!9/11c0f/1 is there nicer way of doing it, i'm ignorant of? potentially there a

arrays - Mapping string values to properties' values in c# -

i'm newbie in c# , have 1 question i have class model this: public class sdview { public int viewpk { get; set; } public string code { get; set; } public string name { get; set; } public string conceptorder { get; set; } } the last property, conceptorder contains string of numbers, each number needs mapped different property value... example: being conceptorder = "1,2,3,5,4" public class item { public string warehouse { get; set; } //concept 1 public string commodity { get; set; } //concept 2 public string variety { get; set; } //concept 3 public string packstyle { get; set; } //concept 4 public string size { get; set; } //concept 5 } what need write method or function returns (based on above example) "warehouse01 bellpepper green jumbo 7x1" conceptorder can in order, every number mapped property (1 warehouse... 2 c

c++ - strcpy_s not working with gcc -

i have c++11 project, , added strcpy_s method calls. works on windows, when compiling on gcc, there error stating strcpy_s symbol not found. i did add line #define __stdc_want_lib_ext1__ 1 to code, no avail. gcc (or rather, glibc) not support strcpy_s() , friends. ideas on can find library support them, see here: are there free implementations of strcpy_s and/or tr24731-1?

amazon web services - AWS Cloudfront does not forward Accept-Language header -

i've created cloudfront distribution deliver couple of pages may change according user language. both pages being served ec2 instance elb in front of them. my cloudfront origin elb , works expected regarding cache default behavior. although, need cache pages according user's accept-language header. that, created custom header whitelist, included accept-language header...but not work @ all. i've tried multiple configurations no success. if request page directly through elb address works expected, every time use cdn address accept-language header gets removed in between. idea of going on here? cloudfront removes header if don't configure cloudfront cache based on header values how configure cloudfront cache based on header values

sql server - Sql query times out. But, after renaming any index it works -

we have query, worked during years. a few months ago started giving timeouts. however, if rename index (adding character name) , run query again, works. day after day have same. every day rename index, query works again. what's problem? how can solve issue? how renaming index solve time out problem? these symptoms suggest suboptimal cached query plan being used due parameter sniffing. renaming index voids cached plan new 1 generated upon next use optimal query parameter values. parameter sniffing can avoided going forward query hint option(recompile) or option(optimze for...) described in sql server documentation .

sql - C# get only top 10 highest selling items in database and put it to chart -

hi have code select products sales database , put chart, selecting products. how can 10? and should query if need opposite top 10 least selling products? code: private void loadchart() { chart1.series[0].points.clear(); chart1.chartareas["chartarea1"].axisx.interval = 1; using (sqlconnection connection = new sqlconnection("data source=benjopc\\sqlexpress;initial catalog=marischelldatabase;integrated security=true")) { sqlcommand command = new sqlcommand("select productname, sum(qtysold) qtysold sales_productholder group productname", connection); connection.open(); sqldatareader read = command.executereader(); while (read.read()) { this.chart1.series["pieces sold"].points.addxy(read["productname"], read["qtysold"]); } read.close(); } } try this: select top 10 productname, sum(qtysold) qtysold sales_productholde

MySQL: Average rating per item, using latest rating for user -

i have items_ratings table follows: items_ratings +----+--------+---------+---------+---------------------+ | id | rating | user_id | item_id | created (datetime) | +----+--------+---------+---------+---------------------+ | 1 | 20 | 1 | 12 | 2017-07-12 14:00:04 | | 2 | 80 | 2 | 12 | 2017-07-12 15:32:12 | | 3 | 50 | 1 | 15 | 2017-08-01 11:14:04 | | 4 | 90 | 1 | 12 | 2017-08-02 19:23:19 | | 5 | 60 | 2 | 15 | 2017-08-05 19:23:19 | +----+--------+---------+---------+---------------------+ i need retrieve average value per item_id , using each user's recent rating. the following gives me average rating each item: select avg(rating) items_ratings group item_id i have identified following query gives me recent row each user_id , item_id . select max(created), user_id, item_id items_ratings group user_id, item_id; i unsure of how should combine these queries yield desired result. y

android - onTouchListener detecting wrong dynamically created cardview -

i have learnt how create cardview dynamically. i'm using button press create cardview , have set ontouchlistener it. when i'm creating 1 card ontouchlistener working i'm creating 1 more card ontouchlistener isn't working expected. when have 2 cards , try move 1st card it's moving 2nd 1 instead of 1st. public class mainactivity extends appcompatactivity implements navigationview.onnavigationitemselectedlistener { context context; imageview imageview; relativelayout relativelayout; static int pos=0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); context=this; relativelayout=(relativelayout)findviewbyid(r.id.rl_layout); drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); actionbardrawertoggle toggle = new actionbardrawertoggle(

delphi - Cannot use FireDAC with RAD studio 10.2 release 1 -

i've updated rad studio 10.2 recent 10.2.1 release. now, when compile working program, error : [dcc32 fatal error] testform.pas(7): f2051 unit firedac.stan.error compiled different version of firedac.stan.resstrs.s_fd_pgunsuptexttype. it's easy reproduce on empty project : insert tfdphysmysqldriverlink or tfdmssqldriverlink firedac component on form , same error. could me ? --- edited --- i've kept rad 10.1 berlin installed seems paths separated between both installs (18.0 versus 19.0 directories). i've installed rad 10.2.1 yesterday , i've not changed system path. working rad 10.2... the compiler path of test project (see above) empty. here "tools/options/delphi options/library/library" paths : $(bdslib)\$(platform)\release $(bdsuserdir)\imports $(bds)\imports $(bdscommondir)\dcp $(bds)\include here related delphi environment variables : $(bdslib) == h:\program files (x86)\embarcadero\studio\19.0\lib $(bdsuserdir) == h:---cc

wpml - wpml_object_id "return NULL if translation missing" not working -

i believe wpml filter not working , there no solution other wait bug fix. following code returns null despite translation existing post id 537: $id = apply_filters( 'wpml_object_id', 537, 'post', false, 'en' ); var_dump($id); by counts, should return post id of translation. returns null. has had similar experiences? not run other plugins except acf. https://wpml.org/wpml-hook/wpml_object_id/

node.js - Socket.io connection with transport=polling is failing in one off cases -

i using socket io koa. nginx load balancer. if not wrong, socket.io starts transport=polling , subsequently socket connection upgraded websocket connection. most of socket.io users repeat visitors, long return force new connection passing io.connect("url", {forcenew: true}) this approach works fine in majority of cases. but in specific cases nginx reverse proxy reports cannot connect socket io with 2017/xx/xx 11:26:20 [error] 21340#21340: *xxxx212 connect() failed (111: connection refused) while connecting upstream, client: 32.xx.xx.314, server: webosocket.localhost,com request: "get /socket.io/?eio=3&transport=polling&t=xxxxxxxxxxxxx-29094 http/2.0", upstream: " http://127.0.0.1:1200/socket.io/?eio=3&transport=polling&t=xxxxxxxxxxxxx-29094 ", host: "webosocket.localhost,com", referrer: " http://localhost:8181/ " is there way debug why transport=polling failing in cases, not in majority of cases?

ibm mq - Connecting IBM MQ queue using F5 virtual ip and C++ -

i trying connect ibm mq queues using c++. these queues have been defined under different manager queues in different servers. idea connect vip balance workload pointing each server. the problem have using cmqc.h libraries, , in order connect have make use of mqconn or mqconnx , need queue manager name, cannot know @ moment of connection don´t know 1 used due f5 balancer. the code using example following: #include <cmqc.h> #include <cmqxc.h> #include <string.h> #include <stdio.h> #include <sstream> #include <stdlib.h> int main() { mqhconn connectionhandle; mqhobj m_sourcequeue; mqlong completioncode = 0; mqlong reasoncode = 0; setenv("mqserver","system.def.svrconn/tcp/<server_ip_address>(56245)",1); mqconn(<queue_manager_name>, &connectionhandle, &completioncode, &reasoncode); if(mqcc_ok != completioncode) { printf ("%s \n", "

How to add extra tears(ticks) in highcharts? -

high charts in addition this question, ask question here in thread. how add tears(ticks), in such way, green bar datalabel, stay inside plotting area, rather, going out of plotting area or made hidden. jsfiddle there lots of ways this. quickest 1 adding max value yaxis using yaxis.max . yaxis: { allowdecimals: false, max: 6000 }, here working example: jsfiddle . or you can use combination of yaxis.tickamount , yaxis.tickinterval this; yaxis: { allowdecimals: false, tickamount: 10, tickinterval: 1000 }, here working example: jsfiddle .

dataframe - How to loop through columns in data.table in R -

this problem bothered me whole weekend. want count number of '1's in column based group of column. want loop through many columns, , example giving here simple case. think dt1 , dt2 should give me same result, dt1 doesn't work. can tell me reason this? thank you! dt <- data.table(sample.name = c("a","b","c","a","a","b"), class1 = c(1, 0, 1, 0, 1, 0), class2 = c(1, 1, 1, 0, 1, 1)) round.test <- colnames(dt) round.test <- round.test[c(2, 3)] round.test <- noquote(round.test) dt1 <- dt[, sum((round.test[1]) == 1), = sample.name] dt2 <- dt[, sum(class1 == 1), = sample.name] starting character vector of column names, can use get have column value: round.test <- colnames(dt) round.test <- round.test[c(2, 3)] dt[, sum(get(round.test[1]) == 1), .(sample.name)] # sample.name v1 #1: 2 #2: b 0

visual studio - MICROSOFT ACCOUNT lacks permission to complete this action. You need to have 'ReadPackages' -

i getting following error in in visualstudio.com when accessing nuget feed: {"$id":"1","innerexception":null,"message":"4d90beec-a2e5-4f8f-8108-23480a7b53f8\ microsoft-account lacks permission complete action. need have 'readpackages'.","typename": "microsoft.visualstudio.services.feed.webapi.feedneedspermissionsexception, microsoft.visualstudio.services.feed.webapi", "typekey":"feedneedspermissionsexception","errorcode":0,"eventid":3000} set correct access level in tfs. default access level set “stakeholder”. https://blogs.msdn.microsoft.com/tfssetup/2016/12/06/tfs-2017-nuget-publisher-task-fails-with-401-unauthorized-exception/ more information here: https://github.com/microsoft/vsts-tasks/issues/4319

python - Put N points into M equal bins -

i have array n (positive) points. find m bin edges of histogram such bars have same height. in other words want find m+1 points such count of array points between 2 consecutive bin edges same. example >>> array = [0.3 0.3 0.3 0.7 0.8 0.9] >>> m = 2 >>> binpartition(array, m) [0, 0.5, 1] i appreciate answer in python , numpy link known algorithm suffice! thank you! :) than can done percentile : import numpy np def binpartition(array, m): return np.percentile(array, np.linspace(0, 100, m + 1)) binpartition([0.3, 0.3, 0.3, 0.7, 0.8, 0.9], 2) >>> array([ 0.3, 0.5, 0.9])

go - Unmarshal json to reflected struct -

is possible unmarshal json struct made reflection without hardcoding original type? package main import ( "fmt" "encoding/json" "reflect" ) type employee struct { firstname string `json:"firstname"` } func main() { //original struct orig := new(employee) t := reflect.typeof(orig) v := reflect.new(t.elem()) //reflected struct new := v.elem().interface().(employee) // unmarshal reflected struct json.unmarshal([]byte("{\"firstname\": \"bender\"}"), &new) fmt.printf("%+v\n", new) } i used cast employee in example. if don't know type? when use v unmarhaling struct zeroed. json.unmarshal([]byte("{\"firstname\": \"bender\"}"), v) when omit cast map. understandable json.unmarshal([]byte("{\"firstname\": \"bender\"}"), v.elem().interface()) the problem here if omit type assertion here:

c++ - template specialization for derived classes -

i have template class (that cannot modify), let's call someclass , i'd specialize classes derive particular class only. following this answer able in gcc 6.3.1, unfortunately need in gcc 4.9.2, , there fails @ compile time saying "partial specialization someclass<t> not specialize template arguments" . is there way change below make work gcc 4.9.2? #include <iostream> #include <string> using namespace std; struct { string name() { return "a"; } }; struct b : { string name() { return "b"; } }; struct c { string name() { return "c"; } }; template<typename t, typename = std::enable_if_t<std::is_base_of<a, t>::value>> using enable_if_a = t; template<typename t> struct someclass { using type = t; }; template<typename t> struct someclass<enable_if_a<t>> { using type = a; }; int main(int, char**) { someclass<a>::type el1; someclass<

c++ - Qt Create with menubar and toolbar in a separate class file -

i create gui using qt creator, , have started normal qt application desktop project. prevent "mainwindow" class-files getting large, break out menubar , toolbar in separate class. new qt, , though have searched high , low on google, haven't been able find suitable example. working in qt 5.8. what have is: main.cpp: #include "mainwindow.h" #include <qapplication> int main(int argc, char *argv[]) { qapplication a(argc, argv); mainwindow w; w.show(); return a.exec(); } mainwindow.h #ifndef mainwindow_h #define mainwindow_h #include "mwmenubar.h" #include <qmainwindow> namespace ui { class mainwindow; } class mainwindow : public qmainwindow { q_object public: explicit mainwindow(qwidget *parent = 0); ~mainwindow(); private: ui::mainwindow *ui; }; #endif // mainwindow_h mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include "mwmenubar.h"

php - My query returns null result if the field contains a special character -

i made simple query in sql server php select top 10 * art articulo = 'name'; and 1 of fields need read returns null if data contains spanish character. work random characters, not null values. causing them? the collation of db modern_spanish

ios - Using an enum to execute a function? -

i want call function in viewdidload() in view controller set behavior of view controller's status bar. want status bar have 3 behavioral states: regular, stay light, stay dark. // view controller view did load override func viewdidload() { super.viewdidload() // status bar behavior // call function setneedsstatusbarappearanceupdate() } i don't have experience enums please tell me how accomplish i'm trying accomplish. ultimately, want call 1 function in viewdidload() depending on behavior of status bar want view controller (regular, stay light, stay dark). enum statusbarbehavior { case regular case staylight case staydark func statusbar() { switch self { // changes status bar depending on variable case .regular: if nighttime == true { uiapplication.shared.statusbarstyle = .lightcontent } else { uiapplication.shared.statusbarstyle = .default

Changing p-value when using elrm in r -

i new user r , perform exact logistic regression. have chosen method because dependent variable binary (i.e. 0 failure , 1 success), , have continuous independent variables. have small sample size of n=10. following sample of code have written. library(elrm) baselinesteps = c(4202, 7244, 4374.6, 2965.6, 4263.5, 1814.1, 3243.1, 3102.9, 4652.5, 6324.9) stepsclass = c(1, 0, 1, 1, 1, 1, 1, 1, 1, 1) const = rep(1,length(stepsclass)) dat = data.frame(pred = baselinesteps, trials = const, success = stepsclass) m.stepsfromsteps = elrm(formula = success/trials ~ pred, interest = ~pred, iter = 22000, dataset = dat, burnin = 2000) i trying use baseline average steps/day taken subject determine class of recovery pattern fall (0 or 1). however, when run last line elrm implemented (changing nothing), obtain drastically different p-values every time run it. see following: > m.stepsfromsteps = elrm(formula = success/trials ~pred, interest = ~pred, iter=30000, dataset = dat, burnin=5000)

c# - Select list population based off of other select list -

i'm in bit of pickle rick , need help. below code select lists in form. need certification list populate based off of category pick category list. how work? code: // get: int_certificationsxref/create public iactionresult create() { viewbag.fullname = userinformation.globals.fullname; viewdata["int_certificationcategoriesid"] = new selectlist(_context.int_certificationcategories, "id", "category"); viewdata["int_certificationconferredid"] = new selectlist(_context.int_certificationconferred, "id", "conferredby"); viewdata["int_certificationsid"] = new selectlist(_context.int_certifications, "id", "certification").where(i => i.categoryid = viewdata["int_certificationcategoriesid"]); viewdata["rim_resourceid"] = new selectlist(_context.rim_resource, "id", "firstname"); return view(); } you can filter list list b

javascript - JQUERY - JSON Result assign it to pre populate form fields on when select is selected -

i have requirement form business save searches, allowing users use saved search data , rerun search. have saved search in database json object. problem when users select saved search via using select - dropdown, form should pre populates selections saved search. when trying alert key value within populate function - show key 0 , value whole json object. missing here ? sample of returned json request database looks like: {"affects":["153","503","537"],"suspect":["101","108"],"state":[],"zip_code":[],"analysis_date_max":["",""],"last_modified_date_min":["",""]} here existing code: //start of problem code function populate(frm, data) { var obj = $.parsejson(data); //alert (data); //alert (frm); alert (obj); $.each(obj, function(key, value){ alert(key + ' ' + value);

ios - Load Single HTML Element in WKWebView -

i'm able html url , load in wkwebview, i'm wanting load single element html. in case, element aside, <aside class="col-sm-4 col-md-3 col-lg-3 sidebar"> my code getting of html. func gethtmlstring() -> string? { let urlstring = "https://kyfb.com/\(county)" guard let countyurl = url(string: urlstring) else { return nil } { let htmlstring = try string(contentsof: countyurl, encoding: .isolatin1) return htmlstring } catch let error { print("error: \(error)") return nil } } the specific url i'm trying https://kyfb.com/jefferson . there aside there has i'm wanting show. extracting element html code downloaded easy: guard let html = gethtml() else { return } let regex = try! nsregularexpression(pattern: "<aside class=\"col-sm-4 col-md-3 col-lg-3 sidebar\">([\\s\\s]*)&

Accessing data in a php multi-dimensional array -

i have multi-dimensional array , php seems returning array instead of value when attempt access values directly. doing cause this? the array looks (via print_r): array ( [12] => array ( [2016] => 93083.00 [2015] => 85367.00 [2014] => 69726.00 ) [11] => array ( [2016] => 66730.00 [2015] => 65548.00 [2014] => 77936.00 ) [10] => array ( [2016] => 84602.00 [2015] => 112070.00 [2014] => 102104.00 ) ) i'm trying access values using $arrayname[12][2016] returning array[2016] instead of 93083 . is simple syntax mistake? or missing part of concept here? i've been trying work problem hours maybe i'm missing simple explanation. edit: syntax above correct, issue in data entry: trying access key didn't exist. tried delete post, can't since has been answered. $arrayname[12] = [2016=>93083.00, 2015=> 85367.00 ] ... ... echo $arrayname[12][2015] ; // prints 85367 i think array has 1 more leve

c# - Trying to troubleshoot Web API Route Issue -

i have application had working routes several web api controllers. suddenly, when switching between branches, routes fail in branches, work in others. when looking @ files (i think in play): web.config, webapiconfig.cs, gobal.asax , controllers themselves, none of files change in working/non-working branches. my question is: there other files in play should looking @ and/or how can see files changing when visual studio it's git calls while changing branches? when looking @ source tree , compare working branch non-working branch, see no differences should causing issue.

reactjs - Add custom HTML attributes with no value to JSX -

i have html needs custom attributes no value dependent on situation.. example these valid: <div classname="playlist-row" selected> <div classname="playlist-row" active> <div classname="playlist-row"> i tried doing like let customattr = {'active'}; // incorrect syntax let customattr = {'active': true}; //doesn't work let customattr = {'active': ''}; //doesn't work <div classname="playlist-row" {...customattr}> any ideas of how can work? i believe should - in render() function: render() { let customattr = "active" return ( <div classname={"playlist-row " + customattr}> ) } or alternately, avoid string concatenation... <div classname={`playlist-row ${customattr}`}>

pandas - Label points in dataframe Python -

Image
i label data points in pandas x axis value. , trying apply solution code: annotate data points while plotting pandas dataframe i'm getting error saying: attributeerror: 'pathcollection' object has no attribute 'text' here's code: def draw_scatter_plot(xaxis, yaxis, title, xaxis_label, yaxis_label, save_filename, color, figsize=(9, 7), dpi=100): fig = plt.figure(figsize=figsize, dpi=dpi) ax = plt.scatter(xaxis, yaxis, c=color) plt.xlabel(xaxis_label) plt.ylabel(yaxis_label) label_point(xaxis, yaxis, xaxis, ax) plt.title(title) fig.savefig(save_filename, dpi=100) # label code https://stackoverflow.com/questions/15910019/annotate-data-points-while-plotting-from-pandas-dataframe/15911372#15911372 def label_point(x, y, val, ax): = pd.concat({'x': x, 'y': y, 'val': val}, axis=1) i, point in a.iterrows(): ax.text(point['x'], point['y'], str(point['x'])) any

error when handling iOS dynamic link for firebase -

i have implemented function generating firebase ios dynamic link deep link, bundle id , app store id (using whatsapp testing case) in server. i can trigger redirection when app installed (reading deep link). however, deep link used redirection when app not yet installed. app store id never triggered. there possible reason behind? couple ideas may debug case. behavior of firebase dynamic links may differs depending in ios app link being tapped. baseline, suggest starting posting link ios notes app , tapping on link notes app. when case works, can move test link in other apps, safari, facebook, whatsapp etc. if ios app not installed, firebase dynamic link (in case) should navigate ios appstore. can post here short or long dynamic link have issues with? alternatively feel free open firebase support bug or email myself @ oleksiyi at google.com . another technique can try: append &d=1 end of link , open link in browser. see debug page link expected behavior. as

r - Average count per group -

i real close missing last step, tell me need change below? my dataset (mydata) looks (the first few entries missing): date_daily station_date air_min air_avg air_max rain_mm temp_davg_c temp_dmax_c temp_dmin_c date months years 1 2006/01/01 <na> <na> <na> <na> na na na na 2006-01-01 01 2006 2 2006/01/02 <na> <na> <na> <na> na na na na 2006-01-02 01 2006 3 2006/01/03 <na> <na> <na> <na> na na na na 2006-01-03 01 2006 4 2006/01/04 <na> <na> <na> <na> na na na na 2006-01-04 01 2006 5 2006/01/05 <na> <na> <na> <na> na na na na 2006-01-05 01 2006 6 2006/01/06 <na> <na>

How to ignore Enter key when giving input in C in linux without external libraries? -

the program print '*' in xy cordinate , when user input "d" should move 1 spade right. #include<stdio.h> void draw(int x,int y) { int i,j; if(x==0 && y==0) { printf("point @ origin"); } else { for(i=1;i<=y;i++) printf("\n"); for(j=1;j<=x;j++) printf(" "); printf("*"); } } int main() { int x,y; char a='a'; printf("eneter x coordinate : "); scanf("%d", &x); printf("eneter y coordinate : "); scanf("%d", &y); while(1) { printf("\033[h\033[j"); //clear screen scanf("%c",&a); draw(x,y); scanf("%c",&a); if(a=='d' || a=='d') { x++; } } return 0; }

c# - asp.net core authenticating with JWT tokens -

i have .net core web app , .net core web api app. web app strictly front end , want web api app handle end data request including authentication. if setup web api app authenticate jwt tokens similiar here (https://stormpath.com/blog/token-authentication-asp-net-core) , how [authorize] attribute work on controllers in web app require user authenticated?

json - PHP string syntax error in data attribute -

this correct syntax <div class="d" data-slick='{"slidestoshow": 4}'> and php code $output .= '<div class="fashmag-gallery-half" data-slick="">'; i have tried no luck, what's wrong here? $output .= '<div class="fashmag-gallery-half" data-slick="{"slidestoshow": 4}">'; the problem here generated html not have escaped quotes data-slick="{"slidestoshow": 4}" cause syntax error. try escaping them data-slick="{\"slidestoshow\": 4}" or better yet remove quotes object inside this: data-slick="{ slidestoshow: 4}"

css - div background color won't fill the div -

this question has answer here: div background-color not extend child divs 4 answers for reason cannot lie of me figure out why background color of div doesn't fill. have 3 images in div. color comes down little ways. cannot find previous post gives me answer. #revwrapper { clear: both; margin: auto; max-width: 1232px; display: block; padding-left: calc((100% - 1232px)/2); padding-right: calc((100% - 1232px)/2); background-color: #006666; padding-bottom: 2%; } #rev1 { clear: both; float: left; width: 33.3%; display: block; padding-bottom: 2%; padding-top: 2%; } #rev2 { clear: none; float: left; width: 33.3%; display: block; padding-bottom: 2%; padding-top: 2%; } #rev3 { clear: none; float: left; width: 33.3%; display: block; padding-bottom: 2%; padding-top: 2%; } .revimagecenter { display:

xml - looking for help parsing SOAP response in C# -

i'm looking in parsing soap response this: <?xml version="1.0"?> - <s:envelope xmlns:d="http://schemas.microsoft.com/xw/2004/10/dssp.html" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"> - <s:header> <wsa:to>http://10.226.88.13:56031/</wsa:to> <wsa:action>http://schemas.microsoft.com/xw/2004/10/dssp.html:getresponse</wsa:action> -<d:timestamp> <d:value>2016-08-10t16:24:46.3329154z</d:value> </d:timestamp> <wsa:relatesto>uuid:36d92433-4e72-47e5-8e8f-fc2b9a7344aa</wsa:relatesto> </s:header> -<s:body> -<somedatadat xmlns="http://schemas.corp.com/2009/02/somedata.html"> -<somedataarray> -<somedata> -<column1> <string>sales some1</string> <str

java - JMenuBar cannot find symbol error -

i have problem trying implement jmenubar keep getting cannot find symbol error. have jframe in separate class along main method , jframe instatiates object of mainpanel class. missing here? appreciated, thank you! the full error message reads cannot find symbol symbol: method setjmenubar (jmenubar) location: class mainpanel public class mainpanel extends jpanel { //whole bunch of code jmenubar menubar; jmenu archive; public uppgift2panel(){ //whole bunch of code menubar = new jmenubar(); archive = new jmenu(); menubar.add(archive); setjmenubar(menubar); //whole bunch of code } } a jpanel doesn't have setjmenubar(...) method. you add menubar frame using setjmenubar(...) method of jframe . read section swing tutorial on how use menus working examples started. start working code. tutorial code show how better structure code. keep tutorial link handy swing basics.

3d - Texture and material loading issue with THREE.OBJLoader2.WWOBJLoader2 -

i using three.js include 3d models (obj + mtl format) in web application. size of 3d models big( 35-70mb ), need load them using web worker in order avoid freezing web page. have tried web worker based method using three.objloader2.wwobjloader2, 1 texture getting applied 3d model. have tried using different 3d models , result same. reader.addeventlistener( 'load', function ( event ) { var uint8arraynew = new uint8array(event.target.result); objbuffer = uint8arraynew; initpostgl(); prepdata = new three.objloader2.wwobjloader2.prepdataarraybuffer( workerinput.obj, // overall model name objbuffer, // obj file arraybuffer workerinput.path, // texture path mtlstring // mtl string ); objectgroup = new three.group(); objectgroup.name = workerinput.obj; prepdata.setscenegraphbasenode( objectgroup ); prepdata.setstreammeshes( true ); wwobjloader2.setdebug(false); wwobjloader2.p

webpack - Vue with Typescript - using components without definition -

i'm trying use vue-instant component child component. i'm not sure how add components without definition, or maybe issue in webpack config ignoring node_modules because of lack of type? here's have: singleusersearch.vue (my custom component): <template> <div class="input-group"> <vue-instant v-model="value" @input="changed" :suggestions="suggestions" name="customname" placeholder="custom placeholder" type="google"></vue-instant> </div> </template> <script lang="ts"> import vue "vue"; import component "vue-class-component"; import axios "axios"; import vueinstant 'vue-instant' let vueinstantcomponent : vue.component = vueinstant; @component({ components: {

Converting JSON from URL to CSV with PHP -

when run code below results in first row in long list of columns containing text array . i've used $decoded = json_decode($json_file, true); indicate want arrays instead of objects i'm not sure issue is. should using bracket or arrow notation somewhere specify want array values? $json_file = file_get_contents('https://fakeurl.com&contenttype=json', false); $decoded = json_decode($json_file, true); $fp = fopen('output.csv', 'w'); foreach($decoded $comment) { fputcsv($fp, $comment); } fclose($fp); here small snippet of json. looks way through: { "rows": [{ "columns": [{ "name": "clientid", "value": "1839", "type": "xs:int", "format": "" }, { "name": "campaignid", "value": "25646", "type&

javascript - Replace method doesn't work -

i want replace smart quotes ‘ , ’ , “ , ” regular quotes. also, wanted replace © , ® , ™ . used following code. doesn't help. kindly me resolve issue. str.replace(/[“”]/g, '"'); str.replace(/[‘’]/g, "'"); use: str = str.replace(/[“”]/g, '"'); str = str.replace(/[‘’]/g, "'"); or in 1 statement: str = str.replace(/[“”]/g, '"').replace(/[‘’]/g,"'"); in javascript (as in many other languages) strings immutable - string "replacement" methods return new string instead of modifying string in place. the mdn javascript reference entry replace states: returns new string or matches of pattern replaced replacement. … this method not change string object called on. returns new string.

Configuration to add mdl-ext npm package to Phoenix via brunch -

brunch / npm , phoenix confuses hell out of me. paucity of concrete examples doesn't help. maybe question can shed little light? here's config @ mo' npm: { enabled: true, styles: { 'material-design-lite': ['dist/material.min.css'], 'mdl-ext': ['lib/mdl-ext.css'] }, globals: { material: 'material-design-lite' } } couple of questions. whilst mdl styles working i'm not sure if .js being pulled through. how check? mdl-ext css getting pulled through again not sure js. not sure how check. feels bit secret sauce. learnt more brunch , found solution. the default brunch-configuraton.js configuration comes "jointo: "js/app.js" uncommented default. so, not contain regex include js files, , consequence includes of them i needed these 2 lines in app.js file: import 'material-design-lite/material'; import 'mdl-ext'; things become little trickier when bun

API Logging in Json format -

i log api request/response json format. the expected logentry { "timestamp" : "...", "level" : "debug", "headers" : [ "header1" : "value1", "header2" : "value2", "header3" : "value3" ], "requestpayload" : "<request json>" // prefereablly sub-document, worst case string fine. "labels" : [ //key fields can used searching logentry "searchfield1" : "....", "searchfield2" : "....", "searchfield3" : "...." ] } my question : using logback, how log nested fields (e.g. headers, labels, requestpaylod in above example), json sub-document. tried mdc, limited map of 'string, string' only, , considers fields after first level string. i hate write custom logger this, , use goodness of proven logging frameworks(logback/log4j) con