Posts

Showing posts from June, 2014

javascript - textbox take only numeric value and not take zero at the starting -

i new in javascript , want validate textbox javascript.textbox should take numeric value , should not take 0 @ starting. i tried below function works fine not understand how avoid 0 first position. below html code. <asp:textbox id="cp1_txtmob" palceholder="10 digit mobile no." ondrop="return false;" onpaste="return false;" runat="server" class="textfile_new2" style="color: #333;" onkeydown="return isnumberkey(event);" maxlength="10" autocomplete="off"></asp:textbox> function isnumberkey(e) { var t = e.which ? e.which : event.keycode; if ((t >= 48 && t <= 57) || (t >= 96 && t <= 105) || (t == 8 || t == 9 || t == 127 || t == 37 || t == 39 || t == 46)) return true; return false; } please me out. you can use onkeyup="avoidzero(this.id);" like <asp:textbox id="cp1_txtmob" palceholder=&

How to copy a table in R -

the problem have following. load table file table <- read.table(opt$input, header = true, sep = "\t") then remove things not need tt<-table[(table[,2] != "xz" & table[,1] != "n" & table[,1] != ""),] then compute frequencies freq<-table(tt[,1], tt[,2]) but xz b 0 0 0 0 s 0 1 0 3 c 0 28 0 83 n 0 0 0 0 so values have been removed placeholders : xz(col), ""(col), n(row) have stayed. how eliminate those. there way copy table not reference value placeholders skipped try (remove factor levels dropped): tt<-table[(table[,2] != "xz" & table[,1] != "n" & table[,1] != ""),] tt[,1] <- factor(tt[,1]) tt[,2] <- factor(tt[,2]) and then freq<-table(tt[,1], tt[,2])

xcode - CocoaPods: App.xcworkspace does not exists -

this happened: $ pod lib lint -> mxkit (5.2.2) - error | [ios] xcodebuild: returned unsuccessful exit code. can use `--verbose` more information. - note | [ios] xcodebuild: xcodebuild: error: 'app.xcworkspace' not exist. [!] mxkit did not pass validation, due 1 error. can use `--no-clean` option inspect issue. i'm using: cocoapods 1.0.1 ruby 2.2.2 xcode 8.0 os x 10.12 by add --verbose option: $ pod lib lint --verbose mxkit (5.2.2) - analyzing on ios 8.0 platform. preparing analyzing dependencies inspecting targets integrate using `archs` setting build architectures of target `pods-app`: (``) fetching external sources -> fetching podspec `mxkit` `/users/meniny/mxdevelop/mxprojects/mxkit-in-objective-c` resolving dependencies of comparing resolved specification sandbox manifest mxkit downloading dependencies -> installing mxkit (5.2.2) - running pre install hooks generating pods project - creating pods project

javascript - Why C++ CGI form_iterator values not getting in XMLHttpRequest asynchronous Ajax request? -

i wrote sample html page ajax script . have .cgi file in cpp accept values ajax , send message html page . facing problem didn't values in cgi script . code : html & ajax script : <html> <head> <script type = "text/javascript"> var xmlhttp; if(navigator.appname == "microsoft internet explorer") { xmlhttp = new activexobject("microsoft.xmlhttp"); } else { xmlhttp = new xmlhttprequest(); } function sentdata () { var name = document.getelementbyid('name').value ; var postdata; xmlhttp.open("post", "simplecgi.cgi", true); postdata = ""; postdata += name; xmlhttp.setrequestheader("content-type", "application/x-www-form-urlencoded"); xmlhttp.setrequestheader("content-length", postdata.length); xmlhttp.send(postdata); xmlhttp.onreadystatechange = function() { document.getelementbyid('area

css - How to fix: Full background image distorts in IE but works fine in chrome when using background-size: cover -

Image
please have css distortion have been battling cross browser: https://dim.crservicesplc.ng/ works fine in chrome distorts in others chrome : ie, edge, firefox assistance appreciated references: http://www.w3schools.com/graphics/svg_rect.asp http://www.w3schools.com/graphics/svg_fegaussianblur.asp https://developer.mozilla.org/en-us/docs/web/svg/element/fegaussianblur you control intensity of filter stddeviation="15" , <rect style="opacity: 0.5;" /> , color of filter <rect style="fill: #333;> solution #1 #home_main { margin: -30px; background-size: cover; padding: 0; background-image: url('https://dim.crservicesplc.ng/img/bg.jpg') !important; /* filter: blur(2px);*/ overflow: hidden; box-shadow: inset 0 0 0 1000px rgba(0,0,0,.3); } body { overflow: hidden !important; } #home_content { font-size: 12pt; text-align: center; fo

git - Save GitHub repo reference with friendly comment? -

how can save references 3rd party repositories friendly comments in account on github (all 3rd party repositories github only, , dont want fork them) you star them, doesn't allow create "friendly comment". how making gist links repositories?

