Posts

Python - Efficiently working with large permutated lists -

i've written short anagram solver script in python 2.7 . #import permutations module itertools import permutations perm #defined functions def check(x,y): #opens dictionary file open('wordsen.txt') dictionary: '''checks permutations against of dictionary words , appends matching ones on of empty lists''' line in dictionary: in x: if + '\n' == line: y.append(i) #empty lists appended later anagram_perms = [] possible_words = [] #anagram user input anagram = list(raw_input("input scrambled word: ").lower()) #creates single list items permutations, deletes duplicates char in perm(anagram): anagram_perms.append("".join(char)) anagram_perms = list(set(anagram_perms)) #uses defined function check(anagram_perms, possible_words) #prints number of perms created, prints possible words beneath print len(anagram_perms) print '\n...

javascript - Add text to input only if div has class `is-active` -

problem players have not been selected, ie. not have class of picked.is-active should not added of input fields when clicked on the maximum number of players be picked each category 2 out of 4 goalies, 6 of 15 defencemen , 12 out of 31 forwards. update #3 added link github repo here: https://github.com/onlyandrewn/wheatkings update #2 added snippet, shows how is-inactive , is-active classes being toggled. update #1 - i've removed second snippet may causing confusion this javascript snippet below grabs name of player clicked , puts input field, if has class of picked.is-active . however, let's you've selected 2 goalies already, click on 2 remaining goalies in category when unselected (have default class in-active ) those unselected players still added inputs, not want. scripts.js - snippet, needs fixing, adds player name input field if max number players in specific category has been reached $(".player").on("click", functio...

maven - No DestinationFactory was found for the namespace - create uber JAR of CXF with Jetty -

i want create uber jar cxf-based application server. want server commandline java -jar . in ide, can run main class com.connexta.desertcodecamp.server , not correctly creating uber jar. when run command java -jar server-1.0-snapshot.jar , org.apache.cxf.service.factory.serviceconstructionexception @ org.apache.cxf.jaxrs.jaxrsserverfactorybean.create(jaxrsserverfactorybean.java:215) @ com.connexta.desertcodecamp.server.<init>(server.java:19) @ com.connexta.desertcodecamp.server.main(server.java:33) caused by: org.apache.cxf.busexception: no destinationfactory found namespace http://cxf.apache.org/transports/http. @ org.apache.cxf.bus.managers.destinationfactorymanagerimpl.getdestinationfactory(destinationfactorymanagerimpl.java:122) @ org.apache.cxf.endpoint.serverimpl.initdestination(serverimpl.java:79) @ org.apache.cxf.endpoint.serverimpl.<init>(serverimpl.java:63) @ org.apache.cxf.jaxrs.jaxrsserverfactorybean...

c# - How to have multiple selection of items on combobox -

Image
hey wanted know how can select multiple items combobox in xaml? note: i'm using data binding. like image: you can use checkbox items of combobox . and when checkbox checked, important modify placeholdertext of combobox , default show selected item, can modify show items checked. for example here: how make list of checkboxes in alarm & clock app .

Visual Studio Code does not Debug Extension to simulate -

Image
i start simple snippet extension , when debug vscode created folder ./vsce configuration file automatically. when run f5 in extension folder, see message bellow. created file configuration, why message? this file wrong .vscode/launch.json , necessary add git folder, change this: // launch configuration compiles extension , opens inside new window { "version": "0.1.0", "configurations": [ { "name": "launch extension", "type": "extensionhost", "request": "launch", "runtimeexecutable": "${execpath}", "args": ["--extensiondevelopmentpath=${workspaceroot}" ] } ] }

Scala infinite while loop even though condition changed to false -

import scala.collection.mutable.arraybuffer object namelist { val names = arraybuffer("placeholder") } class robot { val r = scala.util.random val letters = 'a' 'z' val name = { val initname = namelist.names(0) while(namelist.names.contains(initname)){ val initname = letters(r.nextint(26)).tostring + letters(r.nextint(26)).tostring + r.nextint(10).tostring + r.nextint(10).tostring + r.nextint(10).tostring println("while", initname) println("while", namelist.names) println("checker", namelist.names.contains(initname)) } println("outside", namelist.names) namelist.names += initname initname } } outputs (while,la079) (while,arraybuffer(placeholder)) (checker,false) (while,io176) (while,arraybuffer(placeholder)) (checker,false) the while loop runs indefinitely, above output snippet. why isn't while loop exiting though condition changed false?...

javascript - Twitch TV JSON API Issue -

so,i trying use twitch api: https://codepen.io/sterg/pen/yjmzrn if check codepen page you'll see each time refresh page status order changes , can't figure out why happening. here javascript: $(document).ready(function(){ var ur=""; var tw=["freecodecamp","nightblue3","imaqtpie","bunnyfufuu","mushisgosu","tsm_dyrus","esl_sc2"]; var j=0; for(var i=0;i<tw.length;i++){ ur="https://api.twitch.tv/kraken/streams/"+tw[i]; $.getjson(ur,function(json) { $(".tst").append(json.stringify(json)); $(".name").append("<li> <a href="+"https://www.twitch.tv/"+tw[j]+">"+tw[j]+"</a><p>"+""+"</p></li>"); if(json.stream==null){ $(".stat").append("<li>"+"offline"+...