Posts

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 .