Posts

Showing posts from May, 2012

excel - Remove value from range populating my listbox -

hello have 2 listboxes. first listbox contains items choose from. after selecting item, user clicks on 'add' command button copy value onto range of second listbox. believe of have seen similar add/remove listboxes. both listboxes created inserting controls , populated input range of items on hidden worksheet. here problem: adding names works fine, 'remove' procedure created seems take long time complete since list of items can more 200 items. i use following code match selected listbox value input range value , clears contents of cell in input range: sub remove() dim r long dim al listbox dim d range dim dd range dim allpick worksheet set al = worksheets("listbox").listboxes("listselected") set allpick = worksheets("columns") set dd = allpick.range("selectednames") al r = 1 .listcount if .selected(r) each d in dd if d.value = .list(r) ...

javascript - Angularjs service call from $rootscope causes unending iterative loop -

i'm new ng-world please go easy on noobness :) i've tried keep "angular" way of thinking in organizing code , understanding it's dependency injection ioc methodologies. one of goals dealing rest services in sharepoint. sharepoint integration not issue itself. need call rest service on key-presses within ui elements provide suggestion lists. said i've got service wired , working using ngresource. service combination of $resource element , factory injected helper method wires payload json required in post. an example of how can test service in controller is: peoplepickercontrollers.controller('peoplepickersearchctrl', ['$scope', 'peoplepickerutils', function($scope, peoplepickerutils) { $scope.data = peoplepickerutils.resolveuser('scott'); }]); this calls method factory injected service module. when assigning $scope element data results binding data with: {{ data | json }} i...

c# - the Time complexity of an algorithm -

