Posts

Asp.net's LoggedInTemplate never displays, only AnonymousTemplate -

i'm using microsoft visual studio 2013 build website. want master page different depending on whether 1 logged in or not. end use <loggedintemplate> , <anonymoustemplate> . unanswered question @ loggedintemplate not displayed , however, latter displayed, regardless of whether or not i'm logged in. code @ master page follows: <asp:loginview id="loginview2" runat="server"> <loggedintemplate> <ul id="loggedin"> <li><asp:loginname id="loginname1" runat="server"/>user page</li> <li><asp:loginstatus id="loginstatus1" runat="server" /><a href="logout.aspx">log out</a></li> </ul> </loggedintemplate> <anonymoustemplate> <ul> <li><a href="registration.aspx">register...

javascript - Access to module data from diff module -

i've node module , need parse data , want share parsed properties in different modules.the first module call responsible pass data , other modules doesn't need send data since store parseddata(in cacheobj) , can use of property,the problem when access 1 module , provide data , try access diff module,the cache object not contain data "store",any idea how right? "use strict"; var parser = require('myparser'), _ = require('lodash'); function myparser(data) { if (!(this instanceof myparser)) return new myparser(data); if (!_.isempty(this.cacheobj)) { this.parseddata = this.cacheobj; } else { this.parseddata = parser.parse(data); this.cacheobj = this.parseddata; } } myparser.prototype = { cacheobj: {}, getpropone: function () { return this.parseddata.propone; }, getproptwo: function () { return this.parseddata.proptwo; } }; module.exports = myparser; the ...

c - MapViewOfFile offset - how to use it -

developing game ("jogo" in pt), server can host 5 simultaneous games, client access via mapped memory. so here's have: server: #define max_jogos 5 typedef struct{ ... } sjogo; typedef struct{ sjogo * ps; } sglobals; sjogo jogo[max_jogos]; //global sglobals globals[max_jogos]; //global handle hmapfile; //global int _tmain(int argc, lptstr argv[]) { ... hmapfile = createfilemapping(invalid_handle_value, null, page_readwrite, 0, sizeof(sjogo)*max_jogos, szname); //create map games .... } //called when new game created void createview(int index){ //create view 1 game , store pointer //### need apply offset here ### globals.ps[index] = (sjogo * )mapviewoffile(hmapfile, file_map_all_access, 0, 0, sizeof(sjogo); } //called thread on event set void copyjogo(int index){ //use stored pointer update jogo copymemory((pvoid)globals[index].ps, &jogo[index], sizeof(sjogo)); } client: handle hmapfile; //global sjogo * ps; //global ...

python - Sleep() stops threads -

i trying run script spawns couple of threads using root.after(). sleep() seems lock script. never sees flag being set second root.after(). from time import sleep tkinter import * global flag flag = false def settimer(): global flag while(flag==false): sleep(.1) print('flag set') return def setflag(): global flag flag=true return root=tk() print('start') root.after(1,settimer()) root.after(100,setflag()) print('done') after not start new thread, runs method inside event-loop of tk. while-loop block program. if use after method must non-blocking operations, checking flag. if have background processes, use real threads. notice: must not alter gui inside these threads! import tkinter tk time import sleep threading import thread, event flag = event() def worker(): while not flag.is_set(): sleep(.1) print('flag set') def set_flag(): flag.set() root = tk.tk() print('sta...

multithreading - Signal from QThread doesn't get emitted -

i tried following solution laid out in this question , nothing seems happen once signal supposed emitted. this isn't of code, should enough demonstrate i'm trying do: class startqt5(qmainwindow): def __init__(self): super().__init__() [...] self.getfileproperties(path, batch) def getfileproperties(self, path, batch): self.thread = qthread() self.w = probethread(self) self.w.movetothread(self.thread) self.w.finished[dict].connect(self.setprobeoutput) self.thread.started.connect(self.w.run) self.thread.start() @pyqtslot(dict) def setprobeoutput(self, data): print("gotoutput") self.probeoutput = data print(data) class probethread(qobject): finished = pyqtsignal(dict) def __init__(self, parent): super().__init__() self.parent = parent self.output = {} def run(self): self.output = json.loads(sub...

swift - Multiple buttons for one action without IB -

in view controller, have 10 buttons. each button has tag , buttons call same action (separate switch (sender.tag), case 0 -> case 9 differentiate button selected). made ib, connected buttons ( @iboutlet ) same @ibaction , good. want programmatically, without ib. so removed @iboutlet 's , @ibaction create new buttons ( let mybutton1 = uibutton() ) , new action ( func newaction(sender: uibutton) ). tried addtarget: same selector new buttons, app crashes. anyone has idea fix please ? this should work: func newaction(sender: uibutton) { ... } ... mybutton1.addtarget(self, action: "newaction:", forcontrolevents: .touchupinside) mybutton2.addtarget(self, action: "newaction:", forcontrolevents: .touchupinside) mybutton3.addtarget(self, action: "newaction:", forcontrolevents: .touchupinside)

PHP Get random element out of array 1, show, and move to array 2 -

i'm trying make page when press button randomly returns element out of array1, saves (so can show on page), , moves array2 element doesn't returned second time, have no idea start. here's source array: $subject = array ( array("title1","comment1"), array("title2","comment2"), array("title3","comment3"), array("title4","comment4"), ); try these codes: <?php shuffle( $array1 ); array_push( $array2 , array_pop($array1) ); ?>