Posts

swift - How to change text of a button with a segmented controller? -

i have button links view control. trying change text of button segmented control. using jared davidson tutorial on segmented controls changing text of labels . how change text of button? also, when attempted japanese characters, got error on line: "invalid character in source file". thank you! you can change button title japanese characters way: yourbutton.settitle("ボタンのタイトル", forstate: uicontrolstate.normal)

node.js - Mongoose installation failed on Mac -

Image
this got in terminal. have mongodb , node.js installed already.. if can me i'll appreciate lot! thank you... from see in terminal, think installation mongoose successful. , staring application using nodemon think not installed getting error nodemon: command not found . first need install nodemon using, npm install -g nodemon

c# - Redirect returns "Object moved to" -

i have problem. when try redirect user non-http url mvc action, returns: object moved here. full response (from fiddler): http/1.1 301 moved permanently cache-control: private content-type: text/html; charset=utf-8 location: mygame-app://test.somespecificdata server: microsoft-iis/8.0 x-aspnetmvc-version: 4.0 x-aspnet-version: 4.0.30319 x-sourcefiles: =?utf-8?b?qzpcvxnlcnncuglvdhjcrgvza3rvcfxuywtlc0nhcmvcvgfrzxndyxjlxervy3rvcnncrwrvy3rvclxdb25zdwx0yxrpb25cmtkx?= x-powered-by: asp.net date: thu, 18 jun 2015 18:19:35 gmt content-length: 457 <html><head><title>object moved</title></head><body> <h2>object moved <a href="mygame-app%3a%2f%2ftestprotocol.somespecificdata">here</a>.</h2> <!-- visual studio browser link --> <script type="application/json" id="__browserlink_initializationdata"> {"appname":"firefox"} </script> <script type="te...

android - How Can I put a error msg if there is a blank field on Java? -

i trying make unit converter , seems working need give them error if don't put number on first field , other error if put number on second field (so cant convert backwards) public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final edittext editcentimeters = (edittext) findviewbyid(r.id.editcentimeters); final edittext editinches = (edittext) findviewbyid(r.id.editinches); button buttonconvert = (button)findviewbyid(r.id.buttonconvert); buttonconvert.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { double centimeters = double.valueof( editcentimeters.gettext().tostring()); double inches = centimeters * 0.393700787 ; editinches.settext(string.valueof(inches)); } ...

javascript - Generate html table using angular -

i want generate html table using angular.i have json object , used ng-repeat add multiple rows. table structure different. want generate table structure this: <table> <tr> <td >id</td> <td>sub</td> </tr> <tr> <td rowspan="3">1</td> <td>s1</td> </tr> <tr> <td>s2</td> </tr> <tr> <td>s3</td> </tr> </table> -------------- id | subjects -------------- | s1 -------- 1 | s2 -------- | s3 -------------- | s4 -------- 2 | s5 -------- | s6 -------------- user:[ {id:1 , subjects:[ {id:1 , name:"eng"} {id:2 , name:"phy"} ] }, { id:2 , subjects:[ {id:1 , name:"eng"} {id:3 , name:"math"} ] } ] my ...

angularjs - loopback angular sdk get all users with a certain role -

i'm stuck on getting users role, example admin users, in 1 angular sdk controller. according docs of strongloop. did was: user.find({ filter: { include: [{'relation':'roles', 'scope': { where:{ name:'admin', }} }], }, }, function(list) { console.log(list); }); but list got users, non-admin users included too. on server side default codes, didn't change them. { "name": "user", "plural": "users", "base": "user", "properties": { }, "relations": { "roles": { "type": "belongsto", "model": "rolemapping", "foreignkey": "principalid" } }, "acls": [], "methods": [] } could tell me made wrong? don't want loop through "list" query , filter admin users, because huge list of users, admin...

java - Multithreading for List of Objects -

i have list of 800 customer objects , each customer object in loop needs fetch additional data database, single thread operation taking lot of time. my approach split initial list in multiple lists of 4 , execute each list in parallel each other. can 1 come demo code skeleton problem statement. i confused whether should write db queries , business logic inside run() method of class implementing runnable interface or better approach there? 800 not large number of rows bring back. what's killing loop, you're performing separate query each of these rows. called n + 1 selects antipattern . using multiple threads not improve anything, network round trips problem before , adding threads doesn't make better. instead write 1 query join customer whatever needs, bringing data in 1 resultset. minimizes number of trips across network data.

sql - Run-time error '3049' when qdf.Execute dbFailOnError in Access -