i learning algorithms @ moment , wrote below code, finds if peak exists in 1 dimensional array. question how know time complexity of best case or average case? the worst case time complexity (if element of array sorted) o(n), if array not sorted , has 10 elements code runs 5 loops result, half of array size, can tell me how write in algorithmic notation. int[] arr = { 1,5,2,7,8,9,4,6,7}; int peak; int count = 0; (int = 1; < arr.length - 1; i++) { peak = -1; if (arr[i - 1] <= arr[i] && arr[i] >= arr[i + 1]) { peak = arr[i]; i++; } else if (arr[i - 1] >= arr[i] && - 1 == 0) { peak = arr[i - 1]; } else if (arr[i + 1] >= arr[i] && + 1 == arr.length - 1) { peak = arr[i + 1]; } if (peak != -1) listbox1.items.add(peak.tostring()); ...

How to recursively delete from Visual Studios file system? is it even possible? -

Image
when making installer (using visual studio installer) getting rather tired of having manually delete hundreds of individual files every time application changes. it boggles mind visual studio doesn't seem let recursive delete - instead insisting every file every subfolder deleted in turn. project means either; a) have spend hours deleting files filesystem view. b) recreate installer project each time. is there doing wrong? there workaround people use stuff? sorry if has been posted before, cant seem find right keywords if has - find hard believe no 1 else ever needs remove folders filesystem. what accepted best method removing folders lots of files? edit to clear; isn't real file system. can deleted real files of hard disc without problems. visual studios impression of file system. removing real files not remove reference them, , instead produce more errors telling me files missing. on linux i'd say rm -rf /path/to/dir/or/file since you'...

Suppress welcome message on bash remote command execution -

i'm executing commands on remote server within shell script this: ssh user@host <<endssh ... endssh upon login i'm getting standard server welcome message echoed. there way send \dev\null keep displaying output of executed commands? thanks. create file ~user/.hushlogin on remote host. suppress output login program when user logs in (such time of last login , message of day).

Scala Appending to an empty Array -

i trying append array reason appending blanks array. def schemaclean(x: array[string]): array[string] = { val array = array[string]() for(i <- 0 until x.length){ val convert = x(i).tostring val split = convert.split('|') if (split.length == 5) { val drop = split.dropright(3).mkstring(" ") array :+ drop } else if (split.length == 4) { val drop = split.dropright(2).mkstring(" ") println(drop) array :+ drop.tostring println(array.mkstring(" ")) } } array } val schema1 = schemaclean(schema) prints this: record_id string assigned_offer_id string accepted_offer_flag string current_offer_flag string if try , print schema1 1 blank line. scala's array size immutable. scala's reference : def :+(elem: a): array[a] [use case] copy of array element appended. thus :+ returns new array reference n...

javascript - jQuery Ajax passing response variable to function -

i have javascript function uses jquery ajax fetch response servlet. works when use anonymous function method- function doajax() { $.ajax({ url : 'authentication', data : { username : 'poko' }, success : function(data){ alert(data); //this works } }); } but when try pass response variable declared function nothing happens. function doajax() { $.ajax({ url : 'authentication', data : { username : 'poko' }, success : showresult(data) //this doesn't }); } function showresult(d) { alert(d); } firefox debug gives referenceerror: data not defined . can second method work? in second attempt function doajax() { $.ajax({ url : 'authentication', data : { username : 'poko' }, success : showresult(data) //this doesn't }); } you ex...

c# - Set image position on canvas programatically -

i have following code: namespace game { public partial class mainwindow : window { image img = new image(); public mainwindow() { initializecomponent(); mycanvas.focus(); img.source = new bitmapimage(new uri("c:\\users\\public\\pictures\\sample pictures\\koala.jpg")); img.width = 100; img.height = 100; } public void onkeydownhandler(object sender, keyeventargs e) { canvas.settop(img, 0); canvas.setleft(img, 0); this.content = img; } } } and xaml: <canvas name="mycanvas" keydown="onkeydownhandler" focusable="true" horizontalalignment="left" height="166" margin="118,89,0,0" verticalalignment="top" width="300"/> when press button, image shown, want do, in center of window. want set image on x,y position...

node.js - Re-Register events in socket.io-client after reconnect -

i have socket.io-client application looks this: var port = 1234; var host = "http://host.com"; var ioc = require( 'socket.io-client' ); var isconnected = false; var socket; connect(); function connect() { socket = ioc.connect( host + ":" + port); } socket.once( "connect", function () { isconnected = true; console.log( 'client: connected port ' + port ); socket.emit( "status message", "hello server", function ( message ) { console.log( 'echo received: ', message ); }); }); socket.once( "disconnect", function () { isconnected = false; console.log( '[alert]: disconnected server (' + host + ":" + port + ')! '); }); socket.on("reconnect", function(){ console.log('reconntected'); isconnected = true; }); the problem is, after reconnect event getting called, other event never being called again. "discon...

python - Progress in a itertools.combinations pool() map , result passed in list -

i run multipocessing script this: def intersterer(i): somestuff return x if __name__ == '__main__': pool = pool() list = pool.map(intersterer, itertools.combinations(xrange(great_number), 2)) i want know how can see progress of work. around shared counter, ugly , seems not telling truth. (perhaps wrong code in it) can me great pythonic way? edit: exemple, want store results in list, answers @ question : show progress of python multiprocessing pool map call? doesn't me this. thks edit2: here soluced way. thks every helpers! def intersterer(i): somestuff return x numtot = binomial(number,2) pool = pool() list=[] tpsb=time.time() in pool.imap_unordered(intersterer, itertools.combinations(xrange(number),2)): list.append(i); print "{:3.2f}%, approximatly {:3.2f} seconds left \r".format(100.*len(list)/numtot, (time.time()-tpsb)*100./(100.*len(list)/numtot)-(time.time()-tpsb)), use imap_unordered inste...

tag it - Jquery Tagit Displaying Unwanted x from DB -

Image
i having issue jquery tagit. working fine, when pull records form database , display them using foreach loop displays labels should adds x @ end text. the second x 1 should there deletes record. have tried remove × nothing shows @ all. input value returns x after text. not sure doing wrong. i have provided picture show mean. please me know if needs clarification. assistance. <?php $my_dietary_requirements = explode(', ', $my_dietary_requirements); ?> <fieldset class="edit-boxes"> <ul class="table-tags" id="my-diet"> <?php foreach($my_dietary_requirements $diet){ echo '<li class="tagit-choice ui-widget-content ui-state-default ui-corner-all tagit-choice-editable"> <span class="tagit-label">'.$diet.'</span> <a class="tagit-close"> <span class="text-icon">×</span>...

vb.net - MouseLeave and Enter on Form -

i trying make form fade away taskbar if user not hovering on form mouse. (the form contains hyperlinks). on adverse, want form reset original position if mouse comes form. however, whatever reason, seems thought enter , leave evens fire in sync when either occurs. if leave form mouse, both events fire. if enter form, both events fire. wrong? sub formleave() mouseform = false until y = screen.primaryscreen.workingarea.height + 50 sleep(10) y = y + 1 me.location = new point(x, y) if mouseform = true exit sub end if loop end sub sub formenter() mouseform = true me.visible = true x = screen.primaryscreen.workingarea.width - me.width y = screen.primaryscreen.workingarea.height - me.height me.location = new point(x, y) end sub animation best done timer (i.e. event driven) rather sleeping. you have make sure cu...

django - Queryset, get only one of reverse relationships -

class foo(models.model): name = charfield createdat = datetimefield class bar(models.model): rel = foreignkey(foo, related_name='bars') createdat = datetimefield foo.prefetch_related('bars').all() gives me bars. there way can latest bar each foo , using 1 query? you want use prefetch object, here in docs . prefetch() lets filter query, in example: queryset = bar.objects.latest('createdat') latest_bars = foo.objects.prefetch_related( prefetch( 'bars', queryset, to_attr="latest_bar" ) ) the_latest_bar_for_first_foo = latest_bars[0].latest_bar

How do you get this result, using Jquery Scroll Event & offset/position, css or javascript? -

Image
how result in css, javascript or jquery, or combination of all: i asked , posted similar question before, no 1 answered it. said: "maybe can use javascript (or bether jquery) this. if use jquery, can use scroll event. if scrolling, check if hits other div. https://api.jquery.com/scroll/ checking positions of divs possible offset/position. http://api.jquery.com/offset/ https://api.jquery.com/position/ if want change background, give div background color pink. if hits can add additional background-image has specific background-position (http://www.w3schools.com/cssref/pr_background-position.asp xpos ypos). don't have tried yet, guess possible way." so question is, how go doing result or regardless of way? i came after couple of hours trying make work. pretty fun doing it, i'm sharing it. $(document).ready(function() { var initscrolltop = $(window).scrolltop(); $('.div1').css('top', (initscrolltop+100)+"px...

Why do you have to provide the typename as the first parameter when creating a namedtuple in Python -

this question has answer here: python syntax namedtuple 4 answers in collections.namedtuple() constructor, first parameter name of type want create, far can tell, it's irrelevant aside diagnostic messages. from collections import namedtuple point = namedtuple('point', 'x y') p = point(1,2) # works fine, creates point(x=1, y=2) point = namedtuple('blah', 'x y') p = point(2,3) # works fine, creates blah(x=1,y=2) is necessary item programmer should keep consistent diagnostic purposes because there'd no way python learn name of variable you're assigning namedtuple to? seems error-prone, can see how it'd necessary. wondering if there other reasons or repercussions of mismatching these 2 names. named tuples implemented in kind-of dirty way. there template string has few placeholders, , when call namedtuple...

Push and Unshift Operation in javascript object -

i have following dataset input: dataset[0]=[{data:29, color:"y"},{data:44, color:"g"}] dataset[1]=[{data:16, color:"r"},{data:23, color:"m"},{data:23, color:"b"}] i showing information on bar chart, bar chart attempting group them. , not give me expect. http://jsfiddle.net/7dhb4jh0/1 therefore,i need have following output before feed bar chart the logic behind desired output match length of 2 dataset adding {data:0, color:null} there 2 things involved unshift , push operations desired output: dataset[0]=[{data:29, color:"y"},{data:44, color:"g"},{data:0, color:null},{data:0, color:null},{data:0, color:null}] dataset[1]=[{data:0, color:null},{data:0, color:null},{data:16, color:"r"},{data:23, color:"m"},{data:23, color:"b"}] initial attempt i have did follows, https://jsfiddle.net/s8mywm33/1/ dataset=[]; dataset[0]=[{data:29, color:"y"},{data:44, color...

webpack - Making all combinations of a polyfill bundle -

i want detect features on browser , load specific chunk exact polyfills need. example, assuming there 2 polyfills (lets call them , b), need 3 bundles created: polyfillbundle1.js - contains a polyfillbundle2.js - contains b polyfillbundle3.js - contains both , b the idea load exact polyfillbundle based on modernizr has detected on browser. example, if browser 1 not polyfills, browser 2 needs module b , browser 3 needs everything, browser 2 polyfillbundle2.js , browser 3 polyfillbundle3.js is there plugin doing this? if not, how go doing such thing? one, naive way achieve write entry configuration this: entry: { bundle1: "./bundle1", bundle2: "./bundle2", bundle3: "./bundle3", }, then @ each entry file require polyfills want each bundle. i assume next step generate configuration , bundles dynamically (generate permutations etc.) think above serve starting point. it's not enough generate these bundles you'll...

java - Why separation of interface and implementation? -

in production code see classes defined follows: public interface somecomponent { // methods } public class somecomponentimpl implements somecomponent { // methods} public interface somecomponentv2 extends somecomponent { // methods } public class somecomponentv2impl extends somecomponentimpl implements somecomponent { // methods } why in case want separate interface , implementation? or put way, why bad have 1 base class, , let v2 extend/override v1 follows: public class somecomponent { // methods } public class somecomponentv2 extends somecomponent { // override methods reimplementation // add new methods new features. } it practice separate interface , implementation of class because can swap out classes. imagine want test application depends on web-service bills every request. in addition have class performs real requests web-service, build class implements same interface returns fake data avoid generating costs every request. every time inherit base-c...

python - Extending list class to make a list of objects -

i have particle list of objects of type particle, takes 2 parameters, position , energy: class particle(object): def __init__(self, pos, energy): self.x = pos self.e = energy the way i've managed far create list of particles using list comprehension: number_of_particles = 10 initial_energy = 0 particle_list = [particle(initial_energy,i) in range(number_of_particles)] which allows me things like: particle_list[0].x which want. however, really, follows: particle_list = particlelist(no_of_particles, initial_energy) and create exact same list. i assume have extend list class somehow i'm @ loss how this. why not build function you. simple like: def particlelist(no_of_particles, initial_energy): return [particle(initial_energy,i) in range(number_of_particles)] this should simple way of getting list.

How does not | (Bitwise OR) work in SQL Server/SSIS 2012? -

i've read bitwise or , seems functions same or except it's faster. i read https://msdn.microsoft.com/en-us/library/ms186714(v=sql.110).aspx and here example give: use tempdb; go select a_int_value | b_int_value tablename how expected run? makes no sense, cannot have or in select statement 1) missing something? 2) safe if comparison expressions of type integer, should use bitwise or? (this because bitwise or faster , works on integer comparisons?) i don't have whole lot of experience flavor of sql, bitwise or not same thing or clause in statement. the bitwise or or each bit of integer produce new integer example, numbers 2 , 9 can represented in binary 0010 , 1001. therefore 0010 | 1001 = 1011 in other words 2 | 9 = 11 the | operator in statement performing operation on results. please note operation not equivalent addition i.e. 5(0101) | 3(0011) = 7(0111)

Excel: Transpose Like Rows into Columns -

Image
this question has answer here: excel pivot 2 answers i have excel spreadsheet has student names in first column , corresponding information student in other columns. student names have been changed privacy. you'll notice have multiple students in column because there 2 (or more) test scores in last column. i need have 1 student per row i'd take other scores , make columns. first student there mean score 1 , mean score 2. is possible? the answer looking pivot. excel pivot

ios - Need to return json obj so I display in list view getting back nil -

i new swift. trying return json , view in list view, cant json appapi class return viewdidload(). appreciated. thank in advanced. teli override func viewdidload() { super.viewdidload() let api = appapi(token:self.topasstoken) var test = api.getorders() println("why test come empty array") println(test) println(test.count) } class appapi { var token: string let apiendpoint = "endpoint" let apiurl:string! let consumerkey:string! let consumersecret:string! var returndata = [:] init(token:string){ self.apiurl = “hidden-for-security” self.consumerkey = "token" self.consumersecret = "my consumer secret" self.token = token } func getorders() -> [json] { return makecall("contacts") } func makecall(section:string) -> [json] { let params = ["token":"\(self.token)"] alamofire...

scala - missing parameter type in lambda -

i have following in worksheet: val tarr = array((1, some(1.0)), (2, some(6.0))) val r1 = tarr exists function.tupled((_, sf: option[double]) => sf == none) the ide complays missing parameter type _ worksheet spits out desired result. if plug same line of code in package , compile, compilation stops with, again, missing parameter type both _ , sf i bit confused on why need specify type there , why worksheet works , compilation no. in eclipse ide, code works fine object yrd { val tarr = array((1, some(1.0)), (2, some(6.0))) //> tarr : array[(int, some[double])] = array((1,some(1.0)), (2,some(6.0))) val r1 = tarr exists function.tupled((_, sf: option[double]) => sf == none) //> r1 : boolean = false }

Getting AngularJS orderBy to sort both directions -

i'm attempting setup clickable table column header sort ascending when first clicked, , descending when clicked again. ascending sort working fine, i'm not sure how setup expression within orderby sort descending my setup far: table html has like <th ng-click="sort('lastname')">last name</th> my sort method looks like scope.sort = function (columnname) { if (angular.isdefined(scope.filter)) { if (scope.filter.sortcolumn == columnname) { scope.filter.sortcolumn = columnname; scope.filter.sortdirection = scope.filters.sortdirection == "asc" ? "desc" : "asc"; } else { scope.filter.sortcolumn = columnname; scope.filter.sortdirection = "asc"; } } }; and ng-repeat looks follows <tbody ng-repeat="name in resp.names | orderby : filter.sortcolumn"> how can sortdirection factor orderby? to rever...

rdoc - Documentation as tests in Ruby? -

there great tool rustdoc (currently used cargo ) test examples of documentation comments in rust . rdoc or yard give similar in ruby? well, there few examples of doctest tool in ruby, , fresh 1 (for now) yard-doctest : meet yard::doctest - simple , magical gem, automatically parses @example tags , turn them tests! probably no powerful rustdoc, needs to.

ios - NSMutableArray Thread Concurrency with GCD -

i have nsmutablearray in "sharedstore"-pattern singleton. publicly, it's accessible through methods cast nsarray. within class, it's @property (nonatomic, copy) nsmutablearray *myitems; this array never gets manipulated outsdie singleton viewcontrollers send singleton messages manipulate controller. of these messages empty array, re-populate it, etc. having ended in situation array empty in 1 method call , not yet empty in next, i've started implementing concurrency behaviour. here's i'm doing far: in .m file of singleton, have @property (nonatomic, strong) dispatch_queue_t arrayaccessqueue; in singleton's initializer gets created serial queue. , then, every method has mutating array within dispatch_sync call, example: dispatch_sync(self.arrayaccessqueue, ^{ [_myitems removeallobjects]; }); this has made things better , has made app behave more smoothly. however, have no way of quantifying beyond having fixed 1 odd behaviou...

java - Force JDBC not to use proxy -

i have xampp mysql (so localhost), can connect through mysql workbench or phpymadmin without problem. have webapp using hibernate (also tried easy & ugly way connect db) class.forname("com.mysql.jdbc.driver"); connection cn = drivermanager.getconnection("jdbc:mysql://127.0.0.1:3306/testlink", "testlink", "testlink"); statement st = cn.createstatement(); string query = "insert `cfield_testprojects` (`field_id`, `testproject_id`, `display_order`, `location`, `active`, `required`, `required_on_design`, `required_on_execution`"; st.executeupdate(query); i tried localhost:3306 , without port to... same error time : com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure last packet sent server 0 milliseconds ago. driver has not received packet s server. @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessori...

powershell - Accessing hidden teamcity artifacts -

so, key element here hidden artefacts, known appear under .teamcity/ part of build artifacts. some context: run dotcover on our nunit test step report on our test coverage. places compilation of results in file named coverageresults.xml under .teamcity/.netcoverage/ . file accces can mine if data , send gecko board. now, far, can @ artifacts not in part of directory (such result of build when output it, etc) using advised methodology . problem occurs when accessing hidden directory. the other odd things response: 302 temporarily moved. for reference, link looks like: (in powershell btw) "http://{0}:{1}@{2}/guestauth/repository/download/{3}/.lastfinished/.teamcity/.netcoverage/coveragereport.xml" -f $serverurl, $guname, $gpassword, $buildtype does have advice on accessing hidden artifacts? else data drawn (we've found nothing on system variables this)? note: aware these artifacts not produced till build step completes. doing after fact against complete...

ios - Vfr Reader implementation -

i have web api on backend serves pdf , want show pdf in ios app. able working uiwebview. not pretty , came across vfr reader. able use vfr-reader show pdf web? example on vfr-reader page retrieves pdf local documents directory. has worked documents downloaded web? do have save pdf downloaded web documents folder? dont want users save pdf , deplete storage. thanks!

c - splint large project (hundreds of files) -

i'm using splint moderately large project. fine, trying level "weak" "checks". because checking files 1 one, splint complains undefined functions. seem remember splint had option analyse multiple files individually , final analysis of (compile + link style). i can't find info on how in manual nor general googling. is possible?

ios - Populate TableView from Parse -

i'm trying populate tableview list of strings stored in parse.com. did 3 steps not returning anything, not same normal array? thanks! - (void)viewdidload { [super viewdidload]; [self pfquerynotes]; } //pfquery notes - (void)pfquerynotes { // using pfquery pfquery *notesquery = [pfquery querywithclassname:@"notes"]; self.notesarray = [notesquery findobjects]; } //returns number of cells display in tableview - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [self.notesarray count]; } //fills cells array values - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidenti...

laravel - orWhere giving unexpected result -

i want search pages lang_id = 1, using following laravel query $result = $this->where('lang_id', $this->langid ); $result->where('title', 'like', '%'.$search.'%') ->orwhere('description', 'like', '%'.$search.'%'); $result->get(); it gives me pages having lang_id other 1 too. how fix it? it because build query return records have lang_id , title, or description starting search keyword. , that's why results, because of them don't meet lang_id requirement, meet description match. you need group conditions properly, this: $result = $this->where('lang_id', $this->langid ) ->where(function ($query) use ($search) { $query->where('title', 'like', '%'.$search.'%')->orwhere('description', 'like', '%'.$search.'%') }); $result->get(); this equal to: select * table lang_id = $l...

javascript - $dirty with ng-model-options = { updateOn : 'blur' } -

<form name="angform" novalidate> <div class="form-group"> <label for="name1" class="sr-only">last name</label> <span ng-show="angform.name1.$dirty">* updated model after text box blurred. </span> <input type="text" name="name1" id="name1" class="form-control" ng-model="person.lastname" ng-model-options="{updateon : 'blur'}" ng-disabled="!edit" placeholder="last name" /> </div> </form> the above code have text box span message, expect appear once user interacts (i.e., types) text box, model must updated view value when user leaves text box. but, span message not displaying interaction happens, gets displayed when user leaves text box. can please explain me behaviour?

bash - Add index column to CSV file -

i have large comma-separated file (6gb) , add index column it. i'm looking @ unix type solutions efficiency. i'm using mac. i have this: v1 v2 v3 0.4625 0.9179 0.8384 0.9324 0.2486 0.1114 0.6691 0.7813 0.6705 0.1935 0.3303 0.4336 would this: id v1 v2 v3 1 0.4625 0.9179 0.8384 2 0.9324 0.2486 0.1114 3 0.6691 0.7813 0.6705 4 0.1935 0.3303 0.4336 this work: awk -f'\t' -v ofs='\t' ' nr == 1 {print "id", $0; next} {print (nr-1), $0} ' input.csv > output.csv in awk , nr variable "the total number of input records seen far", in general means "the current line number". nr == 1 in first line how match first record , add "id" column header, , remaining lines use nr-1 index. the -f'\t' argument sets input field separator, , -vofs='\t' sets output field separator.

php - Registering formular that doesn't flush. Symfony 2.5.6 -

i have e little problem. followed tutorial create register formular doesn't persist entity. don't understand why. doesn't create mistake, just... doesn't flush. here tutorial: http://symfony.com/fr/doc/2.5/cookbook/doctrine/registration_form.html here entity: namespace theia\mainbundle\entity; use doctrine\orm\mapping orm; use symfony\component\validator\constraints assert; use symfony\bridge\doctrine\validator\constraints\uniqueentity; /** * usermain * * @orm\table() * @orm\entity(repositoryclass="theia\mainbundle\entity\usermainrepository") */ class usermain { /** * @var integer * * @orm\column(name="id", type="integer") * @orm\id * @orm\generatedvalue(strategy="auto") */ private $id; /** * @var string * * @orm\column(name="email", type="string", length=255, unique=true) * @assert\notblank() * @assert\email() */ priv...

javascript - Simulate a click on js -

i have problem on website. have <div id="test"> display:none default. now, when click on button changes display:block , in div popup displayed disappears when make click. need simulate click div not show. tried : <script> document.getelementbyid('test').setattribute('class','display-block'); document.getelementbyid('test').click(); </script> but not work. // element click execute display $('#button').on('click', function(){ $('#test').css('display','block'); });

cordova - Bootstrap Modal not loading immediately on click button due to jQuery ajax call -

i using bootstrap modal show loading message when doing ajax call validating url based on value returned statuscode. user clicks button loader message should displayed , in behind jquery ajax call made. bootstrap modal displayed slight delay instead want show bootstrap modal loader message. am using bootstrap, backbone, jquery. hybrid mobile app developed using web technologies. here doing, bootstrap modal code, hidden (i opening modal via javascript) <div class="modal fade bs-example-modal-lg" id="mymodal" tabindex="-1" aria-hidden="true" data-backdrop="static" role="dialog"> <div class="vertical-alignment-helper"> <div class="modal-dialog modal-lg vertical-align-center"> <div class="modal-content"> <div class="modal-body"> <div id="gifload"><img id="loading-im...

regex - Use grep to find either of two strings without changing the order of the lines? -

i'm sure has been asked can't find apologies redundancy. i want use grep or egrep find every line has either ' p ' or ' ca ' in them , pipe them new file. can 1 or other using: egrep ' ca ' all.pdb > ca.pdb or egrep ' p ' all.pdb > p.pdb i'm new regex i'm not sure syntax or . update: order of output lines important, i.e. not want output sort lines string matched. here example of first 8 lines of 1 file: atom 1 n thr u 27 -68.535 88.128 -17.857 1.00 0.00 1h5 n atom 2 ht1 thr u 27 -69.437 88.216 -17.434 0.00 0.00 1h5 h atom 3 ht2 thr u 27 -68.270 87.165 -17.902 0.00 0.00 1h5 h atom 4 ht3 thr u 27 -68.551 88.520 -18.777 0.00 0.00 1h5 h atom 5 ca lys b 122 -116.643 85.931-103.890 1.00 0.00 2h2b c atom 6 p thy j 2 -73.656 70.884 -7.805 1.00 0.00 dna2 p atom 8 hb thr u 27 -6...

Plain JavaScript + bluebird promises asynchronous for/while loop WITHOUT USING NODE.JS -

there seem many answers questions on how use bluebird promises call asynchronous functions / while loop, far can see, require node.js work (e.g. promise.method() or process.nexttick() ; e.g. such as: while loop using bluebird promises ). there way in plain js + blue bird? time. well, once promise returning function - don't care environment library takes care of you: promise.delay(1000); // example of asynchronous function see this question on converting functions promise returning ones. now, once have sort of function loop becomes pretty trivial: function whileloop(condition, fn){ return promise.try(function loop(val){ return promise.resolve(condition()).then(function(res){ if(!res) return val; // done return fn().then(loop); // keep on looping }); }); } which let like: var = 0; whileloop(function(){ return < 10; // can return promise async here }, function body(){ console.log("in ...

Spring Security @PreAuthorize on controllers -

i'm trying use url (ant based) matching along @preauthorize("permitall") on controllers i.e. @controller @requestmapping("/register") public class registrationcontroller { ... @preauthorize("permitall") @requestmapping(method = requestmethod.get) public string register() { ... } securityconfig: @configuration @enablewebmvcsecurity @enableglobalmethodsecurity(prepostenabled = true) public class securityconfig extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { // @formatter:off http .authorizerequests() .antmatchers("/").permitall() .anyrequest().authenticated() i've tried adding @enableglobalmethodsecurity mvc config: @configuration @enableglobalmethodsecurity(prepostenabled = true) public class mvcconfig extends webmvcconfigureradapter { ... } but has no effect however still prompted au...

git - Xcode source control wrong username on github -

im having problem, have entered remote repository , committed project. when @ commit on github shows commit has come separate user, , not mine. seems have used name of developer account git username, if have entered correct username when setting repository in github. is there solution, when commit xcode, shows coming github profile, , not separate account? github uses email address in commit header link commit github user. xcode pulls used pull email details contacts. if have multiple email addresses associated own contact card, xcode choosing different email address use doesn't match github username email. i don't believe there's way specify email address use within xcode, can specify in local or global git configuration file. update: try these commands, provide xcode git username , email: xcrun git config --local user.name 'new_user_name' xcrun git config --local user.email 'new@email.com'

meteor - How to check if a mongoDB record is less than a day old? -

i trying implement user "group" system in meteor application. here simplified example of group document mongodb structure : { "_id": "w74grb7gnaoqs4dmj", //id of group "name": "my beautiful group", "createdat": isodate("2015-05-27t12:44:52.288z"), "createdby": "7tkqk3bm72mk47ngh", "users": [ "7tkqk3bm72mk47ngh" //meteor user id array ], "admins": [ "7tkqk3bm72mk47ngh" ], "leaving_users": [ { "user_id": "9zxdv6bm72mk47ngh", "leaving_date": isodate("2015-05-27t16:15:23.170z") }], "modifiedat": isodate("2015-05-27t16:41:57.589z"), "modifiedby": "fz78pr82jpz66gc3p" } i want obtain following behavior: when user leave group, id removed group "users" array. since want him able re-join gro...

payment gateway - Stripe auth and capture -

i stuck question have implemented instant payment method of stripe payment gateway want change instant payment two-step payments method because of requirement. i'm refering does stripe support auth , capture? . saying note charge must captured within 7 days or cancelled. but want auto capture charge without cancellation within 1 or 2 days if possible. help me if there idea this. your appreciated. https://stripe.com/docs/api#create_charge capture optional, default true whether or not capture charge. when false, charge issues authorization (or pre-authorization), , need captured later. uncaptured charges expire in 7 days. more information, see authorizing charges , settling later. so, first off, create charge, now, capture set false. then, when want charge customer, call charge capture method, passing in id of charge created in above step. unfortunately, there's no way of automatically doing this , you're going need write cod...

entity framework 4 - Teamcity build fails because of EF code migrations -

Image
my teamcity build fails because have project has 2 ef code migration configurations in it. from build log: [12:39:58]checking changes [12:39:58]collecting changes in 1 vcs root (1s) [12:40:00]clearing temporary directory: c:\teamcity\buildagent2\temp\buildtmp [12:40:00]publishing internal artifacts [12:40:00]checkout directory: c:\teamcity\buildagent2\work\1679b8b30e00ad0 [12:40:00]updating sources: server side checkout (2s) [12:40:03]step 1/8: gulp (command line) [12:40:03]step 2/8: nuget package refresh (nuget installer) (3s) [12:40:06]step 3/8: compile (msbuild) (21s) [12:40:27]step 4/8: unit tests (nunit) (33s) [12:41:01]step 5/8: transform files (powershell) (2s) [12:41:03]step 6/8: deployment build on xxxxx live (msbuild) (25s) [12:41:29]step 7/8: deploy database (powershell) (5s) [12:41:34]step 8/8: deploy portal.hub (powershell) (33s) [12:42:08]publishing artifacts [12:42:08][publishing artifacts] collecting files publish: [c:\teamcity\buildagent2\temp\buildtmp\nuge...

oracle - Using XMLTABLE and xquery to extract data from xml -

i have following piece of xml: <per:person xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.something.com/2014/11/bla/webservice.xsd" xmlns:per="http://www.something.com/2014/11/bla/person"> <per:initials>e.c.</per:initials> <per:firstname>erik</per:firstname> <per:lastname>flipsen</per:lastname> <per:birthdate>1980-07-01</per:birthdate> <per:gender>male</per:gender> </per:person> from xml want extract data in pl/sql. i'd use xmltable, since extract , extractvalue functions deprecated. i able extract data using query: select pers.initials, pers.firstname lsinitials, lsfirstname xmltable ('*:person' passing pxrequest columns initials path '*:initials', firstname path '*:firstname' ) pers; i'm using wildcards nam...