Posts

How do I delete a list within a list in Python? -

my program involves drawing card deck, adding value of hand , deleting card deck (since don't want draw same card twice). example of card: card = ["4 of clubs", 4] the code doesn't work: card_number = random.randrange(len(deck_cards)) card = deck_cards[card_number][0] print(card) hand_value += deck_cards[card_number][1] deck_cards.remove(card_number) i have no idea doing wrong, , if change code to card_number = random.chioce(deck_cards) it won't accept card = deck_cards[card_number][0] part. what do? list.remove takes object, not index, parameter. so should modify code retrieve card , use directly: >>> card = random.choice(deck_cards) # retrieve object, not index >>> print (card) # card card list, i.e.: ["4 of clubs", 4] >>> print (card[0]) 4 of clubs >>> hand_value += card[1] >>> deck_cards.remove (card) note can delete object @ specified index using del built-in: >...

c# - 'The target account name is incorrect'-IOException with DirectoryInfo.GetFiles -

i doing , working before: var di = new directoryinfo("folderonshareddrive"); var files = di.getfiles("*"); i have exception , difference can see have windows 10. exception thrown: 'system.io.ioexception' in mscorlib.dll additional information: target account name incorrect. try use ip address instead of computer name.

xml - Python Scrapy Xpath? -

for non-profit college assignment i'm trying scrape data website www.rateyourmusic.com using scrapy framework in python, have had small amount of success have been able scrape name of artist artist page xpath other info (birth date, nationality) proving difficult me scrape. of know correct xpath these objects be? here parsing method has @ least worked artist name. def parse_dir_contents(self, response): item = rateyourmusicartist() sel in response.xpath('//div/div/div/div/table/tbody/tr/td'): item['dateofbirth'] = sel.xpath('td/text()').extract() #these 2 selectors aren't working item['nationality'] = sel.xpath('td/a/text()').extract() sel in response.xpath('//div/div/div/div/div/h1'): item['name'] = sel.xpath('text()').extract() #this 1 works yield item here sample url of artist page i'm scraping http://rateyourmusic.com/artist/kanye_west here real...

ios - How to add UITapGestureRecognizer inside a UIView with the target set ```self``` -

i created customized uiview , added uitapgesturerecognizer inside this: @interface customizedview : uiview @property(nonatomic,strong) uilabel* label; @end @implementation customizedview -(void) targetactionforthisview:(id)sender{ nslog(@"clicked!"); } -(void) commoninit{ _label = [[uilabel alloc] initwithframe:cgrectmake(0,0,200,100)]; _label.text = @"test string 1234"; uitapgesturerecognizer* g = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(targetactionforthisview:)]; g.enabled = yes; [self setexclusivetouch:yes]; [self setuserinteractionenabled:yes]; [self setmultipletouchenabled:yes]; [_label addgesturerecognizer:g]; [self addsubview:_label]; } -(instancetype)init{ self = [super init]; [self commoninit]; return self; } -(instancetype)initwithframe:(cgrect)frame{ self = [super initwithframe:frame]; [self commoninit]; return self; } @end then add view control...

database - SQL Server update statement won't update table -

i have server running enterprise version of sql server 2012. took backup of production database 2 days ago test migration script. worked beautifully the same database 2 days newer failed today because first step of process update records. update troopgirls set gsusaid = '00000000000'+gsusaid len(gsusaid) = 1 is 1 such statement. running statement updated(61) records every time i've run inside transaction frame commit, used go statements, messed transaction isolation levels, no avail. there no locks anywhere in database , process running against database query window. right clicking table , saying 'edit top 200 rows' work. problem have update in range of 750k records across many tables , schemas. if "gsusaid" varchar/nvarchar column, concat function work updating it. update troopgirls set gsusaid = concat('00000000000', gsusaid) len(gsusaid) = 1

How to call Rest webservice in Spring Security -

i have @restcontroller in web application, want make use of service in authentication provider security purpose .could please advise how achieve this? ( fyi : using spring boot) for example rest service url : http://localhost:8080/authentication.json login page url : http://localhost:8080/login my question similar following question, difference is, rest service available in same application . hope rest template or httpurl connection not required ? please advise. spring security login rest web service . given below sample code snippet. @restcontroller @requestmapping("authorize") public authorizecontroller{ @requestmapping(method = requestmethod.put, produces = "application/json") public employee authorize(@requestparam string username) { return employee; } } @configuration @enablewebmvcsecurity public class websecurityconfig extends websecurityconfigureradapter { @autowired customauthenticationprovider provider; @ov...

gradle - Provided scope not working in eclipse -

gradle 2.2.1 i trying include dependencies jar file ship other users. want them provide own versions of dependencies , trying emulate provided scope maven. i have followed tutorial here . able build project command line (while still getting classes not found errors in eclipse) until eclipse integration part. post says add eclipse.classpath.plusconfigurations += configurations.provided getting could not find property 'provided' on configuration container apply plugin: 'java' apply plugin: 'eclipse' // causes error //eclipse.classpath.plusconfigurations += configurations.provided sourcecompatibility = 1.8 version = '1.0' jar { manifest { attributes 'implementation-title': '...', 'implementation-version': version } } repositories { mavencentral() } configurations { provided } sourcesets { main.compileclasspath += configurations.provided test.compileclasspath += co...