Posts

Swift: 'Class.type' does not have member named 'variable' -

i have started swift programming language course , need on first program. using playground write anagram program in xcode v6.3.2. logic, first sorting words alphabetically , comparing them. error occurs when declaring word1 , word2 arrays , dictates 'anagram.type' not have member named 'word1'. believe logic correct. struggling understand why error occurs, , how solve it. have looked around online, having difficulty applying find own code. first time using stack overflow. constructive feedback welcomed. import uikit class anagram{ let word1 :string let word2 :string init(word1: string, word2: string){ self.word1 = word1 self.word2 = word2 } var characters1 = array(word1) var characters2 = array(word2) characters1 = characters1.sort() characters2 = characters2.sort() var pos = 0 var match = true while pos < characters2.length && m...

python - Calculating hamming distance with mongodb? -

say i've got large set of documents contain perceptual hashes (around 35,000), fastest way can (using mongodb) compare given hash x hashes in database , find ones distance less n. i'm using python way, i'm assuming isn't possible natively in mongo, maybe possible optimize somehow?

How to get help for S4 class in R? -

beginners in r know how use ? , help learn topic. how documentation s4 classes? i not find systematic discussion of this. there brief mentions of method ? , methods ? , method ? generic("class") . is how help?

What's a simple workaround for this bug in PHP Simple HTML DOM Parser 1.5? -

can suggest simple code (not data) workaround bug in php simple html dom parser 1.5? $html = str_get_html('<html><body><table><tr><td><td><tr><td><td></body></html>'); $r=$html->find('tr',0); echo count($r->find('td')); // expected: 2 ; observed: 4 [code using $r] edit: issue occurs added </table> (^ workaround site's misinterpretation of string inline). edit: find advanced html dom fixes problem not compatible replacement. see incomatible how workaround php advanced html dom's conversion of entities? the simplest workaround switch this library fixes issue , lots of other ones.

class - iOS Size Classes, Uninstalled Views and Outlets -

i have outlet uilabel. label "installed" width , height, "uninstalled" compact width , height. when run project iphone 5 simulator (compact width, height), can still see valid outlet. why this? shouldn't nil or something? thinking valid hidden (i can't see outlet, ishidden false). happens it? what missing? thanks in advance! from apple's size classes design help a runtime object uninstalled view still created. however, view , related constraints not added view hierarchy , view has superview property of nil. different being hidden. hidden view in view hierarchy along related constraints. if @ superview property of uninstalled uilabel see nil . if outlet nil have issues if tried access it; code have explicitly check active size class , adapt behaviour. still creating object not adding view hierarchy code can still operate on label, operations won't have visible effect.

graphics - Circle crop image with transparent background - Android -

i'm trying described here "i want crop circular region bitmap. pixels outside circle should transparent." i trying what's in post of them don't offer transparent background, circle image, tried below , didn't work, ideas? public bitmap getcroppedcircleimage(bitmap bmp, view view) { bitmap bitmap = getcroppedimage(bmp, view); bitmap output = bitmap.createbitmap(bitmap.getwidth(), bitmap.getheight(), bitmap.config.argb_8888); canvas canvas = new canvas(output); final int color = 0xff227722; final paint paint = new paint(); final rect rect = new rect(0, 0, bitmap.getwidth(), bitmap.getheight()); paint.setantialias(true); canvas.drawargb(0, 0, 0, 0); paint.setcolor(color); //canvas.drawroundrect(rectf, roundpx, roundpx, paint); canvas.drawcircle(bitmap.getwidth() / 2, bitmap.getheight() / 2, bitmap.getwidth() / 2, paint); paint.setxfermode(new porterduffxfermode(porterduff.mode.src_in)); canvas.drawb...

security - Data encryption algorithm which decrypts the data only once but need a different key to decrypt it again -

is there encryption algorithm in encrypted data/file can decrypted key once, should re-encrypt file different key needed decrypt same file again. well, not algorithm per se -- once have key, data decrypted. there techniques that, , typically pivot on 1 of following: software obfuscation (you can google keywords such "software protection"), or hardware attack countermeasures (look "trusted execution environment" example), or both @ same time. this example pretty happens when watch netflix movie on pc connected hdmi tv: @ simplified level, happens movie encrypted drm key k1, gets decrypted k1 on pc, , re-encrypted new hdcp key k2 on way out tv (then tv decrypt same hdcp key k2). same story miracast , other similar protocols.