Posts

javascript - Uncaught typeerror: Object #<object> has no method 'method' -

so here's object 'playerturnobj' function playerturnobj(set_turn) { this.playerturn=set_turn; function setturn(turntoset) { this.playerturn=turntoset; } function getturn() { return this.playerturn; } } and here i'm doing it var turn = new playerturnobj(); turn.setturn(1); so try make script setturn() method in playerturnobj() save 'turn' in game i'm making. problem is, not turn.setturn(1); part because keep getting error above what doing wrong? searched, not find exact answer question. this not way javascript works. "constructor" function contains inline functions not visible outside of scope of playerturnobj . variable turn not have method setturn defined, error message states correctly. want this: function playerturnobj(set_turn) { this.playerturn=set_turn; } playerturnobj.prototype = { setturn: function(turntoset) { this.playerturn=turntoset; }, getturn: func...

jsp - Compare specific row or column of xls sheet using java and Apache POI -

my jsp file (to upload excel file) : <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>insert title here</title> </head> <body> <form method="post" action="uploadaction" enctype="multipart/form-data"> upload *.xls file: <input type="file" name="file" value="file"> <br><br> <input type="submit" value="submit"> </body> </html> my servlet code ( process excel file) import javax.servlet.servletexception; import javax.servlet.http.*; import java.io.fileinputstream; import java.io.fi...

jquery - Is inline/block Javascript executed before document-ready? -

assuming 1 has inline javascript code in html document (the body example), piece of javascript executed before jquery document-ready code? for example, following safe? ... <body> <script type="text/javascript"> var myvar = 2; </script> ... </body> ... $(document).ready(function() { alert('my var = ' + myvar); } if not, how can make safe knowing myvar defined in inline/block code? yes, above code safe. inline js executed encountered while document being parsed top bottom. document ready handler executed when document ready (obviously), , won't ready until whole document has been parsed including inline scripts. note don't need document ready handler if include code wraps last thing in document body, because @ point not other inline js have executed of document elements have been added dom , accessible js.

python - i have stored the streaming twitter data in an o1.json file but i am unable to read all tweets -

import json open('o1.json') f: line in f: data=(json.loads(line)) print data["text"] o1.json contains streaming twitter data, when read data in python object, data type of data object dict, interested in finding value of text key, code give me 1 tweet interested in printing tweets may know how can tweets, working on data science assignment of coursea.org you're overwriting data on every iteration of loop, print text after loop finishes - of course you're printing 1 value (the last one). put print statement inside of loop: import json open('o1.json') f: line in f: data=(json.loads(line)) print data["text"]

excel - How to clear duplicate-named columns? -

actually have find column named "account" , have delete data entered in column. lets column name "account" in cell "b9" , values have been entered till "b30"(it variable), have delete data "b10"to "b30". , if have 1 more column in name of "account", have same column also. i have coded 1 column. want write multiple columns. here coding, private sub commandbutton1_click() dim xlapp excel.application dim wb workbook dim findrow range dim ad string dim accell string dim de string dim lad string dim col integer dim rw integer dim r integer dim rw2 integer dim myrange range on error goto errhandler: msgbox "please browse document" set xlapp = createobject("excel.application") filestr1 = application.getopenfilename() workbooks.open filename:=filestr1 , notify:=false xlapp set rng1 = activesheet.usedrange....

mysql - How to move all data from one SQL table to another -

this question has answer here: sql mass insert based off of data pulled table 3 answers i want move data 1 sql table another, both tables have identical structures. sample data : table | id | name | address| table b | id | name | address| requirement : move data table b table a, don't want use select on table b , insert on table data. preferably, alter table structures, achieve this. initial thoughts : deleted table a, , renamed table b table a. worked. problem cannot append data in table a. want retain data in table a, , append data in table b table a. so, solution didn't work. any pointers on how proceed this, appreciated. edit : apologies all, stupid question. best way use insert ... select... apologies, again! you should able rename both tables in single mysql rename table statement rename table tablea tableb, tableb tabl...

android - Admob ads displaying on emulator but not real device -

i have simple activity test display of ads: public class adtestactivity extends activity { private adview adview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); thread.setdefaultuncaughtexceptionhandler(new exceptionhandler(this)); setcontentview(r.layout.ad_test); adview = new adview(this, adsize.banner, "[my ad id]"); linearlayout layout = (linearlayout)findviewbyid(r.id.layout_at_1); layout.addview(adview); adview.loadad(new adrequest()); } @override public void ondestroy() { if (adview != null) { adview.destroy(); } super.ondestroy(); } } ads working fine on emulators, , on phone on adb. however, if create .apk of project , install on same phone (after uninstalling 1 adb), force closes open adtestactivity. activity declared in manifest: <activity android:name=".adtestactivity" android:label="@string/title_activity_main...