Posts

java - Fail to gpg-decrypt BouncyCastlePGP-encrypted message -

when try decrypt message using gnupg encrypted bouncycastle 2 gpg: [don't know]: invalid packet (ctb=xx) messages , decryption fails. i using bouncycastle 1.54 , gpg (gnupg) 2.0.30 on osx details 1) pgp key generated using gpg follows: $ gpg --gen-key gpg (gnupg) 2.0.30; copyright (c) 2015 free software foundation, inc. free software: free change , redistribute it. there no warranty, extent permitted law. please select kind of key want: (1) rsa , rsa (default) (2) dsa , elgamal (3) dsa (sign only) (4) rsa (sign only) selection? 1 rsa keys may between 1024 , 4096 bits long. keysize want? (2048) requested keysize 2048 bits please specify how long key should valid. 0 = key not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years key valid for? (0) 0 key not expire @ correct? (y/n) y gnupg needs construct user id identify key. ...

algorithm - Find keys of the 3 largest values in a Javascript Object with O(n) complexity? -

say have object such as: let objtocheck = { a: 2, b: 5, c: 9, d: 33, e: 4, f: 8, g: 3, h: 10 }; how go returning keys of 3 largest values in ascending order, in case be: [ 'c', 'h', 'd' ] , in linear time? evidently need loop through entire object once compare values, i'm having troubling coming solution doesn't involve nested loops believe o(n²). here solution looks far: function findbig3(obj){ const res = []; const largest = object.values(obj).sort((a,b) => {return b-a}).slice(0,3); (let key in obj){ largest.foreach( (val) => { if (obj[key] === val) res.push(key); }); } return res; } i imagine need declare 3 variables, such big1 , big2 , big3 , , loop through object type of comparison check , reassign appropriate, i'm struggling implementation. this algorithm runs in o(n). function getthreelargestkeys(obj){ var k1, k2, k3; var v1, v2, v3; v1 = v2 = v3 = -infinity;...

r - How to reshape data from long to wide format? -

i'm having trouble rearranging following data frame: set.seed(45) dat1 <- data.frame( name = rep(c("firstname", "secondname"), each=4), numbers = rep(1:4, 2), value = rnorm(8) ) dat1 name numbers value 1 firstname 1 0.3407997 2 firstname 2 -0.7033403 3 firstname 3 -0.3795377 4 firstname 4 -0.7460474 5 secondname 1 -0.8981073 6 secondname 2 -0.3347941 7 secondname 3 -0.5013782 8 secondname 4 -0.1745357 i want reshape each unique "name" variable rowname, "values" observations along row , "numbers" colnames. sort of this: name 1 2 3 4 1 firstname 0.3407997 -0.7033403 -0.3795377 -0.7460474 5 secondname -0.8981073 -0.3347941 -0.5013782 -0.1745357 i've looked @ melt , cast , few other things, none seem job. using reshape function: reshape(dat1, idvar = "name", timevar = ...

php - View content of PHPSESSID variable/cookie based on its value -

when visiting website (not owned me) example has set phpsessid variable/cookie value 7er3hjkal8u235c87u6ih0vz8y, possible view content? tried print_r($_session); in console says 'referenceerror: print_r not defined' . if not possible directly view content, there way view traffic or contents stored/piped phpsessid? thank you. you can't use print_r() in console, because console executing javascript, can't execute php functions in browser's console. you can't view contents of session, because never passed browser. when php creates session, (often times) sets cookie called phpsessid. value of cookie thing sent browser. value references on server (usually file containing serialized version of of session data). unless author of site explicitly writes session data out browser, browser never have access it.

Don't understand why I am receiving SIGKILL on python -

i'm beginner python , i'm trying make code on code challenge website when given list of integers, returns integer closest zero. if there 2 different integers same difference, e.g. 3 , -3, should return none. (however if number repeated, e.g. 3 , 3, doesn't count that) i've made code seems work on outside python interpeters, inside website gives error of "process exited prematurely sigkill signal." on external python interpreter seems return integer i'm looking for def closest(lst): ans = list(filter(lambda x: abs(0-x) == min([abs(0-i) in set(lst)]), set(lst))) return ans[0] if len(ans) < 2 else none is there in code causing inefficiency or website? i suspect coding website testing function passing large generator lst . when program converts set , loads entirety of input memory. if uses memory, process may killed oom killer. i think following solution ought work. note iterates on lst , doesn't construct other large d...

Why does Perl's strict mode allow you to dereference a variable with an undefined value in this foreach context but not in an assignment context? -

this code: #!/usr/bin/perl use 5.18.0; use strict; # part 1 $undef = undef; print "1 $undef\n"; foreach $index (@$undef) { print "unreachable no crash\n"; } print "2 $undef\n"; # part 2 $undef = undef; @array = @$undef; print "unreachable crash\n"; outputs: 1 2 array(0x7faefa803ee8) can't use undefined value array reference @ /tmp/perlfile line 12. questions part 1: why dereferencing $undef in part 1 change $undef arrayref empty array? are there other contexts (other foreach) dereferencing $undef change in same way? terminology describe generic such case? questions part 2: why dereferencing $undef in part 2 fall afoul of strict ? are there other contexts (other assignment) dereferencing $undef fall afoul of strict . terminology describe generic such case? 1) for() in perl puts operand "l-value context", therefore $undef being auto-vivified existence array (reference) 0 elements (see this...

javascript - clipboardData paste html format mobile web in iOS -

Image
clipboarddata in javascript, used getdata('text/html'). const clipboarddata = e.clipboarddata || window.clipboarddata; const pasteddata = clipboarddata.getdata('text/html') || clipboarddata.getdata('text'); this source activates in pc/aos platform. not working on ios. when pasting clipboarddata, want load html specification on ios show this. first picture: mobile web safari load format in ios second picture: pc web chrome load format i try mobile chrome, safari, , on.. same too.