Posts

javascript - JS do ... while -

it seems me misunderstand behavior of ... while loop in js. let's have code like: var = [1,2,3,4,5]; var b = []; var c; {c = a[math.floor(math.random()*a.length)]; b.push(c);} while(c===4); console.log(b); which intended roll out random item array a if item not 4 . if roll several times we'll see doesn't prevent 4 getting array b . why? thought work this: roll random item array a , store c , push c b ; check if (c===4) true ; if — go paragraph 1; if it's not — log b console. where mistaking , why code work in such way? others way 'ban' item array being rolled randomly (except filtering array) if approach can't me? do while runs , checks. random number a, store in c , push b, , if c 4, loop. so if c 4, still push b, won't continue after that. you this: var = [1,2,3,4,5]; var b = []; var c = a[math.floor(math.random()*a.length)]; while (c !== 4) { b.push(c); c = a[math.floor(math.random()*a.length)]; } consol...

c# - .net trace listener for each switch -

currently in application have many trace switch , boolean switch. listener configured log text file. , works. code snippet below. <configuration> <system.diagnostics> <switches> <add name="booleanswitch1" value="true"/> <add name="booleanswitch2" value="true"/> <add name="traceswitch1" value="4"/> <add name="traceswitch2" value="1"/> </switches> <trace autoflush="true" indentsize="2"> <listeners> <add name="tracetestinglistner" type="system.diagnostics.textwritertracelistener" initializedata="d:\traces\tracetesting.log" traceoutputoptions="datetime"> </add> </listeners> </trace> i want each switch logs put different log file. how can achieve that. can add listener each switch , redirect log different log files? if how this? thank h...

sql server 2008 - Insert record into SQL table based on values from another table -

i have sql database access front end. trying employeeid 1 table, , insert it, along other values table. can't figure out doing wrong. not getting errors, , when @ values, there. insert command not working. know getting employeeid other table working. ideas? in advance help! private sub command666_click() dim db dao.database dim rs dao.recordset dim strsql, strsql2, strsql3 string dim st date dim st2 date dim vempid, vworkcode integer dim vhours, vhours2 double dim vdtadd date strsql = "select * tblemployees" set db = currentdb() set rs = db.openrecordset(strsql, dbopendynaset, dbseechanges) rs.movefirst while not rs.eof vempid = rs!employeeid vhours = 40 vhours2 = 8 vdtadd = date vworkcode = 1 st = dateadd("m", 6, date) st2 = dateadd("m", 7, date) if rs!startdate >= st , rs!startdate < st2 strsql2 = "insert tbltimeavailable (employeeid, noofhours, dateadded, workcode) values (@v...

scala - How to share state between Akka actors? -

i have balancesheetactor defined follows: class balancesheetactor extends actor { val tradables = mutable.set[contract] } and have simple depositcontract defined follows: case class depositcontract(facevalue: double) each contract in model asset 1 balancesheetactor , liability balancesheetactor , state of contract shared between actors (i.e., each contract member of @ least 2 sets of tradables ). suppose want increment facevalue of depositcontract amount . either need to... remove old contract both sets of tradables , replace new depositcontract(facevalue + amount) . model each contract akka.agent . model each contract akka.actor (and encapsulating state). option 1 seems needlessly complicated (additionally contracts highly out of sync), option 2 seems ok need create on order of millions of contract agents , concerned memory usage. have similar concerns option 3 well. have no idea if these memory usage concerns founded. thoughts? i hoping there ...

excel - Return array of all matches between two ranges -

Image
ok trying take common tutorial array formula step further cannot figure out how. essentially have set of sheets values below: | sheet 1 || sheet 2 | | products(1) | product group || products(2) | data | | | || | | | 100 | 1 || 100 | abc | | 200 | 2 || 200 | def | | 300 | 3 || 200 | ghi | | 400 | 3 || 500 | jkl | | 500 | 2 || 400 | mno | sheet 1 lists parameters classify each product , uses assign each product group. products unique index key. sheet 2 tracking list of every time product run, how did. therefore product numbers may show multiple times or not @ all. i have third sheet in product number entered, group number calculated, , sheet 1 searched products group number , list returned using array formula (using tutorial ht...

Editing a Python function in real-time -

i'm new python user. i've been trying setup script work -- unsuccessfully. have found that, while importing script returns fatal error, can rewrite line line in real-time. every time make error or typo, python kicks me out of continuing '...' edit mode , '>>>' mode which, limited knowledge means have start over. problem 1 function passes more 100 lines of code. if error in middle, @ stage of knowledge, have begin again. is there way pick function writing left off, before typo? if use python idle (or other ide...there tons of them listed here ), have what's called repl (read-evaluate-print-loop) make life easier! can select small part of code, run it, see effects, make edits, re-run it, run next part, etc.

sql server - Database Difference on publisher and subscriber -

i have sql server transactional replication running. server (publisher & distributor) server b (subscriber). working great. need know whether can add table subscriber in database? affect replication? must databases exact same in terms of schema etc? i need add table that's not part of publishers published articles on server b(subscriber). i need know whether can add table subscriber in database? yes, can. won't affect replication, but, example, if create table dbo.a on subscriber database first , later you'll create table same name , schema on publisher database can lost data in table dbo.a on subscriber because default new articles on subscriber drop if exists within initialize process. you can change behavior in publication properties. must databases exact same in terms of schema etc? no, must not. in transaction replication can replicate either whole tables or columns of tables.