Posts

r - Add datapoints to existing scatterplot -

Image
i have existing ggplot2 scatterplot shows results of parameter against normal database. want add 2 additional points graph pass command line arguments script script age value1 value2 . show these points red r , l geom_text above each point. have following code far not know how add finishing touches pkgload <- function(x) { if (!require(x,character.only = true)) { install.packages(x,dep=true, repos='http://star-www.st-andrews.ac.uk/cran/') if(!require(x,character.only = true)) stop("package not found") } } pkgload("ggplot2") #load current normals database df<-data.frame(read.csv("dat_normals.txt", sep='\t', header=t)) args<-commandargs(true) #specify each argument age <- args[1] rsbr <- args[2] lsbr <- args[3] # run regression , append prediction intervals lm_fit = lm(sbr ~ age, data = df) sbr_with_pred = data.frame(df, predict(lm_fit, interval='prediction')) p <- ggplot...

tfs - Team Foundation Server 2015 git repo with submodules on external git servers -

Image
i've got team foundation server 2015 installed. working great expect 1 thing. i working 2 main git repositories (created team projects). build first repository works great build second repository has problems. the first has sub-modules live on tfs git server itself. build works great here. the second has sub-modules live on different git server. when build runs tfs fails obtain submodules: ****************************************************************************** starting: sources ****************************************************************************** syncing repository: my_app (git) checking out dbab6... c:\tfsbuildagents\agent-utp120w-1\_work\5\s submodules object not found - no matching loose object (f8334...) prepare repository failed exception. (i've abbreviated sha's here simplicity) the sha starts f8334... submodule lives on external git server. guess error: object not found - no matching loose object actually has credenti...

ios - NSURLSession gets the data properly, but returns nothing after Task.resume() -

this question has answer here: returning data async call in swift function 4 answers i trying connect http server data in json format. connects , gets data properly. able print data before task.resume() but, doesn't print after task.resume() also, function returns empty object. i tried saving global variable before task.resume() . so, can use getter method data, still returns empty. can please tell me doing wrong here. in advance func getticketinfo(rdate: string, rname: string) -> nsdictionary { var obj = nsdictionary() let request = nsmutableurlrequest(url: nsurl(string: self.host)!) request.httpmethod = "post" let poststring = "&drivername=\(self.username);&password=\(self.password);&function=getticketprintinvoiceinfo;&routename=\(rname);&routedate=\(rdate);"; request.httpbody = poststring....

Building and Running on a device from Android Studio -

to run application on device think have ensure app. debuggable setting android:debuggable attribute of <application> element true in build.gradle file, (as says in doc. http://developer.android.com/tools/building/building-studio.html ) how file looks like: // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } } you targeting wrong build.gradle (top level). need in lower level build.gradle in android block: android { //... buildtypes { debug { debuggable true } customdebuggablebuildtype { debuggable true } release { debuggable ...

ios - How should I tidy UIViewControllers when they need to be destroyed -

i'm starting write second version of our iphone app , i'm trying tidy previous mistakes (as it's first attempt @ objective-c). question related "things need when uiviewcontroller destroyed", there seem few contradictory answers out there , want make sure understand correctly. couple of constraints: this code use ios 5 , ios 6 devices i don't wish register , deregister nsnotifications on viewwillappear , viewwilldisappear because uiviewcontrollers need receive notifications if can't seen user. i'm using storyboard rather separate nib files. so considering above constraints, following statements true? iboutlets connecting storyboard uiviewcontrollers should weak, strong reference created behind scenes. because iboutlets weak shouldn't need nil them out in low memory situations i shouldn't use viewdidunload because it's being deprecated instead should use didreceivememorywarning. in situation need nil out strong properties (...

python - Getting logged in User's Profile in Django without repeating request.user a lot? -

the application writing in django requires me userprofile model object (which has one-to-one relationship standard django user object) in lot of views. user's profile, end repeating quite bit in different views: user_profile = userprofile.objects.get(user=request.user) or user_profile = userprofile.objects.get(user=self.request.user) i know software engineering principles don't repeat (dry), wondering if there way encapsulate code above in separate method or if it's fine keep way is. thanks in advance help! add related name userprofile in models.py class userprofile(models.model): user = models.onetoonefield(user, related_name='profile') = models.textfield(default='') then in views.py , reference with request.user.profile.about = 'abc' request.user.profile.save() or make shorter p = request.user.profile p.about = 'abc' p.save()

when startKey is unknown how to implement strategy for couchdb/pouchDb -

numerous readings indicate skip should avoided when doing pagination. in link cite using startkey , limit way go. after first page know startkey of page, lastkey of page , total entries. if have pagination control page numbers buttons , user selects page 3, how there? have no idea startkey of page3. perhaps, simple view front go start keys each page. this page nicely describes pagination: http://docs.couchdb.org/en/1.6.1/couchapp/views/pagination.html so, can't have "go page 298", have links previous , next 5 pages, can larger number of preceeding , following documents , generate links accordingly. example, if have 10 posts per page, 50 following keys , take every 10th one. as making "go page x", perhaps background script generates somesort of cache?