Posts

angular - Jasmine test for simple Angular2 component not working -

i have simple component: @component({ selector: 'messages', styleurls: ['messages.component.scss'], templateurl: 'messages.component.html', }) export class messagescomponent implements oninit { constructor(private dataservice: dataservice) {} public getone(): number{ return 1; } } i'm trying run test can't work please help: describe('component: messagescomponent', () => { let component: messagescomponent; beforeeach(() => { testbed.configuretestingmodule({ declarations: [messagescomponent], }).compilecomponents(); const fixture = testbed.createcomponent(messagescomponent); component = fixture.componentinstance; }); it('should have defined component', () => { expect(true).tobetruthy(); }); }); (i'm using webpack if relevant) this error get: error: test module uses component messagescomponent using ...

java - Can I access a string resource from string.xml into an activity in Android? -

this question has answer here: android: how string resources using name? 11 answers i creating android application need use ip of server in many different activities access php files. every time connect new network, manually change ips in activities. my question is, can declare string resource in values-->strings.xml, , change there, modifications done @ once? i know can access string resource in xml file using " @string/my_string_var", my_string_var variable name actual string. can use string resource in of activities, this: final string ip = @string/final_ip; it work fine you (your activity context).this.getresources().getstring(r.string.final_ip); or simple in activity getresources().getstring(r.string.final_ip);

sockets - How do I get multiple clients to connect to the same source in python? -

i made class in python has socket in it. when try run multiple instances of same class error: error: [errno 10056] connect request made on connected socket i can see error saying, though classes independent of each other when run. wouldn't interfere. here's code i'm using: class bot(): host = "localhost" port = 6667 s = socket.socket() def connect(self): self.s.connect((self.host, self.port)) then when create bots: bots = [] def setup_bot(): global bots _bot = bot() _bot.connect() bots.append(_bot) if __name__ == "__main__": in range(5): setup_bot() sleep(1) print "done setting up" how able work? make socket s instance variable instead of setting on class. bot instances share same class attributes , thus, same socket. class bot(): host = "localhost" port = 6667 def __init__(self): self.s = socket.socket() ...

javascript - How to give option to print a bootstrap table? -

my question simple , limited , want print bootstrap table having id ("mytbl") how can make possible javascript / jquery ?(i dont want use plugins) i newbie in using jquery , bootstrap please help <script> $(function () { $('button[type="submit"]').click(function () { var pagetitle = 'page title', stylesheet = '//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css', win = window.open('', 'print', 'width=500,height=300'); win.document.write('<html><head><title>' + pagetitle + '</title>' + '<link rel="stylesheet" href="' + stylesheet + '">' + '</head><body>' + $('#mytbl')[0].outerhtml + '</body></html>'); win.document.close(); win.print()...

Cannot find the management option in the Kaa Sandbox,updated kaa to 0.10.0 -

i have kaa 0.10.0,cannot find sandbox management in earlier version may update sandbox address. in case, have sandbox management page described in documentation . try clean cache in browser. investigate logs located in /var/log/kaa/ directory details. troubleshooting guide helpful.

c# - 'MongoDB.Driver.MongoClient' does not contain a definition for 'GetServer' ...first argument of type 'MongoDB.Driver.MongoClient' could be found -

i'm trying familiar writing mongodb c# programs. i've set code following suggestions http://mongodb.github.io/mongo-csharp-driver/1.11/getting_started/ i'm trying run program getting error "'mongodb.driver.mongoclient' not contain definition 'getserver' , no extension method 'getserver' accepting first argument of type 'mongodb.driver.mongoclient' found". may help? thanks in advance, tien. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using mongodb.bson; using mongodb.driver; //additionally, add 1 or more of these using statements: //using mongodb.driver.builders; //error rebuilding when statement active: "using generic type 'mongodb.driver.builders<tdocument>' requires 1 type arguments //using mongodb.driver.gridfs; using mongodb.driver.linq; //using mongodb.driver.mongoclient; //error rebuilding when statement active "a usin...

android - Activity doesn't show RecyclerView - Databinding -

i tried databinding recyclerview, main_activity doesn't show recyclerview content objects. dont know point of failure is. advice. here simple code class: user public class user { private string name; private int age; public user(string name, int age) { this.name = name; this.age = age; } public string getname() { return name; } public void setname(string name) { this.name = name; } public int getage() { return age; } public void setage(int age) { this.age = age; } } class: useradapter public class useradapter extends recyclerview.adapter<recyclerview.viewholder> { private activity host; private arraylist<user> items; public useradapter(activity activity, arraylist<user> items) { this.host = activity; this.items = items; log.i("useradaptername", items.get(0).getname().tostring()); //log shows gordon } @override public useradapter.itemviewholder oncreateviewholder(viewgroup parent, int viewtype) { ...