Posts

Showing posts from September, 2013

xslt 2.0 - grouping following-siblings with same name and same attributes causes exception in saxon -

xslt 2.0 - grouping following-siblings with same name and same attributes causes exception in saxon - i have xml documents (similar docbook) have transformed xsl-fo. of documents contains poems, , lines of poems written in separate p tags. verses separated br tags. there "page" tags irrelevant , should ignored. typical code example: <h4>headline</h4> <p>1st line of 1st verse</p> <p>2nd line of 1st verse</p> <br/> <p>1st line of 2nd verse</p> <p>2nd line of 2nd verse</p> <page n="100"/> <p>3rd line of 2nd verse</p> <h4>other headline</h4> for xsl-fo output, gather text of verse 1 single fo:block. right mechanism works code structures above, there exceptions. actual way of doing decide every p tag: - first line of verse? - if yes: collect text of verse ynd write fo:block, utilize attributes of actual (first) p tag set formatting of block - if no: contents trea...

android - Parcelable object caching -

android - Parcelable object caching - i'm designing app using nfc on android.when tag read, scheme sends activity tag object. tag object parcelable object. since want write later on tag according user settings, need "cache" object in way. though utilize sticky broadcast retrieve later starting lollipop, sticky broadcast deprecated. alternative save on disk, docs says, it's not thing save parcelable . guess problem can happen if cache on file object, user alter android version, tag object different , crash can happen. need memory cache, seems me there no way forcefulness android maintain memory cache, utilize sticky service, android can kill service @ time. best way in case? when tag read, scheme sends activity tag object. correct. and, @ point, activity, , process, in foreground. come point later. since want write later on tag there no "later" of significance. every millisecond wait millisecond user has chance move device...

javascript - Share data between controllers with a service (AngularJS) -

