Posts

Showing posts from August, 2015

ant - How to add multiple commands in series in "Execute Windows Batch Command" in Jenkins -

Image
i have requirement need run commands in series in order build project. can have give commands in series in jenkins? how supposed that. if give shown below : how can give commands execute 1 after other. please me. i think it's better execute separate build steps, like: windows batch step: env.bat ant build step: ant build ... windows batch step: force-db.bat

javascript - Angular promise difference localhost vs deployed -

i'm doing call rest service returns true or false. function toplevelclosed($stateparams) { var id = $stateparams.id; return id ? traject.toplevelclosed({id: id}).$promise : false; } var toplevelclosed = { method: 'get', url: trajecturl + ':id/toplevelclosed' }; toplevelclosed $resource method. works localhost. toplevelclosed var 'false', equal value returned rest call. when deployed (to google app engine), result "wrapped in promise" seen in image below. when call rest-service through browserwindow, returns false should. promise result when deployed promise result on localhost why won't work when deployed? the behavior describe expect code. when function returns promise call toplevelclosed($stateparams).then(function(value){ /* value */ }); if instead toplevelclosed returns boolean can access value directly without then(...) . to consistent behavior return promise, this: function toplevelclosed($statep

c++ - Calculate some values using template size_t param -

this question has answer here: template metaprogramming - difference between using enum hack , static const 3 answers what c++ way calculate values using template params? template<typename t, size_t size> class threadsafearray { private: static const size_t block_size = size > 32 ? 16 : 4; static const size_t mutex_count = size / block_size + 1; ... }; or this template<typename t, size_t size> class threadsafearray { private: enum { block_size = size > 32 ? 16 : 4, mutex_count = size / block_size + 1 }; .... }; or somehow else? the enum hack old way provide compile-time computations. used when in class initialization not supportted compilers, static const cannot used. nowadays fixed in modern compilers. preferred way use static const . check this answer more info.

php - How to limit the the length of name to be display and display full name in using tooltip -

if have echo long name out echo "arnold schwarzenegger"; i want limit word length , display first 6 char, , display rest in "..." arnold... how it? , there way display long name when hover cursor on "..."? you asking 2 different questions here. shortening name this has been answered couple of times already, easy syntax be: strlen($name, 0, 10); this shows first 10 characters. "0" stands start. i'm hoping you're using objects this, can add method model , use like: $user->getshortname(); this make doing second part lot easier well. showing tooltip full name depending on structure , architecture; can have original full name , shortened name living in same object or in different variables. depending on choice of tools (jquery, additional plugins want use, etc.), can add tooltip plugin. jquery-ui has nice 1 if may suggest one. adding depends on choice of tools, varies how difficult add tooltip. jqu

How to add export button in pdf form? -

i have form in pdf file on website. access button export pdf form filled customer on website. how can customize pdf file in way? create button in pdf in acrobat pro, double click on open button properties , go actions tab , select ' submit form ' select action drop-down. click add... configure preferences action save , where. more info available here... https://helpx.adobe.com/acrobat/using/setting-action-buttons-pdf-forms.html

java - Is direct buffer required for JNI / external library calls? -

i want pass addresses of java objects (especially byte arrays) system calls , external functions return within 1 jni call. the answer openjdk's own jni functions apparently no - instance readbytes/writebytes io_util used file streams introduce direct buffer / heap malloc related external calls. but, why? checked code in java.nio.bits (copyfromarray) , sun.misc.unsafe ( copymemory ), , it's clear contents of java primitive arrays can accessed directly in ordinary c code without special treatment (such notifying vm memory pinning or dealing non-continuous blocks) long it's within scope of current jni function. seems gc cannot happen when jni method being invoked, if that's true, why readbytes/writebytes make copy of data in c heap? anyone experience on this? i'm not seeking official advice/recommendation openjdk or oracle. not interested in portability or beyond current implementations. pinning array getprimitivearraybytescritical() lightweight, ,

oracle - Vugen: Database connection failed from load runner -

i using vugen 1 version. want connect oracle 11g. please mention complete process did performance of web applications earlier. thanks. the core question whether oracle problem or whether have installation issue loadrunner. fortunately, loadrunner ships sample applications can used control elements determine whether loadrunner or oracle based. look sample applications. flightdb application. odbc based application , tell if loadrunner application installed correctly. record application via odbc. if cannot record flights db application point failed installation or failure meet credentials level required application. anti virus software can antagonistic ability record, disabling may provide benefit. only once flightdb application working should turn oracle application. there, start @ primitive level, sql+ windows application. application basic 1 can get. record oracle virtual user, using sql+ windows application. record sign on in init(), query in action() , lo

jbpm - Suggest opensource BPM engine for low-latency service-task -

currently developed in-house workflow engine non-human tasks. in average,my flow have 20 service-task support 100 tps per 1 host. ( 20 cores intel x86 server ). latency between task in near zero. i'm consider opensource bpm engine replace mine more performance , gui design tool ,gui monitoring. i have no experience in bpm, have researched of them, think focus on human-task. how latency between each service-task. could give suggestion 1 suitable requirement? consider eclipse stardust: https://www.eclipse.org/stardust/ if configure transient processes (or async writing of audit data) low latency possible.(see http://help.eclipse.org/mars/index.jsp?topic=%2forg.eclipse.stardust.docs.dev%2fhtml%2fconcepts%2faudit-trail%2ftransient-procs.html&cp=72_4_6_1 ) we did benchmarks including deferred writing of audit data 20.000 messages per second. bottleneck @ point still oracle rac writing audit data. (see examples environments: https://wiki.eclipse.org/stardus

jsf 2 - JSF: Datatable is not updating -

i learning jsf , stuck on below problem: xhtml class: <h:form><p:inputtext value="#{tempview.tempname}" e:placeholder="search name"> </p:inputtext> <p:commandbutton id="search" value="search" action="#{tempview.searchname()}" update="datatable"> </p:commandbutton> <p:commandbutton value="clear" action="#{tempview.clearsearchcriteria()}" update="datatable"> </p:commandbutton> <p:datatable id="datatable" value="#{tempview.tmplist}" var="tempvar" rowstyleclass="#{tempview.rowstyleclass(tempvar)}" rows="12" paginator="true" paginatortemplate="{currentpagereport} {firstpagelink} {previouspagelink} {pagelinks} {nextpagelink} {lastpagelink} {rowsperpagedropdown}" rowsperpagetemplate="5,10,15" scrollable="true">

javascript - Jquery: time counter until the register will be open -

i need create simple time counter until register open. i have create karate class on each sunday @ 13:00 now want allow users register class 11:00 when counter hits time set ( example 11:00) timer disappear , action (like register button show). i need server time (it can done php). var date = new date("<?php echo date("y-m-d h:i:s"); ?>"); now need create time counter show hourse , minuts left untile 11:00 form server time (when user hit webpage). for example: if server time 10:42 counter show 18 minuts , 00 seconds left. , counter start counting time down. you may try option, can have timer function below: function timer(till, ontimerelapsed) { var = new date(); if (from < till){ console.log(from); settimeout(function() { timer(till, ontimerelapsed); }, 1000); return false; } ontimerelapsed() return true; } you can invoke on page load passing time (date) @ want t

iis 8 - IIS8 Unable to upload files above 2mb -

i've been trying upload files larger 2 mb website running on windows 2012 server iis 8. can upload files under 2 mb not timeout problem, above causes refuse file (any extension). what have done far changing defaults to: <httpruntime maxrequestlength="153600" executiontimeout="900" /> <requestfiltering allowdoubleescaping="true"> <requestlimits maxallowedcontentlength="157286400" /> </requestfiltering> asp max request entity body limit 20000000 from i've read, maxrequestlength in kb, maxallowedcontentlength in bytes , should larger maxrequestlength , asp max request entity body limit in bytes. sadly changes did not fix issue. did modify maxallowedcontentlength setting in web.config? you can increase maximum file size modify maxallowedcontentlength setting in web.config file example below: <system.webserver> <security> <requestfiltering> <requestlimits maxallowedco

Want to simplify Asterisk SIP message flows -

i trying implement sip ua , so, studied asterisk console in debug mode sip. tried call 1 extension (a) extension (b). the initial message flow ringing message, understood, including digest authentication part. these are: (b) >--->invite-----[asterisk] followed series of back-and-forth messages: 401 unauthorized nonce ack invite correct digest trying trying ringing after ringing phone (a) picked up, see following exchange of message: (a) >----> ok >-----> [asterisk] (a) <----< ack<-----< [asterisk] [asterisk] >----- ok ------> (b) (a) >---(re)invite--> [asterisk] [asterisk] <-----ack-------< (b) [asterisk] >---(re)invite--> (b) (a) >---trying -----> [asterisk] [asterisk] <-----ok--------< (b) (a) >-----ok--------> [asterisk] (a) <----ack--------< [aster

gtk - Python Gtk3 : widget type -

Image
i'm newbie in pygobject (gtk3). i'm trying build gui, couldn't identify highlighted areas showing in picture below. what name of widget? the name of widget gtktreeview . have give gtktreemodel containing data.

javascript - Angular ng-options track by overriding ng-model default option -

i have ng-options iterating on object, key of object value need ng-options set to. i set ng-model in controller default select box. using track by breaks ng-model default, stopping track by removes issue introduces default of select box no longer key of object. how can around issue? the html using follows <select class="form-control" ng-change="flightnumber = airline[0]" name="airline" id="airline" ng-model="airline" ng-options="airline (airline, flights) in orderedflights track airline"> </select> in controller have following: var flights = { "airline": { }, "airline 2": { }, "-- no airline selected --": [ { unselected: true } ]; } $scope.orderedflights = flights; $scope.airline = flights["-- no airline selected --"];

android - Using context inside class extending BroadcastReceiver -

when alarm in android goes off, want create alertdialog. also, want create notification, depending on option user clicks in radio buttons on dialog. problem arises when try use context or getapplicationcontext() . this code: public void onreceive(final context context, intent intent) { final charsequence[] items = {" i'm taking dose now! "," remind again in ten minutes. "," ignore now. "}; string dosename = intent.getstringextra("dosename"); toast.maketext(context, "take medicine: " + dosename, toast.length_long).show(); alertdialog.builder builder = new alertdialog.builder(context); builder.settitle("it's time medicine."); builder.setsinglechoiceitems(items, -1, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int item) { switch(item) { case 0: toast.maketext(context, "good.", toas

c# - ASP.Net VB - Linq to XML group by child element value -

i need group values based on child element value. below example of xml <matchday date="2016-05-09"> <match id="1288348"> <home id="13" name="club1"/> <away id="14" name="club2"/> <information> <country>england</country> </information> </match> <match id="1288349"> <home id="15" name="club3"/> <away id="16" name="club4"/> <information> <country>england</country> </information> </match> <match id="1288350"> <home id="17" name="club5"/> <away id="18" name="club6"/> <information> <country>italy</country> </information> </match> <match id="1288351"&g

templates - C++ map erase using forward and reverse iterators -

i have template function this template<typename t> void foo(t start , t end) { while(start != end) { if(cond) m.erase(start); start++; } } now have pass both forward , reverse iterator typename. 2 separate calls in 1 forward , 1 reverse iterator. how do ? first of all, let me reiterate logicstuff's comment: should try pass in compatible iterators instead. if really , really , really have no alternative doing way doing right now, use template functions: #include <vector> #include <iostream> // used when both iterators have same type template <typename t> void foo(t begin, t end) { (; begin != end; ++begin) { std::cout << " " << *begin; } } // overload forward begin , reverse end template <typename t> void foo(t begin, std::reverse_iterator<t> end) { foo(begin, end.base()); } // overload reverse begin , forward end template <typename t> void foo(std::reverse_it

wifi - Need help fixing "Failed to associate" error in Reaver -

i learning ethical hacking via online course. during practice, cracking wifi password of own router, getting following error: warning: failed associate xxxxxxxx (essid: xxx) can guide me how fix issue? device in monitor mode , command using is: reaver -i wlan0mon -b xxxxxxx -vv after -b should insert mac address of router. may able find if run " airodump-ng wlan0mon "; make sure device in monitor mode. airodump-ng comes kali, if you're using kali linux you'll not have trouble using command. remember, not try if you're not allowed access network you're trying to.

javascript - addEventListener and angularjs promise : wrap it up -

i trying wrap head around on drawing line between event listeners/handlers , resolution of promise angularjs. i'm using preloadjs in angularjs service dealing audio. service used dependency service needs able perform actions once files have been preloaded (hence use of promise). but have no clue left on how wrap together... so, classical bit of code : // event handlers audio.queue.addeventlistener('fileload', function(event) { console.log('charging file', event); // things while loading (.notify) }); audio.queue.addeventlistener('complete', function(event) { console.log('file loaded', event); // things once it's loaded (.resolve) }); audio.queue.addeventlistener('error', function(event) { console.log('error while charging file', event); // things in case of error (.reject) }); // preload file audio.queue.loadfile({id: 'test', src: 'test.mp3'}); what ? a. $q.all on array of promises fe

java - How to include/exclude field in json(Jackson - conversion from Object to Json) while converting on the basis of some property in spring framework? -

let class be public class student{ (annotate such field included version 1 , excluded others while serializing json) private int id; private string name; } is there method in spring achieve this?

c# - How do I round a decimal value to 2 decimal places (for output on a page) -

when displaying value of decimal .tostring() , it's accurate 15 decimal places, , since i'm using represent dollars , cents, want output 2 decimal places. do use variation of .tostring() this? decimalvar.tostring ("#.##"); // returns "" when decimalvar == 0 or decimalvar.tostring ("0.##"); // returns "0" when decimalvar == 0

angularjs - Assert the text present in a disable text box using selenium webdriver -

i have following text field , disabled. have text value 'city1'. need verify 'city1' displayed in text box. .getattribute('value') , .gettext not working. <input type="text" autofocus="" disabled="disabled" ng-model="sitedetails.streetaddr" class="form-control ic-filterdropdown ng-pristine ng-valid"> you can try yourelement.getattribute("textcontent / innerhtml / innertext /value") .. 1 of should work

python - str object has no attribute '*' -

i wanna update password of user have error str object has no attribute '*' if request.method == 'post': form = resetpwdform(request.post) if form.is_valid(): email = form.cleaned_data['email'] passwordnew = form.cleaned_data['passwordnew'] passwordconfirm = form.cleaned_data['passwordconfirm'] #actual password ok if passwordconfirm == passwordnew: #new password match confirm u = request.post.get('username', '') u.set_password(passwordnew) u.save() the problem on line u.set_password(passwordnew) . the u not instance of user model intended string value coming post form. have user instance due username got in form field u = user.objects.get(username=request.post.get('username', '')) you have handle situation when there no such user given username try: u = user.objects.get(

delphi - incompatible types pwidechar and string ShellExecute -

i try compress files using winrar command line, when add variable in command line these error incompatible types 'pwidechar' , 'string' ! i convert sdate variable widechar it's not work !! how can fix ! procedure tform1.button1click(sender: tobject); var mydate : tdatetime; sdate : string; begin mydate:= now-7; sdate := formatdatetime('yyyy/mm/dd',mydate); shellexecute(0, 'open', pchar('c:\program files\winrar\winrar.exe'), 'a -r -ta'+ pchar(sdate) +' d:\xlsfiles.rar d:\*.xls*', nil, sw_show); end; the text arguments of shellexecute of type pchar . supply string argument number 4. the error message clear. know inspecting declaration of shellexecute problematic argument of type pchar (an alias pwidechar ). , error message tells you passing string . instead of 'a -r -ta'+ pchar(sdate) +' d:\xlsfiles.rar d:\*.xls*' pass pchar('a -r -ta'+ sdate +' d:\xlsfiles.rar

cluster analysis - Compare the clustering algorithms in R -

i have implement 3 clustering algorithms in r (pam, k-means , hierarchical). want find parameters produce best results of each algorithm. i have no idea how in r. does know how it? thank help. you need statistic can calculated 3 clustering methods bic criterion. the model lowest bic best. criterion should used caution, overfitting frequent problem.

r - mailR: How to supress Java-Object message after sending email? -

i'm using code below send authenticated email documented in https://github.com/rpremraj/mailr . everything works looking suppress java-object message below once it's sent won't run via batch file. is possible? [1] "java-object{org.apache.commons.mail.multipartemail@6b09bb57}" send.mail(from = "sender@gmail.com", = c("recipient1@gmail.com", "recipient 2 <recipient2@gmail.com>"), replyto = c("reply else <someone.else@gmail.com>") subject = "subject of email", body = "body of email", smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "gmail_username", passwd = "password", ssl = true), authenticate = true, send = true) thanks lukaa!! wrap send.mail(...) in invisible() did trick!!

ruby - Rails - creating a protected default category -

i create special category posts, default , has 3 distinct features: it assigned default every created post it assigned dependent posts upon destruction of parent category it protected deletion anyone so first point easy implement, not focus on here the second point more puzzling. guessing should go category model: before_destroy :move_dependent_posts def move_dependent_posts #no idea goes here end same problem third point: have check, if category being deleted has id of, say, 1, , after throw error? before_destroy :protect_default_category def protect_default_category return false if category.id(5) #won't work, of course end point 2: before_destroy :move_dependent_posts def move_dependent_posts default_category = category.default_category # find default category here posts.each { |post| post.update_attribute(:category, default_category) } end point 3: before_destroy :protect_default_category def protect_default_category throw "d

c# - creating standard tiles with background image from internet -

i want create standarttile background image direct website, and fine in wp8, same code not work in wp7 here code below: void settile(string title, string iconpath1x1, string iconpath2x2, string iconpath4x2, string iconpath2x2back, string iconpath4x2back, string widecontent, string targeturi) { standardtiledata standarddata = new standardtiledata() { //iconpath2x2 = "http://i.imgur.com/something.png" title = title + "_", backgroundimage = new uri(iconpath2x2, urikind.relativeorabsolute), backcontent = "", backtitle = title + "_", backbackgroundimage = new uri(iconpath1x1, urikind.absolute) }; shelltile tiletopin = shelltile.activetiles.firstordefault( x => x.navigationuri.tostring().contains(targeturi)); if (tiletopin == null) { shelltile.create( new uri(targeturi,

c# - Treeview adding controls to outputted Root node -

Image
i working on project required add button root node of treeview control, looks currently achieve following in node.text property treenode.text = string.format("<span style=\"width: 220px; display: inline-block;\">{0}</span> <input type=\"button\" value=\"go\" onclick=\"treerootgobuttononclick('" + tree + "','" + treenode.value + "','" + treenode.text + "')\" style=\"display:none; height: 20px; float:right;\" />", treenode.text); this works desired in ie not in chrome or other browser firing event anchor tag button sitting in, below <td class="treeview_rootnode treeview_node" style="white-space:nowrap;"> <a class="treeview_rootnode treeview_node" href="javascript:__dopostback('ctl00$uxmastercontentplaceholder$uxtreeviewcollaspsiblepanel$ctl00$uxtreeview','scl^pa')" id="ux

java - How to get Additional fields in the JWT token in security context of Resource Server -

i trying implement spring security oauth2 in application. configuration working except not able additional fields of jwt token in resource server security context object. here configuration: authorization server: public class springsecurityconfig extends authorizationserverconfigureradapter { @autowired @qualifier("authenticationmanagerbean") private authenticationmanager authenticationmanager; @override public void configure(final clientdetailsserviceconfigurer clients) throws exception { clients.withclientdetails(clientdetailsservice()); } @override public void configure(authorizationserversecurityconfigurer oauthserver) throws exception { oauthserver.allowformauthenticationforclients().tokenkeyaccess("permitall()") .checktokenaccess("isauthenticated()"); } @override public void configure(authorizationserverendpointsconfigurer endpoints) throws exception { e

c++ srand() not working -

i didn't understand said here: srand(time(null)) doesn't change seed value quick enough , supposed use srand() generate different random number every time keep getting same number, suggestions? #include <iostream> #include <time.h> using namespace std; int main() { int n, num; cout<<"enter number:\n"; cout<<"n= "<<n<<endl; cin>>num; srand(time(null)); n= rand()%10+1; if(n==num) cout<<"win\n"; else cout<<"lose\n"; return 0; } cout<<"n= "<<n<<endl; here printing n before initialization exhibits undefined behavior . solution print after n= rand()%10+1;

android - app:dexDebug - UNEXPECTED TOP-LEVEL EXCEPTION - on AsyncTask -

oh how hate error. i'm getting dreaded dexdebug error, time around have no idea how fix it. the exact error is: information:gradle tasks [:app:assembledebug] :app:prebuild up-to-date :app:predebugbuild up-to-date :app:checkdebugmanifest :app:prereleasebuild up-to-date :app:preparecomandroidsupportappcompatv72221library up-to-date :app:preparecomandroidsupportsupportv42300library up-to-date :app:preparedebugdependencies :app:compiledebugaidl up-to-date :app:compiledebugrenderscript up-to-date :app:generatedebugbuildconfig up-to-date :app:generatedebugassets up-to-date :app:mergedebugassets up-to-date :app:generatedebugresvalues up-to-date :app:generatedebugresources up-to-date :app:mergedebugresources up-to-date :app:processdebugmanifest up-to-date :app:processdebugresources up-to-date :app:generatedebugsources up-to-date :app:processdebugjavares up-to-date :app:compiledebugjavawithjavac note: input files use or override deprecated api. note: recompile -xlint:deprecation

javascript - electron-builder vs electron-packager -

what main difference between electron-builder , electron-packager . there example projects both? better standalone .exe application build? electron-packager was (update: changed in commit: "refactor: merge electron-packager") used electron-builder. this article states if want go town, take @ electron-builder takes packages produced electron-packager , creates automated installers. electron-builder example electron-builder react boilerplate project electron-packager react boilerplate project , although there github issue use electron-builder .

ios - Make elements in UITableVew Custom cell touchable -

i have uitableview custom cell xib. custom cell has 2 labels , 1 uitextview. works fine, noticed when press on labels or uitextview, nothing happens. when press area of cell not covered labels or uitextview cell respond. how can make cell respond touched in cell? thanks, dan. yeah forgot select interaction option in interface builder. lol...

interface - how to append int value to GET url of retrofit in android -

i have following url http://54.169.227.89:90/dataaccessservice.svc/getproducts/2 wanted use retrofit method how append 2 company id sharepreference during login here ma interface code public interface productsget { string company_id = orderapplication.companyid_new; @get("/dataaccessservice.svc/getproducts/") public void getproducts( callback<list<productsnew>> response); } in order make end point dynamic either can implementing endpoint , make use of seturl() or can use url manipulation block surrounded { , } . int company_id = orderapplication.companyid_new; @get("/dataaccessservice.svc/getproducts/{company_id}" public void getproducts( @path("companyid") int companyid,callback<list<productsnew>> response); yourreference.getproducts(company_id,new callback...)

android - Recycler Item not giving feedback when clicked -

this row item using on recycler view: <relativelayout android:id="@+id/requestcard" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingtop="16sp" android:paddingbottom="16sp" android:background="?android:attr/selectableitembackground" android:descendantfocusability="blocksdescendants" android:clickable="true"> <!--<de.hdodenhof.circleimageview.circleimageview--> <!--android:id="@+id/avatar"--> <!--android:layout_width="@dimen/list_item_avatar_size"--> <!--android:layout_height="@dimen/list_item_avatar_size"--> <!--android:layout_marginright="16dp"/>--> <textview android:id="@+id/t

java - Hibernate do a projection of count alias -

here code: class a{ integer id string name set<b> bs; //getters , setters } class b{ integer id; a; //getters , setters } i need consult rows of a, , each row need know hoy many b reference a. i have sql query, dont know how hibernate in java simplificated query: select a.id y0_, ( select count(*) b b b.c47=a.id , b.fdl='n' ) count, a inner join c c on a.operario=c.id a.did=2 , a.fdl='n' thanks in advance @entity @table(name = "a_table") class { @id @generatedvalue integer id; @column string name; @onetomany(mappedby = "a") set<b> bs; //getters , setters } @entity @table(name = "b_table") class b { @id @generatedvalue integer id; @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "a_id") a; //getters , setters }

Haskell pattern match on tuple length in instances -

i want create data type can take tuple, of either length 2 or 3, , should contain types deriving num , ord. then, want pattern match on length of tuple in type class instances can decide function use based on tuple length. take @ non-compilable, pseudo-code below. there @ least 2 problems: dominates not derivable class i don't know how tuple, e.g. call fitnesses , variable out of data type when pattern matching in instance. code: data fits = i2 (int, int) | f2 (float, float) | i3 (int, int, int) | f3 (float, float, float) data ind = ind { fitnesses :: fits , otherinfo :: string } deriving (dominates) class dominates dominates :: -> -> bool instance dominates ind dominates x@(_,_) y@(_,_) = x `dominates2` y -- takes 2 tuples of length 2 dominates x@(_,_,_) y@(_,_,_) = x `dominates3` y -- takes 2 tuples of length 3 update: data ind = ind { fitnesses :: fits , otherinfo :: string } instan

javascript - Multiply returns a strange result -

this question has answer here: is floating point math broken? 20 answers how deal floating point number precision in javascript? 33 answers i strangest result when multiply 1.09 , 12. 13.080000000000002 instead 13.08!!! causes this? nd solution console.log(1.09*12); regards. as explained here : in javascript numbers ieee 754 floating point numbers. due binary nature of encoding, decimal numbers cannot represented perfect accuracy. analagous how fraction 1/3 cannot accurately represented decimal number finite number of digits. once hit limit of storage you'll need round last digit or down.

Load another page when iframe loads -

hey thx time!!. i want add login page @ website. so, using iframe , centered show username,password , connect button. but, want page load iframe page when user click connect button inside iframe. first, want them add username , password info. , click load, page reloads keeps info (i hope). here code <iframe id="iframe" scrolling="no" src="http://sms.altasoft.gr/panel/index.asp?lang=el&disp_function=user_login&id=5e8a0f4b-063b-4a7a-81fe-99579af44baa"> <p>your browser not support iframes.</p> </iframe> if page loaded iframe uses cookies keep log in information, should work: <script type="text/javascript"> window.onload = function(){ var iframe = document.getelementbyid("iframe"); iframe.onload = function(){ window.location = iframe.src; }; } </script>

Delphi XE4 stringgrid selectcell in FireMonkey -

does know how retrieve column , row when selecting cell in firemonkey stringgrid (in other words, when clicking on cell, want know column/row being selected)...? we using delphi xe4. thanks in advance. to index of current row, use selected property. index of current column, use columnindex property.

ejb - NoClassDefFoundError: Can't instantiate class on application server, works fine locally -

i have ear running on weblogic contains ejb. runs until ejb tries instantiate object of servicefactory - 1 of our own classes. in unit tests, create object of class locally. it's on server error occurs. i'm guessing either build/packaging issue or weblogic 10.3.6 quirk don't know proceed here given dependency exists in ear (in app-inf/lib). i've tried moving dependency contains class root of ear. "class-path: " blank in manifest.mf file ejb , ear, product has run fine until without them. i'm building maven. javax.ejb.ejbexception: do: seems odd quirk of ejb spec. exception is:java.lang.noclassdeffounderror: not initialize class com.company.ts.management.icm.service.servicefactory @ com.oracle.pitchfork.intercept.methodinvocationinvocationcontext.proceed(methodinvocationinvocationcontext.java:110) @ com.company.it.techservices.aae.service.commonservice.bizlog(commonservice.java:37) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ s

javascript - Angular send only changed fields to update method -

i have save method. on click of save want send changed fields instead of since have more 50 fields on page. heavy send fields everytime. api.admin.update({ obsoletedate : adminedit.obsoletedate.$dirty== true?$scope.editobsoletedate:"" }); above checking field dirty value true or false. don't want send value empty if value not changed. other way that? i build object changed properties , send object. make copy of original object before editing , use compare, adapt $dirty. along these lines: function getupdateobject(orig, current) { varchanges = {}; (var prop in orig) { if (prop.indexof("$") != 0 && orig[prop] !== current[prop]) { varchanges[prop] = current[prop]; } } return varchanges ; }; then update code calls function new object changes, assigns whatever primary key i'm working object , sends server. have no idea end is, you'll need http patch in order work. this: func

changing directory whist running python code -

this question has answer here: how set current working directory? 6 answers i have piece of code runs 4 other pieces of code. when codes run write out put writes directory run code in. wondering if there way run code changes directory after every time, here code: loop=np.arange(187761,187854) ext in loop: ext=str(ext) s0='' dcom=["rm *.txt"] dcom=s0.join(dcom) nes=os.system(dcom) a=sys.argv[1] com=['cd /cygdrive/e/desar2.cosmology.illinois.edu+7443/desfiles/desardata/ops/red/', a,'/red/decam_00',ext, '/'] com=s0.join(com) print com sres=os.system(com) com=['python /home/pythoncodes/other4.py ', '00'+ext] com=s0.join(com) print com sres=os.system(com) com=['python /home/pythoncodes/correctedmo.py ', '00'+ext] com=s0.join(com) print com sres=os.system(com) com=['pyth

ember.js - EmberJS - Filtering array removes template auto binding -

see jsfiddle before applying filter array auto binding works perfect. after add filter function array, template not automatically refreshing. to test this. app.fieldroute = ember.route.extend({ setupcontroller: function(controller, model) { //scenario 1 //controller.set('model', app.fields); //scenario 2 controller.set('model', app.fields.filter(function(item, index, enumerable) { if(item.id === model.id) return true; })); } }); run jsfiddle scenario 1(comment scenario 2 , uncomment scenario 1) click "gender" click "add" button add item array , it'll reflect in ui. run jsfiddle again scenario 2. template won't refresh automatically. your scenario 1 works when setting app.fields content since content holds same memory reference of app.fields array. hence push or pop on array reflected content. filtering operation (in setupcontroller) done once when entered route. you can have f

r - Run multiple inputs into a function -

i want run coxph function inputs in myinput ? there way using for-loop in r? myinput [1] "hsa_let_7a_5p" "hsa_let_7b_3p" "hsa_let_7b_5p" "hsa_let_7c_5p" "hsa_let_7d_3p" [6] "hsa_let_7d_5p" "hsa_let_7e_5p" "hsa_let_7f_5p" "hsa_let_7g_5p" "hsa_let_7i_5p" [11] "hsa_mir_100_5p" formula coxph(surv(time, status)~ myinput, data=as.data.frame(test))

amazon web services - how to autoscale node kubernetes -

as know can autoscale on pods here have 2 question: 1. how autoscaling nodes on kubernetes ? 2. how trigger autoscaling group aws ? if go aws asg in web console , select minion asg example: https://us-west-2.console.aws.amazon.com/ec2/autoscaling/home?region=us-west-2#autoscalinggroups:id=kubernetes-dev-minion-group-us-west-2a;view=details then edit asg's min,max should more/less nodes: adjusting num nodes in asg

android - Conversion of PDF files to BMP and print -

i need working android code print pdf files bmp. code had able print text blurry , shrinked difficult read.the device used print small paper width of 384. printed text should clear read. public class pdftoimage { private int viewsize = 384; private string pdferrorcode = null; private string pdfimageerrorcode = null; private string pdfimagesaveerrorcode = null; private string returnerror = null; public string pdftoimage(file pdffilepath) { pdfimage.sshowimages = true; pdfpaint.s_doantialias = true; hardreference.skeepcaches = true; try { randomaccessfile pdfaccessfile = new randomaccessfile(pdffilepath, "r"); byte[] pdfdata = new byte[(int) pdfaccessfile.length()]; pdfaccessfile.readfully(pdfdata); returnerror = pdfloadimages(pdfdata); pdferrorcode = "success";

how to read json response from cloudify rest api using jquery? -

Image
i need fetch json data cloudify rest url (remotehost) http://hostname:8100/service/applications/ . this url returns following json response: { "response": { "petclinic": "" }, "status": "success" } i've tried response code below: $.getjson("http://hostname:8100/service/applications?jsoncallback=?", function (result) { $.each(result, function (i, field) { $("div").append(field + " "); }); }); i checked request net panel in firebug, showing 200 ok status, can't json data. error bellow appears in console: same origin assuming call made same domain (e.g. you're deploying local cloud , , call made locally, , sends request localhost:8100 ), should able succeed performing rest calls, provided remove ?jsoncallback=? request url. this suffix url serves request wrapper function on response, , used jsonp (javascript-object-notation padding)

Is there any way to invoke holding event in wpf while long press the control as like in UWP? -

i have searched lot in internet , found there event called onholding() in winrt , uwp platforms invoke when long press control. there no such event in wpf. please tell me there way handle such event in wpf or not? there mousedown() , mouseup() , touchdown() , touchup() events. if have property: private datetime timeofholdstart { get; set; } which set datetime.now on mousedown() or touchdown() , on mouseup() or touchup() compare length of hold minimum value if(datetime.now.subtract(timeofholdstart) >= new timespan(0,0,1)) { // stuff.. } note, see https://wpf.2000things.com/2013/02/05/749-handling-the-touchenter-and-touchleave-events/ quirks of touch events, example if slide finger control, touchdown() doesn't fired, touchenter() does.