Posts

Showing posts from September, 2010

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"

Google Tag Manager Event in Analytics as Goal -

when google tag manager tracking link-click, shows event in google analytics. far good. let's in gtm: category {{event}} / action {{click event}} , label {{page path}} now have event analytics goal (conversion) - not adwords. right, have set in analytics goal again can't variables gtm? category must "test" action "click" label "link click" or can say, track gtm event in analytics goal linking them thogheter? in gtm can't set analytics goal right? have event , go analytics , make goal, true? if using gtm tracking event. not necessary give {{event}} or predefined macro(variables) event category , event action or event label. entirely upto . can give string/ name create goal in google analytics.. link if click on download link event category 'download link', event action can choose {{click text}} or {{click url}} , event label {{{page path}} after @ time of goal creation can use 'download link' goal category ,

c++ - Find similar distances between all values in vector and subset them -

given vector double values. want know distances between elements of vector have similar distance each other. in best case, result vector of subsets of original values subsets should have @ least n members. //given vector<double> values = {1,2,3,4,8,10,12}; //with simple values example //some algorithm //desired result as: vector<vector<double> > subset; //in case of above example expect result like: //subset[0] = {1,2,3,4}; //distance 1 //subset[1] = {8,10,12}; //distance 2 //subset[2] = {4,8,12}; // distance 4 //subset[3] = {2,4}; //also distance 2 not connected subset[1] //subset[4] = {1,3}; //also distance 2 not connected subset[1] or subset[3] //many others if n 2. if n 3 (normally minimum) these small subsets should excluded. this example simplified distances of integer numbers iterated , tested vector not case double or float. my idea far i thought of calculating distances , storing them in vector. creating difference distance matrix , thres

Access Sub-Contexts of Main-Context in ANTLR4 Tree-Listener -

