Posts

plot - Overlapping graphs in matlab -

i drawing several graphs in same plot in matlab using command, hold on. problem drawing points big markersize on top of of graphs, , theses points have specific color. happens of them take color , others take color, guess colors of points mixed colors of graphs on top of put them. there mean ask matlap overwrite whatever under points color assign them? example: x= 0:1:10; plot(x,x,'r',x,-x,'b','linewidth',2) hold on plot(5,-5,'.',10,10,'.','markercolor',[0,0.5,0],'markersize',24) hold on plot(5,5,'.',10,-10,'.','markerfacecolor',[0,0.75,0],'markersize', 24) imagine curves more complicated theses simple lines no way start having fun cutting them each time want represent point... problem points 5,-5 , 10,10 have same color. namely 0 0.5 0 dark green. color mixed depending on line lie. if specify color '.g' don't problem, problem got many points covered few number of colors lab...

c# - Client not receiving message in time (TcpClient) -

i have 2 applications "talk" each other tcp, problem when send something, application doesn't receives @ same time, when requests second time, 'he' receives duplicated. example: client request connection (income string: 00200001 0050 ); server accept connection(acknowledge) (output string: 00570002 ); the client doesn't receives acknowledge, when requests connection again, receives output string of: 00570002 00570002 (duplicated). this happens in application connects mine. private int listenerport = 4545; private tcplistener listener; private tcpclient socket; public communicator() { try { this.listener = new tcplistener(ipaddress.parse("127.0.0.1"), listenerport); listenerport++; listener.start(); this.connecttopendingrequest(); } ca...

pandas - Python apply a func to two lists of lists, store the result in a Dataframe -

to simplify problem, have 2 lists of lists , function shown below: op = [[1,2,3],[6,2,7,4],[4,1],[8,2,6,3,1],[6,2,3,1,5], [3,1],[3,2,5,4]] ap = [[2,4], [2,3,1]] def f(lista, listb): return len(lista+listb) # real f returns number i want f(op[i],ap[j]) each i, j , idea create pandas.dataframe looks this: ap[0] ap[1] op[0] f(ap[0],op[0]) f(ap[1],op[0]) op[1] f(ap[0],op[1]) f(ap[1],op[1]) op[2] f(ap[0],op[2]) f(ap[1],op[2]) op[3] f(ap[0],op[3]) f(ap[1],op[3]) op[4] f(ap[0],op[4]) f(ap[1],op[4]) op[5] f(ap[0],op[5]) f(ap[1],op[5]) op[6] f(ap[0],op[6]) f(ap[1],op[6]) my real data has around 80,000 lists in op , 20 lists in ap, , function f little bit time consuming, computational cost should worried. my idea achieve goal constructing pandas.series of length len(ap) for each op , , append series final dataframe . example, op[0] , first create series have information f(op[0],ap[i]) each i . i stuck constructing series . trie...

java - How to get the Hibernate SessionFactory from org.springframework.orm.hibernate4.LocalSessionFactoryBean? -

i migrating 1 old legacy application spring. in data access layer of current legacy code, there 1 basedataaccessor. data accessor provide reference of sessionfactory through 1 method. meet delivery date, have keep structure same, , need reference of hibernate sessionfactory in basedataaccessor. i able reference of org.springframework.orm.hibernate4.localsessionfactorybean implementing applicationcontextaware, unable convert sessionfactory. there way this? thanks the localsessionfactorybean creates sessionfactory : @bean public localsessionfactorybean sessionfactory() { localsessionfactorybean sessionfactory = new localsessionfactorybean(); sessionfactory.setdatasource(datasource()); sessionfactory.setpackagestoscan(new string[] { "my.packages" }); sessionfactory.sethibernateproperties(hibernateproperties()); return sessionfactory; } then can inject sessionfactory his: @autowired sessionfactory sessionfactory; check this article d...

java - Regex search taking increasingly long time -

my regex taking increasingly long match (about 30 seconds 5th time) needs applied around 500 rounds of matches. suspect catastrophic backtracking. please help! how can optimize regex: string regex = "<tr bgcolor=\"ffffff\">\\s*?<td width=\"20%\"><b>((?:.|\\s)+?): *?</b></td>\\s*?<td width=\"80%\">((?:.|\\s)*?)(?=(?:</td>\\s*?</tr>\\s*?<tr bgcolor=\"ffffff\">)|(?:</td>\\s*?</tr>\\s*?</table>\\s*?<b>tags</b>))"; edit: since not clear(my bad): trying take html formatted document , reformat extracting 2 search groups , adding formating afterwards. the alternation (?:.|\\s)+? inefficient, involves backtracking. if want match characters including whitespace regex, with [\\s\\s]*? or enable singleline mode (?s) (or pattern.dotall matcher option) , use . (e.g. (?s)start(.*?)end ). note : manipulate html, use dedicated parser, jsoup...

javascript - Display content on click of navigation menu in angularjs -

my html page contain 2 sections. left side have navigation(code below) , right side display contents respective navigation menu. on click of each navigation menu, particular section should rendered on content part. i have done using ng-show/ng-hide setting flag in js file. since setting flags each sections , show/hide , js code file looks odd. know not correct way it. i new angularjs. kindly me achieve efficiently. html code: (only navigation part) <div class="col-md-2"> <ul class="nav nav-pills nav-stacked"> <li class="active"><a href="#home" data-toggle="collapse" data-target="#login">home</a> </li> <div class="collapse" id="login"> <ul class="nav nav-pills nav-stacked"> <li><a class="glyphicon glyphicon-log-in" href="#" ng-click="loginscreen()">login</a></li> <li><a clas...

javascript - How to get the clean "non-highlighted" code with prism.js -

i'm using prism.js highlight css in <pre contenteditable="true"> tag in settup similar this one . on keyup copy code hidden <textarea> output highlighted text such as: <span class="token selector">#description </span><span class="token punctuation">{</span><br> <span class="token property">cursor</span><span class="token punctuation">:</span> ... etc. is there way un-highlighted text able save in clean original format?