python - Can lambda be used instead of a method, as a key in sorted()? -

this first time asking question. i've got without asking. (gratitude face). so, found useful piece of code around here few weeks ago. import re def yearly_sort(value): numbers = re.compile(r'(\d+)') parts = numbers.split(value) parts[1::2] = map(int, parts[1::2]) return parts it works here: def get_files_sorted(path_to_dir): file_names = [] root, dirs, files in os.walk(path_to_dir): file_name in sorted(files, key=yearly_sort): file_names.append(os.path.join(root, file_name)) return file_names now, i'm facing problem describing above function (as can see non-descriptive method name). what should name of above method (instead of some_sort())? can method squeezed somehow in lambda such key in sorted() can bind key=lambda? you squeeze lambda provided numbers compiled (which increases performance) numbers = re.compile(r'(\d+)') file_name in sorted(files, key=lambda value : [int(x) if x.isdigit() el

c# - Loading and unloading WPF assembly from arbitrary path -

i'm struggling find way load , unload wpf assembly arbitrary path (not sub directory of base path) c# console application. i'm exploring stackoverflow couple of days (as have done other forums), can't find way how console application loading wpf assembly , instantiating object assembly. starting point following example c# console application: using wpflibrary; namespace caller { class program { [stathread] static void main(string[] args) { samplewindow wnd = new samplewindow(); wnd.showdialog(); } } } and following code wpf assembly: namespace wpflibrary { public partial class samplewindow : window { public samplewindow() { initializecomponent(); } } } i found various similar questions , suggestions use: reflection via: assembly.load(); using activator.createinstance(); using different appdomain createinstanceandunwrap using

css3 - css transform: translate() % always refer to the size of bounding box? -

i'm confused specifications says. let me clarify understanding. specifications https://www.w3.org/tr/css-transforms-1/#propdef-transform percentages: refer size of bounding box https://drafts.csswg.org/css-transforms-2/#propdef-translate percentages: relative width of containing block (for first value) or height (for second value) my understanding css-transforms-1 there transform property. transform property refer bounding box. so, translate function of transform property refer bounding box. there not translate property. css-transforms-2 there transform property. transform property refer size of bounding box. so, translate function of transform property refer bounding box. there translate property. translate property refer containing box. so, think % of transform: translate() refer bounding box, right? your second link draft used discussion. far know hasn't made final css standards or implementations.

ios - can not replace all occurrences of quotation (") -

i use below code replace occurrences of quotation (") string: nsstring *cluasestext = @"آخرین حقوق کارگر را به‌عنوان \"‌حق سنوات\" به ÙˆÛŒ "; cluasestext = [cluasestext stringbyreplacingoccurrencesofstring:@"\"" withstring:@"*****"]; but code replace 1 of quotations , not replace second one. i checked both of signs same character wondering why not replacing second one. result after running code is: آخرین حقوق کارگر را به‌عنوان "‌حق سنوات***** به ÙˆÛŒ while expect: آخرین حقوق کارگر را به‌عنوان *****حق سنوات***** به ÙˆÛŒ i wondering problem second 1 not replacing? try below code replace characters want, nsstring *cluasestext = @"آخرین حقوق کارگر را به‌عنوان \"‌حق سنوات\" به ÙˆÛŒ "; nscharacterset *charstobereplace = [nscharacterset charactersetwithcharactersinstring:@"/:.\""]; cluasestext = [[cluasestext componentsseparatedbycharactersinset:

python - Convert entries of an array to a list -

i have numpy arrays entries consists of either zeros or ones. example a = [ 0. 0. 0. 0.] , b= [ 0. 0. 0. 1.] , c= [ 0. 0. 1. 0.] want convert them list: l =['0000', '0001', '0010'] . there easy way it? you can convert each list string using join this def join_list(x): return ''.join([str(int(i)) in x]) = [0, 0, 0, 0] b = [0, 0, 0, 1] c = [0, 0, 1, 0] print(join_list(a)) # 0000 the can add them new list for loop new_list = [] l in [a, b, c]: new_list.append(join_list(l)) print(new_list) # ['0000', '0001', '0010']

haskell - Monad Transformers lift -

i looking monad transformers in real world haskell. book said make monad transformer, need make instance of monadtrans type class. so book defined new transformer, maybet m a transformer. they defined monadtrans type class new transformer: instance monadtrans maybet lift m = maybet (just `liftm` m) then made instance of monadstate transformer: instance (monadstate s m) => monadstate s (maybet m) = lift put k = lift (put k) from understand lift function taking underlying monad , wrapping in right constructor. however, not implementation of or put in monadstate type class, in understanding lift doing here. have heard in mtl package because of how type classes defined, can have stack of monad transformers writert, statet etc can use functions get,put,tell etc without doing lifting. wondering how work, suspect these type classes not sure? but can use functions get,put,tell etc without doing lifting this because functions defined on e.g. monadstate

html - jquery show data taken by select after removing parenthesis -

i have html select , div want show message depending on select option. <select id='select1'> shows options "player1(mike)" , want "player1" show in <div id='logid1'></div> . wrote following code <script> $(document).ready(function(){ $("#select1").on("change", function() { $("#logid1").html($(this).find(":selected").text(function(_, text) { return text.replace(/\(.*?\)/g, ""); })); }); }); </script> it shows want result "player1" shows selected. i'm newbie in jquery ideas welcome. currently modifying text of selected option, when use .text(fn) method. you need .text() , perform desired operation. $("#select1").on("change", function() { $("#logid1").html($(this).find(":selected").text().replace(/\(.*?\)/g, ""))

pandas - how to apply filter on one variable considering other two variable using python -

i having data variables participants , origin , , score . , want participants , origin score greater 60 . means filter participants have consider origin , score. can filter on origin or on score not work. if can me, great!!! i think can use boolean indexing : df = pd.dataframe({'participants':['a','s','d'], 'origin':['f','g','t'], 'score':[7,80,9]}) print (df) origin participants score 0 f 7 1 g s 80 2 t d 9 df = df[df.score > 60] print (df) origin participants score 1 g s 80

javascript - Place svg elements over and under each other -

i tring make cannon in svg rotates when click it.it works good.but want little circle go under black parts of cannon(the rectangle , circle),over grey ellipse ,the blue circle , grey line stroke-width:30px ,and grey ellipse go on black parts go on blue circle.i don't know how sure , placing elemente in code on , under each other seems impossible: here fiddle: https://jsfiddle.net/tbplda76/ <!---here goes blue circle---> <!---here go black parts ---> <!---here goes elipse---> <!---here goes new circle---> <!---(the new circle tag should on black parts tags-impossible)-->

c - Usage of clock_gettime doesn't allow output redirection to file -

the following program increments variable i 100ms , prints value. problem doesn't print onto file when redirecting output terminal. #include <stdio.h> #include <time.h> struct timespec start={0,0}, end={0,0}; int main(void) { double diff; while(1) { unsigned long = 0; clock_gettime(clock_monotonic, &start); { ++i; clock_gettime(clock_monotonic, &end); diff = (((double)end.tv_sec + 1.0e-9*end.tv_nsec) - ((double)start.tv_sec + 1.0e-9*start.tv_nsec)); } while(diff < 0.1); printf("i = %lu\n", i); } return 0; } i compile gcc counter.c -o counter , when run ./counter , values of i gets printed onto screen, when ./counter > file.out , there nothing in file. i've tried redirecting stderr 2> , ./counter > file.out 2>&1 . if remove clock_gettime function, seems work fine. idea why happens , how circumvent it? update: question mo

Java - Monitor progress of a async file downloading in server -

i have server-side application download file external url server. happens on async process. need have ajax call file download progress , report in ui. this can achieved updating file download progress db in defined interval , ajax call can progress database. db resource intensive. another option (i'm not sure if works) read file downloading in progress compare size total content-length % downloaded. is there way access outputstream async background process , return upload % ? the front end of application using angularjs , backend implemented using spring framework. file download code generic: // opens input stream http connection inputstream inputstream = httpconn.getinputstream(); string savefilepath = savedir + file.separator + filename; // opens output stream save file fileoutputstream outputstream = new fileoutputstream(savefilepath); int bytesread = -1; byte[] buffer = new byte[buffer_size]; while ((bytesread = inputstream.read(buffer)) != -1) { outputstr

Combating AngularJS executing controller twice -

i understand angularjs runs through code twice, more, $watch events, checking model states etc. however code: function mycontroller($scope, user, local) { var $scope.user = local.get(); // locally save user data user.get({ id: $scope.user._id.$oid }, function(user) { $scope.user = new user(user); local.save($scope.user); }); //... is executed twice, inserting 2 records db. i'm still learning i've been banging head against ages! the app router specified navigation mycontroller so: $routeprovider.when('/', { templateurl: 'pages/home.html', controller: mycontroller }); but had in home.html : <div data-ng-controller="mycontroller"> this digested controller twice. removing data-ng-controller attribute html resolved issue. alternatively, controller: property have been removed routing directive. this problem appears when using tabbed navigation. example, app.js might contai

c# - Dot Net Entity Framework database update doesn't create tables in mysql database -

i'm using mysql database official connection provider. i'm trying next project example (asp.net core 1.0) on mac: public class bloggingcontext : dbcontext { public bloggingcontext(dbcontextoptions<bloggingcontext> options) : base(options) { } public dbset<blog> blogs { get; set; } public dbset<post> posts { get; set; } } public class blog { public int blogid { get; set; } public string url { get; set; } public list<post> posts { get; set; } } public class post { public int postid { get; set; } public string title { get; set; } public string content { get; set; } public int blogid { get; set; } public blog blog { get; set; } } and in startup.cs public void configureservices(iservicecollection services) { var connection = @"server=localhost;userid=efcore;port=3306;database=blogsfinal;sslmode=none;"; services.adddbcontext<bloggingcontext>(options

c - ipv6 local address using netlink -

i write c code using netlink information ip route table , detect new ip address of gived interface. using ipv4, can filter local address using 'ifa_local'. using ipv6, can't local address. rta_type never equal 'ifa_local' local address. the used code following: int main(void) { struct { struct nlmsghdr hdr; struct ifaddrmsg msg; } req; struct sockaddr_nl addr; int sock[2]; memset(&addr, 0, sizeof(addr)); memset(&req, 0, sizeof(req)); if ((sock[0] = socket(pf_netlink, sock_raw, netlink_route)) == -1) { cwmp_log(error,"couldn't open netlink_route socket"); return -1; } addr.nl_family = af_netlink; addr.nl_groups = rtmgrp_ipv6_ifaddr;// |rtmgrp_ipv6_ifaddr; if ((bind(sock[0], (struct sockaddr_in6 *)&addr, sizeof(addr))) == -1) { cwmp_log(error,"couldn't bind netlink socket"); return -1; } netlink_event.fd = sock[0];

java - Array result keep getting the last result -

i put partial of code think source of problem not figure out hence why @ stackoverflow now. anyways class set data , pass array. public arraylist<select.rates> casegetrates() throws ratetableexception, sessiondisconnectedexception { try { for(int i=0;i < arrayrate.size();i++){ arraylist<select.rates> arr = new arraylist<select.rates>(); this.setpair(array[0]); this.setbid((array[2])); this.setask((array[3])); arr.add(this); } return arr; } finally{} } when system.out.print data set in class gives me: eur/usd 1.12372 1.12384 usd/jpy 100.622 100.641 which correct , displayed on webpage.however when pass data servlet try { arraylist<select.rates> rates = example.casegetrates(); for(int i=0;i < rates.size();i++){ system.out.println(""); system.out.println(rates.get(i).getpair()); system.out

node.js - Post a form before all tests chai mocha -

if need submit login form before tests, how can chai , mocha; i've looked @ beforeeach functions cant seem make work var chai = require('chai'); var chaihttp = require('chai-http'); var app = require('../app'); var should = chai.should(); var expect = chai.expect; chai.use(chaihttp); var username = 't@t.com'; var password = 'test'; before(function() { it('should login details login form / post', function(done) { var request = chai.request(app); request .post('/session/new') .field('email', username) .field('password', password) .end(function(err, res) { res.should.have.status(200); res.should.be.html; done(); }); }); describe('vouchers', function() { it('should list vouchers on / get', function(done) { var request = chai.request(app); request .get('/vouchers')

Regular Expressions Pattern Java -

i'm still not sure how deal regular expressions. have following method takes in pattern , return number of pictures taken in year. however, method takes in perimeter year. intending string pattern = \d + "/" + year; means month wildcard year must matched. however, code doesn't seem work. can guide me on regular expressions? expected string passed in should "9/2014" // method returns number of pictures taken in // specified year in specified album. example, if year 2000 , // there 2 pictures in specified album taken in 2000 // (regardless of month , day), method should return 2. // *********************************************************************** public static int countpicturestakenin(album album, int year) { // modify code below return correct value. string pattern = \d + "/" + year; int count = album.getnumpicturestakenin(pattern); return count; } if understand q

sql server - t-sql procedure has no errors but need to be enhanced -

i have written procedure in t-sql returns errorcount based on state code,fiscal year etc..., has 3 pieces involved: 1. returns inner join of 2 tables pull selective columns 2. case statement multiple value possibility coloffset 3. function return errorcount. when run code gives output 3 separate tables, but, intend errorcount output. how can accomplish this. oracle equivalent used cursor. need use here? here's code: alter procedure [hsip].[errorcount] ( @cregion char(2) ='00', @cstate_code char(2) = '00', @nfy numeric(4,0) = 0, @nreport_id numeric(2,0) = 0, @nsection_id numeric(2,0) = 0, @nsubsection_id numeric(2,0) = 0, @ndisplay_number numeric(38,0) = 0, @nquestion_number numeric(38,0) = 0, @nquestion_part_number numeric(38,0) = 0, @suser_id varchar(25) =null, @nfy_st_question_dtl_table_id numeric(38,0)) begin set nocount on; --declare nfy_st_question_dtl_table_id integer --declare ncolumn_index cursor

Powershell Active Directory Users to Multiple Groups using CSV -

i'm trying assign groups users in active directory. in simple case, case doing loop through csv file. however, in circumstances, csv different. example of csv followed. tjone,time,jones,time jones,tim.jones@home.ac.uk,time jones,home work, manager, finance, staff, "ou=groups,dc=home,dc=ac,dc=uk",finance;hr,p@ssw0rd the script followed: #read csv file $pathofcsv = "c:\users\administrator\desktop\users.csv" $header = "samaccountname","givenname","sn","displayname","mail","cn","company","title","department","orgunit","ou","groups","password" $infocsv = import-csv $pathofcsv -delimiter "," -header $header foreach ($user in $infocsv) { add-adgroupmember -identity $user.groups -members $user.samaccountname } this different can see i'm trying process groups column has more 1 name , make matter worse, sepa

version - updating java software require any downtime of the application -

i'm not sure whether can post question here or not. have application deployed tomcat server , application running fine. if have upgrade java version, stop application? in other words need downtime upgrading java version? now if have upgrade java version, stop application until upgrade completed? that advisable. you install newer version of java existing 1 being used run application. however, need restart tomcat , application them start using newly installed jre. do need downtime upgrading java version? you need some down time. however, @andreas says in comment, if design system(s) appropriately, may able implement system live server , "hot" stand-by server, , use load-balancer or haproxy "fail over" 1 system other enough interruption short notice. alternatively, if have multiple "live" instances of server can take instances out of service, upgrade them , reintroduce them.

swift - parse dictionary with different keys and values -

i have dictionary this: var mapnames: [string: [string]] = [ "a": ["a1", "a2"], "b": ["b1"], "c": ["c1", "c2", "c3"] ] now have 1st view controller's tableview's func: override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) { //i want print "a", "b", "c" here. } in 2nd view controller's tableview' func: override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { //if user taps on "a" in 1st vc, show here cells "a1", "a2" } can how can parse dictionary list of keys first , each key, list of corresponding values ? thanks. as pointed eric, should read documentation first. key - value of dictionary, need this: for (key, value) in mapnames { print(key)

jquery - return response()->json to Laravel View - AJAX -

how access json within laravel 5.2 blade view after ajax post request? seems though variable {{ $trackedaddress }} is not accessible within view since error saying undefined. however, within console can see json object exists after click event. controller: public function postmodalchart(request $request) { $task_address = $request['taskaddress']; $task_city = $request['taskcity']; $user = auth::user(); $userid = $user->id; $trackedaddress = db::table('tasks') ->join('soldhomestest', function ($join) { $join->on('tasks.address', '=', 'soldhomestest.address') ->on('tasks.city','=','soldhomestest.city'); }) ->where([ ['user_id', '=', $userid], ['tasks.address', '=', $task_address], ['tasks.city', '=', $task_city], ]) ->get();

xml - visual studio 2015 debugging xsl transformation failed SecurityException -

when debugging xsl in vs 2015 why getting following error securityexception ----------------- request permission of type 'system.security.permissions.securitypermission, mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' failed. xsl generated security exception. if trust stylesheet copying local hard drive remove security check. highly advised review script blocks , http requests in stylesheet before so. firstpermissionthatfailed can enable automatic downloads on miscellaneous xml options page under text editor category of tools/options dialog. i did couple of things , error went away. first, exited vs , reopened right clicking startup icon, clicking 'more'->'run administrator' that alone might have been sufficient fix issue, did error message above suggested , went vs menu , clicked tools->options->text editor->xml->miscellaneous under 'network' there checkmark in 'automatically

bdd - JBehave - best way to reuse/refer already existed story -

each story in bdd tests starts same bunch of steps. there way refer steps or maybe somehow "refer" repeatable story. best way extract common part? currently, using @composite annotation provided jbehave. the solution use background scenario. what execute steps background each scenario. disadvantage if background fails scenarios feature skipped , feature marked failed. i guess assuming if steps common , fail once fail every time. can see example in jbehave documentation .

php - change Laravel default user db connection to another db connection -

i have config/database.php follow: 'default' => 'web', 'connections' => array( # our primary database connection 'web' => array( 'driver' => 'mysql', 'host' => 'host1', 'database' => 'database1', 'username' => 'user1', 'password' => 'pass1' 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), # our secondary database connection 'another' => array( 'driver' => 'mysql', 'host' => 'host2', 'database' => 'database2', 'username' => 'user2', 'password' => 'pass2' 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' =&g

angular - Using Pipes within ngModel on INPUT Elements in Angular2-View -

i've html input field. <input [(ngmodel)]="item.value" name="inputfield" type="text" /> and want format value , use existing pipe: .... [(ngmodel)]="item.value | usemypipetoformatthatvalue" ..... and error message: cannot have pipe in action expression how can use pipes in context? you can't use template expression operators (pipe, save navigator) within template statement: (ngmodelchange)="template statements" (ngmodelchange)="item.value | usemypipetoformatthatvalue=$event" https://angular.io/docs/ts/latest/guide/template-syntax.html#!#template-expressions so should write follows: <input [ngmodel]="item.value | usemypipetoformatthatvalue" (ngmodelchange)="item.value=$event" name="inputfield" type="text" /> plunker example

android - java - does GC try more then once to release memory? -

lets have asynctask this: public void startasynctask() { new asynctask<void, void, void>() { @override protected void doinbackground(void... params) { try { thread.sleep(300000); } catch (interruptedexception e) { e.printstacktrace(); } return null; } }.execute(); } for dont know asynctask creates background thread. , anonymous classes non-static inner classes. now lets in activity (main thread) call startasynctask() the thread take little while complete (about 5 minutes). during background threads lifetime, lets imagine activity gets destroyed , time garbage collect activity. since asynctask has implicit reference outer class (the activity) activity leak , not garbage collected. but question following: after time, child thread finish. can gc attempt free memory again or activity forever leaked ? w

Copy column from one vi editor to other -

i trying yank column of 1300 lines 1 vi editor , paste on other open vi editor. able paste 49 lines of column. i'm not sure can yank columns between vim sessions. best bet might 2 open both files within 1 vim session using :sp or :vsp can copy , paste within 1 file if wanted copy lines over, in command mode, can use: :r! sed -n <begining line nubmer>,<end line number>p <path file> . r! runs external command, , sed searches lines in range given. for more information, check out these sources: http://vimdoc.sourceforge.net/htmldoc/windows.html https://stackoverflow.com/a/9644522/3865495

angular - Huge performance impact on Component's host document click (Angular2) -

Image
so have 300 instantiations of component defines global click event listener through host property: @component({ selector: 'value-edit', template: ``, host: { "(document: click)": "onclickoff($event)", }, changedetection: changedetectionstrategy.onpush ) export class valueeditcomponent { onclickoff(globalevent) { // make sure doesn't affect performance keep empty! } } i noticed hugely impacts performance , takes 2-3 seconds of processing after every click everywhere on document . this js cpu profile made in chrome sequence: wait ~5 seconds, click, wait few seconds , stop recording. click huge green column on screenshot: i've tried detaching change detector on component or parent didn't help. commenting out line "(document: click)": "onclickoff($event)", fixes problem. may issue of framework or bad usage i'm not sure how qualify or workaround in more good-practice-way. plunker here

ios - Swift hide navigation title but show its title as back button in next view controller -

i using tab bar controller main , following way- uitabbarcontroller -> uinavigationcontroller -> uitableviewcontroller (with 5 tab bar & uncheck show navigation bar & made uiview mail box image button click ) -> viewcontroller (with 5 tab bar & without button ) i want button first tab bar title name < home please let me know programmatic or structure way. thanks you need remove text button. simplest way set empty string, this self.navigationcontroller?.navigationbar.backitem?.title = ""

asp.net mvc - In ModelState the Date format is not valid while editing Kedno grid -

i developing mvc application kedno grid. have model item properties: public bool ispaid { get; set; } public nullable<datetime> paymentdate { get; set; } in kedno grid in view: columns.bound(c => c.paymentdate).format("{0:dd-mmm-yyyy}"); when editing in grid , set ispaid false logic has setting paymentdate null. for example have item paymentdate 22-sep-2016 , ispaid true . after editing in kendo grid item setting ispaid false, , when click save changes, invoked method update in controller: public actionresult update([datasourcerequest] datasourcerequest request, [bind(prefix = "models")]ienumerable<itemviewmodel> items) { if (modelstate.isvalid) { // } } but modelstate not valid: "the value '9/22/2016 12:00:00 am' not valid for...". if paymentdate 01-sep-2016, modelstate valid. also, followed steps in globalization section . in web.config: <globalization uiculture=&quo

Recoding missing data in longitudinal data frames with R -

i have data frame similar longitudinal structure data : data = data.frame ( id = c("a","a","a","b","b","b","c","c", "c"), period = c(1,2,3,1,2,3,1,2,3), size = c(3,3,na, na, na,1, 14,14, 14)) the values of variable size fixed each period has same value size . yet observations have missing values. aim consists of replacing these missing values value of size associated periods there no missing (e.g. 3 id "a" , 1 id "b"). the desired data frame should similar to: data.1 id period value 1 3 2 3 3 3 b 1 1 b 2 1 b 3 1 c 1 14 c 2 14 c 3 14 i have tried different combinations of formula below don't result looking for. library(dplyr) data.1 = data %>% group_by(id) %>% mutate(new.size = ifelse(is.na(size), !i

angular - Contents of file in angular2 -

i'm writing small app xml file aggregation. user drops xml files same structure, edits few common tags, , give them xml of needed data in list of elements. i'm using ng2-file-upload file droping, can't figure out way contents of file. don't want upload file backend, read in contents , dom manipulation on xmls. is possible send file angular2.0 route , have contents sent current component? thanks @zero298's comment did more digging file api , came solution! typescript using ng2-file-upload: uploader: fileuploader = new fileuploader({}); //empty options avoid having target url reader: filereader = new filereader(); ngoninit() { this.reader.onload = (ev: any) => { console.log(ev.target.result); }; this.uploader.onafteraddingfile = (fileitem: any) => { this.reader.readastext(fileitem._file); }; } just took digging ng2-file-upload code find how file object out of it.

javascript - JMeter duration assertion Override Response Code -

Image
i have jmeter test plan executes 1 http request multiple times per second. parameter have timeout every request test executes. have added "duration assertion" sampler/listener/ idk^^ now running test , getting response code 200 because request ok duration assertion exceeded. causes in results tree there succeeded , failed requests of them have status code 200. problem in "response codes per second" listener shows requests ok , have response code 200. not ok because of duration assertion! my problem: override status code of requests failed due duration assertion. want them displayed different response code (but if exceed duration assertion) in "response codes per second" listener because cant distinguish them. or there way can make them fail when exceed timeout? i sorry english , hope can understand problem. lot! i'm not aware of test elements allow changing response code, can via scripting follows: add beanshell assertion child

android - Dexguard in a library project -

i upgrading dexguard 6 7 , have question regarding library obfuscation. dexguard 6, obfuscate library module inside android studio , use module in app local dependency: dependencies { compile project(':sdk') } however, when try dexguard 7.0.31 exception: execution failed task ':sdk:transformclassesandresourceswithproguardforrelease'. > java.io.filenotfoundexception: /lib/dexguard-library-release.pro (no such file or directory) you have set minifyenabled true in library project, not work in combination dexguard. set flag false , should ok. recent versions of dexguard check flag , issue error.

refresh value of a Label on Bar Chart javafx -

i tried display value of bar chart on top of each 1 using code posted on how display bar value on top of bar javafx , when update serie's values , old value stays showing in bar chart :( . can me :) . in advance. try setting label series value. ex. xaxis.setlabel(series1.tostring()); hopefully helps

scripting - Bash: Set up a new command on a new line without executing -

this question has answer here: how prefill command line input 1 answer i'm trying write bash script output partially completed command can add parameters to, hit enter , run. want implemented in bash. e.g. ~> ./test.sh ~> ls -al <cursor position here> the variable i've found that's close prompt_command variable, when set inside test.sh 'ls -al', execute once script has exited. is there way stop immediate execution, can add, say, *.log? how about read -e -p"$pwd> " -i"ls -al " cmd; eval "$cmd"

directed acyclic graphs - Is there a 2D-layout algorithm for DAGs that allows the positions on one axis to be fixed? -

Image
i've got dag of around 3.300 vertices can laid out quite dot more or less simple tree (things complicated because vertices can have more 1 predecessor whole different rank, crossovers frequent). each vertex in graph came being @ specific time in original process , want 1 axis in layout represent time: edge relation a -> v, b -> v means a , b came being @ specific time before v . is there layout algorithm dags allow me specify positions (or @ least distances) on 1 axis , come optimal layout regarding edge crossovers on other? you can make topological sorting of dag have vertices sorted in way every edge x->y , vertex x comes before y . therefore, if have a -> v, b -> v , a, b, v or b, a, v . using can represents dag s this:

mongodb - Unique array value in Mongo -

i'm having hard time find way make collection index work way need. collection has array contain 2 elements, , no other array can have these 2 elements (in order): db.collection.insert(users : [1,2] // should valid db.collection.insert(users : [2,3] // should valid db.collection.insert(users : [1,3] // should valid db.collection.insert(users : [3,2] // should invalid, since there's array same value. but, if use db.collection.createindex({users:1}, {unique: true}) , won't allow me have 2 arrays common element: db.collection.insert(users : [1,2] // valid db.collection.insert(users : [2,3] // invalid, since 2 on document one of solutions tried make array 1 level deeper. creating same index, adding documents little different make way need, still allow 2 arrays have same value in reverse orders: db.chat.insert({ users : { people : [1,2] }}) // valid db.chat.insert({ users : { people : [2,3] }}) // valid db.chat.insert({ users : { people : [2,1] }}) // valid, shou

cypher - ConstraintViolationTransactionFailureException when deleting all nodes from Neo4j -

when attempting delete nodes neo4j graph database, have done many times in past on smaller datasets, consistently ran across error: undefined - undefined after running query match (n) detach delete n i figured number of nodes attempting delete @ once may large (>100000), tried query match (n) optional match (n)-[r]-() n,r limit 10000 delete n,r and many variations of it, acting on read in post: best way delete nodes , relationships in cypher . returned error org.neo4j.kernel.api.exceptions.constraintviolationtransactionfailureexception: cannot delete node<32769>, because still has relationships. delete node, must first delete relationships. and each time, node neo4j not delete differs. there way of resolving issue? perhaps noteworthy, while desperately running variations of previous query, when ran query match ()-[r]-() optional match (n)-[r]-() r,n limit 10000 delete r,n i got rather unique error java heap space in console, showed neo.databaseerr

html - How to indent this CSS code? It's produces a gallery output -

i want indent gallery of images right because have side subtoolbar on left side. tried left: 200; code doesn't work. how do this? <style> div.images { margin: 5px; border: 1px solid #ccc; float: left; width: 180px; } div.images:hover { border: 1px solid #777; } div.images images { width: 100%; height: auto; } </style> ... <a target="_blank" href="pics/my drawings/1.jpg"> <img src="pics/my drawings/1.jpg" alt="forest" width="200" height="300"> </a> </div> <div class="images"> <a target="_blank" href="pics/my drawings/2.jpg"> <img src="pics/my drawings/2.jpg" alt="northern lights" width="200" height="300"> </a> </div> <div class="images"> <a target="_blank" href="pics/my drawings/3.jpg">

dart - How do you create custom Polymer and PolymerDart annotations? -

i doing research polymerdart , various annotations can applied dart files. it: @property , @property , @observe , @reflectable , @polymerregister , or @htmlimport . so, started concept of dart , how make annotations them. saw on stackoverflow can this. class datatable { final string name; const datatable(this.name); } which can additional information inside constructor optionally. class datatable { final string name; const datatable(this.name) { console.log("$name referenced."); } } so, can create , implement variety of annotations leverage, starts fishy. i curious if there way create annotations polymerdart? locked down, or can there way create ones simple functions, maybe example: creating annotation executes @property(computed:"") functionality. i wanted create sort of customization our team use. for record, know can like const mycustomannotation = const property(); which allow me do: @mycustomannotation i thinking l

java - Configuring Spring Data error message -

is possible configure spring data return generic error message instead of specific sql error message? i'm asking because need change system accessing database , when throwing error "giving away" many database information, eg: database version. you wrap database query in try statement , in catch section output custom generic error message using logger or otherwise. you further find out exception in particular using 'instanceof' comparitor. is answer you're looking or misunderstanding question?

php - im lost with validating my code -

can me validate codes? user should able input numeric or integer only. have tried using ctype_digit isnumeric , more else , because didnt quite understand on how use nothing successful <?php $table = ''; if ($_post) { $table .= '<table border="4">'; ($i = 0; $i < $_post['rows']; $i++) { $table .= '<tr>'; ($j = 0; $j < $_post['column']; $j++) { $table .= '<td width="100">&nbsp;</td>'; } $table .= '</tr>'; } $table .= '</table>'; } ?> <?php echo "a table "; echo $_post['rows']; echo " row(s) , "; echo $_post['column']; echo " column(s) " ;?> <?php echo $table; ?> <form action="" method="post"> <table border="0" wi

jquery - Html and javascript input validation -

i trying have input accept numbers , '.', working great doesn't allow number pad number keys. cant seem find exact answer online. html <input type="text" id="itemtotal#i#" name="itemtotal#i#" value="#qpriceact#" onkeypress="return isnumeric(event)" onkeydown="return keyispressed(event);"> javascript //prevent , , $ being input function keyispressed(e){ var charval= string.fromcharcode(e.keycode); if(isnan(charval) && (e.which != 8 ) && (e.which != 190 )){ return false; } return true; } //is input numeric function isnumeric (evt) { var theevent = evt || window.event; var key = theevent.keycode || theevent.which; key = string.fromcharcode (key); var regex = /[0-9]|\./; if ( !regex.test(key) ) { theevent.returnvalue = false; if(theevent.preventdefault) theevent.preventdefault(); } } thanks help! the best way believe add class in

Fitting a regression line to graph with log axes in R -

Image
i'm trying make simple body size/weight regression graph log axes can't seem fit straight regression line graph. i've tried using untf function no line being generated. here's simplified sample of i'm trying: plot(average.bl~wet.weight, log="xy") reg=lm(log(average.bl)~log(wet.weight)) abline(reg, untf=false) i've looked @ previous questions same problem can't solutions work me. example of graph generated plotting original variables in log scale different plotting (the fitted regression line with) log-transformed variables in original scale, should latter desired result (plot fitted regression line log-transformed variables in original scale), examples mtcars dataset: plot(log(mtcars$mpg)~log(mtcars$wt)) # plot log-transformed variables, not in log-scale reg=lm(log(mtcars$mpg)~log(mtcars$wt)) abline(reg, untf=f) another option plot in log scale fit regression line in original scale. plot(mtcars$mpg~mtcars$wt, log=&q