Posts

authentication - How to use friend with compojure? -

i'm new clojure, , i'm trying add authentication system compujure app , i'm using cemerick.friend. all routes working fine, i'm never able login, when using dummy in memory database (if can call that). the problem, believe, on cemerick.friend.credentials/bcrypt-credential-fn , never validating credentials. here's gist relevant code: https://gist.github.com/zamith/5940965 any on how solve problem nice. thanks. you want use workflows/interactive-form specify workflows/interactive-login-redirect . the latter function's purpose serve default :login-failure-handler . perform redirect after failed login attempt; makes no attempt log user in. you need remove (resp/redirect "/signup") body of friend/authenticated form in "/dashboard" route, it's unconditionally redirecting logged in users signup page. (that redirect happens in fact proof of user being authenticated, since otherwise body of friend/authenticated not ...

c++ - duplicate symbol for architecture x86_64 : Eclipse -

Image
not able run simple c++ program. kindly me solve problem the message means have loaded same functions twice. in hw.cpp? compiled , linked. if main function cause. suspect since have 1 function.

In XDocReport, how to handle null value? -

is there way handle null value field in xdocreport? or need manipulate on own? example: if (thisvar == null) context.put("sampletext", ""); else context.put("sampletext", thisvar); or there option in docx quick parts? i found line in error message of xdocreport. not understand apply this, in template or in code. tip: if failing expression known legally refer that's null or missing, either specify default value myoptionalvar!mydefault, or use [#if myoptionalvar??]when-present[#else]when-missing[/#if]. (these cover last step of expression; cover whole expression, use parenthesis: (myoptionalvar.foo)!mydefault, (myoptionalvar.foo)?? in docx, append ?if_exists field name «${tx.amount?if_exists}» you may append ! «${tx.amount!}» please refer link uses freemarker. how check if variable exists in freemarker template?

perl - How do I sort a list of IP addresses and compute a class and netmask for each? -

i have 2 options. 1 have array has list of ips. example @ip=(); # array has ips below in sample input: 108.0.0.30 108.0.0.30 108.0.0.30 192.168.1.1 192.168.1.2 10.0.0.1 i need program can sort such array , tell network class , subnet mask is. example, output should 10.1.1.1/25 10.1.1.1 ip , 25 submask net::ip , net::ip::resolver , net::ip::match::regexp , other submodules net::ip doing fine you. part sorting difficult. if google it, find nice methods. example: my @ips = qw( 172.27.32.200 172.19.32.100 10.1.1.60 192.20.30.133 ); @ips = map {s/\s+//g; $_} sort map {s/(\d+)/sprintf "%3s", $1/eg; $_} @ips; print join "\n", @ips; found here

PHP Stack Array Push & Pop -

ive been trying create navigation system project have been working on. i've been stuck while now, feel i'm on right track. i want know how make when user selects sql1.php removed $phpfiles same page wont appear again href. it's set random, fine want, never want user see same link twice. <?php $currentpage = $_server["php_self"]; $nextpage; $prevpage; $phpfiles = array(); $phpfilesprevious = array(); $phpfiles[] = 'sql1.php'; $phpfiles[] = 'sql2.php'; $phpfiles[] = 'sql3.php'; $phpfiles[] = 'sql4.php'; $phpfiles[] = 'sql5_1.php'; $phpfiles[] = 'sql6.php'; $phpfiles[] = 'sql7.php'; $phpfiles[] = 'sql8.php'; $phpfiles[] = 'sql9.php'; $phpfiles[] = 'sql10.php'; $nextpage=$phpfiles[rand(0, count($phpfiles)-1)]; $prevpage=$currentpage; $currentpage=$nextpage; array_push($phpfilesprevious, $currentpage); array_push($phpfilesprevious, $prevpage); unset($phpf...

php - How to add browser cache in Laravel 5? -

i wish add browser caching laravel application. i have used elixir versioning tool so: https://laravel.com/docs/5.2/elixir#versioning-and-cache-busting however, according google pagespeed insights, files still not caching , instead got message: setting expiry date or maximum age in http headers static resources instructs browser load downloaded resources local disk rather on network. i think may because need manually add cache headers? yes need set cache-control , expires in http header static resources, google pagespeed message not show up. since you're using elixir versioning tool, can safely set expires of js/css files 1 week. the way depends on web server using. if using apache , may put following code in .htaccess or config file of virtual website. <filesmatch "\.(js|css)$"> expiresactive on expiresdefault "access plus 1 weeks" </filesmatch> be sure enable mod_expires apache module! with same synt...

javascript - How to create specific chain of numbers -

i have school prompt create function finds out integer, in range user enters, produces longest chain. "chain" consists of: ask user number. if number even, divide 2. if it's odd multiply 3 , add 1. continue until reach 1. e.g. if start 3, sequence 3-10-5-16-8-4-2-1. function print out number produces longest chain , actual integers in chain (length of chain). this have far. can't figure out. function chain2() var startnumber = prompt("enter starting number of range", "4"); var endnumber = prompt ("enter ending number of range", "9") var separator="-"; while (currentnumber>1){ if (currentnumber%2==1){ currentnumber=currentnumber*3+1; chain+=separator+currentnumber; } else if (currentnumber%2==0){ currentnumber=currentnumber/2; chain+=separator+currentnumber; ...