Posts

php - Magicsuggest setValue() changes when move to other field -

on selectionchange setting new value when focus out setvalue change. here code : var ms=$('#mydiv').magicsuggest({ usecommakey: true, hidetrigger: true, placeholder: 'search here', allowduplicates: false, data: '/getdata.php', ajaxconfig: { xhrfields: { withcredentials: true, } }, valuefield: 'name', renderer: function(data){ return data.full_name; }, resultasstring: true }); $(ms).on('selectionchange', function(e, cb){ var response = cb.getvalue(); var respone_ary = response.tostring().split(','); if(respone_ary.length > 1){ this.removefromselection(cb.getselection()); this.setvalue(respone_ary); } }); for example : in response getting ...

android - Response with non-Latin letters using Volley (UTF-8) -

i'm using volley download text files website. this content of sample text file: neon wönn 30€ kostüm größter spaß testtesttesttest★★★★testtest:::test i put in notepad , selected 'encoding utf-8' in savefiledialog. in filezilla in server manager selected 'force utf-8' before uploaded file. when download volley response this: neon wönn 30⬠kostüm gröÃter spaà testtesttesttestââââtesttest:::test here method: public static void getrequest(string url) { requestqueue queue = volley.newrequestqueue(activity); stringrequest stringrequest = new stringrequest(request.method.get, url, new response.listener<string>() { @override public void onresponse(string response) { //response gibberish :/ } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { log.e("volley...

chai - Writing sad path test for Yeoman generator -

i have yeoman generator requires argument. want write test confirm throws error if generator called without arguments. i have tried many variations similar following code. 'use strict'; var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); var chai_assert = require('chai').assert; describe('my yeoman generator', function(){ it('will barf without arguments', function(done) { this.timeout(0); var fn = function() { helpers.run(path.join(__dirname, '../generators/app')) .on('end', done); }; chai_assert.throws(fn); }); }); chai's assert.throws doesn't catch exception 1 thrown. i'm not sure why error thrown chai doesn't catch it. appreciated. the error message given is 1) yeoman generator barf without arguments: assertionerror: expected [function: fn] throw error @ function.assert.throws (node_modules/c...

Parsing JSON in Android using AsyncHttpClient -

i need parse json android application, i’m getting error: org.json.array cannot converted jsonobject what want take json server , parse textviews had made i’m using asynchttpclient, here code. asynchttpclient client1 = new asynchttpclient(); client1.get("http://mahmoudfa-001-site1.atempurl.com/appetizers.json",new texthttpresponsehandler() { @override public void onfailure ( int statuscode, header[] headers, string responsestring, throwable throwable){ } @override public void onsuccess ( int statuscode, header[] headers, string responsestring){ log.i("a1", responsestring); //testing if server responding. toast.maketext(getapplicationcontext(), responsestring, toast.length_long).show(); try { jsonobject job = new jsonobject(responsestring); jsonarray arr = new jsonarray(build); //string arrlen = integer.tostring(arr.length()); jsonobject na = a...

java - How to transform a string such that it only contains vowels which have occurences equal or greater than their given values? -

i asked question in interview. have string s (all lowercase characters) need make new string p such : the total number of a 's in string should equal or greater given value of int variable a . the total number of e 's in string should equal or greater given value of int variable e . the total number of i 's in string should equal or greater given value of int variable i . the total number of o 's in string should equal or greater given value of int variable o . the total number of u 's in string should equal or greater given value of int variable u . constraint in order resultant string, can replace character other lower case character. can number of times each replacement has cost associated it. cost of replacing c1 c2 absolute difference of ascii value of c1 , c2 . eg. replacing b e has cost 3 , c a has cost 2. we need find minimum cost of converting s p. given is: string s five ints - a, e, i, o, u my approach first sort string, d...

Visual Studio: Unit Testing Universal Windows Class Libraries -

i using visual studio 2015 community edition: have created blank app (universal windows): template found in c# -> windows -> universal. i have created class library (universal windows) in same solution: template found in c# -> windows -> universal now intend create unit test project test class library created earlier. now not see unit test project templates in universal windows section (they kind of test apps or ui tests, not suitable testing class libraries directly, think). so tried creating normal unit test project :(template in c# -> test -> unit test project) and when try add reference class library (universal windows) complains cannot add project reference. can suggest how go solving problem?

windows - Batch File delete newest file -

how delete newest file in folder using batch script? all results have found show how delete oldest files or delete them after n days. links : batch file delete files older n days , batch script delete oldest folder in given folder thank you for /f %%a in ('dir /b /o-d /a-d %the_directory%') echo("%the_directory%\%%a"&goto deldone :deldone would approach. rudely escapes for loop having deleted first filename encountered in sorted-in-reverse-date-order ( /o-d ) list. this saves having read entire list. not such problem few files, can pain thousands. the required del command merely echo ed testing purposes. after you've verified command correct , change echo(del del delete files.