Image
i trying commit new data various databases , when keep committing data after while, shows me error: the commit statment looks this: sql "insert bond values("","hk0000122334","cnh",8447.5357732363,8447.5357732400,0.0000000037,109913,"01jun15")". the database reaches 2.09gb well. code looks this: sub commit(dbname string, tablename string, commitstring string, reportdate string) dim ws dao.workspace dim db dao.database dim ssql string dim qdf querydef sdb = dbname & ".accdb" set ws = dbengine.workspaces(0) set db = ws.opendatabase(sdb) sqlstatementlist = split(commitstring, ";") each sqlstatement in sqlstatementlist sqlstatement = replace(sqlstatement, ")" & vblf, reportdate) if instr(tablename, "eis") <> 0 sqlstatement = replace(sqlstatement, "eis", tablename) end if ssql = sq...

Format of R's lm() Formula with a Transformation -

i can't quite figure out how following in 1 line: data(attenu) x_temp = attenu$accel^(1/4) y_temp = log(attenu$dist) best_line = lm(y_temp ~ x_temp) since above works, thought following: data(attenu) best_line = lm( log(attenu$dist) ~ (attenu$accel^(1/4)) ) but gives error: error in terms.formula(formula, data = data) : invalid power in formula there's i'm missing when using transformed variables in r's formula format. why doesn't work? you're looking function i ^ operator treated arithmetic in formula, ie. x <- runif(1:100) y <- x + rnorm(100,0, 3) lm(log(y) ~ i(x^(1/4))

java - How do you reference a button inside of its actionlistener? -

i'm starting used listeners still kind of new working them. need reference button inside of actionlistener text of button. code want is: for(int = 0; i<48; ++i){ button[i] = new jbutton(""); contentpane.add(button[i]); button[i].addactionlistener(new actionlistener() { public void actionperformed(actionevent e) { x_marks_the_spot(); if(button[i].gettext().equals("x")){ increase_hit(); } else{ increase_miss(); } } }); obviously can't because [i] doesn't exist in anon portion of code. sure there way getting source, can't think of it. obviously can't because [i] doesn't exist in anon portion of code. you copying i final variable: // make final copy of loop variable before making listener final tmpi = i; ... // use final variable instead of `...

c# - MVVM Light SimpleIoc instance resolution -

in mvvm light display dialog having implement imodalwindow interface. register using simpleioc.default.register<imodalwindow, dialogview>(); using method though cannot see how can register different dialogs implement same interface , request correct one. looked @ factory method not find suitable example. instead used following simpleioc.default.register<imodalwindow>(() => { return new dialogview(); }, "dialogview"); which allows me access specific dialog type via key, since singleton, error when attempt show dialog second time because instance has been closed. this second method allows mock used unit testing registering same key. how can register different dialogs simpleioc, non-singleton instances , able unit test?

Is there a way to center an R plot within a tabPanel in shiny? -

i working on shiny app, , way have formatted plots way wide. shortened them width argument reasonable can't figure out how center them within tab panel (apparently plotoutput doesn't take align argument). tabsetpanel( tabpanel("plot1", plotoutput("plot1", width="60%")), tabpanel("plot2", plotoutput("plot2", width="60%")) ) i not aware of shiny specific way can use css style output images. add tags$style following content ui: "#plot1 img, #plot2 img { width: 60%; display: block; margin-left: auto; margin-right: auto; }" and remove width="60%" plotoutput . excluding width bootstrap center-block class. minimal ui definition this: shinyui(bootstrappage( tags$head(tags$style( type="text/css", "#plot1 img, #plot2 img { width: 60%; display: block; margin-left: auto; ma...

visual studio - VisualStudio 2015 RC Issue with Includes -

pulling out hair on should simple issue using vc++ , being unable access default includes. after installing visual studio 2015 rc, can no longer build c/c++ projects. receive "intellisense: cannot open source file '*.h'" errors various standard library *.h files. i confirmed files exist in default locations (c:\program files (x86)\microsoft visual studio 14.0\vc\include), , if right-click on #include <cstdio> line in editor can choose "open document" , opens automatically in editor. my include directories string in project settings is: c:\program files (x86)\microsoft visual studio 14.0\vc\include;c:\users\kristopher\libraries\includes;$(vc_includepath);$(vcinstalldir)include;$(vcinstalldir)atlmfc\include;$(windowssdk_includepath);‌ has else run this? feel i'm overlooking simple. your includepath should not specify visual c++ , windows sdk include paths directly. instead, should specify paths specific project , derive incl...

facebook graph api - My Singleton Class isn't executing a block method, objective-c -

the method i'm calling -(void)initialloginuser{ __block bool jobdone = no; __weak typeof(self) weakself = self; [self setself:^{ // block method gets called never enters block nslog(@"entered here"); //never arrives here [weakself uploaduserdata]; //here jobdone = yes; //or here }]; nsdate *loopuntil = [nsdate datewithtimeintervalsincenow:10]; while (jobdone == no && [loopuntil timeintervalsincenow] > 0) { [[nsrunloop currentrunloop] runmode:nsdefaultrunloopmode beforedate:loopuntil]; } } the block i'm calling - (void)setself:(void(^)(void))callback{ if ([fbsdkaccesstoken currentaccesstoken]) { [[[fbsdkgraphrequest alloc] initwithgraphpath:@"/me" parameters:nil] startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, nsdictionary* result, nserror *error) { if (!error) { ...

c++ - How to manage separate GUI processes in a Qt application? -

how qt gui application start separate gui applications in different processes , managed windows? let's have qt application call myapp. user able launch external application available on os within myapp run in own separate process. know qprocess, difficult part haven't been able figure out managing windows. myapp need have it's own title bars windows , cross platform. if launch application, calculator on windows, how rid of os title bar , window frame os default one, , how manage position , geometry of window? more details: idea able extend myapp, including 3rd parties, adding new services implemented in language , gui toolkit. also, if service crashes, shouldn't affect myapp or other services. use analogy, imagine if in visual studio editor implemented in c , gui in gtk, debuger in c++ , interface in qt, etc, , looked 1 piece. from whatever got question , whatever qt know, qt not support handle other application(like changing position). have handl...

php - How do I get the current CPC bid for a keyword in Google AdWords API? -

how current bid keyword in account? tried $adgroupcriterion->biddingstrategyconfiguration->bids[0]->bid->value * adwordsconstants::micros_per_dollar; but gave me error 'trying property of non-object' . when add keyword, i'm able bid in return value ok. the bid doesn't appear selectable in operation. i've searched on documentation it. https://developers.google.com/adwords/api/docs/reference/v201502/adgroupcriterionservice.biddableadgroupcriterion#biddingstrategyconfiguration https://developers.google.com/adwords/api/docs/reference/v201502/adgroupcriterionservice.bids although field returned in response, ignored on input , cannot selected. i'm using example fetch keywords: https://github.com/googleads/googleads-php-lib/blob/master/examples/adwords/v201502/basicoperations/getkeywords.php#l43 i found it. https://developers.google.com/adwords/api/docs/reference/v201502/adgroupcriterionservice.cpcbid#bid $selector->f...

swift - How to document an @IBInspectable property in Xcode -

Image
in custom uiview have property expose storyboard @ibinspectable . /** custom property documentation. */ @ibinspectable var myproperty: double = 2.5 is there way show documentation when user hovers cursor on field in attribute inspector? work built in elements , same property. unfortunately looks can not prepare text presented such tool tip. @ least now. i noticed if not explicitly put type (but assign default value instead) designable, filed not generated in attribute inspector.

r - showing different units in each free_y of facet_grid -

i have plotted 2 facets 1 on top of other 2 different ys (a percentage , cost) , same x (years). took of ideas this post , variations of same. i'd show labels of y axis percentages rate , £ costs, have been unable change each y label format independently. below reproducible example using facet_grid (i managed create similar thing facet_wrap stuck same problem). i considered using grid.arrange() gridextra package, seemed bring other issues legend. library(plyr) library(tidyr) library(dplyr) library(ggplot2) library(scales) set.seed(12345) my_labels <- function(variable, value){ names_li <- list("percentage", "cost in pounds") return(names_li[value]) } df <- data.frame( rate = runif(10, 0, 1), cost = rnorm(10, 100, 40), years = seq(from = 2001, = 2010) ) df %>% gather(type_of_var, value, rate:cost) -> df2 df2 %>% ggplot(aes(x = years, y = value, ymin = 0, y...

Katana+OWIN Context Get HTTP Referrer? -

iowincontext not appear have http referrer in it, , need grab it. right way particular variable? iowincontext has several typed pems don't see referer in particular. the system working self-hosted. thanks. the owincontext doesn't have 'http referer' item in request header. has been renamed in owin self host context. it's known 'referer'. once have object of owin context can information using: context.request.headers["referer"]

php - Access denied for user 'username'@'localhost' (using password: YES) -

i installed mysql on mac running 10.10.3, can't create tables or modify associated databases. when start mysql logs me in '@localhost' mysql> select user(); +-----------------------+ | user() | +-----------------------+ | username@localhost | +-----------------------+ 1 row in set (0.00 sec) mysql> select current_user(); +----------------+ | current_user() | +----------------+ | @localhost | +----------------+ 1 row in set (0.00 sec) mysql> create database ign; error 1044 (42000): access denied user ''@'localhost' database 'ign' i try running log sql. mysql -u username -p enter password: error 1045 (28000): access denied user 'username'@'localhost' (using password: yes) i lost , appreciated. if installed , not know root password, or unsure of password, try resetting root password (assuming have admin rights on machine). create user , apply applicable grant permissions . set pas...