Posts

Showing posts from September, 2015

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

c++ - configuration of QT to code in book "opencv2 computer vision application programming cookbook" -

i teaching self book "opencv2 computer vision application programming cookbook" using qt creator 3.2.1 / qt 5.3.2 (clang5.0 (apple)). when tried build 1 program had warnings follows: undefined symbols architecture x86_64: "cv::imread(std::string const&, int)", referenced from: mainwindow::on_pushbutton_clicked() in mainwindow.o colordetectcontroller::setinputimage(std::string) in mainwindow.o "cv::imshow(std::string const&, cv::_inputarray const&)", referenced from: mainwindow::on_pushbutton_clicked() in mainwindow.o mainwindow::on_pushbutton_2_clicked() in mainwindow.o "std::allocator<char>::allocator()", referenced from: mainwindow::on_pushbutton_clicked() in mainwindow.o mainwindow::on_pushbutton_2_clicked() in mainwindow.o "std::allocator<char>::~allocator()", referenced from: mainwindow::on_pushbutton_clicked() in mainwindow.o mainwindow::on_push

Spark DataFrames: registerTempTable vs not -

i started dataframe yesterday , liking far. i dont understand 1 thing though... (referring example under "programmatically specifying schema" here: https://spark.apache.org/docs/latest/sql-programming-guide.html#programmatically-specifying-the-schema ) in example dataframe registered table (i guessing provide access sql queries..?) exact same information being accessed can done peopledataframe.select("name"). so question is.. when want register dataframe table instead of using given dataframe functions? , 1 option more efficient other? the reason use registertemptable( tablename ) method dataframe, in addition being able use spark-provided methods of dataframe , can issue sql queries via sqlcontext.sql( sqlquery ) method, use dataframe sql table. tablename parameter specifies table name use dataframe in sql queries. val sc: sparkcontext = ... val hc = new hivecontext( sc ) val customerdataframe = mycodetocreateorloaddataframe() customerdatafr

Perl - Hash and the => operator -

so im learning perl , got chapter hashes. understand '=>' operator alias comma operator. when try make value undef warning use of uninitialized value $last_name{"dino"} in concatenation (.) or string @ ./learning.pl line 18. use warnings; use strict; %last_name = ( fred => 'flintston', dino => undef, barney => 'rubble', betty => 'rubble', ); $key; $value; if(%last_name) { foreach $key (sort keys %last_name) { print("$key => $last_name{$key}\n"); } } but when change hash line to: my %last_name = ( fred => 'flintston', dino => undef => barney => 'rubble', betty => 'rubble', ); it works fine , returns value undef. did replace comma operator separating key/value '=>' operator. why later work not former if 2 operators supposed same? they not same. "fat comma" 1 more thing:

Selenium WebDriver C# - Find element in a classic ASP Web page that includes multiple ASP files -

Image
i'm trying write automated test case website, built using classic asp. each web page (when viewed in browser) created using multiple asp files, each of takes panel in overall web page. when trying use selenium webdriver, can see elements in main content, cannot find elements in "included asp files". for example, content of navigation panel coming asp file; achieved doing this... navpanel.body.nav.location.href = "navi.asp" although content of navi.asp page shows when viewed in browser, i'm not able contents using: driver.findelements(by.cssselector("*")) could please let me know how can find elements defined in "included" asp file? here additional info - summary of html source viewed in browser follows - can see below, there multiple elements , default webdriver seems picking elements of last occurrence of tag i.e, contents of "content" frame. but, want access elements in "nav" frame. how can switch

Dynamic youtube iframe in javascript and jQuery -

i'm going crazy, trying fix , wont work way want work,ahhh feel child :/ var videoid; var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); videoid = sessionstorage.getitem("key"); var onyoutubeiframeapiready = function(){ player = new yt.player('player', { height: '315', width: '560', videoid: videoid, events: { 'onready': onplayerready } }); } //the api call function when video player ready. function onplayerready(event) { event.target.playvideo(); console.log(videoid); } function searchquery() { //declare selectors var querycontainer = $('div.search-box ul'); var searchbox = $('div#search-bar input[type=search]');

ruby - Array elements to integers -

i have array of strings containing numbers: array = ["1", "2", "3"] i want convert every string in array integer. array.each { |n| n.to_i } not work, because p array.inject(:+) returns "123" (string) rather 6 (integer) array = ["1", "2", "3"] new_array = array.map { |n| n.to_i } p new_array.inject(:+) => 6

reporting services - How to know if a report is already printed in SSRS? -

the user of report know if report has been printed? if report has been printed user see message report has been printed on report next time report generated. best way achieve this? in advance. there no official documentation on how achieve this, there way of doing this. the executionlogstorage table contains information reports executed or exported. when print report clicking on print button in toolbar, report "re-generated" , logged in executionlogstorage table, format = 'image' . if export report tiff file, line generated format = 'image' . fortunately, there bytecount column, contains "size of rendered reports in bytes." according msdn . this bytecount column contains 0 in case report printed, , image size if image export. so ended following query, can execute in ssrs db: select els.[logentryid], c.[name], c.[path], els.[parameters], els.[username], els.[timestart], els.[time

sql - Issues while using xp_cmdshell to run from stored procedure -

i running sql server agent job, using proxy account a , agent job executes stored procedure, uses xp_cmdshell run exe. sql server agent , sql server running under account b . i have created proxy credentials account a , has access full access director contains executable. when try execute job , log account running under (using xp_cmdshell 'whoami') logs account b . is there someway can run under account a ? can please help? thanks, ben check out this question . has account xp_cmdshell command running under. (please note xp_cmdshell can exploited a security vulnerability , should careful when allowing on server.)

javascript - Calling a function in js file from C# code -

i having cs file want call function of js file. js file function foo(date){ //code } in cs file, want call foo function. possible ? if yes, how ? if want insert 1 alert how it, if want call function, dont know way. to call inline javascript works page.clientscript.registerstartupscript(gettype(), "", "<script type='text/javascript'> alert('hello');</script>"); try putting function name rather whole script itself. page.clientscript.registerstartupscript(gettype(),"","foo()",true); or scriptmanager: scriptmanager.registerclientscriptblock(this, this.gettype(),"","foo()",true); edit: add boolean value @ end true , automatically add script tags, dont need to.

drag and drop - JavaFX - DnD - Third-Party Program to JavaFX App -

i have javafx app drag n drop email feature working fine if drag file windows explorer tab app. however, if try drag email file outlook app, dragboard hasfiles method false, ondragdropped handler executed, tho. im using transfermode.any , said, if drag email, or txt files using windows explorer work. is there trick or limitation if u want drag app? thanks first, what's in dragboard: dragboard db = event.getdragboard(); db.getcontenttypes().foreach(df -> system.out.println(df + " - " + db.getcontent(df))); you output this: [text/x-moz-url] - i [application/x-moz-file-promise] - null [text/x-moz-message] - i [application/x-moz-file-promise-url] - java.nio.heapbytebuffer[pos=0 lim=200 cap=200] [_netscape_url] - java.nio.heapbytebuffer[pos=0 lim=63 cap=63] (in example dragged mail fossamail) this tells mime-type (application/x-moz-file-promise-url) , class (heapbytebuffer): dataformat df = dataformat.lookupmimetype("application/x-moz

php - When to use single quotes, double quotes, and backticks in MySQL -

i trying learn best way write queries. understand importance of being consistent. until now, have randomly used single quotes, double quotes, , backticks without real thought. example: $query = 'insert table (id, col1, col2) values (null, val1, val2)'; also, in above example, consider "table," "col[n]," , "val[n]" may variables. what standard this? do? i've been reading answers similar questions on here 20 minutes, seems there no definitive answer question. backticks used table , column identifiers, necessary when identifier mysql reserved keyword , or when identifier contains whitespace characters or characters beyond limited set (see below) recommended avoid using reserved keywords column or table identifiers when possible, avoiding quoting issue. single quotes should used string values in values() list. double quotes supported mysql string values well, single quotes more accepted other rdbms, habit use single quot

php - Best practice for > < and == in a function -

i have come across conundrum use bunch of ifs or switch. to put in perspective, current project working on involves comparing width , height of image number determine if width longer height or same. here code far: private function compare($width, $height) { return $width - $height; } this works might expect. what find out if there better way this: if($this->compare($this->width, $this->height) == 0) { } if($this->compare($this->width, $this->height) < 0) { } if($this->compare($this->width, $this->height) > 0) { } thanks for value returned method compare(), have 3 posibilities, have 2 conditions , can obmit one: $recievedvalue = $this->compare($this->width, $this->height); if( $recievedvalue == 0 ) { // value equal 0 } else if( $recievedvalue < 0 ) { // value less 0 } else { // value more 0 }

c - UVA problems 12503 gives TLE -

i trying solve 12503 problem on uva online judge. think have figured out solution, gives me tle. here problem : you have robot standing on origin of x axis. robot given instructions. task predict position after executing instructions. • left: move 1 unit left (decrease p 1, p position of robot before moving) • right: move 1 unit right (increase p 1) • same i: perform same action in i-th instruction. guaranteed positive input integer not greater number of instructions before this. first line contains number of test cases t (t <= 100). each test case begins integer n (1 <= n <= 100), number of instructions. each of following n lines contains instruction. output for each test case, print final position of robot. note after processing each test case, robot should reset origin. sample input 2 3 left right same 2 5 left same 1 same 2 same 1 same 4 sample output 1 -5 here code i

fastcgi - Nginx Variable Cache Time -

i'm working fastcgi_cache , wanted pass variable fastcgi_cache_valid have variable amount of cache time depending on file. seems not accept variable. i tried following: set $cache_time 15s; fastcgi_cache_valid 200 ${cache_time}; fastcgi_cache_valid 200 $cache_time; set $cache_time "15s"; fastcgi_cache_valid 200 ${cache_time}; fastcgi_cache_valid 200 $cache_time; set $cache_time 15; fastcgi_cache_valid 200 ${cache_time}s; fastcgi_cache_valid 200 $cache_time; but receieved following errors: nginx: [emerg] invalid time value "$cache_time" in /etc/nginx/conf.d/www.com.conf:118 nginx: [emerg] directive "fastcgi_cache_valid" not terminated ";" in /etc/nginx/conf.d/www.com.conf:118

Best practices for using MapDB with Android -

what best way use mapdb android, regards activity lifecycle? keeping singleton instance of db around cause memory issues long map instances garbage collected correctly? what happen if instance of db garbage collected before closed (supposing transactions have been commited)? there not best practices. make sure db closed correctly after writes finish. if want use newest mapdb 2.0, must remove file unsafestuff.java , recompile mapdb project

gsub - replacing several string occurences in r -

i want replace several strings one. i've researched , found gsub can replace elements 1 @ time. if warning saying first 1 used. data$evtype <- gsub( c("x","y") , "xy", data$evtype) i trying sapply data$evtype <- sapply(data$evtype, gsub, c("x", "y"), "xy") it's been more 5 minutes , still processing. stack overflow message time now. :-/ there elegant short solution this? there package can use this? needs small because need several cases have duplicate names. please help! thanks useful comments. done frank suggested. gsub( "x|y" , "xy", data$evtype). instead of using vector.

Multiple users with unique session ids in jmeter -

we trying perform load testing multiple users having unique session ids, users should unique. trying following steps 1. login 2. search id 3. submit request. 4. logout. we trying in jmeter test plan thread group http header manager http request default http cookie manager csv data set (login user names) transction controller csv data set (containing id${__threadnum} filename) http sampler (login) loop controller http sampler (search id) http sampler ( submit) http sampler (logout) the problem works fine user recording/scripting done , , not produce intended results other users. e.g. if have recorded script user1 , search , submit user1 only. other users e.g. user2 , user3 product empty/no results in search , submit request's response. if record user2 start working user2 , not work user1 any please. think problem related session or cookies. kindly can please let me know best practice use cookie manager. , suggestions problem

python - Fastest way to fetch value of just one field of an instance in Django -

let's have model this: class a(models.model): title = models.charfield(max_length=10) (more fields) i want fetch value of title field of instance. can either use filter : a.objects.filter(id=1).values_list('title', flat=true) which generates sql statement this: select "app_table_a"."title" "app_table_a" ("app_table_a"."a_id" = 1) limit whatever or use get : a.objects.get(id=1).title which generates this: select "app_table_a"."id", "app_table_a"."title", ... ,"app_table_a"."all fields in model" "app_table_a" ("app_table_a"."a_id" = 1) the difference in select part of queries, gives impression first approach better option. when @ execution time of statements, don't see meaningful difference , both statements fluctuate around, example, 25ms. so, question whether there difference, performance-wise (spe

jquery - Throwing PHP error vs giving a different return in AJAX -

i'm pretty new php, , i'm using ajax validate form upon button click. currently, i'm using if statement see whether continue on next page of multi-step form or not. $.ajax({ url: 'index.php', type: 'post', data: { myid: 1, action: action, username: user, password: pass }, success: function(data){ if (data == "continue") { wizard.next(wizard); wizard.showbuttons(); } else { helpframe.text(data); helpframe.show(); } } }); i'm wondering when use if statement above in return ajax function vs. throwing error in php, since it's understanding can somehow use code purposely cause php throw error , execute different code upon "failure".

python - How is returning the output of a function different than printing it? -

in previous question , andrew jaffe writes: in addition of other hints , tips, think you're missing crucial: functions need return something. when create autoparts() or splittext() , idea function can call, , can (and should) give back. once figure out output want function have, need put in return statement. def autoparts(): parts_dict = {} list_of_parts = open('list_of_parts.txt', 'r') line in list_of_parts: k, v = line.split() parts_dict[k] = v print(parts_dict) >>> autoparts() {'part a': 1, 'part b': 2, ...} this function creates dictionary, not return something. however, since added print , output of function shown when run function. difference between return ing , print ing it? print prints out structure output device (normally console). nothing more. return function, do: def autoparts(): parts_dict={} list_of_parts = open('list_of_parts.txt', 'r')

nsstring - .containsString in Swift 2? -

previously, when wanted see if swift string contained string, cast nsstring , call .containsstring. apple, in infinite wisdom, made version-aware, if try under s2 demand #available wrapper if target platform support (which guess bug). so best solution appears this: extension string { func contains(substr: string) -> bool { if #available(osx 10.10, *) { return nsstring(string: self).containsstring(substr) } else { return self.rangeofstring(substr) != nil } } } and check it, instead of this: if nsstring(string: line).containsstring(" ")... you use nicer looking: if line.contains(" ")... this no longer complains version, , (imho) looks better too. want too: extension string { var length: int { return self.characters.count } } apple keeps changing way length, , hope future changes api #available -able, @ point .length can modified. , these sanity: extension string

javascript - Paypal return url with Angular app -

this part of router.js: .state('app.thanks', { url: "/thanks", views: { 'menucontent': { templateurl: "templates/thanks.php" } } }) and in payapl website payment preferences -> return url address define this: https://my-website-url.com/#/app/thanks , as understand, in order params payapl need use code transaction id: if(isset($_get['tx']) && ($_get['tx'])!=null && ($_get['tx'])!= "") { $tx = $_get['tx']; if($tx) dosometing(); } else { exitcode(); } how can combine angular app? need put code in thanks.php page? thanks!! you cannot step angular app. has clear since need verify transaction , payment paypal. properly, code has run on server , validated payment process successful, otherwise can hand out products free. did not add code here hope have 1 ready properly. after verifying transactio

unity3d - Serialization misbehave when closing Unity -

i'm using iserializationcallbackreceiver serialize custom interrelated data following tutorial http://blogs.unity3d.com/2014/06/24/serialization-in-unity/ regarding serialization of graph nodes adjusting needs. my serialization working fine when i'm hot swapping code when i'm developing scripts. once save scene, close unity , reload project again, data deserializing bogus. [01] [17:23:43] quest[the sculpture , box|sleep]: serializing queststepdata[fqcn=experiment.questsjg.steps.gotolocation|name=sculpture|description=f|closedbyindex=-1|go1present=true|go1=sculptures_01_02 (unityengine.gameobject)|go2present=true|go2=[1] go location point (sculpture) (unityengine.gameobject)|f1=8] [02] [17:23:43] quest[the sculpture , box|sleep]: serializing queststepdata[fqcn=experiment.questsjg.steps.gotolocation|name=box|description=s|closedbyindex=-1|go1present=true|go1=box1 (unityengine.gameobject)|go2present=true|go2=[2] go location point (box) (unityengine.gameobject)|f1=4]

ios - App validation error, CloudKit entitlements error -

i have made app cloudkit support, app works fine @ testing retrieves records icloud, , add new records. when archive app , click validate saw following error: no matching provisioning profiles found applications/aplicationname.app none of valid provisioning profiles allowed specific entitlements: com.apple.developer.icloud-containers-identifiers, beta-reports-active, com.apple.developer.icloud-services. i read following @ apple developer: "before ship app, configure app using distribution workflow. in workflow, xcode lets choose whether want target development or production environment , adds com.apple.developer.icloud-container-environment entitlement app value selected. prior shipping, sure configure app production environment. apps target development environment rejected app store." i think it's solution, can't find way have this. i found solution. went developers portal , @ provisioning profiles, created profile distribution, choose app proble

node.js - Javascript / NodeJS: (() => 0) === (() => 0) -

Image
i'm reading javascript allongé , , in see code supposed return false: (() => 0) === (() => 0) when run on commandline (ubuntu 14.04) using nodejs, 3 dots: ... , after cancel using ctrl-c. i start node.js following command: nodejs , not node . using --harmony doesn't make difference. node.js version: v0.10.25 why don't result back? thought using nodejs commandline test utility, maybe not idea? the simple answer why returns false because though functions same thing , same, initialized in 2 different memory locations (for objects functions, plain objects, , arrays, strict equality operator === checks memory location of object.) also, if you're going use node.js, have make sure interpreting ecmascript6 (otherwise, () => 0 not valid es5, default node.js). you can use --harmony flag: node --harmony app.js see question "what node --harmony do?" more info using es6 in node.js. brief quote top answer: it seems harmony

java - The "route_id" not found -

Image
i trying id of inserted raw in routes table. getting error column 'route_id' not found route , direction being inserted in table before why getting error? code: databasemetadata dbm = con.getmetadata(); resultset routestables = dbm.gettables(null, null, "routes", null); int route_id; if (routestables.next()) { preparedstatement preproutesinsert = con.preparestatement( "insert routes(direction, route)" + "values( ?, ?)", statement.return_generated_keys); preproutesinsert.setstring(1, direction); preproutesinsert.setint(2, route); preproutesinsert.executeupdate(); try (resultset generatedkeys = preproutesinsert .getgeneratedkeys()) { if (generatedkeys.next()) { int id = generatedkeys.getint("route_id");

vb.net - Databound ErrorProvider not blinking -

Image
i have error provider on form has datasource bound collection of errors in record class: the validation working expect, red blinking icon not appear next form controls. record implements idataerrorinfo: public readonly property [error] string implements idataerrorinfo.error if _errors.count > 0 return string.format("the record cannot saved because there {0} errors", _errors.count) else return string.empty end if end end property ''' <summary> ''' gets error message property given name ''' </summary> ''' <value></value> ''' <returns></returns> default public readonly property propertyerror(fieldname string) string implements idataerrorinfo.item if _errors.containskey(fieldname) return _errors(fieldname).tostring

python - Deferred Task Request deadline exceeded but work never started -

i have task queue handles deferred tasks need processed in real time (i have heard isn't idea can't find supporting documentation on this.). queue hit large influx of tasks (2500/min) , receives nothing minute or two. queue.yaml - name: event-message rate: 200/s bucket_size: 200 retry_parameters: task_retry_limit: 2 min_backoff_seconds: 1 what have noticed "process terminated because request deadline exceeded. (error code 123)" messages tasks aren't started . task sits in queue 10min without being run , times out. thought may related queue configuration have included here. 2015-06-18 10:22:45.842 /_ah/queue/deferred 500 641080ms 0kb appengine-google; (+http://code.google.com/appengine) module=default version=1-0-21 0.1.0.2 - - [18/jun/2015:07:22:45 -0700] "post /_ah/queue/deferred http/1.1" 500 0 "http://*******/_ah/queue/deferred" "appengine-google; (+http://code.google.com/appengine)" "********&quo

sql - Not able to get the required output based on job -

i have emp table regular 14 rows. want write query scan table , return in following way means return output based on job. if first sees president returns row scans next job sees manager , returns , not return other manager , on. each new job sees returns row , pass on next new job. thanks 7839 king president 17-nov-81 5000 10 7698 blake manager 7839 01-may-81 2850 30 7788 scott analyst 7566 19-apr-87 3000 20 7369 smith clerk 7902 17-dec-80 800 20 please help thanks this return first person (by alphabetically ordered last name) each job: select employee_id, last_name, job_title, manager_id, hire_date, salary, department_id ( select e.employee_id, e.last_name, j.job_title, e.manager_id, e.hire_date, e.salary, e.department_id, row_number()

c# - ProcessStartInfo doesn't start application and Error code -532462766 -

i'm trying launch application using system.diagnostic.process way : if (this.isrequiredfieldfilled()) { processstartinfo start = new processstartinfo(); messagebox.show("pic" + up.pathpic); start.filename = up.pathpic; //start.windowstyle = processwindowstyle.normal; //start.createnowindow = true; int exitcode; try { using (process proc = process.start(start)) { proc.waitforexit(); exitcode = proc.exitcode; messagebox.show(exitcode.tostring()); } } catch (exception ex) { messagebox.show("exception -> " + ex.message); } } else { //todo handle input } i can see spinner nothing apear , receive return code -> -532462766 don't understand because, when double click on application there no problem, , if launch app process work too. did miss ?

javascript - How to have multiple functions in jQuery ready? -

i can create jquery functions, if want more functions. example wanted have function drop down list , button. can seem 1 function: <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { this.hide(); }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("banner").click(function() { this.fadeto(); }); }); </script> is right on how create multiple functions in 1 document or there easier way create them? can show me how create multiple ones instead of one? both functions can go inside same document ready function: <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { $(this).hide(); }); $("banner").click(function() $(this).fadeto(); }); }); </script> however, selector $(&q