Posts

java - Is there a way to compare lambdas? -

say have list of object defined using lambda expressions (closures). there way inspect them can compared? the code interested in is list<strategy> strategies = getstrategies(); strategy = (strategy) this::a; if (strategies.contains(a)) { // ... the full code is import java.util.arrays; import java.util.list; public class closureequalsmain { interface strategy { void invoke(/*args*/); default boolean equals(object o) { // doesn't compile return closures.equals(this, o); } } public void a() { } public void b() { } public void c() { } public list<strategy> getstrategies() { return arrays.aslist(this::a, this::b, this::c); } private void teststrategies() { list<strategy> strategies = getstrategies(); system.out.println(strategies); strategy = (strategy) this::a; // prints false system.out.println("strategies.contains(thi...

Java BigInteger variable -

in code have check if string valid number following try{ new bigintger(numericstring); }catch(numberformatexception e) { throw numberformatexception; } i know sort of hack/workaround whatever it, wanted know new bigintger(numericstring) must creating object in heap if assign value variable biginteger val = new bigintger(numericstring) variable val stored ? it sounds basic not able imagine difference between two. val reference object itself, object stored in heap , pointer stored in stack. the actual value of val in stack address of object in hep. the new reserved word in java, says reference returned, in first case dont save object usual created in stack collected in short while. in second case, while val still in stack , pointing object, stay in heap

html - how to play youtube video at last when all element is load -

i load youtube video in page , buy play before other element load. page loading speed make slow... <div class="wel_come_msg"> <div class="video_box"> <iframe width="100%" height="315" src="//www.youtube.com/embed/rdm7wstkg8s?autoplay=1" frameborder="0" allowfullscreen></iframe> </div> </div> change iframe to <iframe id="video" width="100%" height="315" frameborder="0" allowfullscreen></iframe> jquery $(document).load(function(){ $("#video").attr("src","http://www.youtube.com/embed/rdm7wstkg8s?autoplay=1") });

javafx - Netbeans giving me the runs -

Image
netbeans javafx not deleting run files after exiting, example: these files created in dist folder when run or debug application within netbeans, , should deleted when quit them, not. does know of solution enable automatic deletion of these folders?

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

so i'm trying install zoneminder , have run under nginx, has few compiled files need run using fast-cgi. these files lack extension. if file has extension, there no issue , nginx interprets file , return 404 if can't find it. if has no extension, assume it's directory , return 404 when can't find sort of index page. here have now: # security camera domain. server { listen 888; server_name mydomain.com; root /srv/http/zm; # enable php support. include php.conf; location / { index index.html index.htm index.php; } # enable cgi support. location ~ ^/cgi-bin/(.+)$ { alias /srv/cgi-bin/zm/; fastcgi_pass unix:/run/fcgiwrap.sock; fastcgi_param script_filename $document_root/$1; include fastcgi.conf; } } the idea is, under cgi-bin directory goes through fastcgi pipe. any idea on howi can fix this? upon closer inspection, realized zoneminder has 2 cgi sc...

c# - Model for confirmations in MVC app -

i have requirement has update start date of period payment. if change it, need check if there transactions outside of period. if there need popup confirmation, saying "are sure want change date 13th of july, 2014. there 18 transactions before date deleted." how handle far pattern goes? @ moment, mvc application controllers have 'get' , 'save' controller method. like, ' transaction(int accountid) ' get, , ' transactions(transactionmodel model) on save. confirmation, need controller method? what's standard doing tis sort of confirmation? adding ' confirmtransaction(transactionmodel model) ' gets called if confirmation required? additionally, i'd same view used.. using modal popup handle confirmation. you can this: when user submits form, stop post, , make ajax request action, @ date field , calculations mention, action return data display in modal. when receive ajax result, can show modal, if user clicks ok, subm...

sql In clause with wildcards (DB2) -

is there anyway use wildcards in clause similar "in", this select * table columnx xxxxxxx ('%a%','%b%')? i know can do: select * table (columnx '%a%' or columnx '%b%') but i'm looking alternative make querystring shorter. btw: i'm not able register custom functions, nor temp tables, should native db2 function. i found similar answer oracle , sqlserver: is there combination of "like" , "in" in sql? there's no native regular expression support in "puresql" db2, can either create own in: http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html or use purexml in: http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.xml.doc/doc/xqrfnmat.html example: where xmlcast(xmlquery('fn:matches(\$text,''^[a-za-z 0-9]*$'')') integer) = 0 yet variant may shorter: select t.* table t join ( values '%a%...