Posts

Showing posts from March, 2012

Is it possible to return the report chain of a user from Azure AD Graph? -

i checked api document https://msdn.microsoft.com/library/azure/ad/graph/api/users-operations#operationsonusernavigationpropertiesgetausersmanager , seems support returning direct manager instead of entire chain of report line user top, ceo the way retrieve entire report chain walk tree manually looking manager of each employee in chain.

java - How private method of super class are resolved? -

class a{ private void saya(){ system.out.println("private method of a"); } public static void main(string args[]){ instancea=new b(); instancea.saya(); } } class b extends a{ } i expecting throw run time exception @ compile-time compiler checks if saya() can called on reference of a , @ run-time it'll check if saya() can called on b 's object. instead printed " private method of a ". accessibility compile time concept (reflected in reflection apis). from java language specification note accessibility static property can determined @ compile time; depends on types , declaration modifiers. that is, compiler doesn't care runtime type of instance referenced variable named instancea a instancea = new b(); it cares invoked method on reference of static type a . method private , since within body of class declares it, visible, , therefore usable. otherwise, member or constructor declared privat...

python - Why do you need lambda to nest defaultdict? -

i bit confused on why need lambda function nesting defaultdict why can't this? test = defaultdict(defaultdict(list)) instead of test = defaultdict(lambda:defaultdict(float)) test = defaultdict(defaultdict(list)) because defaultdict requires give can called create keys missing values. list such callable, defaultdict(list) not. it's defaultdict instance, , can't call defaultdict . the lambda function that, when called, returns value can used in dictionary, works. essentially, defaultdict(list) going evaluated before defaultdict instantiated, , want defer until missing key encountered. why callable object (a type or function) used here.

ios - Horizontal spacing for NSTextAttachment -

i'm trying display image in uitextfield using nstextattachment , want horizontal space between image , text. however, when add nskernattributename attribute attributed string follows, resets height of attachment same height surrounding text. var str = nsmutableattributedstring(attributedstring: nsattributedstring(attachment: imageattachment)) str.addattribute(nskernattributename, value: 10, range: nsrange(location: 0,length: 1)) is there way add horizontal space between image , text? the direct way in string start set few space : nstextattachment *attachment = [[nstextattachment alloc] init]; [attachment setimage:[uiimage imagenamed:@"dest_poi_content_quotation"]]; nsstring *reviewtext = [nsstring stringwithformat:@" %@", review.text]; nsmutableattributedstring *attributedstring = [[nsmutableattributedstring alloc] initwithstring:reviewtext]; nsattributedstring *attrstringwithimage = [nsattributedstring attributedstringwithattachment:attach...

asp.net mvc - How can I effectively prevent bot requests or at least prevent them from clogging my logs? -

i assume errors i'm getting caused bots have: indexed previous website under same domain; and are probing vulnerabilities of kind. here of errors: code: 404 ; type: http ; error: a public action method 'ipc$' not found on controller ... code: 0 ; type: invalidoperation ; error: the requested resource can accessed via ssl. there other errors specific urls used exist, have since been removed. is there way prevent bots hitting these links or i'll have deal filtering out specific requests in elmah? unfortunately, due amount of bots out there , variety of ways coded attack or scrape website, not able prevent of these errors. however, can choose ignore specific types of errors in elmah. here sample of filter in <elmah> section of web.config file: <errorfilter> <test> <or> <and> <!-- filter errors out fall in range 400-499 --> <greater binding="httpstatuscode" value=...

javascript - When clicking a button, the OnClientClick event does not raise -

i have js function so: <script type="text/javascript"> function cols() { rows = document.getelementbyid("gridview1").rows; (i = 0; < rows.length; i++) { rows[i].cells[8].style.visibility = "visible"; rows[i].cells[9].style.visibility = "visible"; rows[i].cells[10].style.visibility = "visible"; rows[i].cells[11].style.visibility = "visible"; rows[i].cells[12].style.visibility = "visible"; rows[i].cells[13].style.visibility = "visible"; rows[i].cells[14].style.visibility = "visible"; } } </script> and button onclientclick event: <asp:button id="add_button" runat="server" onclick="add_button_click" text="add new record" onclientclick="cols()" /> the cells in func...

python - Changing tick labels without affecting the plot -

