Posts

Showing posts from July, 2015

twilio - Twillio Client To Client Call ios Never Recieve call method is didReceiveIncomingConnection -

i working on ios application using twilio sdk manage client calling through device. implement using hello monkey demo application have imported in xcode. after initial setup able establish connection receiving delegate no longer working. have gone through complete twilio documentation no success. please suggest alternative or solution asap. here code of hello monkey sample project - (void)viewdidload { nslog(@"clint id----------------------- %@",name); //check out https://github.com/twilio/mobile-quickstart server nsstring *urlstring = [nsstring stringwithformat:@"https://testdemo786.herokuapp.com/token?client=%@", name]; nsurl *url = [nsurl urlwithstring:urlstring]; nserror *error = nil; nsstring *token = [nsstring stringwithcontentsofurl:url encoding:nsutf8stringencoding error:&error]; if (token == nil) { nslog(@"error retrieving token: %@", [error localizeddescription]); } else { _phone = ...

ASP JSON: Object not a collection -

how should retrieve pitcherid json? using class http://aspjson.com . json [ { "pitcherid": "456068" }, { "pitcherid": "431148" } ] code ojson.loadjson("...") each thing in ojson.data("pitcherid") set = ojson.data("pitcherid").item(thing) response.write this.item("pitcherid") next error microsoft vbscript runtime error '800a01c3' object not collection in experience it's far easier use jscript server side scripting language use aspjson class. render json object follows <%@language="javascript"%> <!doctype html> <html> <body> <% var ojson =[ { "pitcherid": "456068" }, { "pitcherid": "431148" } ] (i in ojson) { response.write((ojson[i].pitcherid) + "<br />"); } %> </body> </html>...

json - Grails - JSONBuilder - Spec toPrettyString() returns stackoverflow -

i'm making unit test needs return json. build i'm using toprettystring() method jsonbuilder. this class spec: class lugar { string sigla string nombre coordenada coordenada string tostring(){ "${sigla}" } string tojson() { new jsonbuilder( ).toprettystring() } static constraints = { nombre blank: false , nullable: false } } the spec run this: @testfor(lugar) class lugarspec extends specification { void "tojson not empty"() { when: lugar lugar = new lugar(sigla: "bue", nombre:"buenos aires") string aux = lugar.tojson(); then: ! aux.dump().empty } } but result is: <error type="java.lang.stackoverflowerror">java.lang.stackoverflowerror @ org.springsource.loaded.ri.reflectiveinterceptor.jlrmethodinvoke(reflectiveinterceptor.java:1270) @ groovy.lang.metabeanproperty.getproperty(metabeanproperty.java:60...

react native - Checking for nil parameter and if that parameter is an empty string in Swift -

there may or may not easier way write this, feel being novice @ swift, missing something. have parameter (filename) method optional string? need check if nil , or if empty string. code have, , works fine, seems bit more concise/readable. func writefile(filename: string?, withcontents contents: string, errorcallback failurecallback: rctresponsesenderblock, callback successcallback: rctresponsesenderblock) -> void { // if filename has value -- not nil if let filename = filename { // check see if string isn't empty if count(filename) < 1 { // craft failure message let resultsdict = [ "success": false, "errmsg": "filename empty" ] // execute javascript failure callback handler failurecallback([resultsdict]) return; // halt execution of function } // else, filename nil, , should return same error message. } else { // craft failure message let resultsdict = [ ...

Any way to check if a css file is referenced somewhere in the solution? Visual Studio -

i working on updating of css files , want make sure old files arent referenced anywhere in solution. guess ctrl+find of following: <link rel="stylesheet" href="/content/front/css/style.css" /> but hoping able have quick way see how many times , file being referenced. similar how can code inspection various classes call throughout project. my second goal remove css/js files aren't being used solution altogether! any awesome. working in vs 2013 ultimate. you try running code old file deleted , of errors code throws. (all of can't find file errors) note: of programmers see , feel crying. know not cleanest way of doing should work , easy do. let me know if there better way of doing this.

apiblueprint - apiary commend line tools responds with 503 -

i using command line apiary tool (offline), generate documentation in html format. have seen error "apiary service responded error: 503 service unavailable". question are what error mean. does offline tool contacts external apiary service not reachable @ point of time when error received. if referring apiary cli , may need connect apiary server operations. it great if provide other informations, such as confirm we're talking apiary cli context , command executed did set apiary_api_key ?

date - PHP strtotime behaviour -

the following lines of code returns 2 different outputs on 2 different servers , b: echo date("m y", strtotime("2015-01")); echo date("m y", strtotime("2015-02")); the expected output "jan 2015" , "feb 2015" correct on server a. but same code on server b returns output "jan 2015" , "mar 2015". on debugging, found strtotime function on server b returning timestamp current day of every month (today 29th), explains why "2015-02" shown "march 2015" (since there no feb 29, 2015). yesterday, code returning same output on both servers since feb 28th valid , translated feb 2015. so essentially, on server a, effective code is echo date("m y", strtotime("2015-01-01")); echo date("m y", strtotime("2015-02-01")); while on server b, effective code echo date("m y", strtotime("2015-01-29")); //or, strtotime("2015-0...

scala - Running a Spark Application in Intellij 14.1.3 -

i trying run spark application written in scala in intellij 14.1.3.the scala sdk scala-sdk-2.11.6. following error when execute code: exception in thread "main" java.lang.nosuchmethoderror: scala.collection.immutable.hashset$.empty()lscala/collection/immutable/hashset; @ akka.actor.actorcell$.<init>(actorcell.scala:336) @ akka.actor.actorcell$.<clinit>(actorcell.scala) @ akka.actor.rootactorpath.$div(actorpath.scala:159) @ akka.actor.localactorrefprovider.<init>(actorrefprovider.scala:464) @ akka.remote.remoteactorrefprovider.<init>(remoteactorrefprovider.scala:124) @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45) @ java.lang.reflect.constructor.newinstance(constructor.java:422) @ akka.actor.reflectivedynamicaccess$$anonfun$creat...

excel - BPC VBA After_Refresh -

i automating report open upload template perform evsnd , close upload template in order complete report. when upload template closed, message: uploadtemp.xlsm closed. trimming evinp function or refresh schedules cannot completed. i understand there vba available after_refresh, not know how include in code. this code: dim ultemplate workbook set ultemplate = workbooks.open("c:\uploadtemp.xlsm") ultemplate application.run ("mnu_esubmit_refschedule_book_clearandrefresh") end ultemplate.close savechanges:=true how make excel wait until refresh complete prior closing file? you try this for = 1 activeworkbook.connections.count activeworkbook.connections(i).oledbconnection.backgroundquery = false msgbox activeworkbook.connections(i).oledbconnection.backgroundquery next activeworkbook.refreshall

c# - Extension Methods vs Instance Methods vs Static Class -

i'm little bit confused different ways use methods interact objects in c#, particularly major design differences , consequences between following: invoking instance method using static class on poco creating extension method example: public class mypoint { public double x { get; set; } public double y { get; set; } public double? distancefrom(mypoint p) { if (p != null) { return math.sqrt(math.pow(this.x - p.x, 2) + math.pow(this.y - p.y, 2)); } return null; } } if accomplish desired outcome placing method in class definition, why poco combined either static helper class or extension method preferable? you asked, "if accomplish desired outcome placing method in class definition, why poco combined either static helper class or extension method preferable?" the answer depends on situation, , if methods in question directly related class' primary concern (see single responsibilit...

javascript - AngularJS validation error for input with brackets -

when using angularjs form validation work smoothly except following part when validating select input brackets <div class="form-group" ng-class="{'has-error': editdorm.classid.$invalid}"> <div class="col-sm-10"> <select class="form-control" ng-model="form.classid" name="classid[]" multiple required> <option ng-repeat="class in classes" value="{{class.id}}">{{class.classname}}</option> </select> </div> </div> appreciate help. thanks you need use bracket notation, name of element sq: brackets added key in form controller, need refer modal instance form controller instance editdorm['classid[]'] . when in doubt print form instance in html, i.e {{editdorm}} show kvp. i.e: ng-class="{'has-error': editdorm['classid[]'].$invalid}" angular.module('app...

objective c - OSX status bar menu occasionally not dismising other status bar menus -

so have status bar app launches small popover in form of nspanel has transient behaviour. if open dropbox popover , open apps popover dropbox menu not disappear until click button in popover. strange because happens sometimes, , using [window makekeyandorderfront:self]; when opening popover. works skypes drop down menu host of other status bar applications. there couple won't dismiss when open mine until make interaction in popover. there way set focus button or in panel might force other menus close time?

java - The operator < is undefined for the argument type(s) String, int -

i'm having problem when trying run program. program supposed receive number , compare int. understand program thinks i'm trying compare string int , not happy it. can do? import java.util.scanner; public class c { public static void main(string args[]) { scanner input = new scanner (system.in); string age = input.nextline(); if (age < 50){ system.out.println("you young"); }else{ system.out.println("you old"); } } } you cannot compare string int using numerical comparison-operator. §15.20.1 of java language specification describes seeing: the type of each of operands of numerical comparison operator must type convertible ( §5.1.8 ) primitive numeric type, or compile-time error occurs . since string not convertible primitive numeric-type, cannot compare against integer. therefore have 2 options: you can convert string int using integer#parseint : int ag...

How to access urls of images and xy coordinates from the DOM. dragging related also pure js please -

how access urls of images , xy coordinates dom. i have div multiple image gifs in it. the gifs represent electronic components on stripboard or protoboard. img gifs generated using code. function creatediv(img)//img here original code creating new divs { alert(divnumber);//an incrementing or decrementing image array position counter { var divtag = document.createelement("img"); divtag.id ='part'+divnumber; imagearray[divnumber+1]=200;//arbitrary inital x placement imagearray[divnumber+2]=200;//arbitrary initial y placment divtag.classname ="dragme"; divtag.src = imagearray[divnumber];//gif;//imagearray[i]; document.body.appendchild(divtag); } divnumber=divnumber+3;//offset between gif url in image array } the gifs draggable using code. don't understand drag code simplest find , make work. //<script language="javascript1.2"> <!-- var ie=document.all;//if using explorer var nn...

javascript - Cannot read property 'document' of null - UI Bootstrap for angular -

i working on angular web application, , want use ui bootstrap angular ( https://angular-ui.github.io/bootstrap/ ).. i downloaded js file , added index.html after angular.js , added 'ui.bootstrap' angular module... now have error when loading application: typeerror: cannot read property 'document' of null @ m.each.contents (https://code.jquery.com/jquery.min.js:2:26696) @ function.m.extend.map (https://code.jquery.com/jquery.min.js:2:3714) @ m.each.m.fn.(anonymous function) [as contents] (https://code.jquery.com/jquery.min.js:2:26777) @ fa (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js:61:73) @ t (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js:51:429) @ t (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js:52:55) @ t (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js:52:55) @ e (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js:49:436) @ http://ajax.googleapis...

multithreading - How in Dart implement a bounded buffer? -

how in dart solve producer-consumer problem? possible implement same thing in dart? // https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/condition.html class boundedbuffer { final lock lock = new reentrantlock(); final condition notfull = lock.newcondition(); final condition notempty = lock.newcondition(); final object[] items = new object[100]; int putptr, takeptr, count; public void put(object x) throws interruptedexception { lock.lock(); try { while (count == items.length) notfull.await(); items[putptr] = x; if (++putptr == items.length) putptr = 0; ++count; notempty.signal(); } { lock.unlock(); } } public object take() throws interruptedexception { lock.lock(); try { while (count == 0) notempty.await(); object x = items[takeptr]; if (++takeptr == items.length) takeptr = 0; --count; notfull.signal(); ...

javascript - Playing music that is linked and not loaded? -

this odd question, fun recreated spotify layout app in codepen, want add functionality, there way can music play using js or jquery? my first thought embed video , hide behind play button, doesn't quite work me. is there way can set var set = url, use onclick or toggle command play url? the way think going be: var expireprettylow = 'url:www.fake.com' $('#play').toggle( function(){ //play youtube link? ); i hope makes sense, there api can call mp3s? don't want upload them since it's linking, not trying make product out of this, add portfolio. for reference here codepen link . thanks whatever advice/direction can give me! edit: clarify, 'linked' , not 'loaded' accomplish linking url (ie: href="" ) opposed saving in directory , loading through filepath (ie: music/tracks/expire-prettylow.mp3 ) user blank audio tag , set play button's onclick "var newsrc = newsource.com/song.mp3; playtrack(...

ruby - which one is better practice to deliver email in rails? -

i have following fakemailer class sending emails. class fakemailer < actionmailer::base def fake_method_1(recipient, subject) mail(to: email, subject: "#{rails.env} - #{message}", body: body).deliver end def fake_method_2(recipient, subject) mail(to: email, subject: "#{rails.env} - #{message}", body: body) end end both of fake_method_1 , fake_method_2 send out same email. do fakemailer.fake_method_1(recipient, subject) fakemailer.fake_method_2(recipient, subject).deliver which 1 better practice? in other words, should return mail instance deliver, or deliver directly fakemailer class? what's trade-off? thanks the second option. if someday want deliver_later instead? i'm sure there other reasons not call deliver within method well.

javascript - How to insert array of images into swipebox gallery? -

this html code: <div class="profile-gallery"> <div class="profile-gallery_top js-bigimg"> <a href="img/bigimg1.jpg" class="swipebox"> <img class="profile-bigimage" src="img/bigimg.jpg" alt=""/> </a> </div> <ul class="profile-thumbs"> <li><img src="img/imgthmubs1.jpg" data-bigimage="img/bigimg1.jpg" data-original="img/origimg1.jpg" alt=""/></li> <li><img src="img/imgthmubs2.jpg" data-bigimage="img/bigimg2.jpg" data-original="img/origimg2.jpg" alt=""/></li> <li><img src="img/imgthmubs3.jpg" data-bigimage="img/bigimg3.jpg" data-original="img/origimg3.jpg" alt=""/></li> </ul> ...

java - Configuring MongoDB datasource in JBoss 7 -

does know how can configure mongodb datasource in jboss 7? i'm guessing can set mongo driver module in jboss in same way have done mysql driver, add dependency in manifest of ear. correct approach? i couldn't find documentation on turns out pretty simple. download driver , set module in jboss this . then add dependency meta-inf/manfest.mf file of ear. if you're using maven can add configuration section of ear plugin in pom.xml. <archive> <manifestentries> <dependencies>com.mongodb</dependencies> </manifestentries> </archive> there doesn't seem need configure data source. i've done , can see in logs database accepting connections.

javascript - Getting "undefined" when trying to get values from spreadsheet -

i'm getting "undefined" error when try value cell in spreadsheet. thing if execute same command different cell value in cell. difference between 2 cells way value produced. the value in cell show correctly produced directly google form associated spreadsheet. value doesn't show when called, produced script created in google form. script form (triggered on form submit): // code set edit form url value @ cell "c2". function assignediturls() { var form = formapp.getactiveform(); var ss = spreadsheetapp.openbyid("my-spreadsheet-id") var sheet = ss.getsheets()[0]; var urlcol = 3; // column number url's should populated; = 1, b = 2 etc var formresponses = form.getresponses(); (var = 0; < formresponses.length; i++) { var resulturl = formresponses[i].geteditresponseurl(); sheet.getrange(2 + i, urlcol).setvalue(resulturl); } spreadsheetapp.flush(); } table (changed html) <table...

android - Custom holder adapter error -

i'm trying implement listview checkbox part of bigger app. when tried start activity, got nullpointer error i'm not able find out what's going wrong. maybe asynctask doesn't return true value? here logcat: https://www.dropbox.com/s/p8w9mz7lbofaeja/log.txt?dl=0 and code: public class listactivity extends activity { /** * xml name list */ private string url; /** * list of products parsed xml */ list<book> products; /** * actual activity */ private activity currentactivity; /** * xml files path */ @suppresslint("sdcardpath") private string folder = "/data/data/com.group7.ule.barcodeshoppinglist/files/"; /** * products list's listview */ listview listview; /** * array lists user can change */ string[] data; @suppresswarnings("unchecked") @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_list); currentactivity = this...

devops - Should I use separate Docker containers for my web app? -

do need use separate docker container complex web application or can put required services in 1 container? explain me why should divide app many containers (for example php-fpm container, mysql container, mongo container) when have ability install , launch stuff in 1 container? something think when working docker how works inside. docker replaces pid 1 command specify in cmd (and entrypoint , more complex) directive in dockerfile. pid 1 init system lives (sysvinit, runit, systemd, whatever). container lives , dies whatever process started there. when process dies, container dies. stdout , stderr for process in container given on host machine when type docker logs mycontainer . incidentally, why need jump through hoops start services , run cronjobs (things done init system). important in understanding motivation doing things way. now, can whatever want. there many opinions "right" way this, can throw away , want. figure out how run of services in 1 contain...

matlab - Entropy of pure split caculated to NaN -

i have written function calculate entropy of vector each element represents number of elements of class. function x = entropy(a) t = sum(a); t = repmat(t, [1, size(a, 2)]); x = sum(-a./t .* log2(a./t)); end e.g: a = [4 0] , entropy = -(0/4)*log2(0/4) - (4/4)*log2(4/4) but above function, entropy nan when split pure because of log2(0) , in above example. entropy of pure split should zero. how should solve problem least effect on performance data large? thanks i suggest create own log2 function function res=mylog2(a) res=log2(a); res(isinf(res))=0; end this function, while breaking log2 behaviour, can used in specific example because multiplying result inside of log, making zero. not "mathematically correct", believe that's looking for.

javascript - laravel 500 (Internal Server Error) -

i got 500 internal server error when trying perform ajax post, please help. @foreach($influencer->categories $category) <div class ="cat_sec" cid="{{ $category->id }}"> <tr><td>{{ $category->category_name }}</td> <td><a class="btn btn-danger btn-xs remove_button" href="{{ route('ajax_remove_cat', array('inf_id'=>$influencer->id,'cat_id'=>$category->id)) }}">remove</a></td> </tr> <div> @endforeach @section('scripting') <script type="text/javascript"> $('.remove_button').click(function(event) { event.preventdefault(); var myurl = $(this).attr('href'); var jqxhr = $.ajax({ url:myurl, type:'post', }).done(function() { var response = ...

php - Q: How can I combine these two foreach loop -

i have simple html dom query read informations football fixtures source, , loading json source. here full code: <?php header('content-type: text/html; charset=utf-8'); ini_set("user_agent", "user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.17 (khtml, gecko) chrome/24.0.1312.60 safari/537.17"); include_once('simple_html_dom.php'); ini_set('display_errors', true); error_reporting(e_all); $str = file_get_contents('general.json'); $json = json_decode($str,true); $filename = "source.html"; $html = file_get_html($filename); class matches { var $day; var $kickofftime; var $result; function matches ($day, $kickofftime, $tip){ $this->day=$day; $this->kickofftime=$kickofftime; $this->result=$result; return $this; } } $i=0; $day=$html->find('h1',0); $day->plaintext; $day=str_replace("<h1>today football fixtures:...

javascript - error cannot read property count of undeifned -

Image
i have odata controller sending me count of total entities trying read in javascript i.e. angular app. odata.count property visible proper value keep on getting error. please refer attached image. when try read countresponse.odata.count i error cannot read property count of undefined. please guide the reason have property name dot. code trying access object on countresponse called odata , odata 's count . either change whatever code sets property not use periods or change syntax countresponse["odata.count"] .

Javascript code with 2 classes and issue -

i have 1 issue javascript code of clicking buttons in 1 page. to have code var el = document.getelementsbyclassname('a'); (var i=0;i<el.length; i++) { el[i].click(); } but code clicks 1 button, leaves 1 one unclicked , after clicks 3rd button etc. (it goes 1 click leaves 1 , click other.) my first problem , second problem that if run again code clicks clicked buttons. has no point. therefore checked when button clicked, class affected. , i'm trying code see if working doesnt. var el = document.getelementsbyclassname('num_button'); var ele = document.getelementsbyclassname('num_clicked'); (var i=0;i<el.length; i++) { if ( ele != 1) { el[i].click(); } } but not working @ all. still clicks button has been clicked. any solution??? thanks! edit 1: here html code before click <div class="stats_wrapper num_stats_wrapper "> <span class=" num_button num_sta...

android - TextView AutoLink opens link even though you didn't click/press it -

we have aboutscreen in our android app have textview autolink enabled web|phone|mail. my problem opening of link (doesn't matter if web phone or mail) happens recognizes touch on it. for example: touch down on link , drag finger away free space. though didn't click link dragged away instead, link opening. is there way resolve this?

entity framework - Fixing Model/Column mapping in Code First/EF6 -

first of all, shot myself in foot. i'm building test application (this work related, not school btw.) have model foreign key property home_teamid that mapped column called home_teamid in database. happy until refactored use id instead of id. didn't notice migration added column called home_teamid1 , storing data there instead of home_teamid (where want it.) so is: drop column home_teamid1 (no problem, can that.) rename home_teamid home_teamid. (no problem, can that.) tell ef write data original column. i've read how use database mappings in dbcontext, isn't i'm trying either (i.e., one-time thing, not need every time app runs.) (btw, there no .edmx file either.) so that's question -- how tell ef write home_teamid field in domain model home_teamid column in table? i should add i've done migration since it's not (necessarily) easy target 1 revision. edit 1: ef writing same team id both home_teamid , home_teamid1 columns, alth...

c# - Webtest - missing dll -

when creating webtests want add "web test plug-in" message box information 1 of nuget library missing. whole solution compilable , "missing" library exists entry in csproj , config files. after compilation of test project library inside "bin" folder. check under dotpeek version, publictoken etc correct. my question webtest project library? if webtests missing dependency: right click solution > manage nuget packages solution > click manage on package in question, select webtests project > ok. if webtests has broken link dll : look @ references, , see if there yellow triangles, , point to. if case, delete reference , re-attach.

Impute missing observations R -

i have dataframe of calendar days , hourly observations associated values so: starttime hour delay 04-22 0 10 04-22 1 10 04-22 3 10 04-22 4 10 what's needed hours of day , 0 associated said missing hours instead of no value or na. how best achieved? have attempted full_join dplyr dummy data frame, method seems clunky , inefficient. in short, need this: starttime hour delay 04-22 0 10 04-22 1 10 04-22 2 0 04-22 3 10 04-22 4 10 you use data.table efficiently join dataset. convert 'data.frame' 'data.table ( setdt(df1) ), set key columns ( setkey(.., starttime, hour)`), join combination of unique values of 'starttime' , 'hour', , replace na values in delay '0' library(data.table) setkey(setdt(df1), starttime, hour)[cj(starttime=unique(starttime), hour=min(hour):max(hour))][is.na(delay), delay:=0l] # st...

excel - VBA UDF fails to call Range.Precedents property -

i trying write simple udf, supposed loop through each of cells of given_row, , pick cells not have precedent ranges, , add values. here code: public function totalactualdeductions(given_row integer) integer total_actual_deduction = 0 present_column = 4 153 set precedent_range = nothing if cells(2, present_column) = "tds (replace computed figure when deducted)" on error resume next set precedent_range = cells(given_row, present_column).precedents if precedent_range nothing total_actual_deduction = total_actual_deduction + cells(given_row, present_column) end if end if next totalactualdeductions = total_actual_deduction end function if try run modifying top declaration, from: public function totalactualdeductions(given_row integer) integer to: public function totalactualdeductions() given_row = 4 then runs successfully, , expected. picks cells match criteria, , good. however, when try run p...

asp.net web api - Creating testcases using nunit and moq on WEB API controllers -

i trying create unit test cases using nunit on controllers in existing web api project. using moq mocking framework. in here mock repository return expected result.i not sure can @ point of setting of repository mockup , validating result. can suggest if whatever doing right ? took random controller question. advise or guidance example url appreciated. [testcase] public void testmethod1() { accountcontroller ac = new accountcontroller(); var mockauthrepository = new mock<authrepository>(); //mockauthrepository.setup(m=>m.registeruser(it.isany<usermodel>)) } [routeprefix("api/account")] public class accountcontroller : apicontroller { private readonly authrepository _repo; public accountcontroller() { _repo = new authrepository(); } } [httppost] [authorize(users = "admin")] [route("register")] public async task<ihttpactionresult> register(usermodel usermodel) { identityresult result = await...

active directory - DirectoryServicesCOMException.ExtendedErrorMessage - List of Data Codes -

i building website let's users log in active directory accounts, , want inform user why login failed. the background logins fail due bad username/password, can fail due expired password or account being locked out. i using this code perform login: public mycustomuserclass login(string domainname, string username, string password) { string domainandusername = domainname + @"\" + username; directoryentry entry = new directoryentry(this._ldappath, domainandusername, password); mycustomuserclass user = new mycustomuserclass(); //bind native adsobject force authentication. try { object obj = entry.nativeobject; // ... return user; } catch (directoryservicescomexception ex) { // why did login fail? } catch (exception ex) { // else went wrong } } when receive directoryservicescomexception , can access more information failed login attempt within .extendederrormessage prop...

javascript - i18next - Providing a key in data-i18n-options attribute for interpolation -

currently using i18next.js , have run in problem. say there's 2 keys: { 'keyone':'i __name__', 'item': 'a person' } in html: <div data-i18n="keyone" data-i18n-options={"name":"item"}></div> and result i'd like: 'i person' where 'a person' isn't string literal reference key (i.e. using data-i18n attribute) would possible provide 'item' key (not string 'a person') use in 'keyone' interpolation? useful when change locale i'd have call .i18n() on div , both keys translated. without functionality i'd have re-evaluate context , update div manually. any appreciated. thanks i18next has nesting functionality: http://i18next.com/translate/nesting/ so make want. can test in jsfiddle: https://jsfiddle.net/leonardonsantos/3zy4xmnm/1/ just change in data-i18n-options $t : <div data-i18n="keyone" data-i18n-opt...

javascript - AngularJS routing. Save and restore state on back button -

i'm trying figure out best way implement following scenario using angularjs routing: users have list of items search capability (e.g. movies). users can search , select item, click on , view details in separate view. once finish viewing item can click browser button , return previous list restored search options continue viewing list. default ngroute doesn't provide state concept , has implemented separately (i wonder best solution here) use ui-router. i've never worked , wonder if provides such functionality out-of-the-box for button go same state page in search screen save state of search parameters, pagination etc in url: $location.search({"searchterm": "jaws", "genre": "fishy", page: 3}); this add ?searchterm=jaws&genre=fishy&page=3 url , reload controller. @ start of controller set variables url thus: var searchterm = $location.search().searchterm; var genre = $location.search().genre; va...

android - Adding Google Maps co-ordinates/markers from a custom map link -

i know if can input url of custom map created through google maps , show waypoints in app without having manually add them all. here's example - https://www.google.com/maps/d/viewer?mid=zd38facajqek.k_fdpsyzc2wi what fastest way input of markers/waypoints , co-ordinates android app uses maps api? thanks. to exact, wanted show markers on map created google maps. unfortunately, doesn't seem android google maps api can read kml files directly, importing these files app not possible. one thing do, though quite bit of work, export created map's kml file , read programmatically. extract coordinates need , add them markers app.

Delete jenkins jobs having the matching pattern -

how delete jobs on jenkins having prefix "data_jobs_" ? , how disable jobs having prefix "data_jobs_server" ? anyone know how going /script page ?? the following should work: for (job in jenkins.model.jenkins.theinstance.getprojects()) { if (job.name.startswith("data_jobs_")) { job.delete() } else if (job.name.startswith("data_jobs_server")) { job.disable() } }

html - Shiny - change the size (padding?) of dropdown menu (select tags) smaller -

Image
how can change size of dropdown menu (select tags) smaller? thought padding makes dropdown looking 'thick'. change padding 0 make 'thin' , not work, shinyui(fluidpage( sidebarpanel( # change font size. tags$style(type='text/css', " .selectize-input, .selectize-dropdown { padding:0 ; }"), # species/ pollutant options selectinput( inputid = "species", label = "species:", choices = c(...) ), .... the result quite awkward, any ideas? for dropdown options, it's line-height want (the padding 0 default think, @ css on using chrome debugger). for box itself, looks bootstrap placing min-height on it, need add min-height: 0; . again, figured out right debugger looking @ css. so here's working solution: runapp(shinyapp( ui = fluidpage( tags$style(type='text/css', ".selectize-input { padding: 2px; min-height: 0;} .selectize-dropdown ...

emacs - Hiding files in dired while using recursive flag -

my workspace tends have lot of .class clutter, , since use -r switch dired show entire workspace easier navigation, searching inevitably ends matching bunch of .class files have go through before reaching file looking for. i used solution here , found doesn't work recursive flag. when navigate directory .class files, doesn't show them, promised, when view directory somewhere above it, still shows them. is there way hide/omit these files while using recursive flag? it works me. (but i'm on ms windows, uses ls-lisp.el , might make difference here.) please show more do. i opened dired on directory, using r among switches (e.g., -alfr ), recursive listing. i turned on dired-omit-mode (the url posted shows old way of using omission). all of expected files omitted, throughout buffer, i.e., included subdirs. (keep in mind omission buffer-specific, i.e., specific each dired buffer.)