currently i'm using code access sub-contexts of main-context in tree listener implementation antlr4: ctx.children.foreach(function(child) { if (child.italic != undefined) { var text = child.italic().gettext(); ... } else if (child.labelref != undefined) { var text = child.labelref().gettext(); ... } ... due fact i'm using javascript antlr4 target i'm not quite sure if correct way of accessing information this. if c# or java target think find best way. or result in child.italic != null calls , stuff that? the results fine , everything's working. i'm curious if there's better solution. yes, how access individual subparts. alterntaively, can use childrens property of main context, contains parsetree instances (actually either terminalnode or rulecontext instances, depending on whether it's terminal or not). way don't need check individual sub context (which view of childrens list

javascript - Ext.js - Format TimeStamp into yyyy-mm-dd hh:mm:ss[.fffffffff] -

i have timestamp value: var timestamp = 1469088703280; i have tried convert timestamp format yyyy-mm-dd hh:mm:ss[.fffffffff] . var timestampdate = new date(timestamp * 1000); ext.date.format(timestampdate ,'yyyy-mm-dd hh:mm:ss') however, method produces value: 52525252-temtem-2727 1414:0707:4444 any ideas on how achieve required format? i see have asked decimal fraction of seconds can use below snippet. var timestamp = new date(new date()); ext.date.format(timestamp ,'y-m-d h:i:s.u'); "2016-07-28 14:03:26.711" refer ext js docs more closely can configuration wish , wont have elsewhere. http://docs.sencha.com/extjs/6.0.2-classic/ext.date.html

symfony - How to get an email from a imbricated form into swiftmailer? -

i want insert email imbricated form swiftmailer. email "sendto" section of swifmailer. as tried doesn't work. form sent no email recieved. how can have it? have idea? so controller, action send form , email : /** * creates new reservations entity. * */ public function createaction(request $request) { $entity = new reservations(); $emailpool = new pool(); $form = $this->createcreateform($entity); $form->handlerequest($request); if ($form->isvalid()) { $em = $this->getdoctrine()->getmanager(); $em->persist($entity); $em->flush(); // sender's email adress $sender = $entity->getemail(); // recipients' emails adresses (pool address) $emailpool = $this->$pool->getemailpool(); // mal codé >> trouver la bonne méthode // send email

angularjs - angular route template not found 404 -

hi when run spring angular app showing get http://localhost:8080/cyclone/admin/admin/cycle 404 (not found) . don't have idea second admin came on url. access url <a href="#/cycle">cycle</a> , html page under web-inf/views/admin/cycle.html angular root setup app.config(['$routeprovider', function ($routeprovider) { $routeprovider.when('/cycle', { templateurl: 'admin/cycle.html', controller: 'cyclecontroller' }); }]); my spring controller @controller @requestmapping(value = "/admin") public class admincontroller { @requestmapping("/cycle.html") public string getcarpartialpage() { return "admin/cycle"; } } change code below $routeprovider.when('/cycle', { templateurl: 'cycle.html', controller: 'cyclecontroller' }); and in spring controller @r

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

i'm trying combine registration, activation , login scripts php website backend script front end developer can pass variables different forms to. my question whether appropriate approach this. don't want have lot of php files different pieces of application developing. far have written following 2 functions login, register , activate user front end developer can call: <?php /** * created phpstorm. * user: karl * date: 26/07/2016 * time: 02:25 */ class users { function register_user($email, $password, $user_name) { $server_name = "localhost"; $u_name = "root"; $db_password = "root"; $db_name = "betamath_graspe"; //email notification variable $from_address="info@slack.com"; //registration form $msg_reg_user='username taken. please choose different username'; $msg_reg_email='email registered'; $msg_reg_active=&#

'Hello Xamarin Forms' Android App - how to get it to work targeting JellyBean 18 (4.3)? -

i need target android jellybean (4.3) platform project. having xamarin forms installed, download 4.3 sdk , create new xamarin forms pcl project. right-click .droid project , set compile, minimum , target android versions android 4.3 ( api level 18 - jelly bean ). hit build , compilation error: error 1 no resource identifier found attribute 'touchscreenblocksfocus' in package 'android' e:\users\toby\documents\visual studio 2013\projects\m3slm10\testm3\m3slm10\m3slm10\m3slm10.droid\obj\debug\resourcecache\2fcce52afb6f854a55fa951fa3c83f6e\res\layout\abc_screen_toolbar.xml 28 m3slm10.droid how resolve error? you should setting minimum sdk api 18. compile sdk or targetframework should set latest api installed (api 23). way resources can compiled xamarin.forms. there's great resource on here: http://redth.codes/such-android-api-levels-much-confuse-wow/

Limit length of characters in htm in javascript -

i have question. used editable plugin in octobercms project. can't find in documentation. how can limit length of characters in content in html. if there no way how can javascript ? tried use code low in javascript . var x = document.getelementbyid('gallery'); var tekst= x.outertext; console.log(tekst); console.log(x.outertext.length); if (x.outertext.length > 150) { var trimmedstring = tekst.substring(0, 150); document.getelementbyid('gallery').outertext = trimmedstring; } but text not use dic , classes , editable. can fix this? maybe should in html instead. <form action="demo_form.asp"> username: <input type="text" name="usrname" maxlength="10"><br> <input type="submit" value="submit"> </form> http://www.w3schools.com/tags/att_input_maxlength.asp

MaxMin Function within Select Statement SQL 2012 -

i having few issues making max function work within select statement see example data below: table 1 table 2 visit_id car_id move_id visit_id movestartdate moveenddate 1 1 25/07/2016 27/07/2016 b 2 2 28/07/2016 28/07/2016 c 1 3 b 19/07/2016 22/07/2016 d 3 4 d 28/06/2016 30/06/2016 i select statement pick min start time , max start time based on visit_id expecting: result visit_id car_id startdate enddate 1 25/07/2016 28/07/2016 b 2 19/07/2016 22/07/2016 so far have tried have inner joins in select statement: ,(max (enddate) visit.visit_id = move.visit_id) end date i have looked @ other queries second select statement within select end like: select visit_id, car_id ,(select max(enddate) full outer join table 2 on table 1.visit_id = table 2.visit_id gr

java - How to split the URL the get all the link in webpage? -

i'm doing project hyperlink crawler inspecting broken link. code. www.utem.edu.my/portal/portal. link give 404 error. think code split url wrong. me please. public class hinterface extends jframe { // declaring variables used components in interface private jlabel lblurl; private jtextfield inputsearch; private jbutton btnsearch; private jeditorpane outputlinks; public hinterface() { super("hyperlink crawler"); settype(type.popup); setresizable(false); getcontentpane().setbackground(color.black); settitle("web link crawler inspecting broken link"); flowlayout flowlayout = new flowlayout(); flowlayout.setalignment(flowlayout.left); getcontentpane().setlayout(flowlayout); // creates label displaying text lblurl = new jlabel("\r\nenter url : "); lblurl.setlocation(new point(13, 9)); lblurl.setdoublebuffered(true); lb

ios - How to notify nearby users within a certain location -

i've been thinking , couldn't figure out on how develop feature. app technically notify every driver, whenever user trigger button. i'm using google maps calculating routes , on. the feature i'm building similar uber notification system, whenever user click "set pickup location" notify bunch of drivers nearby user's location. but problem right now, notify every drivers online, , that's not want. want notify drivers nearby user's location. how achieve this? sorts of variables need accomplish this im using ios/swift google maps node.js backend , socket.io realtime algorithm overview to notify user near you, suggest following algorithm: determine location determine location of other users calculate distance you this algorithm simple, heavy, perhaps why @lu_ suggest on server. optimizations there multiple hacks optimize it, example, instead of checking location , calculating distance millions of users in app, ca

php - Behat3 MinkExtension could not be enabled -

i want achieve take screenshot using behat, mink , seleniumgrid but errors: given go "mysite.org/private" # featurecontext::visit() mink instance has not been set on mink context class. have enabled mink extension? (runtimeexception) │ ╳ mink instance has not been set on mink context class. have enabled mink extension? (runtimeexception) │ └─ @afterstep # feat my behat.yml: default: extensions: behat\symfony2extension: ~ behat\minkextension: base_url: http://integration.fvs.dev.intern.etecture.de/private-clients browser_name: 'firefox' selenium2: wd_host: http://hub.selenium.intern.etecture.de:4444/wd/hub capabilities: { "browser": "firefox", "version": "14"} goutte: ~ sessions: goutte: goutte: ~ selenium2: selenium2: ~ symfony2:

android - xamarin binding jar type error -

i have library .jar following function: public void doaction(arraylist<string[][]> list, int[] time) { } i have create binding project , api.xml has code: <method abstract="false" deprecated="not deprecated" final="false" name="doaction" native="false" return="void" static="false" synchronized="false" visibility="public"> <parameter name="p0" type="java.util.arraylist<java.lang.string[][]>"> </parameter> <parameter name="p1" type="int[]"> </parameter> </method> i have added reference of binding dll in android project , exploring dll see: using android.runtime; using system; using system.collections.generic; [register ("doaction", "(ljava/util/arraylist;[i)v", "getdoaction_ljava_util_arraylist_arrayihandler")] public virtual void doaction (ilist<string[][]> p0,

c# - How to delete Zip file after copying into another folder -

how delete zip file after copying folder...i getting exception while deleting..it saying "the file being used process". string pathstring1 = fullfilepath; string sourcefilename = path.getfilename(pathstring1); string foldername = path.getdirectoryname(pathstring1); string pathstring = path.combine(foldername, "uploaded"); if (!system.io.directory.exists(pathstring)) { system.io.directory.createdirectory(pathstring); string destfile = system.io.path.combine(pathstring, sourcefilename); file.copy(pathstring1, destfile); file.delete(pathstring1); file.delete(filename); } if decompress zip-file, in using block or .dispose() object responsible decompressing. lib using?

multiple anchor tags click event using angularjs -

i have multiple anchors tags in document, want put 1 function every anchor tag click, example in jquery $(document).on('click','a',function(){ window.location.href='/home.html' }); how need write in angularjs. can please me? you can make directive , add anchor tag app.directive('myevent', function() { return { restrict: 'a', link: function(scope, element, attrs) { element.bind('click', function($event) { $window..location.href = '/home.html' //your link here }); } } }); in view can anchor tag or normal div <div myevent class="click">click me</div> or <a myevent href="#">click me</a> it work around prefer use jquery more appropriate this. hope helps. thank you. there many other ways using ng-click div tag same. <div ng-click="myevent()"></div>