Posts

java - How to get original password from BCryptPasswordEncoder -

i'm using spring security application. when user register first time, passwords encrypted bcryptpasswordencoder . bcryptpasswordencoder passwordencoder = new bcryptpasswordencoder(); string hashedpassword = passwordencoder.encode(password); now, in case of password changing, users enter current password , need check if current password same against encrypted password saved in database. i know not possible generate 2 same encrypted hash same string bcryptpasswordencoder . way compare passwords if same original password saved in database , compare current entered password. so, there way compare passwords or original password database saved hashed password? you need check raw password against encoded password in db. example, bcryptpasswordencoder bcryptpasswordencoder = new bcryptpasswordencoder(); string p = bcryptpasswordencoder.encode("somecoolpassword"); system.out.println(bcryptpasswordencoder.matches("somecoolpassword", p));

Nginx + Systemd/Systemctl + Django not working (502 bad gateway) -

i've been @ hours , yet cannot figure out why setup isn't working. if run command that's in exec on own, can access page through browser fine. when try run service, 502: bad gateway. i first tried using unix sockets, when didn't work, plugged in ip , port directly, still no luck. gunicorn.service: [unit] description=gunicorn daemon after=network.target [service] user=username workingdirectory=/home/username/naomiselect environment="path=/home/username/naomiselect/naomienv/bin" execstart=/home/username/naomiselect/naomienv/bin/gunicorn --workers 3 --bind local_ip:8000 naomiselect.wsgi:application [install] wantedby=multi-user.target nginx.conf: user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # basic settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; ...

swift - UITableView.insertRowsAtIndexPaths not working -

i'm using core data , have problem. app crashes because when insert new element try access cell doesn't exist should. the code matters: func controllerwillchangecontent(controller: nsfetchedresultscontroller) { tableview.beginupdates() } func controllerdidchangecontent(controller: nsfetchedresultscontroller) { tableview.endupdates() } func controller(controller: nsfetchedresultscontroller, didchangeobject anobject: anyobject, atindexpath indexpath: nsindexpath?, forchangetype type: nsfetchedresultschangetype, newindexpath: nsindexpath?) { switch type { case .insert: if let indexpath = newindexpath { self.tableview.insertrowsatindexpaths([indexpath], withrowanimation: .fade) // doesn't work print(indexpath) // returns row 0 section 0 print(tableview.numberofrowsinsection(0)) // returns 0 print(tableview.cellforrowatindexpath(indexpath)) // returns nil ...

jquery - How to add a transition to a navbar dropdown -

i finished making navbar mobile , add transition drops down slower currently. here jquery: (function( $ ){ $(document).ready(function(){ $(".burguer-nav").on("click", function(){ $("header nav ul").toggleclass("open"); }); }); })(jquery); and css: span.burguer-nav { display: none; } @media screen , (max-width: 845px){ .main-navigation li { display: block; text-align:center; } .burguer-nav{ display: block !important; height: 40px; cursor: pointer; font-size: 18pt; } header nav ul{ overflow:hidden; height:0; background-color: #505050; } header nav ul.open{ height:auto; } } how , can add transition? @media screen , (max-width: 845px){ .main-navigation li { display: block; text-align:center; } .burguer-nav{ display: block !important; ...

java - Handle clicks on Image in ImageViewer (Codenameone) -

we try make image clickable time within image viewer. in view, there no listener it? we have gallery of images. after clicking on image opened in separate window. in thread found opportunity put image on button. need restructure our gallery, want avoid here code opening image. works far: form picture = (form) createcontainer(res, "imageviewer"); beforeimageviewer(picture, currentobjektmodel); picture.showback(); postimageviewer(picture, iv.getimagelist().getitemat(iv.getimagelist().getselectedindex())); the problem doing image viewer handles pointer events swipe/pan rely on. can use scaleimagebutton cases since need swiping not option. you can derive image viewer , override pointerpressed & pointerreleased . if pressed called released after , distance between 2 x/y coordinates (from pressed/released) small that's click.

multithreading - C++ Fork Join Parallelism Blocking -

suppose wish run section in parallel, merge main thread section in parallel, , on. similar childhood game red light green light. i've given example of i'm trying do, i'm using conditional variable block threads @ start wish start them in parallel block them @ end can printed out serially. *= operation larger operation spanning many seconds. reusing threads important. using task queue might heavy. i need use kind of blocking construct isn't plain busy loop, because know how solve problem busy loops. in english: thread 1 creates 10 threads blocked thread 1 signals threads start (without blocking eachother) thread 2-11 process exclusive memory thread 1 waiting until 2-11 complete (can use atomic count here) thread 2-11 complete, each can notify 1 check condition if necessary thread 1 checks condition , prints array thread 1 resignals 2-11 process again, continuing 2 example code (naive adapted example on cplusplus.com): // condition_variable example...

php - cant send an email on cakephp3 -

i can't cakephp3 send emails. in cakephp2 no problem. using latest wamp, , cakephp3.3 on windows 7. tried follow directions looks getting basic wrong. need configure wamp checked php.ini -development file there no smtp entry change error- stream_socket_client(): ssl operation failed code 1. openssl error messages: error:14090086:ssl routines:ssl3_get_server_certificate:certificate verify failed stream_socket_client(): failed enable crypto stream_socket_client(): unable connect ssl://smtp.gmail.com:465 (unknown error) controller public function singletutoremail(){ $email = new email(); $email->transport('gmail3'); $to='jjxxx@gmail.com'; $subject='testing'; $message='hello, dfsfsdfsdf sdfsdf'; $email->from(['jjxxx@gmail.com' => 'test']) ->to($to) ->subject( $subject) ->send($m...