javascript - Share data between controllers with a service (AngularJS) - i want build site, supports several languages. wanted utilize angularjs controllers controll view. have written script, next error: typeerror: cannot read property 'getlang' of undefined here angularjs code: var myapp = angular.module('myapp',[]); myapp.service('languageservice' , function() { var language = 'en'; homecoming { getlang: function() { homecoming language; }, setlang: function(ind) { if (ind == 0) { language = 'en'; } else if (ind == 1) { language = 'ru'; } } }; }) myapp.controller('changelangctrl', ['$scope', function($scope, languageservice) { $scope.changelang = function(ind) { languageservice.setlang(ind); } }]) myapp.controller('navictrl', ['$scope', f...

reporting services - ssrs footer dynamic textbox -

reporting services - ssrs footer dynamic textbox - in footer of report, contains textbox 1 , textbox2 . i want textbox 1 hidden both on page 1 , 2. but, know how hide on page 1. using look =iif(cstr(globals!pagenumber)="1", true, false) in visibility . do know how hide textbox 1 page 1 , 2? you utilize same expression add together logic sec page. =iif(cstr(globals!pagenumber) = "1" or cstr(globals!pagenumber) = "2", true, false) you don't need convert string cstr function nor utilize quotes around number: =iif(globals!pagenumber = 1 or globals!pagenumber = 2, true, false) reporting-services textbox footer

How to search for multiple conditions in python regex? -

How to search for multiple conditions in python regex? - i'm writing helper script dnd needs, part of script should take either integers or dice notation. latter in format of 1d20+4 where can replace 1 , 20 , natural number, , +4 integer. input can hit +3 harm 1d8+1 hp 3d6+2 and split 2 list using re . problem when seek observe both dies , numbers. know that observe number need use re.listall('[\+\-][0-9]*',input_line) and observe die need search for re.listall('[0-9]*d[0-9]*',input_line) and i'm quite search die bonus need re.listall('[0-9]*d[0-9]*[\+\-][0-9]*',input_line) however, can't figure how search combination of two. though placing them in parenthesis, i.e. re.listall('([\+\-][0-9]*)([0-9]*d[0-9]*)',input_line) however, error sre_constants.error: unbalanced parenthesis which leaves me confused. how can overcome this? i think need regular expression: re.findall('((\d+d\...

database - Advise on what else I could inclide in my Ruby WebApp -

database - Advise on what else I could inclide in my Ruby WebApp - hope you're well. have built app takes feedback user, can create , view own feedbacks. admins can view feedbakcks. admins can create users , create feedbacks, edit destroy delete etc (they have powerfulness on everything). looks brilliant. i've used devise authentication , cancan authorization. else can include in app create improve or function improve or else can create app usefull in way @ ideas anyone? here database , relationship between two: user has_many :feedbacks feedbacks belong_to :user cheers guys. ruby-on-rails database rest web-applications devise

jsf 2 - How to find in java that a jsf component has been removed using jquery? -

jsf 2 - How to find in java that a jsf component has been removed using jquery? - i bound remove primefaces component client side. using jquery remove() that. as can not set rendered=false client side, trying count or find in backend controller removed component absent. after removing, inspected page html , component no more in dom. before , after removing component, same value of kid count (non zero) fetched through facescontext : facescontext.getcurrentinstance().getviewroot().findcomponent("htmlgeneratedcomponentid").getchildcount(); i know facescontext won't know element has been removed client side script. jsf wouldn't know no communication has been made jsf , rendered attribute remain true checked by: facescontext.getcurrentinstance().getviewroot().findcomponent("htmlgeneratedcomponentid").isrendered(); right now, requirement after removing component using client side script need find in java controller, way know component has b...

javascript - The JQuery window object scroll top function -

javascript - The JQuery window object scroll top function - i started learning javascript , jquery, , have question regarding window object $(window) . have code, create div stick top of screen when scrolled top. $(function () { $(window).scroll(function(){ var window_top = $(window).scrolltop(); var div_top = $("#sticky-anchor").offset().top; if (window_top > div_top) { $('#sticky').addclass('stick'); } else { $('#sticky').removeclass('stick'); } }); }); what don't understand if entire screen window, when window_top > div_top? the top property returns topmost browser window of current window. top useful both when you're dealing frames , when dealing windows have been opened other pages. the place in reddish considered top ! if scroll page, whichever part of page in red area, part @ window.top . so, if div above top , window_top > div_top returns t...

python - python3, how to repeat a list of character -

python - python3, how to repeat a list of character - goodmorning, have problem next function: aminoacids = ['a', 'r', 'n', 'd', 'c', 'q', 'e', 'g', 'h', 'i', 'l', 'k', 'm', 'f', 'p', 's', 't', 'w', 'y', 'v'] pair_no_change = ['a', 'k'] original_pairs = [['a', 'k'], ['a', 'k'], ['a', 'k'], ['a', 'k'], ['a', 'k'],['d', 'e'], ['s', 'f'], ['b', 'c'], ['y', 'v'], ['k', 'w']] fq = 5 def frequency(original_pairs, pair_no_change, fq): updated_pairs = list(list()) pair in original_pairs: if pair != pair_no_change: pair[0] *= fq pair[1] *= fq updated_pairs.append([pair[0], pair[1]]) else: ...

Copy/paste implementation in file manager using ClipBoardManager android -

Copy/paste implementation in file manager using ClipBoardManager android - i looking effective , efficient approach implement re-create paste functionality. how achievable using clipboardmanager class. everywhere shown how re-create text suing clip data. want re-create file or maybe folder. in advance clipboardmanager myclipboard; myclipboard = (clipboardmanager)getsystemservice(clipboard_service); copying data clipdata myclip; string text = "hello world"; myclip = clipdata.newplaintext("text", text); myclipboard.setprimaryclip(myclip); pasting data clipdata abc = myclipboard.getprimaryclip(); clipdata.item item = abc.getitemat(0); string text = item.gettext().tostring(); android copy-paste clipboardmanager

mysql - First normal form violation -

mysql - First normal form violation - let's user can have multiple phone numbers. i can understand first table below violation of 1nf, userid=2 repeated. +--------+-------+ | userid | phone | +--------+-------+ | 1 | 1010 | | 2 | 1020 | | 2 | 1021 | | 3 | 1030 | +--------+-------+ but sec table violation of 1nf ? yes, appears bad, inflexible design - violating 1nf ? +--------+--------+--------+ | userid | phone1 | phone2 | +--------+--------+--------+ | 1 | 1010 | | | 2 | 1020 | 1021 | | 3 | 1030 | | +--------+--------+--------+ it violation of 1nf. 1nf requires that there no multiple-valued fields in table. there no repeating groups in table. phone1 , phone2 etc repeating groups, violation of 1nf. repetition of userid=2 not violate 1nf itself. mysql sql database relational-database normalization

pxssh.pxssh() is producing error in python -

pxssh.pxssh() is producing error in python - i got next errors when run pxssh.pxssh() in python. please allow me know missing here. exception attributeerror: "'pxssh' object has no attribute 'closed'" in <bound method pxssh.__del__ of <pexpect.pxssh.pxssh object @ 0x10d98e910>> ignored ......... file "/users/any_user/system/somelibrary_lib.py", line 377, in login ssh = pxssh.pxssh(maxread=read_buffer, ignore_sighup=false) typeerror: __init__() got unexpected keyword argument 'ignore_sighup' ......... i faced same problem. solution found utilize ssh_opts property of pxssh object instead of options ctor ( __init__ ) argument. code looks this: s = pxssh.pxssh() s.ssh_opts += " -o stricthostkeychecking=no" s.force_password = true s.login(ip, user, passwd) it doesn't throw attributeerror exception on module initialization , typeerror too. still doesn't work me. if rem...

testing content of each line in a text file in python -

testing content of each line in a text file in python - i want write programme reads of lines given python text file , tests if line has letters and/or numbers , if not print error message you can utilize file.readlines() iterates on lines in file. here's example. with open("/path/to/my/file.txt") file_to_read: line in file_to_read.readlines(): # check if non-letter/number character in each line do note readlines() include \n @ end of each line, remember remove it. simple search on google "python read file line line" have given result. python

Haskell - finding k'th element from end, and haskell's can't match the pattern -

Haskell - finding k'th element from end, and haskell's can't match the pattern - i'm trying implement recursive function returns k's element end. this attempt: kelementfromend :: int -> [x] -> x kelementfromend _ [] = error "cannot request k item empty list" kelementfromend k [x] | k < 0 = error "k must non negative" | k == 0 = lastly [x] | otherwise = kelementfromend (k-1) (init [x]) and error i'm receiving: *main> kelementfromend 2 [1,2,3] *** exception: ex2.hs:(4,1)-(8,54): non-exhaustive patterns in function kelementfromend i don't understand why haskell can't match pattern. what's going on i'm not understanding? thanks you've matched empty lists ( [] ) , single element lists ( [x] ). think mean replace [x] , pattern matches single element list , assign's single value x , xs , pattern matches list not matched. like kelementfromend :: int -> [x] -> x -...

php - Fatal error: Class 'RulesEventHandlerEntityBundle' not found in drupal 7 -

php - Fatal error: Class 'RulesEventHandlerEntityBundle' not found in drupal 7 - i got next fatal error in drupal. please guide me how resolve error out update rules module. because wrote custom rules in module. fatal error: class 'ruleseventhandlerentitybundle' not found in c:\xampp\htdocs\projectname\sites\all\modules\rules\modules\node.rules.inc on line 147 most there update module , didn't run update.php. i had same error few days ago when updating drupal commerce project (rules module included) , had forgotten run database upgrade script. how utilize update.php (drupal docs) php drupal drupal-7

elixir - How to pattern match Ecto query error -

elixir - How to pattern match Ecto query error - like other functions in elixir (as ecto's own transactions), want pattern match handle potential errors ecto queries. this: case repo.get!(user, id) {:ok, user} -> #do {:error, message} -> #pass error end obviously not work, how can pattern match ecto errors ecto.notsingleresult , other potential query problems preload errors? use repo.get homecoming value or nil. can pattern match on expected struct or utilize if-clauses. repo.get! raises on purpose (for cases expect struct there , not beingness there error). elixir ecto

ios - Swift Serial Dispatch Block only finish after delegate -

ios - Swift Serial Dispatch Block only finish after delegate - this hard 1 explain. creating serial queue handling work in app. imagine this: dispatch_async(myqueue, { () -> void in self.sendsms(); }); dispatch_async(myqueue, { () -> void in self.sendemail(); }); now phone call self.sendemail after delegate(sendsms delegate) finishes work. is there simple way this? many thanks assuming sendsms asynchronous method, i'd advise changing sendsms take completion handler closure: // define property hold closure var smscompletionhandler: (()->())? // when initiate process, squirrel away completion handler func sendsmswithcompletion(completion: (()->())?) { smscompletionhandler = completion // initiate sms } // when sms delegate method called, phone call completion closure func messagecomposeviewcontroller(controller: mfmessagecomposeviewcontroller!, didfinishwithresult result: messageco...

regex - deleting email pattern, keeping the rest using grep, awk or sed? -

regex - deleting email pattern, keeping the rest using grep, awk or sed? - i got plain text wich want delete email adresses (or replace e). want maintain else in text file. email adresses can followed space, colon, semicolon, question or exclamation mark. work gnuwin , tried grep didn't got right result grep -eiv "\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\b" in.txt > out.txt this removes every line containing email pattern. want emails gone. thank you for substitution utilize sed not grep : sed -r 's/\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\b//ig' in.txt > out.txt regex email sed grep pattern-matching

ruby - Issue with OAUTH in Rails 4 using Spotify -

ruby - Issue with OAUTH in Rails 4 using Spotify - been stuck couple days now. devise, omniauth, spotify. i'm trying allow users signin/signup spotify. says redirect uri invalid, have set 'http://localhost:3000/users/auth/spotify/callback/' on spotify website. here's error... reasons doing 2 omniauth requests may because have gem 'omniauth' , gem 'omniauth-oauth2' i'll show below. started "/users/auth/spotify" 127.0.0.1 @ 2015-04-09 10:20:31 -0500 started "/users/auth/spotify" 127.0.0.1 @ 2015-04-09 10:20:31 -0500 i, [2015-04-09t10:20:31.062564 #63684] info -- omniauth: (spotify) request phase initiated. started "/users/auth/spotify" 127.0.0.1 @ 2015-04-09 10:20:34 -0500 started "/users/auth/spotify" 127.0.0.1 @ 2015-04-09 10:20:34 -0500 i, [2015-04-09t10:20:34.782951 #63684] info -- omniauth: (spotify) request phase initiated. started "/users/auth/spotify/callback?code=stuff&sta...

php - Is it necessary to use a procedure or function for sequential query with persistent connection -

php - Is it necessary to use a procedure or function for sequential query with persistent connection - i using postgresql , php within codeigniter framework application. are there sequential query require order of 1 insert, 1 update , 1 select? is necessary utilize procedure or function when having persistent connection database sequential database queries? persistent connection keeping 'pool' faster use, automatic management of connection usage , other associated features, not overlook fact saves overhead time of otherwise making connection each time db query needing execution. select should not need function or procedure unless a. depending on preceding dml operations not want 'dirty read' i.e. want insert / update operations go success , fire select. b. when transforming result of select heavily e.g. selecting 3-4 tables, massaging info in-memory , applying business rules etc. before returning final outcome. yes, advisable encapsulate i/u/d (dml ...

parsing - How to Calculate LRC in Java -

parsing - How to Calculate LRC in Java - my message protocol follows: stx: 0x02 etx: 0x03 dle: 0x10 (delimiter used in front end of 0x2, 0x3 or 0x10 info bytes , not stx, etx or dle). data: values 0x02, 0x03 or 0x10 delimited avoid confusion stx, etx , dle lrc: calculates 'xor' , excludes dles , stx includes etx. also, lrc values not delimited if 0x2, 0x3 or 0x10. here info test message testing: byte[] testmessage1 = { 0x02, // stx 0x10,0x2,0xa,0x10,0x10,0x7,0x8, // info 02, a, 10, 7, 8 0x03, // etx 0x2^0xa^0x10^0x7^0x8^0x03 // lrc calculated info (with dle removed) plus etx }; here lrc calculation have: public static byte calculatelrc(byte[] bytes) { byte lrc = 0; (int = 1; < bytes.length; i++) { lrc ^= bytes[i]; } homecoming lrc; } how lrc calculation of test byte message according protocol check if valid message, , info before not corrupted? very broadly speaking, parsing works state va...

How to parse an item in a list containing two floats and omit its parentheses in Python -

How to parse an item in a list containing two floats and omit its parentheses in Python - this question has reply here: unpacking function argument 2 answers so have list containing floats stored so: points = [(0.06 , -4.00), (3.76, 0.02), (7.53, 0.09), (26.28, 1.15)] so index[0] == (0.06, -4.00) and pass them 1 1 function accepts parameters in format point(x,y) so @ first thought had solution with for item in points: p = point(item) i realised providing function with point((0.06, -4.00)) which leaves function wanting 1 more parameter, seeing thinks 'x' variable. have seen string stripping, can't seem convert indices of points float after done stripping. think may due comma interfering. some help or hints appreciated! you can do: for x, y in points: p = point(x, y) or this: for item in points: p = point...

c# - FlowLayoutPanel's ScrollBar disappears after change in size -

c# - FlowLayoutPanel's ScrollBar disappears after change in size - i utilize code add together objects controls list of flowlayoutpanel. when controls added, vertical scroll bar appears (if necessary) set autoscroll true. i have event handler: private void form1_resize(object sender, eventargs e) { resultsflow.width = this.width - resultsflow.left; resultsflow.height = querysetuppanel.height = this.height; } when resize form, scroll bar disappears regardless of content's height beingness more panel's height. i tried setting minimum , maximum size both form , panel suggested in similar question, doesn't work mine. also, when restore window maximum state normal, panel's content don't repositioned properly. i'm pretty sure i'm resizing panels correctly based on positioning. does has thought going on? c# resize scrollbar flowlayoutpanel

java - Force Download CSV from Spring Controller -

java - Force Download CSV from Spring Controller - follow question last issue has since been resolved. i'm trying download file via spring @controller returning filesystemresource . receive valid http 200 response , can view of file's content in browser, never receive prompt download file. here's method: @requestmapping(method = requestmethod.get, headers="accept=*/*", value = "/download/{filename:.+}", produces = mediatype.application_octet_stream_value) @responsebody public filesystemresource download(@pathvariable string filename, httpservletresponse response) throws ioexception { file file = new file(path + '/' + filename); response.setcontentlength((int)filename.length()); response.setcontenttype("application/force-download"); response.setheader("content-disposition","attachment; filename=\"" + filename + "\"");//filename); homecoming new filesystemresource(fi...

upgrading Ruby on Openshift (Python Cartridge) -

upgrading Ruby on Openshift (Python Cartridge) - i'm working on flask app + deploying redhat openshift using python 2.7 cartridge. need utilize ruby cli tools create & upload iron.io workers, cli tool requires ruby 1.9.2 , cart has ruby 1.8.7. i can't install rvm / rbenv via sshing gear, because openshift won't give root access. so, there way install ruby on openshift without sudo or sol? (somebody @ iron.io suggested using iron.io via docker, seems overkill scheduling sms texts.) you can't update ruby cartridge on openshift. have create new app , utilize ruby 1.9 beginning. can utilize like: rhc app create myapp ruby-1.9 python ruby openshift iron.io

Maintain continuity in Git repo when a file's name changes -

Maintain continuity in Git repo when a file's name changes - i have codebase of javascript files utilize drive web site. synchronize many files in deployment, name files appended version number. have "master" file contains current version numbers different components. used generate script tags in html file. i have codebase set git repository. because of way managing version numbers, time deploy new file set, issue git mv file.old-vers.js file.new-vers.js this works in general, except git treats finish new file, , lose history of changes. question: there way tell git maintain continuity? (i.e. though file name has changed, remains same entity) git log can track renames. seek git log --follow path/to/file . git

asp.net mvc - How to build a generic repository -

asp.net mvc - How to build a generic repository - i'm developing web application in asp.net mvc nhibernate. based in articles , tutorials i've found @ google, i'm using repository classes. i have 10 classes , 10 repositories. today figured out 90% of mine repositories equal each other, except class. 1 example: public class promocaorepository:ipromocaorepository { private isession session; public promocaorepository() { this.session = nhibernatesessionfactory.opensession(); } public void add(promocao promocao) { using(itransaction transaction = this.session.begintransaction()) { this.session.save(promocao); transaction.commit(); } } public void edit(promocao promocao) { using(itransaction transaction = this.session.begintransaction()) { this.session.update(promocao); transaction.commit(); } } public void remove(promocao promocao) { us...

c++ - Vectors 2D first usage -

c++ - Vectors 2D first usage - it first time utilize 2d vectors in c++ , seems i'm trying access forbidden location although indexes of loops less size int generate_(vector<int> row,vector<int> column) { int i=1,j=1,k=0,l=0; vector<vector<int > >matrix;//2d vector for(k=0,l=0;l<column.size();l++) { matrix[k][l]=row[l]; cout << matrix[k][l]<<endl; } for(k=0,l=0;l<row.size();l++) matrix[l][k]=column[l]; for(i=1;i<row.size();i++) { for(j=1;j<column.size();j++) { matrix[i][j]=matrix[i][j-1]+matrix[i-1][j]+matrix[i-1][j-1]; } } homecoming matrix[i-1][j-1]; } matrix not initialized, has no elements matrix[k][l] raise exception c++ vector

python list with tuple iterate for existence and get the index -

python list with tuple iterate for existence and get the index - i have python list has tuples, want check if first element of tuple in tuples in list, manage follows: x = [('a',1), ('b',2), ('c',3)] if 'a' in ([y[0] y in x]): //how index of tuple 'a' exist what want in index of tuple 'a' above illustration exist. you can utilize next() : next(i in xrange(0, len(x)) if x[i][0] == 'a') note if a not found, you'll stopiteration exception. can provide default have value returned instead: next((i in xrange(0, len(x)) if x[i][0] == 'd'), -1) demo: >>> next(i in xrange(0, len(x)) if x[i][0] == 'a') 0 >>> next((i in xrange(0, len(x)) if x[i][0] == 'd'), -1) -1 enumerate() can used here index value: >>> next(i i, (a, _) in enumerate(x) if == 'a') 0 >>> next((i i, (a, _) in enumerate(x) if == 'd'), -1) -1 ...

c# - Get records of last week adding by datetime in database -

c# - Get records of last week adding by datetime in database - i'm using asp.net mvc in project. database table includes records. table has datetime column records. want records of lastly week adding. lastlyrecords is: datetime.now = 04.04.2015 lastweekdatetime = 28.04.2015 lastweekdatetime < lastlyrecords < datetime.now have method accepts "start date" , "end date" parameters. call start/end date like: getrecords(datetime.now.addweeks(-1), datetime.now); for there, can have stored procedure fetch records between date range (or similar entity framework or whatever you're using). you can similar in t-sql via getdate() , dateadd(), it's arguably improve range calculation in calling code (because it's more business logic thing info access thing). c# asp.net asp.net-mvc entity-framework model-view-controller

linux - How to write C program that accepts user input that contain both integers and punctuation characters? -

linux - How to write C program that accepts user input that contain both integers and punctuation characters? - solution #include <stdio.h> #include <string.h> int main() { char value[50]; char *end; int sum = 0; long conv; while(conv != 0 ) { printf("enter measurement , unit(ex: 4' or 3\";0' or 0\" when done): "); fgets(value, 50, stdin); conv = strtol(value, &end, 10); if(strstr(value, "\'") != null) { conv = strtol(value, &end, 10); sum = sum + (conv*12); } else if(strstr(value, "\"") != null) { conv = strtol(value, &end, 10); sum = sum + conv; } } printf("total: %d, %s\n", sum, "inches" ); homecoming 0; } update still having problems new program..uns...

ios - Parse Unpin Does Not Remove Object From Local Datastore -

ios - Parse Unpin Does Not Remove Object From Local Datastore - this should work. here 1 of many attempts figured out mytrainingsessions[indexpath.row].unpininbackgroundwithblock{ (succ, e) -> void in if succ == true { // remove table view etc self.mytrainingsessions[indexpath.row].deleteeventually() self.mytrainingsessions.removeatindex(indexpath.row) self.tableview.deleterowsatindexpaths([indexpath], withrowanimation: .fade) // shows object still in datastore! // object should unpinned - appers in result.... var query = pfquery(classname:trainingsession.parseclassname()) query.wherekey(self.usertype(), equalto: pfuser.currentuser()) query.orderbydescending("createdat") query.fromlocaldatastore().ignoreacls() query.findobjectsinbackgroundwithblock { (objects, erro...

Dynamic function calling in Java 8 Streams with Predicate Object -

Dynamic function calling in Java 8 Streams with Predicate Object - here parent class class parent { string attrib1; string attrib2; string attrib3; // getters , setters of 3 fields then created list list<parent> objlist = new arraylist<parent>(); then added number of parent objects objlist. now want filter these objects based on value of fields in class. field name dynamically. want utilize streams purpose. list<parent> temp = objlist.stream() .filter(nesteddo -> nesteddo.getattrib2() == "manu") .collect(collectors.tolist()); here getattrib2() varies. can getattrib1() or getattrib3(). so need dynamic function calling. can accomplish using predicates. unfortunately, don't know predicate object. please explain reply elaborately concepts within it. yes, can create different predicate , utilize them based on condition. predicate<parent> first= e -> e.getattrib1().equals(...

metatrader4 - MQL4 How To Detect Status During Change of Account (Completed Downloading of Historical Trades) -

metatrader4 - MQL4 How To Detect Status During Change of Account (Completed Downloading of Historical Trades) - in mt4, there exists stage/state: when switch accounta accountb, when connection established , init() , start() triggered mt4; before "blinnnggg" (sound) when historical/outstanding trades loaded server. switch account>establish connection>trigger init()/start() events>start downloading of outstanding/historical trades>completed downloading (issue "bliinng" sound). i need know (in mql4) trades completed downloaded tradeserver --to know business relationship empty -vs- still downloading history tradeserver. any pointer appreciated. i've explored istradeallowed() iscontextbusy() , isconnected() . these in "normal" state , init() , start() events fired ok. cannot figure out if history/outstanding trade lists has completed downloading. update: final workaround implemented utilize ordershistorytotal() . apparentl...

Storing Bash Associative Arrays -

Storing Bash Associative Arrays - i want store (and retrieve, of course) bash's associative arrays , looking simple way that. i know possible using on keys: for key in "${!arr[@]}" echo "$key ${arr[$key]}" done retrieving done in loop: declare -a arr while read key value arr[$key]=$value done < store but see set print version of array in style: arr=([key1]="value1" [key2]="value2" ) (unfortunately along other shell variables.) is there simpler way storing , retrieving associative array proposed loop? to save file: declare -p arr > saved.sh (you can utilize typeset instead of declare if prefer.) to load file: source saved.sh arrays bash associative-array data-retrieval storing-information

java - How to insert multiple records generated by select group by query -

java - How to insert multiple records generated by select group by query - the actual sql query generates result based on practicecode , count.as contains multiple rows ,i not able insert database using insert query.please help me this..?? query select practicecode,count(id) ccr empi_ccr_export_preview delflag=0 grouping practicecode code public void doinsertdata2(httpservletrequest request,httpservletresponse response, resultset rs92, resultset rs102,resultset rs112) { seek { while(rs9.next()&& rs10.next()&& rs11.next()) { integer t1=integer.parseint(rs9.getstring("practicecode")); integer t2=integer.parseint(rs9.getstring("ccr")); integer t3=integer.parseint(rs10.getstring("optinpracticecode")); integer t4=integer.parseint(rs10.getstring("lab")); integer t5=integer.parseint(rs11.getstring("sourceprac...

Is there a way to undo git reset if files are not added? -

Is there a way to undo git reset if files are not added? - i stupidly ran git reset --hard on branch. in wrong branch. unfortunately, didn't perform git add together . . there way work? no. not believe there method local code if never added local or git repository @ point. if added @ point, utilize git fsck lastly deleted info added @ point. there stack overflow here talking possibility git

java - Ant build XML not copying .so files -

java - Ant build XML not copying .so files - i'm trying run re-create command within ant build xml file build 3rd party software source. i've tried command numerous ways various results. attempt 1 (out of box): <copy file="${result.grep_out}" tofile="${build.libpcap.so}" /> this fails next error: build failed /home/pi/mydir/build.xml:612: utilize resource collection re-create directories. so seems ".so" files (which beingness copied in case) considered special file, , cannot treated normal file. attempt 2: <copy todir="${build.libpcap.so}"> <fileset dir="${result.grep_out}" /> </copy> this didn't cause build fail on line, did cause problems later .so file beingness copied took form of dir, not file @ all, , rendered useless. attempt 3: changing to: <copy tofile="${build.libpcap.so}"> <fileset dir="${result.grep_out}" /> ...

Scroll the screen to bottom without scrollview and without ID and without firstChild android-espresso automation -

Scroll the screen to bottom without scrollview and without ID and without firstChild android-espresso automation - i want scroll bottom of current screen displayed, but application don't have scrollview. application have horizontalscrollview out of context. using onview, tablelayout id in screen. throws error matches multiple views in hierarchy. using onview, getting firstchild() still throws error cannot perform operation, error performing 'scroll to' on view 'with first kid view of type parentmatcher'. tried ondata(hastostring(startswith(). throws error matches multiple views in hierarchy. tried other ways getting current monitor , activity still didn't work. ok, can suggest, based on scanty info in question: easy approach (but not correct) - swipe int gridview go bottom: onview(withid(r.id.gridview_id)).perform(swipeup()); easy approach: ondata(instanceof(object_in_the_row.class)) .inadapterview(withid(r.id.gridview_id)) ....

Ada - How to control decimal places when printing Duration data type? -

Ada - How to control decimal places when printing Duration data type? - this print statement: timeinmili: duration; timeinmili := (finish - start)*1000; put_line(duration'image(timeinmili)); (multiplying 1000 alter in milliseconds seconds) the above produces alot of decimal places. can please show me illustration of how print set number of decimal places. ada.text_io.fixed_io generic bundle fix-point types provides improve command on output format 'image attribute. an example: with ada.text_io; utilize ada.text_io; procedure foo bundle duration_io new fixed_io(duration); timeinmili: duration := 1.0 / 3.0; begin duration_io.put(timeinmili, fore => 0, aft => 2); new_line; end foo; output: 0.33 ada

ios8 - Working with Photo Library: How do I add/retrieve a location per photo? -

ios8 - Working with Photo Library: How do I add/retrieve a location per photo? - i'm trying location of photo via ios 8's photo library. doc says phasset class has 'location' attribute. tried view 'location' via xcode v6.3 attached itouch running ios 8.3... assessing itouch photo library: (lldb) po asset 5c9845f2-6bfd-410b-8222-ffbce5ffd4a8/l0/001 mediatype=1/0, assetsource=6, (3008x2000), creationdate=2015-04-05 22:40:28 +0000, location=0, hidden=0, favorite=0 (lldb) po asset.creationdate 2015-04-05 22:40:28 +0000 (lldb) po asset.location error: :1:1: error: 'phasset' not have fellow member named 'location' asset.location ^ ~~~~~~~~ though see 'location' attribute within 'asset' object, can't access it...apparently there's no 'location' data. questions: 1) why debugger phasset doesn't have 'location' attribute when can see (...having 0 value; , described ...

c - get pointer of functions for use on other fuctions -

c - get pointer of functions for use on other fuctions - i need help i want homecoming string in function , utilize on do this? char *randstring() { int n = (0 + rand() % ( 4 - 0 )); char cadena[5][100] ={ {"duck"}, {"taxi"}, {"hola mundo!"}, {"paris"}, {"lexugon"} }; homecoming cadena[n] ; } and want on main function , send function user... int main (){ srand(time(null)); int contador = 0; /*while ( contador < 100 ){ char* ptr = randstring(); printf ( "%s\n", ptr ); contador++; }*/ char *ptr=randstring(); compare( ptr ); getchar(); homecoming 0; } you cannot homecoming string comes local array in automatic storage, if declared array static and/or moved declaration outer scope: static char cadena[5][100] ={ {"duck"}, {"taxi"}, {"hola mundo!...

javascript - how to make a three js css3d panorama without a cubemap -

javascript - how to make a three js css3d panorama without a cubemap - i haven't been able find illustration on how this. i've achieved want accomplish using webgl, , i'm making css3d fallback. method used in webgl won't work because css3d can't handle meshes. so there way render panorama in css3d using single panoramic image instead of cubemap? try skydome instead, not need more 1 image. still must processed cube wrapping. http://www.ianww.com/2014/02/17/making-a-skydome-in-three-dot-js/ javascript css3 three.js panoramas

iphone - Reachability Guide for iOS 4 -

iphone - Reachability Guide for iOS 4 - has found halfway decent guide implementing reachability on ios4? have yet find one. thanks in advance! i have implemented reachability this. download https://developer.apple.com/iphone/library/samplecode/reachability/index.html , add together reachability.h , .m project. add together systemconfiguration framework project. #import "reachability.h" want utilize it. utilize code. -(bool)reachable { reachability *r = [reachability reachabilitywithhostname:@"enbr.co.cc"]; networkstatus internetstatus = [r currentreachabilitystatus]; if(internetstatus == notreachable) { homecoming no; } homecoming yes; } when want check reachability... if ([self reachable]) { nslog(@"reachable"); } else { nslog(@"not reachable"); } here illustration project made. http://dl.dropbox.com/u/3656129/reachabilityexample.zip iphone reachability

ruby on rails - Refresh Same page -

ruby on rails - Refresh Same page - i'm working on project using ruby on rails. want refresh same page when action called or redirect page action called. how do ? you can utilize 'render' refresh page, , 'redirect_to' redirect page going through controller. if want store page redirect to, can use: def store_location session[:return_to] = request.fullpath end def redirect_back_or(default) redirect_to(session[:return_to] || default) clear_return_to end def clear_return_to session[:return_to] = nil end this taken michael hartl's book, uses similar code redirect requested page after user signs in. http://railstutorial.org/chapters/updating-showing-and-deleting-users#sec:friendly_forwarding ruby-on-rails

asp.net - How to create a hierarchical listview -

asp.net - How to create a hierarchical listview - i wondering how create hierarchical listview has main nodes read categories table sub nodes subcategories table. its 1 many relation ship type of template should give listview control? thanks in advance, asp.net listview templates hierarchical

c++ - MSVS 2013 "step into" steps in a non-consistent manner -

c++ - MSVS 2013 "step into" steps in a non-consistent manner - i'm working on pure c++/opengl project without .net or other specific libs, pure c++ syntax pure opengl code. utilize windows 8.1 , msvs 2013 community update 4. set breakpoint , @ debugging paused expected , there continued f10/f11 go line line , skip code wasn't mine. showed line marker line executed, fine until in function , nail f10 skipped 3 lines that, no reason, conditional or otherwise. after f10 returned line supposed go in first place , continued correctly. today after adding files , code, msvs 2013 debugger wouldn't break @ breakpoints @ all. after 6 hours of repairing, uninstalling , installing msvs 2013 express (with btw project incompatible (?!)) , msvs community 2013, debugger paused 1 time again @ breakpoints still f11 jumps randomly @ point. here part of code: void loop() { glclearcolor(0.0f, 0.0f, 0.0f, 1.0f); // breakpoint!, press f10 glclear(gl_color_buff...

mathematical optimization - Moving some of the control points of a bezier curve with minimal change to its length -

mathematical optimization - Moving some of the control points of a bezier curve with minimal change to its length - given bezier curve defined p0 (1-t)^3 + 3p1 (1-t)^2 t + 3p2 (1-t) t^2 + p3 t^3 t=0..1, p0, p1, p2, , p3 command points of bezier curve, find how command points adjacent 1 moved need adjusted alter overall length of bezier curve after command points have been moved minimized. if, example, moving p3, want adjust position p2, if moving p2, want adjust positions of both p1 , p3, since both adjacent moved command point. in case there multiple solutions, solution adequate. i am, ideally, looking algorithm feasible utilize in interactive scheme user may drag 1 point , adjacent ones updated in real time per above description, if no computationally efficient algorithm exists (eg, entire length of resulting bezier curve must recalculated scratch each , every frame), that's matter need know, consider if costs incurred create such interactive scheme non-viable....

change url on scrolling using jquery/javascript -

change url on scrolling using jquery/javascript - i want alter url when scrolling bar without using # . code:- <a class = "section" href = "#first" > first paragraph < /a> < p > < /p> < class = "section" href = "#second" > sec paragraph < /a> < p > < /p> < class = "section" href = "#third" > 3rd paragraph < /a> < p > < /p> < class = "section" href = "#fourth" > 4th paragraph < /a> function isscrolledintoview(elem) { var docviewtop = $(window).scrolltop(); var docviewbottom = docviewtop + $(window).height(); var elemtop = $(elem).offset().top; var elembottom = elemtop + $(elem).height(); homecoming ((elembottom <= docviewbottom) && (elemtop >= docviewtop)); } $(window).scroll(function(e) { var anchors = $('.section...

java - Filling a JPanel with JRadioButtons using HashMap -

java - Filling a JPanel with JRadioButtons using HashMap - i've been stuck on trying figure out how create popout window dynamically created based on array's content , i'm i'm missing vital might help me solve , understand issue. what trying do? i have programme loops through directory, collects folder names , stores in arraylist . problem arises when seek dynamically create window using arraylist . i'm not sure how tackle this. what's current through process i have 3 classes. view, model , command class. array folders stored in model class. retrieve through command class. create new jpanel within actionlistener along hashmap . loop through hashmap adding string names , jradiobutton and seek populate window don't know how. here's piece of code i'm working with: public void actionperformed(actionevent e) { if (e.getsource() == theview.viewbutton) { system.out.println("view button clicked"); ...

laravel 5 - How do I call a batch of Laravel5 commands? -

laravel 5 - How do I call a batch of Laravel5 commands? - i have few complex commands split "sub commands" (example following). site multi-domain, need capability of customizing sequence , composition of sub commands perform (so far had in config under l4). migration l5, i'm refactoring functionality using command bus. example of command sequence: site a: 1) authorizecharge 2) dosomethinga 3) dosomethingb 4) charge site b 1) authorizecharge 2) dosomethinga 3) dosomethingc 4) dosomethingd 5) charge each of these line items command it's handler. part clear me (and works fine). how can dispatch elegantly in controller? here tried. fixed version (works)(in controller): $return = $this->dispatch( new dosomethingacommand($form)); $return[] = $this->dispatch( new dosomethingbcommand($form)); variable version (pseudo code): someconfig.php return [ 'dosomethingacommand', 'dosomethingbcommand' ]; app\namesp...

c# - Best way to return value from serial port within a library -

c# - Best way to return value from serial port within a library - i trying send , receive info serial port, , can info datareceived event normally. now, create library, developed send , receive info serial port. don't know how send command , retrieve value 2 different methods. makes me confused, help me, please! static void main(string[] args) { fxreader reader = new fxreader(); reader.comport = port; reader.connect(); console.writeline(reader.setportpower(1)); console.readline(); console.writeline(reader.getportstatus(1)); console.readline(); } public class fxreader : idisposable { private serialport rs232 = null; public string comport { { homecoming rs232.portname; } set { rs232.portname = value; } } public bool isconnected { { homecoming rs232.isopen; } } public f520reader() { rs232 = new serialport(); rs232.baudrat...

Generate odd number to be added as parameter into sql statement vb.net -

Generate odd number to be added as parameter into sql statement vb.net - i working in vb.net windows form applications sql end. trying utilize loop write odd numbers sql column starting 1 , moving amount of rows in datagridview. however, statement not giving me next step , depending on loop placements either miss loop write rows sql database or miss odd number. here code: cn integer = 0 datagridview1.rowcount - 1 dim starttime date = datagridview1.rows(cn).cells(1).value integer = 1 cn 'sql code seek using conn1 new sqlconnection(connstring) conn1.open() using comm1 new sqlcommand("insert table1 (col1, col2, col3, col4, col5) values (@col1, @col2, getdate(), 5, @col5)", conn1) comm1.parameters .addwithvalue("@col1", starttime) .addwithvalue("@col2", combobox1.selectedv...

Return .filter jquery with 2 conditions -

Return .filter jquery with 2 conditions - i want create filter 2 conditions: item.values().course_setor == val ; hasclass('january'); var updatelist = function(val){ if (val) { userlist.filter(function(item) { homecoming item.values().course_setor == val; }); } else { userlist.filter(); } in case, i'm doing 1 condition: return item.values().course_setor == val; i want this: return item.values().course_setor == val && item.values().another_filter == "something"; jquery filter

php - dataTables filter specific column without using footer -

php - dataTables filter specific column without using footer - is there anyway search columns sec col without using filter? i've tried using: "aocolumndefs": [ { "bsearchable": false, "atargets": [ 1 ] }] "searchcols":[null, {"search":""}, null] here finish script: $(document).ready(function(){ otable = $("#roles").datatable({ "processing":"true", "serverside": "true", "ajax": "roles", "columns":[ {data: 'id', name:'id'}, {data: 'name', name:'name'}, {data: 'link', name:'link'} {data: 'actions', name:'actions'} ], "oclasses": { "sfilter": "pull-right", "sfilterinput": "form-control input-rounded ml-sm" }, "dom...

ios - Multiple detail views in master-detail application. How should I approach this? -

ios - Multiple detail views in master-detail application. How should I approach this? - i'm pretty new app development , experimenting master-detail app using swift. have master uitableview have populated array of info (i.e. not static cells) , ready design detail pages each of 100 or items in master tableview. each detail page have own unique combination of text , images, , in mind there 2 approaches can take. the first add together static view controller , segue each item in master tableview. the sec utilize single detail page , alter content of page depending on item in master tableview selected. can comment on these approaches , create recommendations regarding approach take? there performance benefits/detriments of using 1 approach on other? having multiple static detail pages create important difference overall size of app? there seems less thinking involved if used multiple detail pages, single view controller approach much easier manage , add ...

css - Question about VS 2010 web application template (html markup) -

css - Question about VS 2010 web application template (html markup) - in image below, in markup, title of page "welcome sample web site" (not caps). however, in split screen, title shown in caps. the code in css is: h1, h2, h3, h4, h5, h6 { font-size: 1.5em; color: #666666; font-variant: small-caps; text-transform: none; font-weight: 200; margin-bottom: 0px; } h1 { font-size: 1.6em; padding-bottom: 0px; margin-bottom: 0px; } .header h1 { font-weight: 700; margin: 0px; padding: 0px 0px 0px 20px; color:white; border: none; line-height: 2em; font-size: 2em; } i want display title coded in markup (not caps). i seek changing font-variant: small-caps; font-variant: normal; css visual-studio-2010

jenkins - ERROR: Workspace has a .git repository, but it appears to be corrupt -

jenkins - ERROR: Workspace has a .git repository, but it appears to be corrupt - i not able pull code github through jenkins. did seek switch git plugins in jenkins didn't work. no thought issue is..some pointers helpful.. missing plugins or ami using plugins wrong version? class="snippet-code-html lang-html prettyprint-override"> started user anonymous building in workspace /var/lib/jenkins/jobs/testgitcon/workspace checkout:workspace / /var/lib/jenkins/jobs/testgitcon/workspace - hudson.remoting.localchannel@37ff3f85 using strategy: default error: workspace has .git repository, appears corrupt. hudson.plugins.git.gitexception: error performing command: usr/bin/git rev-parse --verify head at hudson.plugins.git.gitapi.launchcommandin(gitapi.java:904) at hudson.plugins.git.gitapi.launchcommand(gitapi.java:858) at hudson.plugins.git.gitapi.launchcommand(gitapi.java:868) at hudson.plugins.git.gitapi.validaterevision(gitapi.java:326) at hudso...