Posts

Showing posts from April, 2014

iOS app with only launch feature will it clear store review? -

i tying launch ios app website. planned start development few months later have app on store small functionality of launching app open mweb directly site url. so app accepted in app store review? i suggest apple reject it. to quote app store review guidelines : apps not useful, unique, web sites bundled apps, or not provide lasting entertainment value may rejected.

python - Individual timeouts for concurrent.futures -

i see 2 ways specify timeouts in concurrent.futures . as_completed() wait() both methods handle n running futures. i specify individual timeout each future. use case: future getting data db has timeout of 0.5 secs. future getting data http server has timeout of 1.2 secs. how handle concurrent.futures ? or library not right tool? conclusion afaik solution mdurant work-around. i think use different library next time. maybe asyncio has better support this. see: https://docs.python.org/3/library/asyncio-task.html#asyncio.sleep how implementing own: wait(dbfutures + httpfutures, timeout=0.5) [fut.cancel() fut in bdfutures if not fut.done()] wait(httpfutures, timeout=0.7) [fut.cancel() fut in httpfutures if not fut.done()] (or while loop sleep/check or wait short timeout)

angularjs - How to bind object to ng-model in datalist selected option ng-repeat -

in text box want show customer name per user enter key if user enter letter customer name starting letter display in search box.for using "data-list" but problem if writing option value="customer.name" display customer names in text box per requirement @ same time bind customer name ng-model. i want customer object bind ng-model <div ng-app="myapp" ng-controller="myctrl"> <div class="form-group"> <label class="control-label">customer name :</label> <input list="browsers" name="browser" ng-model="selectedcustomer" > <datalist id="browsers"> <option ng-repeat="customer in customers" value="{{customer.name}}" >{{customer.name}} </option>

How can a Java enum start with 1? -

