Posts

nullpointerexception - Android Connection with MYSQL database using php -

i trying connect android login page mysql database present on server. but facing problem in passing php file through android. connection php mysql database successful, though. php code: <?php $host='localhost'; $uname='amodbina0106'; $pwd='amodbina200'; $db="kezin_king"; $con=mysqli_connect("localhost","amodbina0106","amodbina200","kezin_king"); if ($con->connect_error) { die("connection failed: " . $con->connect_error); } echo "connection successful"; $username = $_get['username']; $password = $_get['password']; $flag['code']=0; if($name == '' || $username == '' || $password == '' || $email == ''){ echo 'please fill values'; } else{ $sql=mysql_query("insert sample values('$id','$name') ",$con); ...

authentication - How to authenticate every request over a websocket in javascript? -

have setup javascript server , configured websocket it. on client side using react , npm. so, want authenticate every request web socket using rest api. authentication first step , information transfer happening using same web socket after authentication done. possible pass headers authentication websocket ? can please tell how proceed ? below code server , client experimenting with. server code - #!/usr/bin/env node var websocketserver = require('websocket').server; var http = require('http'); var server = http.createserver(function(request, response) { console.log((new date()) + ' received request ' + request.url); response.writehead(404); response.end(); }); server.listen(5005, function() { console.log((new date()) + ' server listening on port 5005'); }); wsserver = new websocketserver({ httpserver: server, autoacceptconnections: false }); function originisallowed(origin) { return true; } wsserver....

c# - ASP.NET Core Web API exception handling -

i started using asp.net core new rest api project after using regular asp.net web api many years. don't see way handle exceptions in asp.net core web api. tried implement exception handling filter/attribute: public class errorhandlingfilter : exceptionfilterattribute { public override void onexception(exceptioncontext context) { handleexceptionasync(context); context.exceptionhandled = true; } private static void handleexceptionasync(exceptioncontext context) { var exception = context.exception; if (exception mynotfoundexception) setexceptionresult(context, exception, httpstatuscode.notfound); else if (exception myunauthorizedexception) setexceptionresult(context, exception, httpstatuscode.unauthorized); else if (exception myexception) setexceptionresult(context, exception, httpstatuscode.badrequest); else setexceptionresult(context, exception, httpsta...

Initializing and using Interfaces in Java? -

first of all, learned that: you cannot instantiate interface an interface doesn't implement functions after seeing following java code: public class myclasstest { public static void main(string[] args) { // string charsequence? charsequence c = "java"; system.out.println(c); system.out.println(c.length()); } } i confused when learned charsequence interface how can use interface object , initialize it? why charsequence implements length function if interface? "java" instance of string class, implements charsequence interface, includes implementing length() method. therefore can assign charsequence variable. a variable type interface can assigned references instances (objects) of classes implement interface.

css - CSS3 rotate3d bug -

i've got little problem rotate3d. on fiddle: https://jsfiddle.net/c3snpkpr/ the problem is, if hover on <div> from left or right, works , bugging , rotating more or less given 180deg. <div> corners same. how can avoid this? what happens when hover element, mouse pointer kind of end outside when animates (the element loose mouse capture), , when, moves if have taken pointer outside yourself. use wrapper element ( fiddle demo ) or pseudo (below sample) div { width: 150px; height: 150px; margin-right: 20px; } div:after { content: ''; display: block; background: green; width: 150px; height: 150px; transition: 1s; transform: rotate3d(0, 1, 0, 0deg); border-radius: 50%; border: 5px solid red; } div:hover:after { background: red; transition: 1s; border: 5px solid green; transform: rotate3d(0, 1, 0, 180deg); } <div></div>

angular - Display web api exception in angular2 -

i working on project web api backend , angular2 front end. having issue showing server error in angular2. every time server error throws cors error. here sample api public iactionresult post([frombody] visitor model) { if (model == null) throw new httpresponseexception(new httpresponsemessage(httpstatuscode.nocontent) { reasonphrase = "missing model in post" }); _registerservice.register(model); return ok(model); } , here angular2 service addvisit(visit: visit) { let siteid = visit.siteid; let body = json.stringify(visit); let headers = new headers({ 'content-type': 'application/json' }); let options = new requestoptions({ headers: headers }); return this.authhttp .post(`${this._visitorsurl}` + siteid, body, options) .map(res => { res.json(); console.log("map: " + json.stringify(res.json())); }) .catch(err => console.log(err)); } when model null return error 502 or cors error ...

html - image still shows translucent opacity after change in opacity value -

functionality: the following page translucent , has opacity: 0.68; and within page, have image opacity: 1.0; . main idea the image placed in overlay on translucent background, , image shouldn't sharing same translucent property background. issue: the image within translucent page sharing same translucent property, though have set opacity property of image 1.0. how able set image of solid state without showing opacity property have set main background? .brandmenu { background-color: #d3d3d3; filter: alpha(opacity=98); opacity: 0.98; } .branddescription { background-color: #ffffff; filter: alpha(opacity=200); opacity: 1.0; } <div id="park_branddescription" class="brandmenu" align="center" style="position:absolute; width:1080px; height:1920px; background-repeat: no-repeat; display: none; z-index=9; top:0px; margin:auto;"> <img id="pa_description" class="branddescription" ...