Posts

Showing posts from April, 2014

reactjs - React: Losing ref values -

i using 2 components , using pattern: child component should stay isolated can - handling own validation error. parent component should check errors have dependencies between children. so, in case: password field , password confirmation field. here code: a) signup (parent) setting initial state. constructor() { super(); this.state = { ispasswordmatching: false }; } in render() method outputting child component. through prop called callback propagating method ispasswordmatching() binding parent's this . goal method can called within child component. <textinput id={'password'} ref={(ref) => this.password = ref} callback={this.ispasswordmatching.bind(this)} // other unimportant props /> <textinput id={'passwordconfirm'} ref={(ref) => this.passwordconfirm = ref} ... ispasswordmatching() method checking if passwords match (through refs this.password , this.passwordconfirm ) ,

java - SQLite syntax error with JTable -

hi want to create jtable sqlite database. data should come sqlite database , stored in . new details added typing in text field . however, error message : "java.sql.sqlexception: near "(": syntax error" what´s wrong? public class sqlite { public static defaulttablemodel model = new defaulttablemodel(); private static jtextfield fieldid; private static jtextfield fieldname; private static jtextfield fieldage; private static jtextfield fieldaddress; private static jtextfield fieldsalary; public static void main( string args[] ) { connection c = null; statement stmt = null; try { class.forname("org.sqlite.jdbc"); c = drivermanager.getconnection("jdbc:sqlite:test.db"); c.setautocommit(false); system.out.println("opened database successfully"); stmt = c.createstatement(); c.commit(); jframe f = new jframe(); f.setlayout(new gridlayout(5,1)); f.setdefaultcloseoperation( jframe.exit_on_close );

Coerce fixef to data frame in R (PLM package) -

i'd fixed effects fixed effects panel data regression data frame. this: data("produc", package = "plm") zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, data = produc, index = c("state","year")) view(as.data.frame(fixef(zz))) unfortunately, last statement not work. my expected output data frame state in first column , fixed effect in second. i've googled, , come this: extract fixed effect , random effect in dataframe unfortunately, answer not seem function. this easy construct. first check kind of object fixef returns: str(fixef(zz)) #class 'fixef' atomic [1:48] 2.2 2.37 2.26 2.5 2.4 ... # ..- attr(*, "se")= named num [1:48] 0.176 0.175 0.167 0.201 0.173 ... # .. ..- attr(*, "names")= chr [1:48] "alabama" "arizona" "arkansas" "california" ... # ..- attr(*, "type")= chr "level" this tells fixef returns ob

javascript - React.js: How to use the same button while passing variables to a click function -

i using material-ui ui framework , trying create view 2 buttons have different values. render: function() { return <card> <cardmedia overlay={<cardtitle title={this.props.title} />}> <img src={this.props.image}/> </cardmedia> <cardactions> <flatbutton onclick={this._handleclick} label="good"/> <flatbutton onclick={this._handleclick} label="bad"/> </cardactions> </card> since new react think miss basic. how can pass values flatbutton, can use "ref" attribute? main problem using framework. if had written components use props, such "label" , handle click event component itself. update: found solution, still if feels anti-pattern... <flatbutton onclick={this._handleclick.bind(this, 1)} label="good"/> <flatbutton onclick={this._handleclick.bind(this, 0)} label="

javascript - File upload change function submit form? -

i trying post files jquery, didnt come anywhere, thinking if post form instead, when select files, have been same. got problem right now, aint posting form , cant figure out im doing wrong :s js: $(".filesupload").on("change", function() { $("#fileupload").submit(); }); html: <li class="uploadbg"> <form method="post" action="index.php" id="fileupload" enctype="multipart/form-data"> <input type="file" name="filesupload[]" class="filesupload" multiple=""> <a href="#" class="btn btn-xs btn-default"> <span class="fa fa-upload"></span> ladda upp </a> </form> </li> css: .uploadbg { position:relative;} .uploadbg input { width: 94px;height: 24px;position:absolute;top: 10px;z-index:1;opacity: 0;cursor:pointer } hope of guys can tell me i'm doi

C++ linux interface for Windows? -

i know cygwin windows interface linux, there linux interface windows. if use linux interface windows, once library built on interface can used build projects on windows? i'm looking solution myriad of build errors when building open source c++ libraries. thanks cygwin not "windows interface linux" per se. it's set of emulation libraries, tools, , bash shell allows existing unix/linux code recompiled , run on windows. apps compiled exes within cygwin can redistributed other windows machines including built exe , subset of cygwin dlls same install directory. i suspect if took open source code, , built shared libary (.dll) under cygwin, link code dll. might possible build .lib files, i've never tried. distribute executables built under visual studio (or other compiler), cygwin compiled binaries, , cygwin runtime together.

why it is not posssible to create object for interface and abstract class in java -

this question exact duplicate of: instantiate interface [duplicate] 4 answers i know can't create object interface , abstract class. doubt why? why can't create object interface , abstract class? example class demo{ } demo demo = new demo();//it possible but interface demo{ } demo demo = new demo();// not possible why? an object in java contains data (class members) , set of operations (methods). these operations performed on data stored object. now both interface , abstract class don't provide concrete implementation of operations, performed on object data. interface , abstract classes in java used define/declare contract object. contract of operations later fulfilled concrete/complete classes. so these incomplete objects of no use in application. java not allow creating instance of interface or abstract classes .

sql - Update Query (String --> Date) -

this question has answer here: conversion failed when converting date and/or time character string while inserting datetime 10 answers i'm trying update field (type of date) string field. the string field example : 20/10/2015 i new in sql. tried query: update [dbo].[employeewithcompcar] set [emer_attachenddate] = cast([emer_info1] date) i message: conversion failed when converting date and/or time character string. can me fix it? thank's! you need use convert() format. try this: update [dbo].[employeewithcompcar] set [emer_attachenddate] = convert(date, [emer_info1], 103); the formats available in documentation . note: in sql server 2012+, use try_convert() instead of convert() . way, if string in wrong format, result null instead of error.

c# - Project not running after reinstalation of windows and Visual Studio 2013 Express for Web -

i upgraded windows 10 enterprise edition , had reinstall vs 2013 express web. after reinstalling tried run project used run before no success. it's trowing following error: não foi possível carregar o ficheiro ou assemblagem 'system.web.webpages.deployment, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' ou uma das respectivas dependências. definição manifesto de assemblagem localizada não corresponde à referência de assemblagem. (excepção de hresult: 0x80131040) detalhes da exceção: system.io.fileloadexception: não foi possível carregar o ficheiro ou assemblagem 'system.web.webpages.deployment, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' ou uma das respectivas dependências. definição manifesto de assemblagem localizada não corresponde à referência de assemblagem. (excepção de hresult: 0x80131040) what can causing this? i've googled can't find answer solves issue. going crazy in here. thanks guys. app

ruby - custom attributes in rails -

i have student model , method calculations , returns value class student < activerecord::base def total_result #some calculations return result end end now in students controller following student.where("total_result > ?", params[:result]) but brings pg::undefinedcolumn: error. using postgres. how achieve this? you use: student.select { |student| student.total_result > params[:result] } a word of warning: load students database , calculate value each of them. slow depending on number of students in table. if need more make sense store/cache result of calculation in database.

recursion - How do recursive functions work in Lisp? -

so i'm coding in lisp , came function counts number of atoms in list (with no sub-lists). code this: (defun num-atoms (list) (cond ((null list) 0) ((atom list) 1) (t (+ (num-atoms (car list)) (num-atoms (cdr list)))))) and works , makes sense me. if call function list (1 2 3) in argument should go follows: (num-atoms '(1 2 3)) not null not atom num-atoms(1) atom returns 1 num-atoms ((2 3)) not null not atom num-atoms (2) return 1 .... and on but, if write code this: (defun num-atoms (list) (cond ((null list) 0) ((atom list) 1) (t (+ (num-atoms (cdr list)) (num-atoms (car list)))))) here switched de car , cdr positions in last line. it still works ! , if trace, gives me number of atoms in same order ! counts 1 first in '(1 2 3) list , on. can explain me how 2nd version of code still works ? dont understand logic here. if trace both functions you'll see how hey differ. in first v

android - Custom MaterialSearchView Displayed Under Toolbar in a Fragment -

i'm using custom materialsearchview, , project following : layouts: mainlayout fragmentsection layout codes : mainactivity sectionfragment in mainactivity there's drawer library, have 6 sections, 1 of fragments has search icon, here's problem . in main layout have toolbar , fragment : <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" tools:context="com.abohani.ramadantime.mainactivity"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:la

c# - WPF Custom Property -

i have added new property progresbar control, how ever don't think i'm doing correctly. below progressbar in mainwindow.xaml, need have 2 values gap between them. <progressbar style="{staticresource circularprogress}" value="50" extensions:customextensions.radius="140 0" /> now here custom extension, made string there gap between 2 numbers. public static readonly dependencyproperty radiusproperty = dependencyproperty.registerattached("radius", typeof(string), typeof(customextensions), new propertymetadata(default(string))); public static void setradius(uielement element, string value) { element.setvalue(radiusproperty, value); } public static string getradius(uielement element) { return (string)element.getvalue(radiusproperty); } now here use custom property, isn't working. <pathfigure x:name="pathfigure" startpoint="{binding path=radius, relativesour

swift - Game lagging when AVAudioPlayer plays -

i'm creating game user controls character jetpack. when jetpack intersects diamond, add diamond total , play sound. however, sound makes game pause tenth of second or , disrupts flow. code i'm using: var diamondsound = nsbundle.mainbundle().urlforresource("diamondcollect", withextension: "wav")! var diamondplayer = avaudioplayer?() class gamescene: skscene{ override func didmovetoview(view: skview) { { diamondplayer = try avaudioplayer(contentsofurl: diamondsound) guard let player = diamondplayer else { return } player.preparetoplay() } catch let error nserror { print(error.description) } } and later: override func update(currenttime: cftimeinterval) { if character.intersectsnode(diamond){ diamondplayer?.play() adddiamond() diamond.removefromparent() } } also usi

Running R on Meteor.js mongodb -

i want port mean stack app meteor.js. need use r run time-series calculation on bi-weekly basis on mongodb data. rest crud app. guessing can run r on ec2 instance, connect mongo, extract data, calculations , insert results. worried performance impact. thinking deploying on aws , using above approach. are there other ways? if want deploy meteor app galaxy or modulus, running r on ec2 perhaps bad idea performance reasons. so not expert in meteor.js know different way doing things work express , should work meteor, since have restful endpoints. use similar https://www.hirefire.io/ or polls (bi-weekly) app @ specific restful endpoints process time series calc via r. lets sat /timeseries . lastly in service respond route request invoke r via shelljs. https://github.com/shelljs/shelljs or if have r wrapper use that.

unity3d - unity c# Animation property change sprite -

good afternoon . in animation property ( sprite ) , how change sprite of frame in c #? tried put event calling function takes sprite rendering object , puts in sprite field not change run . runs defined in animation. i'm trying change directly there not know how do. help please!! as far i've seen , researched, can't currently. the best workaround, 1 have done before , highly recommend, create customanimationclip script array of sprites , timer switch each frame next. can change animation's sprites @ time editing array. here example: spriterenderer spriterenderer; public sprite[] frames; [serializefield] int fps; int currentframe = 0; float frametime; float frametimer = 0; void awake() { spriterenderer = getcomponent<spriterenderer>(); } void start() { frametime = 1 / (float)fps; spriterenderer.sprite = frames[0]; } void update() { if (frametimer < frametime) { frametimer += time.deltatime; } else

ethernet - Receive multiple client request in aRest arduino as web server -

i pretty new arduino, stuck arduino code need receive multiple sequential request client , update value in arduino board. using ethernet board arduino , arest library expose arduino board restful services. please check below code , let me know should modify or edit achieve below requirements (note have commented watchdog related code), https://gist.github.com/shaikhmshariq/36264bf20f24faf078c4155542fc6836 i need receive multiple (sequential) requests client through ethernetclient , update motor speed based on received input. when run code below, with watchdog - resets board , because of motor shuts down after 4 seconds not want. without watchdog- doesn't receive second request @ all, means server doesn't respond @ after serving first request receive instant response server. i can't access code here due proxy problems, faced similar problem long time ago when tried configure board server. reason why service stop responding second request lack of memor

each function in javascript for new elements -

i have page infinite scroll appends new elements user scrolls down. ".product-variation" 1 such element. want remove first option of newly arriving elements. code below job think goes , down dom bit - retarding performance in process. there better , more efficient way of removing first option of newly arriving elements? the first option of newly arriving element '' , that's trying remove. jq(".product-variations").each(function(){ var fresh_variant = jq(this).find("option:nth-child(1)").val(); if(fresh_variant == '') { jq(this).find("option:nth-child(1)").remove(); } jq(this).trigger('change'); }); i'd put flag : jq(".product-variations:not([data-set])").each(function(){ var fresh_variant = jq(this).find("option:nth-child(1)").val(); if(fresh_variant == '') {

syntax highlighting - How is syntaxhighlighters.py called by Spyder IDE? -

for spyder ide, syntaxhighlighters.py compiled spyder.exe, or called directly spyderlib? i see on github ( https://github.com/spyder-ide/spyder/blob/master/spyderlib/utils/syntaxhighlighters.py ) , several other sites syntaxhighlighters.py included in spyder package. what's not clear how used spyder. part of source code compiled spyder.exe? the desired end state able update syntaxhighlighters.py kivy syntax highlighting. kivy has pygments lexer kv language, available through github, https://github.com/kivy/kivy/blob/master/kivy/extras/highlight.py i'm trying figure out if can try modify spyder's syntaxhighlighters.py, using kivy's highlight.py, or if need somehow re-compile spyder incorporate changes syntaxhighlighters.py. thank you. pygments not natively support kivy highlighting (yet), (look available lexers here ) you add ability modifying generic pygments highlighter located here now need add kivy somewhere in spyder codebase, in syntaxh

python - requests: 'module' object has no attribute 'get' -

i installed requests package last week , worked fine.. until morning. coded , got attributeerror: 'module' object has no attribute 'get' message: import requests r = requests.get('http://www.yellowpages.com/search?search_terms=coffee&geo_location_terms=montreal%2c+qc') i read in other posts might because have more 1 requests packages installed. when code print(dir(requests)) 2 lists..: ['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'requests'] ['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'requests'] any appreciated. sylvain is possible named script requests.py or have named file in same directory?

VB.Net ComboBox (as Dropdown) not translating text to DisplayMember with Databinding -

i inherited large project @ work undocumented , written in vb (originally started pre .net, ended around .net 2). i'm in process of updating / refreshing lot of code, have run annoying issue haven't found solution yet. system utilizes ui, web service, , sql db. problem : have databound combobox (originally set dropdownlist - i'm changing dropdown, started mess - going isn't option) tied dataset comes web service. when user types in item want manually, data text field doesn't seem associate displaymember, forces ws/sql query fail (it sent blank value when it's expecting valuemember). if user types in partial selection , chooses value want displaymember list using arrow keys or tab, query goes off without problem. my question : how text field translate displaymember tie valuemember allow query execute correctly? sorry making sound complicated or convoluted; i'm sure answer easy , i'm glazing on it. the relevant bit of code is: with cmbdid

Shopify product API integer limit 4 -

i getting error 3401314564 out of range activerecord::connectionadapters::postgresql::oid::integer limit 4 when updating product via shopify api. integer here 1 of shopify's own, should in range. there data type problem? yes there is. need use long integer format. limit of 8 when setup field in postgresql. shopify has warning 2 years ago, kicking in...

Selecting environment in jenkins -

Image
i having configuration issue in jenkins when running selenium. i have different environments setup in jenkins configuration when select environment drop down list in jenkins runs in environment added in main.properties file. jenkins configuration: try https://wiki.jenkins-ci.org/display/jenkins/extensible+choice+parameter+plugin specify properties file , value.

android - NullPointerException in dialog - Strange case -

i have stupid problem couldnt solve yet. have activity button in toolbar, button open 1 dialog filter params. here did.. spinner spinner_categoria; spinner spinner_vendedor; seekbar seek_preco; textview tv_filtro; oncreate method { ... } onclickevent{ dialogfiltro(); } public void dialogfiltro() { context context = salesactivity.this; final dialog dialog; dialog = new dialog(context); //dialog.setcontentview(r.layout.dialog_filtro); // dialog.settitle("filtro"); //dialog.show(); vendedordao auxvendedor = new vendedordao(); final list<string> listvendedor = auxvendedor.getvendedorlist(); view dialogview = layoutinflater.from(context).inflate(r.layout.dialog_filtro, null, false); cardview bt_cancelar = (cardview) dialogview.findviewbyid(r.id.cb_filtro_cancelar); cardview bt_aceitar = (cardview) dialogview.findviewbyid(r.id.cb_filtro_aceitar); seek_preco = (seekbar) dialogview.findviewbyid(r.id.sb_prec

java - Android Watch: 'cannot resolve symbol' error on GregorianCalendar? -

i'm trying set watch using calendar class. line: calendar mcalendar = new gregoriancalendar(timezone.getdefault()) gives me error: cannot resolve symbol gregoriancalendar error what doing wrong? perhaps need add import java.util.gregoriancalendar; to java class in question?

C# IF statement -

(int k = 0; k < proc.count; k++){ (int = k + 1; < proc.count; i++){ if (proc[k].arrivaltime >= proc[i].arrivaltime && proc[k].priority >= proc[i].priority && proc[k].brust > proc[i].brust){ temp = proc[i]; proc[i] = proc[k]; proc[k] = temp; } } } input process arrival brust priority p0 0 10 5 p1 1 3 1 p2 1 2 1 p3 5 1 5 p4 5 8 2 i want sort these processes following these rules 1) if process arrived alone it'll work no matter what. 2) if 2 processes arrived in same time, gonna check priority if first 1 has higher priority(lower number) it'll work first, , if have same priority gonna let 1 has lower brust work first. there's problem last 2 processes where's problem? p3 5 1 5 p4 5 8 2 proc

java - Why GUI not updating in Observer pattern? -

i have observable class notifies observer when string changes. in observer's update method updated string can printed console. gui not updated accordingly. why? public void update(observable o, object arg) { string s=swimmingcompetition.init().getscoredata().getresults(); system.out.println(s); //this works jtextarea1.settext(s); //this not } i bet neglecting invoke addobserver() on observer , or neglecting invoke both setchanged() and notifyobservers() in observable . complete examples shown here .

json - couldn't get data from editText android studio -

i created login form , want check user credentials correct or wrong. before found, not edittext value in string variables. please me store edittext value. my java code private string output; private toolbar toolbar; private button button; public edittext username,password; public string myurl,uservalue23,passvalue; list<datamodel> loginlist; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_login); toolbar = (toolbar) findviewbyid(r.id.app_bar); setsupportactionbar(toolbar); username = (edittext) findviewbyid(r.id.etusername); password = (edittext) findviewbyid(r.id.etpassword); uservalue23 = username.gettext().tostring(); passvalue = password.gettext().tostring(); button = (button) findviewbyid(r.id.btn_login); button.setonclicklistener(this); } @override public void onclick(view v) { if(v.getid()==r.id.btn_login) { if(inonline(

spring security - Why doesn't my implementation of AuthenticationProvider with Java Config work? -

i tried connect custom authenticationprovider spring security configuration below: @configuration @enablewebmvcsecurity public class websecurityconfig extends websecurityconfigureradapter { @autowired private customauthenticationprovider customauthenticationprovider; @override protected void configure(authenticationmanagerbuilder auth) throws exception { auth.authenticationprovider(customauthenticationprovider); } @override protected void configure(httpsecurity http) throws exception { http.authorizerequests().antmatchers("/", "/signup", "/resources/**", "/home").permitall() .antmatchers("/user").hasrole("user").anyrequest().authenticated() .and() .formlogin().loginpage("/login").loginprocessingurl("/login").permitall() .and().logout().permitall(); } } here customauthenticationprovider

Getting nameerror in python -

i have following function, want concat 2 strings, wrong doing here? commands = ["abcd","123"] def configure_dev(self, steps): func_name = self.id + ':configure dev' global conf_cmd key in commands: conf_cmd += key + '\n' print(conf_cmd) getting following error: conf_cmd += key + '\n' after running it, error: nameerror: name 'conf_cmd' not defined i added code critical issue resolved. commands = ["abcd","123"] def configure_dev(self, steps): func_name = self.id + ':configure dev' global conf_cmd = '' // <-- '' key in commands: conf_cmd+=key+'\n' print(conf_cmd)

dataset - Storing two linked values in Python -

i understand there's different ways of storing data in python can't figure use needs. i've made small client/server game, , want amount of guesses took them score. write name (currently ip address) along score file create list of high scores. while can fine, want maximum of 5 scores stored , able sort them when display high scores , names user, lowest (being best score) @ top. i'd allow username exist more once. while it's easy write data , read it, can't figure out data type use, dictionary make lot of sense in cases, key can have 1 value , key can exist once, list has no relation other specific values contained within neither make sense use, , tuples can't sorted either seems. i thinking reading each line sperate list , using index compare score sort them , write file, bad on memory in opinion? what easiest method save name , score without using extreme learning curve sql? you can store list of tuples each tuple containing data in part

javascript - How to retrieve the text of an element and write it to a file for later retrieval in protractor using angular js -

so, have check status of action started automation script using automation script. in order track action, have capture id , write file can read second script action. problem having unable action id number using gettext(). instead, keep seeing other non sensical text when check content of file or variable first store id. the html code action id is: <dd class="ng-binding">232</dd> i trying capture id (#232 here) this: var id = element(by.xpath('html/body/div[1]/div[2]/div/div[2]/div/div[2]/div[3]/dl/dd[1]')).gettext(); upon executing automation script, console output shows var id: id:[object object] i have verified using protractor elementexplorer xpath points right element , can extract id , displays on screen correctly. not work when trying store same id variable , write file can retrieve later use. or hints on how appreciated. gettext() returns promise, have resolve it, using absolute xpath bad way of locating elements. have tr

objective c - Confirmation Popup when poppingViewController in iOS -

Image
i have uitableviewcontroller loads tabbarviewcontroller on selecting row. the user can change information on screen, , hit back button in navigation controller. tabbarviewcontroller of kind show (e.g. push) via storyboard segue. if user changes on screen , hits button, want able display alert asking if want leave screen. or if switch tabs. i used this question reference can't seem hook right. if @ below screenshot can see tabs broken various items. the "vehicle view controller" monitor changes using bool didmakechanges gets set true when edits made. in viewdidload in vehicleviewcontroller - (void)viewdidload { [super viewdidload]; didmakechanges = false; //here holding reference tabviewcontoller self.mvc = (mastertabviewcontroller*)self.tabbarcontroller; uibarbuttonitem *bbtnback = [[uibarbuttonitem alloc] initwithtitle:@"go" style:uibarbuttonitemstylebordered target:self action:@selector(goback:)]; [self.navi

java print pdf with printdialog -

how can print pdf showing printdialog? now printig code: public static void print2(){ inputstream = null; try { printservice defaultprintservice = printservicelookup.lookupdefaultprintservice(); docprintjob printerjob = defaultprintservice.createprintjob(); file pdffile = new file(temppdf); = new bufferedinputstream(new fileinputstream(pdffile)); doc simpledoc = new simpledoc(is, docflavor.input_stream.autosense, null); printerjob.print(simpledoc, null); } catch (exception e) { e.printstacktrace(system.out); } } but show print dialog: public static void print2(){ inputstream = null; try { printerjob pj = printerjob.getprinterjob(); //pj set pdf file print ...? pj.printdialog(); } catch (exception e) { e.printstacktrace(system.out); } }

list - why zip returns only two items (Python 3) -

i'm having problems understanding happens here. networkfile="http://regulondb.ccg.unam.mx/menu/download/datasets/files/network_tf_gene.txt" = 36 lista = [] n in range(0,8): data = urllib.request.urlopen(networkfile).readlines()[i] line = data.decode('utf-8') line2 = line[0:5] lista.append(line2) = + 1 print(lista) values = [] in range(0,8): values.append('') print(values) d = dict(zip(lista,values)) print(d) i know far efficient way deal type of problem, i'm pretty new this'll have do. my problem output looks like: 'accb\t', 'accb\t', 'acrr\t', 'acrr\t', 'acrr\t', 'acrr\t', 'acrr\t', 'acrr\t'] ['', '', '', '', '', '', '', ''] {'accb\t': '', 'acrr\t': ''} the first 2 lists work properly, implied print-command, zip 2 lists, , create dictionary

c# - Reading AuthorizationSection from web.config provides incorrect values -

Image
edit #2: config.filepath showing it's looking @ different file i'm expecting: "c:\windows\microsoft.net\framework64\v4.0.30319\config\web.config". expecting use web.config in project. need figure out why that's happening. i have method in web api i'm trying read values authorization section in web.config. based on i've found, should work: public authorizationsetting getauthorizationsettings() { var config = webconfigurationmanager.openwebconfiguration(null); var section = config.getsection("system.web/authorization") authorizationsection; foreach (authorizationrule rule in section.rules) { if (rule.action.tostring().tolower() == "allow") { debug.writeline(rule); } } return new authorizationsetting(); } and section of web.config contains authorization info: <system.web> <compilation debug="true

Display an embedded google map iframe with a marker on a certain latitude and longitude -

this should possible right? i've tried searching this, docs show similar example can embed map marker on 'place', so: <iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=place_id:chijdd4hrwug2ecrmsrv3vo6lli&key=..." allowfullscreen></iframe> is there way show marker using latitude , longitude instead of place without using js api? if use "place mode" of embedded api can use coordinates place marker: <!-- new york, ny, usa (40.7127837, -74.00594130000002) --> <iframe width="100%" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/place?q=40.7127837,-74.0059413&amp;key=your_api_key"></iframe> working example

html - GOOGLE web font loader -

i've check many blogs, couldn't find answer question, i'm using google web font loader asynchronously load fonts google cdn, however, making use of font stored locally on server using @font face declaration in css. is possible combine two, i.e. make async script load google fonts cdn , local font (including fallback) // here's script in html file <script type="text/javascript"> webfontconfig = { google: { families: [ 'merriweather:400,900italic,700italic,900,700:all' ] }, custom: { families: ['fira sans'], urls: ['../assets/css/type.css'] } }; (function() { var wf = document.createelement('script'); wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'; wf.type = 'text/javascript'; wf.async =

android - Firebase's RemoteMessage object contains no message ID or sent time -

i'm testing firebase's messaging functionality on android through api (not firebase console) getmessageid() returns null , getsenttime() returns 0 . can others fields normally, though. bug in firebase or what? currently using version 9.2.0 of firebase dependencies. what i'm sending through api is: { "to":"frl...", "data":{"title":"hi", "body":"such body" } } i'm sending notification fields in data field because want handle notification manually, cannot if use notification field. turns out bug fixed in version 9.4. more info here https://firebase.google.com/support/release-notes/android#9.4 remotemessage#getmessageid() returns correct message-id received messages. previously, returned null.

database migration - Laravel 5.1.11 migrate with php artisan does not work for me -

i using laravel 5.1.11 when try run php artisan migrate command faced following error message: ****[symfony\component\debug\exception\fatalerrorexception] syntax error, unexpected 'public' (t_public)**** with database connection configuration in database.php , .env quite fine because php artisan migrate:install works fine. this migration code: **<?php use illuminate\database\schema\blueprint; use illuminate\database\migrations\migration; class createflightstables extends migration { /** * run migrations. * // schema::create('flights', function (blueprint $table) { * @return void */ public function up() { // schema::create('flights', function (blueprint $table) { $table->increments('id'); $table->string('name');

java - Method intercepted twice even though it was called once -

in following code snippet i'm calling method dostuff once on instance of subclass . intercepted twice. note dostuff defined in parent class superclass . if dostuff defined in subclass interception logic work expected: 1 interception. am using byte buddy incorrectly? package com.test; import static net.bytebuddy.matcher.elementmatchers.any; import static net.bytebuddy.matcher.elementmatchers.namestartswith; import java.util.concurrent.callable; import net.bytebuddy.agent.bytebuddyagent; import net.bytebuddy.agent.builder.agentbuilder; import net.bytebuddy.description.type.typedescription; import net.bytebuddy.dynamic.dynamictype.builder; import net.bytebuddy.implementation.methoddelegation; import net.bytebuddy.implementation.bind.annotation.runtimetype; import net.bytebuddy.implementation.bind.annotation.supercall; import org.junit.test; public class reprobugtest { @test public void reprobug() { new agentbuilder.default().type(namestartswith(&qu