taking @ source code of java.time.dayofweek reveals: public enum dayofweek implements temporalaccessor, temporaladjuster { /** * singleton instance day-of-week of monday. * has numeric value of {@code 1}. */ monday, /** * singleton instance day-of-week of tuesday. * has numeric value of {@code 2}. */ tuesday, // .. } so how can dayofweek.monday = 1 ? asking because use gwt not support new java.time stuff yet (or never idk). did made own version of dayofweek 1 got public int getvalue() { return ordinal() + 1; } annoying since have call everytime. that why curious why above version starts 1. other thing i'd know why f has start 1 , not 0 every other enum does. have gone monday = 0 , tuesday = 1 , etc. no ! instead switched sunday = 0 , monday = 1 , etc. thing there. no, not option public enum mydayofweek { dummy, monday, tuesday, // .. ; } simply because annoying: for(mydayofweek day : mydayofw

angularjs - ngResource custom model actions -

i'm using ngresource handle models in ionic/angular app , i'm having trouble figuring out how/if can make custom actions on resource. i'm storing model instances in local storage , when update record, want update local storage well. have working, i'm having copy , paste code multiple instances , keep dry. logentry.update($scope.timelog, function(data) { // update local storage ( var = 0; < logentries.length; i++) { if(logentries[i].id == $scope.timelog.id){ logentries[i] = $scope.timelog; } }; localstorageservice.set('logentries', logentries); }); here situation update record, , after promise returns update local storage. make repeatable, how envision being possible (based on other things i've seen in other frameworks , other languages) like: logentry.update($scope.timelog, function(data) { // update local storage logentry.updatelocalstorage($scope.timelog); }); my resource looks like: .factory('logentry'

ruby - How do I search words seperated by _ and . in ElasticSearch? -

i new elasticsearch , happy speed @ moment. still have 1 requirement haven't been able achieve. elasticsearch seems split following text when doing indexing: "bmw.co.uk" "apple_macbook_pro" i searching in ruby using elasticsearch gem: result = client.search index: 'elasticsearch_dev', body: { query: { "bool" => { "must" => {"match" => {"search_text" => {"query" => "bmw", "operator" => "and"}}}, "must_not" => {"match" => {"search_text" => {"query" => "", "operator" => "or"}}} } }, } what i'm trying achieve: when search 'bmw' or 'bmw.co', want records bmw.

php - How to update html repeated field values to mysql database -

i have html repeated values in array need update database, need on how use php script update database staffid mataches . see below html code <!doctype html> <html> <head lang="en"> <meta chartaxt="utf-8"> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet"> <script src="js/jquery.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <title>sample salary computation</title> </head> <body> <form method="post" name="regis" id="regis"> <table align="center" border="1" width="200"> <tr> <th>staff id</th> <th>salary</th> <th>total tax</th> <th>total net pay</th> </tr> <!--staff 1-->

css - display:flex; cancels margins% on firefox but works on chrome -

i'm using bootstrap , wanted vertically center div class="col-md-12" in div class="row" . so added class div class="row" : .row-vertical-align { display: flex; align-items: center; } however, div class="col-md-12" have margins in %, working on chrome, not on mozilla. if remove display:flex;, margins come here goes vertical alignment. could please me find solution? thanks in advance. you can add display: table; parent class (row) , display:table-cell;vertical-align:middle; child class (col-md-12).

excel - move files from one folder to another -

actually searching code move excel files 1 folder if there way please me. sorry dont know how coding have never used vba in fact see first time. i grateful you you can use filesystemobject: dim fso object set fso = createobject("scripting.filesystemobject") fso.movefile("sourcefilename", "targetfilename") feel free comment, if need further instructions.

php - bindParam gives Invalid parameter number -

im trying prepared statements send data table. giving me error. doing wrong? did wrong here? error: sqlstate[hy093]: invalid parameter number: number of bound variables not match number of tokens my code below $stmt = $conn->prepare("insert mystic_male (id, name, m1, m2, m3, m4, m5, m6, m7, m8, m9, time) values (:id, :name, :m1, :m2, :m3, :m4, :m5, :m6, :m7, :m8, :m9, current_timestamp)"); $stmt->bindparam(':id', $id); $stmt->bindparam(':name', $name); $stmt->bindparam(':m1', $m1); $stmt->bindparam(':m1', $m2); $stmt->bindparam(':m1', $m3); $stmt->bindparam(':m1', $m4); $stmt->bindparam(':m1', $m5); $stmt->bindparam(':m1', $m6); $stmt->bindparam(':m1', $m7); $stmt->bindparam(':m1', $m8); $stmt->bindparam(':m1', $m9); // insert row $id = ""; $name = "$ps0"

c# - Calling web service returns The remote server returned an error: (502) Bad Gateway -

i trying call web service in c# using wsdl proxy, web service requires credentials passed partsinquiryservicehttpservice client = new partsinquiryservicehttpservice(); client.url = "url"; client.credentials = new networkcredential("user name", "password"); in line exception thrown client.getmultiplepartsinquiry(enquiry); unhandled exception of type 'system.net.webexception' occurred in system.dll additional information: remote server returned error: (502) bad gateway please help the problem in web.config. proxy tag added , web service request fails because proxy credentials not included. removing proxy section solved problem.

Why GPS is still in usage eventhough i removed location updates for fused location api in android -

i using fused location api location updates in app. when request location updates, gps getting on(we can see location symbol in status bar) , when removing location updates calling removelocationupdates,sometimes gps not switching off(we can see still location symbol in status bar).no other app using gps @ point of time other app. resulting in consuming more battery app. creating required object instances mlocationclient = new googleapiclient.builder(this) .addconnectioncallbacks(connectcallbacklistener) .addonconnectionfailedlistener(connectfailedlistnr) .addapi(locationservices.api).build(); mlocationrequest = locationrequest.create(); mlocationrequest.setpriority(locationrequest.priority_high_accuracy); mlocationrequest.setinterval(update_interval_in_milliseconds); mlocationrequest.setfastestinterval(fastest_interval_in_milliseconds); requesting location updates locationservices.fusedlocationapi.requestlo

ios - How to offset NSDate with UTC timezone offset without hardcoded manual calculation -

imagine current local time being 15:11 utc. retrieve data set server showing opening closing time of business displayed so: { close = { day = 3; time = 0200; }; open = { day = 2; time = 1700; }; i receive utc-offset property exposed so: "utc_offset" = "-420”; imagine minute offset giving hour offset of 7 hours seems right considering timezone i'm in utc , business location's opening hours information i'm receiving business in los angeles 7 hours behind. how use property able time calculations on want determine whether current local time falls between open , close time bit have figured out calculations come out wrong considering time comparison done in local timezone when needs offset before calculating against time range. i'm trying avoid doing things like psuedocode: nsdate.date hour componenent + (utc_offset / 60 = -7 hours) update: here's how i'm checking if business open right now if currentarmytime.com

javascript - Problems onclick function on child button -

i trying create table, made buttons, allow me geological time chart. create 4 buttons class "levels" , execute function return childs api. the point function works first time, stop working new created buttons. here code: $(".levels").click(function clicklevel(){ var buttonname = $(this).text(); console.log($(this).text()); $.each(jsonobject, function(index,value){ if (buttonname == value.nam){ lvloid = value.oid; console.log(lvloid); } if(lvloid == value.pid){ console.log(lvloid == value.pid); var button = "<button class=\"btn-flat levels\" style=\"background-color:"+value.col+";\">"+value.nam+"</button>"; $(".conti").append(button); } }); }); i guess problem creating class within function, don't find other solution (i tried declare function , call in .click event, don't work!). thank

javascript - angular ui router back button issue -

'use strict'; angular.module('cbapp') .config(function ($stateprovider) { $stateprovider .state('search', { url: '/college/search', templateurl: 'app/collegesearch/views/collegesearch.html', controller: 'collegesearchctrl' }) .state('searchcollegefilter', { url: '/college/search/:streamid?cities&courses&branches&ordering', templateurl: 'app/collegesearch/views/collegesearch.html', controller: 'collegesearchctrl' }); }); here application calls 1st state i.e 'search' url /college/search. inside controller transition state searchcollegefilter. wanna navigate user back came when click browser button. came '/' want them go home page. in browser history there 2 entries college/search. want happen 1st time. for northing angularjs, thing need watch browser event before navigating "windo

c# - previewing what a .NET HttpResponse object will post (obtaining cURL or similar serialised output) -

i not getting response wanting following code: var multipart = new multipartformdatacontent(); var empty = encoding.ascii.getbytes("\r\n\r\n\r\n"); httpcontent content = new bytearraycontent(empty); content.headers.add("name", "jform[ical_url]"); multipart.add(content); ...[cut brevity]... using (var handler = new httpclienthandler { usecookies = false }) using (var client = new httpclient(handler) { baseaddress = new system.uri("http://icalendar.org") }) { var response = await client.postasync("/validator", multipart); i know post request (having used firebug's 'copy curl' menu item). is there way see client.postasync send, or extension serialise multipart variable above can compare curl string successful post? thank you. overriding delegating handler has provided of answer, per this answer . i had not explained class library. tried crowcoders advice, couldn't work, , entire solution

java - Spring web flow don't redirect after post submission -

i encounter strange issue in project using spring web flow 2.4.0. in documentation of web-flow project can read on chapter 2 following statement: by default web flow client-side redirect upon entering every view state. my concern when submit form web flow not make redirection implies new form submission made if user reload or refresh page. boring. tried many things , found couple of solutions on web example make redirection programmaticaly following code : context.getexternalcontext().requestflowexecutionredirect(); and found attribute "redirect" tag view-state in flow configuration. when set true works fine. since web flow documentation mentions behavior (redirect automatically ) default 1 , heard better way after form submission. i looking kind of post redirect pattern. thank , sorry english :) just verify springwebflow xml file configuration, because of redirect flag set false in flow-execution-attributes. <webflow:flow-execut

Can I get user info for same user with linkedin API -

can user info same user linkedin api if user dont auth in linkedin-api-application? all linkedin api requests require authentication made. once authenticated, can retrieve profile information authenticated user making call people api: https://api.linkedin.com/v1/people/~?format=json more details available here: https://developer.linkedin.com/docs/signin-with-linkedin

java - How to pass a String parameter to a void method? -

i need write java program course i'm taking looks genes in strand of dna.the issue having test method, need pass printallgenes(a) void printallgenes method. in test method i've tried setting 'int a' 'string a', in either case error when compiling explaining void cannot converted int or string. i'm sure obvious, i'm new programming, please pardon ignorance! thank you. import java.io.*; import edu.duke.*; public class findprotein { public void test() { string = "atg aaa tab tag atg aaa tga aat ag"; int b = printallgenes(a); system.out.println("dna string " + a); system.out.println("gene found " + b); } public void printallgenes(string dna) { int sp = 0; //start point while (true) { int start = dna.indexof("atg,sp"); if (start == -1) { break; } int stop = findstopindex(dna, start + 3); if (stop != dna.length()) { system.out.println(dn

SQL Access - Transpose Multiple results into one row -

i struggling following problem new sql. problem: projtask table has multiple tasks 1 project. need transpose results show statuses (e.g. task 150, 130, 110, 70 status) every task on single result row against 1 project. at moment coming multiple result rows against 1 project due number of tasks associated project. hope makes sense. if not please probe. thanks, appreciated :) ultimately want result like: project x - task 10 - status c - task 130 - status - task 150 - status c project y - task 10 - status - task 130 - status c - task 150 - status project z - task 10 - status c - task 130 - status c - task 150 - status c select iif(dbo_projtask.[task-num]=150 , dbo_projtask.stat='c','released') 150_status, dbo_projtask.[proj-num], iif(dbo_projtask.[task-num]=130 , dbo_projtask.stat='a','active') 130_status dbo_projtask group iif(dbo_projtask.[task-num]=150 , dbo_projtask.stat='c','released'), dbo_projtask.[proj-num],

javascript - Angular2 server-side-listener for file uploads -

in angular2 cli project, finnaly implemented this upload button vaadin. button ui works, don't know how make upload file anywhere . i keep finding solutions express server listens file uploads, multer or node server , , have no idea how write such server, put it, how start it, how access it, etc.. figured trivial file upload should easier achieve, seems not. what simple solution implement along side angular2 in order make button upload files somewhere can download them later? found solution in ng2-uploader repo , adapted work vaadin upload . component.html <div *ngif="newname.valid"> <vaadin-upload target="http://localhost:10050/upload" </vaadin-upload> </div> server.js 'use strict'; const hapi = require('hapi'); const inert = require('inert'); const md5 = require('md5'); const multiparty = requi

php - Wordpress: List of cron jobs by plugin -

i'm running wordpress blog on 512mb vps , due lack of memory, mysql crashes frequently. i'm trying optimize server , need know plugins use cron jobs. found wordpress method _get_cron_array() returns array of scheduled tasks don't have information scheduled each of them. so, how can list of cron jobs plugin ? you can use https://wordpress.org/plugins/wp-crontrol/ cron control plugin useful add , manage cron jobs.

Web2PDF not reading Javascript or Php values -

i'm using web2pdf print few values pdf document. in html, these values show when i'm converting webpage pdf, these php/js values disappear. can fix this? <html> <body> <?php session_start(); $variable = $_session['getsessionvar']; ?> <span id = "name"><?php echo $variable ?></span> <button id="cmd" ><a href ="http://www.web2pdfconvert.com/convert"> generate pdf </a></button> ..tags closed. when run script, variable value shown pdf converter not picking up. there wrong code? else, other web-to-pdf generator can use can pick php or js values written html? thanks! update - can't seem convert get/post or session variables in php script pdf though assign them html division. tried assigning php variable js , using document.getelementbyid('id').innerhtml = "<?php echo #var_from_prev_page"?>"; however, can print , convert php variable

Spring MongoDB @Query parameter ?0 not being substituted -

i using spring/mongodb @query annotation follows @enablemongorepositories specified, string parameter substitution causes parsing/number format exception. when hardcode string date debugging purposes, works. missing dependency or work. here relevant sections: this works: @query("{'mydata.fromdatestamp' : { $gte: { $numberlong: \"20130801000000\" } }}") list<mydata> findmydata(); this not: @query("{'mydata.fromdatestamp' : { $gte: { $numberlong: ?0 } }}") list<mydata> findmydata(string fromdatestamp); the error: java.lang.numberformatexception: input string: "_param_0" here dependencies: dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.release") } ... compile("org.springframework.boot:spring-boot-starter-web") { exclude module: "spring-boot-starter-tomcat" } compile("org.springframework.boot:spring-boot-starter-jetty&quo

soap - An error was discovered processing the <wsse:Security> header in SoapUI -

Image
i try intercept encrypted soap message in wildfly 10 soapui. deployment successful. first below pics outgoing ws-security configuration includes signature , encryption. * signature keystore - client keystore alias - alias of client's private key password - password of client's private key key identifier type - x.509 parts - arg0 (name), body (encode) * encryption keystore - client keystore alias - alias of server's public key password - empty (no password required public key) key identifier type - x.509 parts - arg0 (name), body (content) the final pic shows incoming ws-security configuration. decrypt keystore - client keystore signature keystore - client keystore password - password of client's private key but returned response soap-fault following <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <soap:fault> <faultcode xmlns:ns1="http://docs.oasis-open.org/w

java - How can I mock Google's Geocoding API request using mockito/powermock? -

i want unit test method using mockito/powermock: @service public class googleapiservice { private static final logger logger = loggerfactory.getlogger(googleapiservice.class); private static final string language = "es"; private list<addresstype> addresstypes = arrays.aslist( addresstype.locality, addresstype.administrative_area_level_2, addresstype.administrative_area_level_1, addresstype.country ); @autowired private geoapicontext geoapicontext; public string getlocalityfromlatlng(latlng latlng) throws exception { logger.debug("getlocalityfromlatlng"); geocodingresult[] geocodingresults = geocodingapi.newrequest(geoapicontext) .latlng(latlng) .await(); (geocodingresult geocodingresult : geocodingresults) { addresstype addresstype = geocodingresult.types[0]; if (addresstypes.contains(addresstype)) {

Editing a file on a Sharepoint Server with C# -

i trying edit powerpoint file on sharepoint through c#. have direct access directory tried doing if edit ppt file on local system: // open presentation pptpresentation = pptapplication.presentations.open(@"\\sharepoint.adress.com@ssl\userwwwroot\folder\subfolder\pres.pptx"); // open slide on id has added. pptslide = pptpresentation.slides[slidenumber]; // add textbox shape = pptslide.shapes.addtextbox(msotextorientation.msotextorientationhorizontal, 0, 0, 1, 1); [...] but "access denied" error on first line of code, if logged in , have folder open in window. have open file in special way because it's on sharepoint? there better approach doing this? what worked copying file local directory , opening editing , copying back. not allowed multiple reasons. you need login sharepoint. this, can use csom (client sharepoint object model) there lot off documentation on net. exemples : using sharepoint foundation 2010 managed client object model op

android - How to make Proguard keep the class method names and attribute names as it is? -

as above. my proguard config is -keepclassmembers public class myapp.interfaces.** -keepclasseswithmembernames public class myapp.interfaces.** -keepattributes signature -keepparameternames really new , no real idea i'm doing. what i'm trying achieve make proguard not change method , variable names of classes inside myapp.interfaces.* . if want rearrange algo stuff optimise or whatever, it's fine. long names not changed. this must done because of serializable issue between server , client. simply use: -keep class myapp.interfaces.** { *; } it not touch class or members. if errors / warnings, rebuild project.

Anagram test for two strings in python -

this question: write function named test_for_anagrams receives 2 strings parameters, both of consist of alphabetic characters , returns true if 2 strings anagrams, false otherwise. 2 strings anagrams if 1 string can constructed rearranging characters in other string using characters in original string once. example, strings "orchestra" , "carthorse" anagrams because each 1 can constructed rearranging characters in other 1 using characters in 1 of them once. note capitalization not matter here i.e. lower case character can considered same upper case character. my code: def test_for_anagrams (str_1, str_2): str_1 = str_1.lower() str_2 = str_2.lower() print(len(str_1), len(str_2)) count = 0 if (len(str_1) != len(str_2)): return (false) else: in range(0, len(str_1)): j in range(0, len(str_2)): if(str_1[i] == str_2[j]): count += 1 if (count ==

docker - Create image-stream on image from private registry on OpenShift -

i've set openshift origin 1.1.3 cluster. i'm pulling images private registry. registry 'insecure'. has self-signed certificates , credentials authenticate. i'm able perform docker login , pull image manually on node. the problem node can access image. when i'm scaling pod (based on image), replica's run on specific node. other nodes not able pull or use image. so want create image-stream image: oc import-image --insecure=true ec2-xxx:5000/image but: message: may not have access docker image "ec2-xxx:5000/image" reason: unauthorized i read creating secret. created it: oc secrets new-dockercfg mysecret --docker-server=ec2-xxx:5000 --docker-username=*** --docker-password=*** --docker-email=any@mail.com how have add secret image-stream? , right approach? @cloudnoob answer helped me lot. main problem i've created secret in wrong way. saw after starting openshift master loglevel 5. unable find secret match htt

opencv - What are Python constants for cv2.solvePnP method flag? -

i need use cv_p3p solvepnp method, there doesn't seem documentation of python equivalents of c++ flags, cv_iterative, cv_p3p , cv_epnp. i've tried cv2.cv_p3p, cv2.p3p, cv2.cv.p3p, etc. i've found few questions asking this, including these: http://opencv-users.1802565.n2.nabble.com/solvepnp-name-of-flag-constants-in-python-td7484093.html http://answers.opencv.org/question/8861/what-opencv-constants-are-available/ but no answers, apart link source page, defines python constants. there seem no references constants i'm looking for. https://github.com/itseez/opencv/blob/e3ae36dcb3c1d523802f8642e5c3984db43637c4/modules/python/src2/defs i tried passing integers argument, still seems using default method. is possible other solve methods don't exist in python version of opencv? i found following constants worked: cv2.solvepnp_iterative cv2.solvepnp_p3p cv2.solvepnp_epnp cv2.solvepnp_dls e.g: retval, orvec, otvec = cv2.solvepnp(object_po

A function in C to `push` items to a queue -

using c write push(queue **, nod *) method. want check if have covered basics when pushing nods onto queue . void push_back(queue ** q, process * p){ p->next = null; if( (*q)->head == null && (*q)->tail ==null){ (*q)->head = (*q)->tail = p; } (*q)->tail->next = p->next; (*q)->tail = p; } am assigning null (*q)->tail->next assigning p->next correctly? (*q)->tail->next should null . and if queue not empty don't link in new node properly. instead if queue not empty should make (*q)->tail->next point p , make tail point p : if (/* queue empty */) { ... } else { (*q)->tail->next = p; (*q)->tail = p; } and said in comments, don't seem need indirection created passing pointer pointer, mean rewrite (with changes) as void push_back(queue * q, process * p){ p->next = null; if( q->head == null && q->tail ==null){ q-&g

C++ continuing past the while loop -

i'm having bit of trouble finding way bypass infinite input loop i've put myself in. here's code: int main() { vector<double>v; double input; double low = numeric_limits<double>::max(); double high = numeric_limits<double>::min(); cout << "enter doubles in sequence. << '\n'; while (cin >> input) { v.push_back(input); if (input < low) { low = input; cout << low << "is new low" << '\n'; } if (input > high) { high = input; cout << high << "is new high" << '\n'; } sort(v.begin(), v.end()); (int = 0; < v.size(); ++i) { cout << v[i] << " "; } cout << '\n'; } cout << "test"; } the last output me attempting test whether relay &quo

Drools 6.4 KieScanner : How create and add Jar with rules in Maven? -

i beginner drools , maven , facing problem load rules kiescanner. the aim of project able dynamically load rules in permanent kiesession. wonder if possible manage rules kiefilesystem (not sure possible without dispose of session , starting 1 leading lack of previous inserted facts), way use kiescanner. it seems requires creation of jar containing rules , having maven id (releaseid), not find detailed documentation creation of these jar files. which files shall included in such jar ? drl files, pom.xml , manifest.mf ? where can jar file added ? according documentation should not added in classpath when detection of new issues of file necessary : "once module on classpath, no other version may loaded dynamically". is maven command needed ? can give me information on points or give me link creation , deployment of such jar , management in kiescanner described ? lot. here example of stateless kiesession using kjar maven repository (code in scala, sure

Hide show div front and back per div behaviour function/toggle jquery -

i want create sort of toggle between 2 div's classes: front , back. both in .entry-footer. it's wotking allright. last step needs correct normal : front visible, hidden... , not backs should hidden klikobj (=clikobject).... suggestions optimize code? https://jsfiddle.net/ontwerp73/osg8up7a/2/#&togetherjs=uojqmsnd2f $('.entry-footer').on('click', function(event) { var klikobj = event.target; $(klikobj).closest('.front').hide(); $(klikobj).next('.back').show(); $('.back').on('click', function(event) { $(klikobj).closest('.front').show(); $(klikobj).next('.back').hide(); }); }); the html base : <footer class="entry-footer"> <div class="front" style="display: block;"> <br>titel: mr robot<br>regisseur: mr bean<br>producent: spielberg<br>info: extra! extra! extra! extra! <br>productieja

php - Laravel findorfail() redirect -

i have following code : public function showtestprofile($id){ $auth = auth::user(); $tests = app\test::findorfail($id); return view('profile',compact('auth','tests','members')); } if have id in db table come findorfail() , but if add not existing id url : http://newpro.dev/user-profile/24645645456 then no query found larvel page comes up. how can redirect route if have no id. add uses in controller use illuminate\database\eloquent\modelnotfoundexception;//find or fail error exception class. and modify current code this public function showtestprofile($id){ try{ $auth = auth::user(); $tests = app\test::findorfail($id); return view('profile',compact('auth','tests','members')); } catch(modelnotfoundexception $err){ //if id doesnt exist skip return view('profil.. //and excute whatever in section } }