Posts

java - Best approach to generate a dynamic key in security -

this question has answer here: how create secure random aes key in java? 3 answers a defined key used in this example : byte[] keybytes = new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }; secretkeyspec key = new secretkeyspec(keybytes, "aes"); i need know recommended approach generate dynamic enhanced unpredictable key, when security working jax-ws , jax-rs web services. that's securerandom class in java for: securerandom random = new securerandom(); byte[] key = new byte[24]; // 24 or whatever key length random.nextbytes(key); securerandom provides " a cryptographically strong random number generator (rng) " according javadoc documentation. it's faulted being slow, not being insecure.

How to encrypt/decrypt javascript array, while using php -

i creating javascript array dynamically using php instance take 1 example here <?php echo "<script> var array={ 'a' : { 'a':123 , 'b':[[1,2],[3,4]] } }; function dum(arr) { window.alert(arr); } dum(array['a']['a']); </script>"; ?> in case array created holds important information not want share of client, since impossible mask view source in browser understood previous post, encrypt before echo in view source client won't able understand array is, array contains, , sending array function in case dum , inside function dum descrypt it, , process. i hope approach clear, negative voters kindly comment understand mistake. while encrypt data before sending client, if want you'll have send client instructions on...

javascript - MultiSelect Dropdwon list value Move To Text Box -

i using javascript code copying field value field. when use check box in dropdown, have click check box value copy text-box. but selects single not multiple value in text box... <script> $(document).ready(function() { $("#dropdown").on('change',function(){ var dropdownval=this.value; $("#textbox").val(dropdownval); }); }); </script> <form> <p> <select multiple="multiple" name="dropdown" id="dropdown" style="width:370px"> <option value="red">red</option> <option value="green">green</option> <option value="blue">blue</option> <option value="orange">orange</option> </select> </p> <input type="text" class="normal" id="textbox" n...

javascript - GetBoundingClientRect doesn't work outside the window -

i making script should measure distances in post. example, if have 3 posts: post 1: two lines of text, image want see. post 2: just image want see. post 3: the image want see followed 2 lines. the reason want this, because think tumblr displays nonsense in discriptions. making chrome extension crop nonsense around images have scroll less. on every posts apear button see whole post. as of today, works great! getboundingclientrect can top, left, bottom , right offset window. there 1 problem. can not posts on page right away, because if post 700px or more away of visible part of document, part you're viewing in browser, values provided gbcr 0. these values not valid, , 0 because post isn't rendered on screen. , make extension try dimensions if scroll, when post gets in visible part of window, processed. doesnt have preference. mean js functions have triggered every time user scrolls, bad practice. rather start functions when dom loaded, if new posts added, functi...

c++ - Determining cascaded shadow map split ranges -

i'm doing cascaded shadow maps, , believe have problem concerning way split comparison select proper shadow map. stands, shadow mapping works overall in few cases @ angles not work. currently lighting shader stage looks this: "#version 420 const float depth_bias = 0.00005; layout(std140) uniform unifdirlight { mat4 mvpmatrix[4]; mat4 mcamviewmatrix; vec4 msplitdistance; ...

How to use JSON to parse data into android application -

i can not understand code. i beginner of android , java. how work doinbackground(void... params) , onpostexecute(string result) . how pass value on method mainacitivity. please me.thanks class downloadtask extends asynctask<void, void, string>{ @override protected string doinbackground(void... params) { string result=null; try { httpclient client=new defaulthttpclient(); httpget get=new httpget(urlstring); httpresponse response=client.execute(get); if(response.getstatusline().getstatuscode()==httpstatus.sc_ok){ inputstream in=response.getentity().getcontent(); bufferedreader reader=new bufferedreader(new inputstreamreader(in)); string line=reader.readline(); log.v(getclass().getsimplename(), line); return line; } } catch (exception e) { e.printstacktrace(); return null...

objective c - iOS navigate from inital view to second view from the last view -

Image
below see view hierarchy. view green color last view. last view want show view, indicated black arrow. however when user wants navigate view, initial view (indicated yellow arrow) should presented. make segue last view "black arrow" view. how can show initial view (yellow arrow) when user goes back? method1: well, depends on segues, if of them push type, green vc embedded too. if is, can navigate through hierarchy via [self.navigationcontroller poptoviewcontroller:desiredviewcontroller animated:yes] . here method does: pops view controllers until specified view controller @ top of navigation stack. reference: uinavigationcontroller class method2: if still want use modal presentation, create weak delegate property bind greencontroller controller, presented (or use nsnotificationcenter listen dismiss modal view controller event). once user pressed on dismissing, controller presented greencontroller redirects no animation yellow one. create illusio...