Posts

sql - How can I test an IF statement in MySQL? -

how can test if statement in mysql ? i need know, happens when query if statement , returns nothing (0 row selected) ? in other word, select query returns when no row selected? return null ? if yes, throw error? if ( null ) ... ? or in case statement of if won't execute? in reality, have code this: if ( select banned users id=new.user_id ) // stuff note: banned column contains either 0 or 1 . all want know, code safe when query doesn't return row? mean throw error or nothing happens (just if statement doesn't execute) ? noted wanted test myselft, don't know how can test if statement in mysql. example, wanted test code: begin if ( select banned users id=new.user_id ) select 'test'; endif; end but code above doesn't run. that's why i've asked question. an if statement can tested in context of mysql stored program (a procedure, function or trigger.) mysql doesn't support anonymous blocks...

Fill field value while page is loading in HTML Page -

i have third part web address (www.samplespage.com). call page web site. possibe fill field values before page load or after page load? tried vith url parameters did not work. www.samplespage.com?id=fieldid&value=fieldvalue this how looks in codes. (i picked source via f12 development tools in ie) <input name="fieldname" id="fieldid" size="12" maxlength="11" value=""> when it's html page works url parameters otherwise need use selenium or ptyhon ..

go - Serve a file when no route is matched with Gorilla? -

i'm using gorilla mux web server. i define bunch of routes, if no route matched, want serve index.html file. func (mgr *apimgr) instantiaterestrtr() *mux.router { mgr.prestrtr = mux.newrouter().strictslash(true) mgr.prestrtr.pathprefix("/api/").handler(http.stripprefix("/api/", http.fileserver(http.dir(mgr.fullpath+"/docsui")))) _, route := range mgr.restroutes { var handler http.handler handler = logger(route.handlerfunc, route.name) mgr.prestrtr.methods(route.method) .path(route.pattern) .name(route.name) .handler(handler) } // here want catch unmatched routes, , serve '/site/index.html` file. // how can this? return mgr.prestrtr } you don't need override 404 behaviour. use pathprefix catch-all route, adding after other routes. func main() { var entry string var static string var port string flag.stringvar(&en...

node.js - Why is my session expiring every time I close the browser? -

i set session maxage of express documented. here code: app.use(session({ secret: process.env.session_secret, saveuninitialized: true, resave: true, maxage: 1000* 60 * 60 *24 * 365, store: new mongostore({mongooseconnection:mongoose.connection}) })); but every time close browser, find myself logged out. also, note using passport local, facebook, , google authentications. they expire. in console, can see connect.sid in expires/maxage section lists "session" while other cookies have dates... what doing wrong? you need configure express-session, , set maxage on session-cookie app.use(express.session({ cookie : { maxage: 1000* 60 * 60 *24 * 365 }, store : new mongostore({mongooseconnection:mongoose.connection}) }); //..... app.use(passport.session());

php - Package development - auth check doesn't work -

i have made simple fresh laravel 5.3 app purpose of developing package. have followed instructions here , modifications made in comments user named janis. works perfectly. then decided upgrade published view @if(auth::check()) id: {{auth::id()}}. @else not logged in @endif the current state of app uploaded github here . problem the view check doesn't work. have not logged in . how make auth::check() work? in tab of browser logged correclty. a hint i not sure how follow this hint to do please instruct me how make auth::check() work in view. since laravel 5, route in routes.php automatically uses web middleware, not happend packages routes. to use laravel's authentication package controllers , views need enforce web middleware usage in package route.php using like: route::group(['middleware' => 'web'], function () { // package routes here });

html - divider with icon in the center won't span width of div -

this question has answer here: line before , after title on image 2 answers i trying divide part of page , center icon between 2 divider lines. figure have use ::before , ::after , wrote this jsfiddle.net i:after { background-color: #999; content: " "; display: inline-block; height: 3px; margin: 0 0 8px 20px; text-shadow: none; width: 100%; } i:before { background-color: #999; content: " "; display: inline-block; height: 3px; margin: 0 20px 8px 0; text-shadow: none; width: 100%; } in jsfiddle doesn't seem work @ all. when open index file in chrome works point. show line left , right of icon, won't have fill whole body div. ideas great. if u use font-awesome u can add icon in menu this example : <li><i class="fa fa-home"></i>home</li...

Xamarin.Forms Previewer -

it not practical write xamarin.forms application without ui previewer. platforms offer design preview option, if code needs compiled. far know, xamarin released previewer xamarin studio mac in alpha channel, can't use in visual studio. why xamarin still not provide previewer? should not forced use third party tool process. (and third party tools in beta releases.) shouldn't there @ least roadmap or planned date announced since such fundamental part of product? nice if xamarin answer. using latest version of xamarin can use following steps: use view > other windows > xamarin.forms previewer menu in visual studio open preview window.