Image
i plotting 2-d array in python using matplotlib , having trouble formatting tick marks. first, data organized 2-d array (elevation, latitude). plotting values of electron density function of height , latitude (basically longitudinal slice @ specific time). i want label x axis going -90 90 degrees in 30 degree intervals , y values array of elevations (each model run has different elevation values can't manually assign arbitrary elevation). have arrays latitude values in , elevation values both 1-d arrays. here code: from netcdf4 import dataset import numpy np import matplotlib.pyplot plt #load netcdf file variable mar120="c:/users/willevo/desktop/sec_giptie_cpl_mar_120.nc" #grab data new variable fh=dataset(mar120,mode="r") #assign model variable contents python variables lons=fh.variables['lon'][:] lats=fh.variables['lat'][:] var1=fh.variables['un'][:] #specifying time , elevation map ionst=var1[0,:,:,21] ionst=ionst[0:len(i...

android - How do I configure my AlarmReceiver to actually trigger at my desired interval? -

the goal portion of app run repeating alarm in background @ times grabs new prediction every 15 minutes server side machine learning algorithm, updating app. i have skeleton desired behavior implemented, make sure methodology correct. skeleton supposed trigger toast every 10 seconds stating alarm working. however, after set alarm, never see message. have included write console, never appears well, leading me believe not entirely understand how alarm receiver works. here main activity class instantiates alarm , receiver: public class mainactivity extends appcompatactivity implements timepickerfragment.fragmentcallbacks { private pendingintent pendingintent; private alarmmanager manager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // retrieve pendingintent perform broadcast intent alarmintent = new intent(this, predictionupdat...

r - Setting limits with scale_x_datetime and time data -

i want set bounds x-axis plot of time-series data features time (no dates). limits are: lims <- strptime(c("03:00","16:00"), format = "%h:%m") and ggplot prints fine, when add scale_x_datetime scale_x_datetime(limits = lims) i error: invalid input: time_trans works objects of class posixct only fully reproducible example courtesy of how create time scatterplot r? dates <- as.posixct(as.date("2011/01/01") + sample(0:365, 100, replace=true)) times <- as.posixct(runif(100, 0, 24*60*60), origin="2011/01/01") df <- data.frame( dates = dates, times = times ) lims <- strptime(c("04:00","16:00"), format = "%h:%m") library(scales) library(ggplot2) ggplot(df, aes(x=dates, y=times)) + geom_point() + scale_y_datetime(limits = lims, breaks=date_breaks("4 hour"), labels=date_format("%h:%m")) + theme(axis.text.x=element_text(angle=90)) the error m...

r - Finding local maxima and minima -

i'm looking computationally efficient way find local maxima/minima large list of numbers in r. without for loops... for example, if have datafile 1 2 3 2 1 1 2 1 , want function return 3 , 7, positions of local maxima. diff(diff(x)) (or diff(x,differences=2) : @zheyuanli) computes discrete analogue of second derivative, should negative @ local maxima. +1 below takes care of fact result of diff shorter input vector. edit : added @tommy's correction cases delta-x not 1... tt <- c(1,2,3,2,1, 1, 2, 1) which(diff(sign(diff(tt)))==-2)+1 my suggestion above ( http://finzi.psych.upenn.edu/r/library/ppc/html/ppc.peaks.html ) intended case data noisier.

c++ - Reading file made by cmd, results in 3 weird symbols -

Image
im using piece of code read file string, , working files manually made in notepad, notepad++ or other text editors: std::string utils::readfile(std::string file) { std::ifstream t(file); std::string str((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>()); return str; } when create file via notepad (or other editor) , save something, result in program: but when create file via cmd (example command below), , run program, receive unexpected result: cmd /c "hostname">"c:\users\admin\desktop\lel.txt" & exit result: when open file generated cmd (lel.txt), file contents: if edit generated file (lel.txt) notepad (adding space end of file), , try running program again, same weird 3char result. what might cause this? how can read file made via cmd, correctly? edit changed command (now using powershell), , added function found, named skipbom, , works: powershell -...

MongoDB Aggregation SQL Union and SQL Exists like clause -

i make mongodb aggregation query on data : collection a { _id : 1, active : true, hasquery : false, running : false, } { _id : 2, active : true, hasquery : true, running : false, } { _id : 3, active : true, hasquery : false, running : true, } { _id : 4, active : true, hasquery : true, running : true, } { _id : 5, active : false, hasquery : false, running : false, } { _id : 6, active : false, hasquery : false, running : true, } this json data represented table architechture table a primarykey | active | hasquery | running 1 | true | false | false 2 | true | true | false 3 | true | false | true 4 | true | true | true 5 | false | false | false 6 | false | false | true if apply following query on table : select *...

sql - Check for uniqueness within update statement -

i have table links class students in class: create table class_student (class_id int, student_id int, constraint class_student_u unique nonclustered (class_id, student_id)) if want transfer classes 1 student (remove 1 student classes he/she enrolled in , add student each of classes old student enrolled in), use following query: update class_student set student_id = @newstudent student_id = @oldstudent , class_id not in (select class_id class_student student_id = @newstudent) delete class_student student_id = @oldstudent how can transfer classes more 1 student new student? can't put where student_id in (@oldstudent1, @oldstudent2) because if both old students in same class, after running above query there violation of unique constraint. also, i'd update in few queries if possible (i run above queries twice, i'd in fewer). i'm using sql server 2008 r2. edit: clarify, here's example: class_id s...

objective c - Extract data from Json into Label Text IOS -

so using pokedex api learning curve ios , web services, here didrecivedata when connection completes - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data{ //if resposne recieved call function // nslog(@"data %@", data); //nsstring *mystring = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; //nslog(@"string %@", mystring); //put data string nserror *e = nil; pokedictionary = [nsjsonserialization jsonobjectwithdata:data options:nsjsonreadingmutablecontainers error:&e]; nslog(@"dictionary %@", pokedictionary); } this outputs json console, can log console this - (void)connectiondidfinishloading:(nsurlconnection *)connection { // data // receiveddata declared method instance elsewhere nslog(@"succeeded!"); nslog(@"the pokemon's name %@", pokedictionary[@"name"]); nslog(@"the pokemon's attack %@...

mysql - Adding rows to database from a dynamic form in PHP -

i have form index parts belong schematic drawings. have hundreds of drawings , each 1 have different number of parts attached it. each part requires 3 pieces of information number, part_id , description. initial form captures , allows user add many rows form needed parts drawing. form fields named number_1, part_id_1 , description_1. each row added form increments number @ end one. example if schematic has 10 parts end number_1 - number_10. while ($i <= $fieldnum) { $number = "number_".$i; $partnumber = "partnumber_".$i; $description = "description_".$i; print (" <input name=$number type=\"text\" size=\"3\" /> <input name=$partnumber type=\"text\" size=\"20\" /> <input name=$description type=\"text\" size=\"35\" /> "); $i++; } whe...

How to identify triangles in Netlogo -

how can find triangles in undirected network in netlogo, is, list instances of a-b, b-c, c-a? thank you, thomas here naive approach. if network not big, enough: to-report find-triangles let triangles (list) ask turtles [ let t1 self ; find triangles turtle part of ask link-neighbors [ let t2 self ask link-neighbors [ let t3 self if link-with t1 != nobody [ set triangles lput (turtle-set t1 t2 t3) triangles ] ] ] ] report remove-duplicates triangles end let's test simple network: to setup clear-all create-turtles 4 ask turtle 0 [ create-link-with turtle 1 create-link-with turtle 2 ] ask turtle 1 [ create-link-with turtle 2 ] ask turtle 3 [ create-link-with turtle 1 create-link-with turtle 2 ] ask turtles [ set label ] repeat 30 [ layout-spring turtles links 0.2 5 1 ] show map sort find-triangles end from command center, result is: obser...

inputstream - ServletInputStream thread stuck in undertow handler of jboss wildfly 8.2.0 final -

i'm trying send file in body of post request servlet deployed in wildfly 8.2.0. in code i'm trying read file stream request servletinputstream object using request.getinputstream(). works fine in jboss 7.x. on wildfly 8.2.0, undertow's servlet handler seems kicking in. see file stream transferred servletinputstream object. undertow doesn't seem releasing thread after 100% transfer. not sure if bug in undertow or have configured wrongly in undertow module. suggestions here? here details of thread has been stuck after 100% transfer: default task-17 sun.nio.ch.pollarraywrapper.poll0(native method) sun.nio.ch.pollarraywrapper.poll(pollarraywrapper.java:117) sun.nio.ch.pollselectorimpl.doselect(pollselectorimpl.java:73) sun.nio.ch.selectorimpl.lockanddoselect(selectorimpl.java:87) sun.nio.ch.selectorimpl.select(selectorimpl.java:98) sun.nio.ch.selectorimpl.select(selectorimpl.java:102) org.xnio.nio.selectorutils.await(selectorutils.java:46) org.xnio.nio.niosocketcond...

Mobile Ads Refresh Rate & Optimization -

i'm looking add mobile ads using mopub. in thinking , on activities place ads, i'm thinking more screen views = more ad refreshes = more cpm impressions however mopub's guide emphasizes click throughs , asks not refresh ad often. think ad refreshes after timeout anyways. http://www.mopub.com/2011/10/12/how-to-optimize-your-mobile-ads-part-2-of-3/ i'm little confused approach mean less ad impressions. missing? obviously i'm trying optimize ad placement profitability. should refresh myself each activity & fragment load? or best reload less ? thanks. this trade off since higher ctr (click through rate) means higher ecpm (estimated cost per mille (impression)) ads. however, faster refresh, more ad impressions ctr drops ad there less screen time individual ad. for banners, i'd 20-30s refresh rate optimal. know mopub, can set values lower 10, minimum around 10 seconds refresh rate. you can run a/b test programmatically on mopub 2 subse...

python - NLTK Wordnet Synset for word phrase -

i'm working python nltk wordnet api. i'm trying find best synset represents group of words. if need find best synset "school & office supplies", i'm not sure how go this. far i've tried finding synsets individual words , computing best lowest common hypernym this: def find_best_synset(category_name): text = word_tokenize(category_name) tags = pos_tag(text) node_synsets = [] word, tag in tags: pos = get_wordnet_pos(tag) if not pos: continue node_synsets.append(wordnet.synsets(word, pos=pos)) max_score = 0 max_synset = none max_combination = none combination in itertools.product(*node_synsets): test in itertools.combinations(combination, 2): score = wordnet.path_similarity(test[0], test[1]) if score > max_score: max_score = score max_combination = test max_synset = test[0].lowest_common_hypernyms(tes...

java - Void method to jTextArea-Transform console(recursive method) output to jTextArea -

i have following code class binarytree{ node root; public void inordertraversetree(node node) { if (node!= null) { // traverse left node inordertraversetree(node.leftchild); // visit focused on node system.out.println(node); // traverse right node inordertraversetree(node.rightchild); } } public void preordertraversetree(node node) { if (node!= null) { system.out.println(node); preordertraversetree(node.leftchild); preordertraversetree(node.rightchild); } } public static void main(string[] args) throws sqlexception { binarytree thetree = new binarytree(); //retrieve data database, create tree, call functions, //works-it shows @ console thetree.preordertraversetree(thetree.root); thetree.inordertrave...

javascript - Edit property of an object in array of objects -

i have class itemcollection stores information purchases. class has array _items property purchases stores. when user adds new purchase in cart class using additem method adds item in _items property if has item method iterates quantity property if not adds new item in array. problem instead of adding new item in array when other item chosen keeps incrementing quantity property of first item added. cartcollection class (object): var cartcollection = { _items: [], additem: function(obj) { 'use strict'; var purchase = { item: { id: obj.id, name: obj.name, price: obj.price }, thisitemtotal: obj.price, quantity: 1 }; var result = _.findwhere(this._items, purchase.item.id); console.log(result); if (typeof result != 'undefined') { //console.log(result); var index = _.findindex(this._items, { id: result.item.id }); ...

hyperlink - Is there an easier way to link back to the index.html file? -

i trying link index.html sub folder inside portfolio, right have method "works", feels long route. here "link" looks in notepad++ <a class="navlist" href="/college/tech%20classes/html%20and%20javascript/midterm%20project/index.html">home</a> . i curious if there different/easier way link index.html ? edit: guess should mention doing within said folder/html file l:\college\tech classes\html , javascript\midterm project\htmljava\htmljava.html . you can use relative link .. means going 1 folder. e.g.: <a class="navlist" href="../index.html">home</a>

html5 - CSS drop down sub-menus vertical alignment -

i have drop down menu @ https://admin.vybenetworks.com/vybe/dropdown/ works fine except 1 thing. sub-menus aligned top of navigation rather menu item part of. example, under "billing" there sub-menu called "reports" 1 item called "sales report". sub-menu displaying near "recurring billing" item instead of next "reports" one. i tried searching issue few hits issue. think containing element (li) "position: relative" , sub-menu (ul) "position: absolute" puts relative the parent ul instead. thanks hints. in vybe.css file on line 286px, have element so: nav ul ul ul. change property top of element to: nav ul ul ul { /* other code here, don't copy comment */ top: 252px; /* other code there, don't copy comment */ } it make sub menu element slide down next it's corresponding parent. can modify seem fit think 252px spot on. let me know if worked/did not work you.

html - radio button (checkbox hack) -

i'm trying use css radio button hack reveal hidden div, cannot appear when clicked. current code below hidden, , nothing happens when click check box. intend add similar boxes (and later hide them) display few tabs of light content. can please offer aid? here html (only first box written): <section class="panel clearfix skillsbox"> <div class="wizard wizard-vertical clearfix" id="wizard-2"> <ul class="steps"> <li class="step changeskill"> <input type="radio" id="zskills"><label for="zskills"><span class="badge badge-info">1</span>feel activities</label> </li> <div class="reveal-if-active-skillsall"> <div class="step-pane step-content" id="all"> <ul> <li>all activities in feel stage listed below.<br> </li> <li>you can c...

java - Only getting one single client in my serverSocket -

this question has answer here: java server- accepting more clients 2 answers i have server socket , want open multiple clients. getting 1, , if close client, im not allowed more client. server code: public class server { public void startserver() { final executorservice clientprocessingpool = executors.newfixedthreadpool(10); runnable servertask = new runnable() { @override public void run() { try { inetaddress ip; connect cn = new connect(); serversocket serversocket = new serversocket(9239); socket clientsocket; system.out.println("waiting clients connect..."); clientsocket = serversocket.accept(); string hostname = ""; ...

Chart.js - How to Add Text in the Middle of the Chart? -

Image
i'm using chart.js create line chart: but need label zones, this: any ideas? you extend chart used , write labels using helper methods html <canvas id="mychart" width="500" height="400"></canvas> in below js, note parameter calculatey y value , while calculatex, label index chart.types.line.extend({ name: "linealt", draw: function(){ chart.types.line.prototype.draw.apply(this, arguments); this.chart.ctx.textalign = "center" // y value , x index this.chart.ctx.filltext("zone1", this.scale.calculatex(3.5), this.scale.calculatey(20.75)) this.chart.ctx.filltext("zone2", this.scale.calculatex(11.5), this.scale.calculatey(13)) this.chart.ctx.filltext("zone3", this.scale.calculatex(2), this.scale.calculatey(9.75)) this.chart.ctx.filltext("zone4", this.scale.calculatex(14.5), this.scale.calculatey...

html - nth-of-type(2) is targeting the first of type? -

i have relatively modular page due cms, content of these paragraph blocks don't fill whole block, want increase font size of blocks. however, when try target 2 , 3, doesn't seem recognize @ all. in fact, targets only first one, , in inspector, says because it's applying rule 2. example html <div class="container"> <div class="item video"> <!-- html video stuffs--> </div> <div class="item copy"> <h1>example title</h1> <p>example words</p> </div> <div class="item photo"> <!-- html photo stuffs--> </div> <div class="item video"> <!-- html video stuffs--> </div> <div class="item copy"> <h1>example title</h1> <p>example words</p> </div> <div class="item photo"> ...

python - Selenium IEDriver accept download -

Image
how accept save download link selenium , iedriver? (this iedriver page) there no way control download pop-ups on browsers using selenium because browsers use native dialogs cannot controlled javascript, need alternate approaches. alternate approaches working : get browser preconfigured. means everytime click on download of file, browser should directly download without giving options open/save/cancel. can set in settings menu of browsers. you can try more harder, read : link note : assuming automating here. , automation tests have @before condition should ensure test goes through. in case, if follow first (& easy approach) have given - @before condition. hope helps.

android - Cannot resolve symbol 'AndroidJUnit4' -

Image
obviously need correct import statment solve problem. according docs androidjunit4 , should import android.support.test.runner.androidjunit4; when that, android studio highlights runner in red , complains "cannot resolve symbol 'runner'". background i got point following tutorials on android developer site setting tests using ui automator . first problem encountered com.android.support:support-v4:22.2.0 , com.android.support.test:runner:0.2 depend on different versions of com.android.support:support-annotations . followed suggestions this android bug report , added following allprojects in project's build.gradle : configurations.all { resolutionstrategy.force 'com.android.support:support-annotations:22.1.0' } this solved immediate error, suspect lead current problems. have suggestions how fix this? relevent sections `./gradlew :app:dependencies androidtestcompile - classpath compiling androidtest sources. +--- com.jayway.androi...

windows - IIS virtual directory goes to main site -

i have windows 2012 server iis8. on have default web site, defaultsite.com/ and under site have 2 virtual directory sub-site classic asp applications. defaultsite.com/site1 defaultsite.com/site2 now site2 works fine, when go defaultsite.com/site1 browser (ie11) gets sent defaultsite.com/ any idea setting causing this? i have seen websites 404 error (page not found) redirects home page instead of throwing 404 error. possibly home page in defaultsite.com/site1 not configured correctly. can check if default page set correctly , exists.

python - Ubuntu and Django, no module named 'django' -

i have problem django on ubuntu. when type python in terminal, terminal returns python 3.4.1 (default, jun 2 2015, 15:13:43) [gcc 4.8.2] on linux so it's allright. when type admin-django.py version terminal returns 1.8.2 so it's still allright. when go python import django terminal returns: traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named 'django' i'm fighting whole day, i'm quite new linux. know solution?

python - how can i make a consult in oracle with django, using date in where clause -

i need make consult in oracle using django. i making raw consults, because need it. the problem after de clause, im goint put code after clause. in oraclesqldevelopment works, when put django doesn`t work. ' mov.instante>='20/04/2015 00:00:00.00' , mov.resolucion=2 ' i allready tried insert "\" or triple""" ' mov.instante>=\'20/04/2015 00:00:00.00\' , mov.resolucion=2 ' or """... mov.instante>='20/04/2015 00:00:00.00' , mov.resolucion=2 """ when print query, result is: where mov.instante>='20/04/2015 00:00:00.00' , mov.resolucion=2 and django returns exception unexpected error:

Tomcat behind Nginx: how to proxy both HTTP and HTTPS, possibly on non-standard ports? -

description we're installing application running tomcat 6 behind nginx different clients. of installations http only, https only, somewhere both. 1 of installations has http , https working on non-standard ports (8070 , 8071) due lack of public ips. application @ hand displayed iframe in app. current behaviour tomcat redirects https requests http (so nothing displayed in iframe due browser restrictions mixed content). current configuration iframe code: <iframe src="/saiku-ui"> tomcat's server.xml : <connector port="8080" protocol="http/1.1"/> <!-- bit later... --> <valve classname="org.apache.catalina.valves.remoteipvalve" remoteipheader="x-forwarded-for" protocolheader="x-forwarded-proto" /> nginx vhost: server { listen 80; listen 443 ssl spdy; location /saiku-ui { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_heade...

iOS8 Swift: Navigation and Tool Bars don't show up -

Image
navigationbar , toolbar not showing in simulator. went through similar questions posted in forum , included learnt answers. still i'm unable figure out why bars not shown. included following lines viewwillappear() //show toolbar , navbar self.navigationcontroller?.setnavigationbarhidden(false, animated: true) self.navigationcontroller?.settoolbarhidden(false, animated: true) below screenshot of storyboard. the simulator screenshot appears i reach view controller tableviewcontroller (which embedded in tabbarcontroller) programmatically, following code var nextcontroller = imagepickviewcontroller() nextcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("imagepicker") as! imagepickviewcontroller self.presentviewcontroller(nextcontroller, animated: true, completion: nil) any appreciated. please let me know if additional information required. thanks in advance hari thank james udacity. posting diagnosis. the toolbars didn...

c# - Application with elevated privileges is slow to load -

i testing c# wpf program requires elevated privileges, loads without delay if logged on admin, if logged on standard user (99% of time) there delay of 30 seconds before ui appears. using same elevation code in c# console app , in c# winforms app, there no delay in loading, know code works. so, can explain me why there delay associated wpf; , there workaround? here code app.xaml.cs ( remainder of project genereated vs2010) using system; using system.collections.generic; using system.configuration; using system.data; using system.linq; using system.windows; using system.security.principal; using system.diagnostics; using system.reflection; using system.componentmodel; using mynewservicelib; using system.runtime.interopservices; namespace whysoslow { /// <summary> /// interaction logic app.xaml /// </summary> public partial class app : application { protected override void onstartup(startupeventargs e) { base.onstartup...

F# finding only prime numbers -

i'm new f# please bear me. problem have i'm trying find prime numbers. i've write code: let isprime n = let rec check = > n/2 || (n % <> 0 && check (i + 1)) check 2;; let listnums = list.filter isprime >> list.length;; let nums = [ 16; 17; 3; 4; 2; 5; 11; 6; 7; 18; 13; 14; ];; let countprimes (x:int) = x |> list.ofseq |> listnums;; trying call countprimes nums;; but failed message: the type 'int' not compatible type 'seq<'a>' any appreciated you not need countprimes separately. enough remove , work: let isprime n = let rec check = > n/2 || (n % <> 0 && check (i + 1)) check 2 let nums = [ 16; 17; 3; 4; 2; 5; 11; 6; 7; 18; 13; 14; ] let listprime lst = lst |> list.filter isprime nums |> listprime |> printfn "%a" out: [17; 3; 2; 5; 11; 7; 13] link: https://dotnetfiddle.net/nvxwz5

class - How to Inherit from two or more classes in JavaScript -

so have classes function node() { node.prototype.setname=function(_n){this.name=_n;}; } function textablenode() { textablenode.prototype.settext=function(_t) {this.text=_t;}; } function attributionalnode() { attributionalnode.prototype.setattribute=function(_a) {this.att=_a;}; } all of these inherited node(); how implement new class such universalnode(); have methods?

sql server - Why does using a variable cause the query to never complete? -

i have table of ~10 million bigints offset larger known constant. i'd know how many numbers within range of constant. (the actual query doesn't matter). when use constant converted bigint performance acceptable (1 second). when store constant in variable or parameter query never finishes. here script generate sample table: if object_id('bigints', 'u') not null drop table bigints; t (select * (values(1),(1),(1), (1),(1),(1), (1),(1),(1), (1))f(n)) select num = convert(bigint, 123456789012) + abs(binary_checksum(newid())) bigints t a, t b, t c, t d, t e, t f, t g and here example of failing query: declare @const bigint = convert(bigint, 123456789012); t (select * (values(1),(1),(1), (1),(1),(1), (1),(1),(1), (1))f(n)), tall...

angularjs - Persistent Array in Angular Factory Possible? -

i'm attempting create persistent array throughout client's session without using $window.sessionstorage. right every single time change route array empties out, if it's same exact route on. possible make data persistent without using sessions or localstorage? var = []; pushing it: a.push(b); result of after rerouting: []; your controller function re-run on route changes, clearing local variables every time. there few ways skin cat here, suggest using $rootscope , special top level controller won't re-run unless whole app refreshes. // controller function whatevercontroller ($scope, $rootscope) { // create array if 1 doesn't exist yet $rootscope.persistentarray = $rootscope.persistentarray || [] $rootscope.persistentarray.push('heyoo') $scope.localarray = $rootscope.persistentarray } $rootscope can passed factories (pretty sure), can achieve want typical factory, scoped variables getter / setters

How is it possible to get tracked features from tango APIs used for motion tracking -

as shown in project tango gtc video , local features extracted , tracked motion estimation fused accelerometer data. since developer may need track features develop his/her apps, wondering if there way features through apis . although possible extract point , retrieve flow using estimated 6dof pose returned apis , adds overhead. issue approach pure visual flow (including outliers) not achievable , influenced imu data. so question if these features tracked using hardware-accelerated algorithms, how can them using apis without having implement , redundant task. any answer , suggestion appreciated. it straightforward compile opencv tango nvidia's tadp package. use 3.0r4. may need merge opencv-4-android bits it's easy, , es examples fail on device don't sweat it.

javascript - Is it possible to get specific static contents of a webpage only using client side technology? -

i allowed use client side technologies such html5 javascript ect.. possible specific contents of webpage using these technologies alone? if on same domain or site supports cross-origin resource sharing yes. want @ javascript xmlhttprequest.

swift - Resetting and changing speed on SKActions -

is there way change velocity/speed of skaction , reset skaction? let wait = skaction.waitforduration(5.0) let moveright = skaction.movebyx(300, y:0, duration: 1.0) let sequence = skaction.sequence([wait, moveright]) let endlessaction = skaction.repeatactionforever(sequence) node.runaction(endlessaction) this code works things change how fast skspritenode moves right @ moment it quite slow , make skspritenode return orignal position rather keep on moving right forever? thank you since velocity = distance / time , decreasing duration increase speed the sprite move across screen. regarding second point, considering how skaction.movebyx(300, y:0, duration: 1.0) moves node right; skaction.movebyx(-300, y:0, duration: 1.0) must therefore move node left, original position. hope helps.

Android Studio First Project Rendering Issues -

Image
i got android studio make first app, when created test project, gui didn't show , says rendering problems version of rendering library more recent version of android studio. please update android studio (details) the details below. org.jetbrains.android.uipreview.renderingexception: version of rendering library more recent version of android studio. please update android studio @ org.jetbrains.android.uipreview.layoutlibraryloader.load(layoutlibraryloader.java:90) @ org.jetbrains.android.sdk.androidtargetdata.getlayoutlibrary(androidtargetdata.java:159) @ com.android.tools.idea.rendering.renderservice.createtask(renderservice.java:164) @ com.intellij.android.designer.designsurface.androiddesignereditorpanel$6.run(androiddesignereditorpanel.java:475) @ com.intellij.util.ui.update.mergingupdatequeue.execute(mergingupdatequeue.java:320) @ com.intellij.util.ui.update.mergingupdatequeue.execute(mergingupdatequeue.java:310) @ com.intellij.util.ui.up...

sql - MySql: How to group by day and by hour each? SOLVED -

there many questions here posted none one. what trying query brings me count of records each hour day. see example in table below: <table> <tr> <th>day/hour</th> <th>0</th> <th>1</th> <th>2</th> <th>4</th> <th>5</th> <th>6</th> <th>7</th> <th>8</th> <th>9</th> <th>10</th> <th>11</th> <th>12</th> <th>13</th> <th>14</th> <th>15</th> <th>16</th> <th>17</th> <th>18</th> <th>19</th> <th>20</th> <th>21</th> <th>22</th> <th>23</th> </tr> <tr> <td>2015-06-02</td> <td>12</td> <td>22</td> <td>198</td> <td>234...

onclicklistener - Android Editext: Layout with 2 Edit Text fields needs 2 click to clear the text? -

i have 2 edit text fiels on layout name mainactivity. <edittext android:id="@+id/edt1"/> <edittext android:id="@+id/edt2"/> i want clear text when click on text field. in case have 1 text field , when click on it, text clear immediately. however, in situation (2 text fields), when enter text field 1, field 2. then click field 1 again, , need 2 clicks clear text. i guess problem related focusable java code @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); edt1 = (edittext) findviewbyid(r.id.edt1); edt1.setonclicklistener(this); edt2 = (edittext) findviewbyid(r.id.edt2); edt2.setonclicklistener(this); } @override public void onclick(view v) { switch (v.getid()) { case r.id.edt1: edt1.settext(""); break; case r.id.edt2: edt2.settext(""); ...

ndepend - Refining CQLinq rule for nested visibility -

we have ndepend 5.4.1 , want alter queries field/type/method have lower visibility. want query take scope of enclosing class account when deciding whether consider violation. for example, internal class x { public int a; public void b() { } public class c { // … } } we don’t want a, b or c generate violation saying of them should made internal. if class x public, on other hand, , none of a, b , c used outside assembly, should generate violations. to accomplish this, added following line queries: // consider visibility of enclosing class f.parenttype.visibility < f.optimalvisibility so fields, new query looks like: // <name>fields have lower visibility</name> warnif count > 0 f in justmycode.fields f.visibility != f.optimalvisibility && !f.hasattribute("ndepend.attributes.cannotdecreasevisibilityattribute".allownomatch()) && !f.hasattribute("ndepend.attributes.isnotdeadcodeattribute".a...