Posts

Showing posts from June, 2013

mongodb - Mongo DB: How to delete documents in mongo db using spark scala -

as per our requirement using mongo db 3.4 spark 2.0 , scala. want delete document reference id through spark scala. we looking option such below, use update logic in 1 line: dfsurvey.write.format("com.mongodb.spark.sql").mode("append").option("replacedocument", "false").save() or other better option directly delete documents in mongo db collection connected through spark , scala.

sql - select case when select query -

i need in solving query. want fetch choicename based on conditions. below code snippet select psc.sku_id, psc.choice_id, psc.option_id, po.*, ( case when po.std_id = 0 (select * prodopt_choices option_id = psc.option_id , choice_id = psc.choice_id) when po.std_id = 1 (select * stdopt_choices option_id = psc.option_id , choice_id = psc.choice_id) ) choicename prod_sku_combos psc left join product_options po on po.option_id = psc.option_id psc.sku_id = #sku_id# any appreciated.. tia if need 1 column (e.g. choicename ), , joins 1:(0-1) can use left join each, , case expression: select psc.sku_id, ps...

javascript - Hide() in jquery doesn't work -

code in index.html <head> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/index.js"></script> </head> <body onload="loadindex()"> <a id="registration" href="register.html"> register </a> </body> code in index.js function loadindex() { alert("page loaded"); $("#registration").hide(); } i alert, link not hidden. have more files, , not work in of them. think mistake not in code, don't know is. your code fine exception of tiny syntax issue. you're missing closing tag </head> . check code below: function loadindex() { alert("page loaded"); $("#registration").hide(); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <head> <script type="text...

Analyzing audio files java -

i'm working on music visualizer in java i'm running conceptual issue i'm having trouble getting around. program reads audio, , i've figured out mathematical operations/drawing functions, issue figuring out how set methods such programs draws visuals while audio plays. this snippet of code reading in audio (after line has been created, , audioinputsystem, saved ais, has been called on file getaudioinputstream): byte[] data = new byte[ext_buff_size]; int bytesread =0; while(bytesread!= -1){ try{ bytesread = ais.read(data,0,data.length); }catch(ioexception e){e.printstacktrace();} if(bytesread>0){ int byteswritten = line.write(data,0,bytesread); } } line.drain(); line.close(); i've tried putting calls other functions @ different places inside while or try no avail. hoping perhaps putting before line.write() work doesn't. it seems solution call read , write functions on increments of file instead of whole thing, i'm afraid...

java - Set onlyIf dependency on Gradle plugin task -

i've implemented gradle plugin in java. followed this tutorial . my plugin class looks follows: public class demoplugin implements plugin<project> { @override public void apply(project project) { project.getextensions().create("demosetting", demopluginextension.class); project.gettasks().create("demo", demotask.class); } } currently intended implement onlyif feature unfortunately did not succeed yet. my try following: public class demoplugin implements plugin<project> { @override public void apply(project project) { demopluginextension ext = project.getextensions().create("demosetting", demopluginextension.class); closure closure = new closure(this) { public object docall() { return ext.isexecutetask(); } }; project.gettasks().create("demoproperties", demotask.class).onlyif(closure); } } the error obse...

typescript - How to implement a variable for an array (Angular 4) -

i'm trying right value skill.team[ variable here ].name angular gets team name skill here's code: html <select [(ngmodel)]="skill.teams[1].name" name="teamname" id="teamname" class="form-control"> <option *ngfor="let skill of skills" [value]="skill.teams[1].name">{{ skill.teams[1].name }}</option> </select> array skill = { _id:'', name:'', teams:[{name:'team1'},{name:'team2'}] } i believe you're looking for; should iterating on skill.teams array *ngfor . changes model skill.name , however, may or may not you're looking for. <select [(ngmodel)]="skill.name" name="teamname" id="teamname" class="form-control"> <option *ngfor="let team of skill.teams" [value]="team.name">{{team.name}}</option> </select...

UI Background from XML not shown corretly in Android Studio -

i'm working on new project support friends gaming clan. ever since i've been working android studio, error never occurred , non-native english man, it's kinda hard google this. whenever i'm setting drawable backgrounds or background colors layouts or widgets in project, not shown in-app! background in xml designer vs. in app very frustrating. there no errors shown, neither in debug nor in android-studio. using same type of drawables in other projects. anyone got before or has advice? ps: progressbar not showing correct here! a little difficult understand question let's see if can you try set octopus logo in imageview, , green colocar background of layout. this. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="m...

React Native - Disable soft keyboard permanently on Android -

is possible not show soft keyboard when textinput gets focused? use case need hide keyboard (for example when use external keyboard) need retain focus on textinput can use (see caret , so). i don't hacking libs, looked inside textinput folder in react-native package , found files thought relevant. first one: https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/reactandroid/src/main/java/com/facebook/react/views/textinput/reacttextinputmanager.java#l96 i replaced code on line 96 this: edittext.setinputtype(inputtype.type_null); edittext.settextisselectable(true); but unfortunately didn't work. then found file: https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/reactandroid/src/main/java/com/facebook/react/views/textinput/reactedittext.java#l215 and commented out line 215, again, didn't help. could point me in correct direction how done? thanks. you can setting flag on mainac...

php - Remove WooCommerce product image from Wordpress -

i’m trying remove woocommerce product image in wp page (i'm using estore template). don’t need product image shown, when remove product image using following php snippet, blank space image supposed be, , looks terrible: remove_action( ‘woocommerce_product_thumbnails’, ‘woocommerce_show_product_thumbnails’, 20 ); i've tried remove image placeholder inserting following css snippet, nothing happens: .single-product .product .summary { width: 100% !important; float: none !important; } could please give me guidance on this? note - code come from: remove woocommerce image just make image gallery area display nothing , 100% should fill area. tried following css on default template , worked me: .single-product .product .images { display:none; } and here example page wondering: https://demo.themegrill.com/estore/product/shoe-for-men/ koda

ruby on rails - ActiveRecord is not reloading nested object after it's updated inside a transaction -

i'm using rails 4 oracle 12c , need update status of user, , use new status in validation model need update: class user has_many :posts def custom_update!(new_status) relevant_posts = user.posts.active_or_something activerecord::base.transaction update!(status: new_status) relevant_posts.each { |post| post.update_stuff! } end end end class post belongs_to :user validate :pesky_validation def update_stuff! # can call other places, need transaction here activerecord::base.transaction update!(some_stuff: 'some value') end end def pesky_validation if user.status == old_status errors.add(:base, 'nope') end end end however, failing , receive validation error pesky_validation , because user inside post doesn't have updated status. the problem is, when first update user, instantiated users inside relevant_posts variable not yet updated, , i'd need fix call reload , however, may...

python - How to convert a list in a float? -

my code has following error: float () argument must string or number, not 'list'. i know ww function list of values, not know how convert float, since ww function. tried list comprehension, following question in: typeerror: float() argument must string or number, not 'list' python but didn't work. def func(n): return 2/(n+1) def ww(n): return [-1 + i*func(n) in range(0,n+1)] def g(x,y): return x**2 + y this g(x,y) spherical harmonics, put simplicity. def integral(n): return [np.pi*func(n)*(1 + math.cos(np.pi*(-1 + i*func(n))))*g(np.pi*i,ww(n)) in range(0,n+1)] your ww function returns list of floats, passed g() . calculation fails because cannot add list number. it not possible "convert list of floats float" without performing sort of operation on numbers — e.g. "add", "subtract", "multiply". however, can convert list numpy array, can operated on whole. multiplying array of ...

regex - Find substring and match until character appears -

i have want extract part comes after url:' , until hit next ' so basicly when doing regexpt far url:[*.'] wrong cause dont want include url in match. from text below there should 2 matches gives me /company/513092-1/jk-servicemontage-ab /company/515413-1/energi-o-inneklimat-i-norrkoping-ab my text file looks like. [{company:'jk servicemontage ab', kundnr:'513092-1', icon:'', url:'/company/513092-1/jk-servicemontage-ab', lat:'59.3159923', long:'18.277547599999934', adress:'ripvägen 4 b 13247 saltsjÖ boo sweden'},{company:'energi & inneklimat norrköping ab', kundnr:'515413-1', icon:'', url:'/company/515413-1/energi-o-inneklimat-i-norrkoping-ab', lat:'58.59852349999999', long:'16.1451237', adress:'fridhemsvägen 3 60213 norrkÖping sweden'}] you use (?<=url:').*?(?=') (?<=url:') - lookbehind url:' .*? - non-gree...

exception - JFreeChart throws java.util.ConcurrentModificationException -

i using jfreechat in order draw charts java. actual drawing part of quite big project, not allow me include more code. me seems exception thrown directly jfreechart component. appreciate if out. there way track down in more detail exception thrown? read exception thrown in cases iteration of lists, while removing elements same list @ same time (which not doing right now). exception in thread "awt-eventqueue-0" java.util.concurrentmodificationexception @ java.util.arraylist$itr.checkforcomodification(arraylist.java:901) @ java.util.arraylist$itr.next(arraylist.java:851) @ org.jfree.chart.plot.xyplot.drawannotations(xyplot.java:3972) @ org.jfree.chart.plot.xyplot.draw(xyplot.java:3339) @ org.jfree.chart.jfreechart.draw(jfreechart.java:1229) @ org.jfree.chart.chartpanel.paintcomponent(chartpanel.java:1624) @ javax.swing.jcomponent.paint(jcomponent.java:1056) @ javax.swing.jcomponent.painttooffscreen(jcomponent.java:5210) @ javax.swing.r...

javascript - Envionment with React-Relay GraphQL and Highcharts -

i complete newbie react-relay, , wanted render quick chart using highcharts. have template relay environment function fetchquery( operation, variables) { return fetch('/graphql', { method: 'post', headers: { 'content-type': 'application/json', }, body: json.stringify({ query: operation.text, variables, }), }).then(response => { return response.json() }); } //relay environment const modernenvironment = new environment({ network: network.create(fetchquery), store: new store(new recordsource()), }); basically, want data graphql server built, , use display data. know pass environment queryrenderer component, how pass environment reactdom.render(element, document.getelementbyid('react-app')); ? element react element create using createelement function in react .. cannot seem find way data graphql, after passing environment, without using queryrenderer... please me?

In teamcity MSbuild.exe incremental clean causing issues -

so have 2 projects copies of each other in teamcity. 1 qa , other stage. difference between 2 pull 2 different branches in repo , use 2 different pubxml's. pubxml's supposedly same except publish url. for publish step use command line build step calls msbuild.exe , uses pubxml publish files. in stage in build log see there incremental clean section several of our dll's being deleted checkout directory. understandably not being copied deployment server. in qa isn't happening, in fact there no incremental clean section @ all. files copied on , no problems. can explain happening? causes incremental clean step occur during msbuild.exe , how can stop it?

How to parse Firefox manual JSON bookmarks backup using jq? -

i've created own json bookmark backup according page : http://kb.mozillazine.org/backing_up_and_restoring_bookmarks_-_firefox#creating_bookmark_backups i won't post json bookmark backup file here (it's big), can create own file , have @ entire file. then testing tried uri of bookmarks (later extract other datas too) didn't work jq -r '.[] | .uri' bookmarks-2017-09-13.json jq: error (at bookmarks-2017-09-13.json:1): cannot index string string "uri" jq -r '.uri' bookmarks-2017-09-13.json null version of firefox : firefox 55.0.2 (64 bits) ubuntu 16.04 lts version of jq : jq-1.5-1-a5b5cbe regards here solution using tostream . tostream # read [[path],value] , [[path]] stream | select(length==2) [$p,$v] # put [path] in $p , value in $v | select($p[-1] == "uri") # keep paths ending in "uri" | $v # emit value if above filter in ...

In Matplotlib, Python - Plotting the amplitude of .wav file on 3d axes -

i have simple script generates amplitude plot .wav file follows:- import matplotlib.pyplot plt scipy.io import wavfile # api fs, data = wavfile.read('audio1.wav') # load data plt.plot(data) # plot entire amplitude curve of audio file plt.show() resulting in following:- link example image script outputs here in 2d image data retrieved audio file provides values plot x , y axes i have been attempting plot on 3d axes, uasing guide:- http://matplotlib.org/examples/mplot3d/lines3d_demo.html but cannot seem extract values x , y axes satisfactorily apply. any ideas??

r - Prediction of value with Bayesian Linear Regression using rstanarm -

Image
i have excel file shown below , converted r data frame shown in r data frame: wanted predict value year-2001 , lag-168 (coloured in red) using values in row of year 2001. know value of year-2001 , lag -168 in there research wanted check accuracy of model. need use bayesian glm "rstanarm" package. can please me solve issue. great how predict if there no predictors in solving bayesian glm's. r dataframe: year lag amount yearno 2001 12 187572 1 2001 24 331364 1 2001 36 354886 1 2001 48 361970 1 2001 60 365251 1 2001 72 366729 1 2001 84 368047 1 2001 96 368775 1 2001 108 369457 1 2001 120 369709 1 2001 132 370048 1 2001 144 370109 1 2001 156 370152 1 2001 168 370262 1 2002 12 193797 2 2002 24 340855 2 2002 36 363227 2 2002 48 369038 2 2002 60 373025 2 2002 72 379143 2 2002 84 381168 2 2002 96 382779 2 2002 108 383456 2 2002 120 383633 2 2002 132 38...

php - Selecting array of unique results from database and using them foreach -

i'm trying array of unique rows database , use them in foreach dropdown menu, have never ever touched arrays or foreach function. thought getting it, code doesn't seem work. couldn't find on site or web on subject turn help. in advance. <select name='item'> <?php $getitems = $data->query('select * items id != "'.$sellid.'"'); while($row = $getitems->fetch_assoc()) { $getitems_2 = $data->query('select * inventory itemid = "'.$row['id'].'"'); $raw = $getitems_2->fetch_assoc(); $raw = array_unique($raw['itemid'])); foreach ($raw $value) { echo "<option value='".$value."'>".$row['name']."</option>"; } } ?>

Group By Having Count > 1 in Linq -

this question has answer here: linq group having count 2 answers i have following data date | projecttypeid -------------- ------------- 10/31/2016 | 1 11/30/2016 | 2 12/31/2016 | 2 01/01/2016 | 3 what linq query dates projecttypeids has dates count > 1 results should yield me following list of dates because projecttypeid = 2 has 2 dates associated it 11/30/2016 12/31/2016 something like: var result = data.groupby(item => item.projecttypeid, item => item.date) .where(group => group.count() > 1) .selectmany(group => group) .tolist();

c# - Returning IEnumerable<T> vs. IQueryable<T> -

what difference between returning iqueryable<t> vs. ienumerable<t> ? iqueryable<customer> custs = c in db.customers c.city == "<city>" select c; ienumerable<customer> custs = c in db.customers c.city == "<city>" select c; will both deferred execution , when should 1 preferred on other? yes, both give deferred execution . the difference iqueryable<t> interface allows linq-to-sql (linq.-to-anything really) work. if further refine query on iqueryable<t> , query executed in database, if possible. for ienumerable<t> case, linq-to-object, meaning objects matching original query have loaded memory database. in code: iqueryable<customer> custs = ...; // later on... var goldcustomers = custs.where(c => c.isgold); that code execute sql select gold customers. following code, on other hand, execute original query in database, filtering out non-gold customers in memory: ienumerable...

Exception in thread "main" java.lang.NoSuchMethodError: org.openqa.selenium.io.FileHandler.unzip(Ljava/io/InputStream;)Ljava/io/File; -

i'm trying run selenium webdriver program, getting following error : exception in thread "main" java.lang.nosuchmethoderror: org.openqa.selenium.io.filehandler.unzip(ljava/io/inputstream;)ljava/io/file; firefox version : 47.0.1 selenium version : 2.53.1 eclipse : oxygen release (4.7.0) import org.apache.xpath.xpathcontext; import org.openqa.selenium.webdriver; import org.openqa.selenium.firefox.firefoxdriver; public class pg1 { public static void main(string[] args) { webdriver driver = new firefoxdriver(); driver.get("http://demo.guru99.com/selenium/newtours/"); system.out.println("the title of page : " + driver.gettitle()); driver.close(); } } this program working fine in laptop, not working on new laptop/setup. can please help. error i'm getting : exception in thread "main" java.lang.nosuchmethoderror: org.openqa.selenium.io.filehan...

Linux, how to read a file with execute permission disabled -

i'm working on homework linux class , we're working on permissions. 1 thing have make owner of directory allowed read , write directory, not able execute. problem i'm running when disable execute can't open of these files using cat. there other command can/have use read and/or write file? it helps i'm running older version of fedora. update: have found can read files if disable execute files individually, not if disable execute directory. accessing directory considered executing it? might have been problem along you simple : (the -x disable execution if file permission) sudo chmod -x file | cat file

regex - Changing Specific attribute -

i want change specific attribute in each file (there total 350 of them) same code. for example, folder 'target' there 350 files have same attribute change. in file a, <revised-comment mcr="">revised effect text 13</revised-comment> in file b, <revised-comment mcr="">revised effect text b 14</revised-comment> in file c, <revised-comment mcr="">revised effect text c 15</revised-comment> i have 350 files have same manner of attribute, values different. here, use "find in file" in sublime text find of revised-comment attributes change this. <revised-comment mcr=""></revised-comment> is there way can regex syntax with? appreciated! this should require simple pattern consisting of literal characters. find: <revised-comment mcr="">.+</revised-comment> replace <revised-comment mcr=""></revised-comm...

php - Get all words or urls with 'www' on a given text -

i need words or urls 'www' on given text. tried far. <?php $needle = 'www'; $sentence = 'this www.google.com http://www.facebook.com website https://www.amazon.com make me awesome'; echo $needle . "<br />"; echo $sentence . "<br /><br />"; if(preg_match('/\b(' . preg_quote($needle, '/') . '\w+)/', $sentence, $match)){ echo "<pre>"; print_r($match); echo "</pre>"; } ?> the output i'm expecting array of values: www.google.com http://www.facebook.com https://www.amazon.com but currently, code not work , output blank array. please me solve this. thanks. try believe desired result $sentence = 'this www.google.com http://www.facebook.com website https://www.amazon.com make me awesome'; $pattern = '@((https?://)?([-\\w]+\\.[-\\w\\.]+)+\\w(:\\d+)?(/([-\\w/_\\.]*(\\?\\s+)?)?)*)@'; preg_match_all($pattern, $sen...

javascript - Momentjs changes the timezone value -

i have these lines of code const starttime = '2017-09-12t09:00:00-04:00'; let s = moment(starttime); s.format() these lines output '2017-09-12t13:00:00+00:00' how can still output previous string? '2017-09-12t09:00:00-04:00' i've tried going through documentation , tried using utcoffset() s.utc().format() after looking @ other answers on stackoverflow i perform add operation on time doesn't seem relevant @ "moment". var starttime = '2017-09-12t09:00:00-04:00'; var s = moment.parsezone(starttime); s = s.add(1, 'd'); console.log(s.format()); //2017-09-13t09:00:00-04:00 starttime = '2017-09-12t09:00:00+00:00'; s = moment.parsezone(starttime); console.log(s.format('yyyy-mm-ddthh:mm:ssz')); <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> moment's string parsing functions moment(string) , mome...

c++ - What is an undefined reference/unresolved external symbol error and how do I fix it? -

what undefined reference/unresolved external symbol errors? common causes , how fix/prevent them? feel free edit/add own. compiling c++ program takes place in several steps, specified 2.2 (credits keith thompson reference) : the precedence among syntax rules of translation specified following phases [see footnote] . physical source file characters mapped, in implementation-defined manner, basic source character set (introducing new-line characters end-of-line indicators) if necessary. [snip] each instance of backslash character (\) followed new-line character deleted, splicing physical source lines form logical source lines. [snip] the source file decomposed preprocessing tokens (2.5) , sequences of white-space characters (including comments). [snip] preprocessing directives executed, macro invocations expanded, , _pragma unary operator expressions executed. [snip] each source character set member in character literal or string literal, e...

html - Used span to style certain words in list. It shifted other element to next row. Why and how to fix? -

i'm working on basic bootstrap project. i used span tag style words in list. this: <li>the agile feline <span class="text-info" style="font-size:30px"><strong> squeezed through</strong></span> fence</li><br> and in doing so, shifted other bullet list(on right hand side) , empty middle column down next row. it's supposed go: list ------ empty middle column ------- list but instead looks this: list empty middle column ------ list (<---with these ones on next line; should on same line) altogether, section looks this: <div class="row bullet" style="margin-top:15px"> <div class="col-md-4 text-left"> <ul class="bg-success"> <li>water a<span class="text-info" style="font-size:30px"><strong> sacred element </strong></span> , fundamental building block of life</li><br> ...

How can I check user admin on routes.rb in Rails? -

i have 2 different views , 2 different controllers in rails app want user redirect specific 1 depending on whether user admin or not. i saw post this one directs page depending on whether user authenticated or not, looking (i using devise): #routes.rb authenticated :user if user.admin root to: "admin/first_page#index", as: :authenticated_root else root "first_page#index", as: :authenticated_root end end root to: "user/sign_in" when user signs in, checks user's admin privilege. if user admin, go admin/first_page#index . if user isn't admin, go first_page#index . i thought of using 1 page , hide features non-admin, like: <% if user.admin%><%= secret_admin_feature %><% end %> keep dry, have own reasons why choose not keep dry in case. is possible admin check routes.rb? if yes, how can done? if not, alternative? i don't think idea check admin privileges in routes. proper way ...

javascript - Pingdom not loading all of my site -

pingdom unable load large portion of page. it's aspx page, no html developer willing touch it, know little bit of windows code, not enough. experienced aspx developer doesn't have clue issue is... i'm worried though, because i've got ranked in position, lot of page won't load on pingdom. doesn't load on homepage, , https:// speedytests .co.uk / driving - test - cancellations could please put url pingdom , give me idea's why it's unable load of page? it's images etc. very worried.. thanks

php - String has the same value repeated after space -

i need remove duplicate, don't know how call exactly $string = "this sample sample" as can see there " this sample " twice in single string. have many strings (with of course different text, repeated again) , need bulk remove duplicate text, don't have idea how this. result want is: $string = "this sample" try this: <?php $text = "this sample sample"; echo $splitstring1 = substr($text, 0, floor(strlen($text) / 2)); ?> i hope can you

algorithm - Can Lower bound of Upper bound of f(n) equal Upper bound of Lower bound of f(n) -

assertion : Ω(o(f(n))) = o(Ω(f(n))) to disprove, need give counter example functions f(n), so let f(n) = n assuming k1 <= n <= k4 ; k1, k4, n > 0 thus : o(n) = k4 ; k3 <= k4 <= k5 k3, k5 > 0 Ω(n) = k1 ; k0 <= k1 <= k2 k1, k2 > 0 now, o(k1) = k2 Ω(k4) = k3 can state, k2 <= k3 hence assertion disapproved ?? if equal stands ?? your argument not correct because portion below; k1 <= n <= k4 ; k1, k4, n > 0 you can not use numbers k1 , k4 prove or disapprove these relations because in asymptotic notations , should use function . you can use below solution disapprove relation: f(n) = n h(n) = o(f(n)) => h(n) <= f(n) i assume ( counterexample ) h(n) = n for right side of relation, assume that f(n) = n g(n) = Ω(f(n)) => f(n) <= g(n) i assume ( counterexample ) g(n) = log n by replacing these functions in first relationship have; Ω(o(f(n))) = o(Ω(f(...

jquery - Bootstrap-confirmation not binding to dynamic elements? -

i have form uses ajax load dynamic content on page. using bootstrap-confirmation use confirm function cancels request. confirmation works when page loaded. here example code: $(function() { $('[data-toggle=confirmation]').confirmation({ rootselector: '[data-toggle=confirmation]', popout: true }); $(document).on('submit', '#some-form', function(e) { e.preventdefault(); submitform(); }); $('.static-element').on('click', '.cancel-request', function() { cancelrequest(); }); } the click event .cancel-request works on dynamic content, confirmation not. i've tried changing selector on click handler document makes no difference. can't find way bind confirmation dynamic element. i've tried creating callback on cancelrequest() , reinitializing bootstrap-confirmation inside made no difference. tried reinializing inside complete: option didn't work eit...

reactjs - some incompatible instantion of Props -

why not work: try flow! function mergetheme<props: {}, t: {}>( component: react.componenttype<{ theme: t } & props>, injectedtheme: t ): react.componenttype<{ theme: t } & props> { const themed = (props: { theme: t } & props) => { let theme: t = injectedtheme; return <component {...props} theme={theme} />; }; return themed; } the error: 11: return <component {...props} theme={theme} />; ^ props of react element `component`. type incompatible 5: function mergetheme<props: {}, t: {}>( ^ incompatible instantiation of `props` 11: return <component {...props} theme={theme} />; ^ props of react element `component`. type incompatible expected param type of 5: function mergetheme<props: {}, t: {}>( ^ incompatible instantiation of `props` but works: try flow! function mergetheme<props: {}, t: {}>( component: react.componenttyp...

dependencies - Is there a task dependency processing framework -

we have requirement process large amount of tasks ( 10 million ) day, tasks submitted task producer , executed task consumers, tasks may have dependencies, means if tasks have same dependency key, need processed 1 one. we have 2 kinds of dependencies: weak dependency : first task same dependency key failed, rest tasks invoked execute. strong dependency :the first task same dependency key failed, rest tasks marked failed , no need execute in consumer side. anyone can advise there open source framework can meet our requirement? thanks in advance.

asp.net mvc - Angular 4 spa template deployment on iis -

i created angular 4 application using vs 2017 angular spa template , works fine in local machine. i'm having issues setting project on server iis. have published files on server, created site on iis , mapped index.cshtml under \views\home\ directory. when browse site i'm getting http error 404.3 - not found. target framework net461 , iis version 8.5 could please resolve issue.

calculated columns - Dynamic jQuery add up totals and shipping and tax for invoice -

i having trouble adding calculations items add subtotal adding shipping input value , tax, e.g.: item + item = subtotal subtotal + shipping = total total + 10% = grandtotal i calling class add items up: $(document).ready(function() { // add new row on invoice var cloned = $('#invoice_tables .clone').clone(); $(".add-row").click(function (e) { e.preventdefault(); cloned.clone().appendto('#invoice_tables'); }); //calculatesum(); $('#invoice_tables').on('change keyup keydown paste', '.txt', function() { // updatetotals(this); calculatesum(); }); //calculatesum(); $('#invoice_table').on('change keyup keydown paste', '.txt', function() { // updatetotals(this); calculatesum(); }); // remove row $('#invoice_tables').on('click', ".delete-row", function(e){ e.preventdefault(); ...

python - How to look up values from another dataset with Tensorflow? -

i got 2 csv datasources. need doing data formatting before building model. =============================================== datasource 1: plant.csv the features of different plants. plantid, int / plantname, str / color, str / size, float / cost, float / category, int / weight, float / expire, int / status, int datasource 2: [201601.csv, 201602.csv, 201603.csv....] monthly order sales of plants plantid, int / salesperson, str / date, datetime / qty, int / price, float / gardener, str / package1, bool / package2, bool / package3, bool =============================== now going join files single file this: plantid, int / plantname, str / color, str / size, float / cost, float / category, int / weight, float / expire, int / status, int / salesperson, str / date, datetime / qty, int / price, float / gardener, str / package1, bool / package2, bool / package3, bool which plantid key. there millions of sales records each month. could advise how make tensorflow...

Butchers algorithm in Jasmin -

i keep getting errors , have been trying print forever seems. ive looked info on jasmin , far can tell there isn't lot of information. code appreciated. i'm supposed use butchers algorithm print jasmin on command line next 10 years of easter. of problem in printing of month , code below..... .class public example/easterdeb .super java/lang/object ; ; standard initializer .method public <init>()v aload_0 invokenonvirtual java/lang/object/<init>()v return .end method .method public static main([ljava/lang/string;)v ; set limits used method .limit locals 20 .limit stack 6 ; setup local variables: ; 1 - printstream object held in java.lang.system.out getstatic java/lang/system/out ljava/io/printstream; astore_1 ; 2 - integer 10 - counter used in loop bipush 10 sipush 2016 istore_2 ;count in 2 istore 4 ;year in 4 ; loop 10 times printing out number loop: ; compute 10 - <local variable...

OpenCV 3.3 compilation fails through visual studio -

i trying compile opencv 3.3. have followed steps in this , this point visual studio compiling code in either debug or release mode. using latest version of cmake. however, both vs 2015 , vs 2017 give me similar errors , haven't been able compile code fully. here logs compilation vs 2017: errors build output logs i appreciate if can me resolve these issues. don't know libraries i'm missing or supposed in visual studio compilation.

python - css working in local but fails after deploying to heroku flask -

i'm running flask app , deploying heroku. changed single line of code in vendor distribution css applying style in needed template page, not work when deployed heroku, while works fine in local. read on precompiling couldn't find 1 flask. i using scroller . there's item in centers elements, namely this: #amazingcarousel-1 .amazingcarousel-item-container { padding: 6px; text-align: center; } testing further seems changing css static folder change text-align locally, , seemed have worked in local because didn't clear cache. there way can deploy static css onto heroku? i added following , deployed changes. <div style="text-align:initial;"> <!--thing don't want aligned--> </div>

java - Instantiate classes of an interface at server startup -

i have set of subscribers need start when server starts up. right i'm instantiating them , calling run method on them in application.java . was thinking wonderful if these instantiated on own, may using custom annotation or belonging interface (get classes of interface , instantiate). way writing new subscriber in future doesn't need create object , call run() on it. wondering if has solved earlier , whether makes sense it. example: i have interface event handlers: interface eventhandler { void process(string data); } and implementation classes: public class cooleventhandler implements eventhandler { public void process(string data) { //handle cool event } } public class hoteventhandler implements eventhandler { public void process(string data) { //handle hot event } } and have subscriber service listens remote apis , if there's data, passes handler: public class pollservice { public static void register(string api, eventhandle...

javascript - How to rerender a component in Vue -

i have sidebar consisted of 3 tabs: home users list when click 'users' tab, router transition this: this.$router.push('index/users') and users component rendered in: <router-view></router-view> now want click users tab again in order fetch latest data.but component won't re-render again, , data doesn't refresh. are there other ways can resolve instead of f5? hope works of components. ps: fetch data in lifecycle hook created(). i had same issue, solved watching router change in component "reload": https://router.vuejs.org/en/essentials/dynamic-matching.html watch: { '$route': 'fetchdata' // call function update data },

Codeigniter Send Data/Parameter to PostgreSQL -

i'am familiar mysql server , try learn postgresql. before, save/update data ci using mssql store procedure sample: my controller $data = array( 'name' => $_post['name'], ); $insert = $this->db->save($data); my model public function save($data){ $sp = "insert ?"; $result = $this->db->query($sp,$data); return $this->db->affected_rows(); } i'am try implement code call postgresql function give me error this error: syntax error @ or near "insert" line 1: insert e'name' this postgresql function create or replace function insert(name varchar(50)) returns refcursor $$ declare nama varchar(50); begin insert dt_anggota values(nama); end; $$ language plpgsql; whats wrong code or function? thank you i found solution code $sp = "select 'function_name' (?)"; $result = $this->db->query($sp,$data); return $this->db->affe...

sql - Trying to Group Rows -

i thought distinct statement group orders.customer_num, doesn't seem case. believe has expression in select statement. new sql. select distinct orders.customer_num "customer number", count(orders.order_num) "number of orders", sum(items.quantity) "total quantity", stock.unit_price "unit price", items.quantity * stock.unit_price "total price" orders, items, stock orders.order_num = items.order_num , items.stock_num = stock.stock_num group orders.customer_num, items.quantity, stock.unit_price order orders.customer_num; attached pic showing getting. my result your stock.unit_price seems unique. logically selects unit_price per item . either need discard stock table , related join conditions or sum up

angular - Ionic 3 Save webservice json to sqlite -

i'm newbie on ionic3. want save generated json webservice sqlite. heard should use plugin called sqlite-porter . don't know hot make service provider? help. this example of json { "book":[ { "title": "book title", "cover_url": "http://xxx.xxx/xxx", "file_url": "http://xxx.xxx/xxx" }, { "title": "book title", "cover_url": "http://xxx.xxx/xxx", "file_url": "http://xxx.xxx/xxx" } ], "country":[ { "country_id" : "country id", "country_name" : "country name" }, { "country_id" : "country id", "country_name" : "country name" } ] }

javascript - How to check if an object contains another object? -

var person = { "name" : "bronn", "description" : { "occupation" : "guardian knight", "age" : 52 } } for(var key in person){ if(person[key] == /*contains json object */){ //do } } i want loop person , check if value contains single data or object. you can use map function or loop , can check using typeof method in javascript. var person = { "name": "bronn", "description": { "occupation": "guardian knight", "age": 52 } } object.keys(person).map(item => { if (typeof person[item] == 'object') { // logic here... console.log(person[item]); } });

c++ - Rendering a second pass yields a different result -

Image
currently i'm trying render multiple passes different shaders in simple opengl application. here's (simplified) code: void initscene() { glviewport(0, 0, mwindowwidth, mwindowheight); glmatrixmode(gl_modelview); glloadidentity(); glmatrixmode(gl_projection); glloadidentity(); glortho(0, mwindowwidth, mwindowheight, 0, -1, 1); mframebuffername = createframebuffer(mwindowwidth, mwindowheight); } void drawscene() { glmatrixmode(gl_modelview); glpushmatrix(); if(drawdirectlytoscreen) { // works fine, image fill whole screen // directly draw screen drawfullscreenquad(); } else { // not work. image first pass small quadrat // draw frame buffer instead of screen glbindframebuffer(gl_framebuffer, mframebuffername); drawfullscreenquad(); glbindframebuffer(gl_framebuffer, 0); // ready second pass bindframebuffertextureandactivateanothershader(); // draw screen drawfullscreenquad(); } glpopmatr...

angular - don't show data in ag-grid -

i using ag-grid in angular4. want show data using api getting method. api ok , getting data in console. can not able show data in ag-grid. not understand problem here. when compile project, there no error shown. project runs in browser , showing header name not show data come api. my ts file: import {component, oninit} '@angular/core'; import {gridoptions} 'ag-grid'; import {http} '@angular/http'; @component({ selector: 'app-my-grid-application', templateurl: './my-grid-application.component.html', styleurls: ['./my-grid-application.component.css'] }) export class mygridapplicationcomponent implements oninit { public gridoptions: gridoptions; public columndefs = []; public rowdata = []; constructor(public http: http) { this.gridoptions = <gridoptions>{ rowdata: [], columndefs: [ { headername: 'id', field: 'id' }, { headername: 'name', field: 'name' ...

ssh - Unable to install puppet enterprise on ubuntu 14.04 as cannot telnet to port 3000 -

i want install puppet enterprise using web based installation. have opened ports required usinf ufw allow cannot install link installation not generated , port 3000 unreachable error displayed. after created tunnel port 3000 , tried got following error when tried telnet: channel 3: open failed: administratively prohibited: open failed i have tried editing sshd_config file , adding permittunnel,allowtcpforwarding same problem. please suggest solution.

php - Stripe payment gateway implementation -

i want validate stripe payment gateway token id before charging customer using token id. can in stripe payment gateway? development language validating token id there 1 way validate token , retrieve token details check here https://stripe.com/docs/api#retrieve_token \stripe\stripe::setapikey("sk_test_*******lfq2"); \stripe\token::retrieve("tok_******gxzwu"); it throws error if invalid token_id passed hope helpful.

c# - How to get mail sent successfully with MailKit IMap? -

i'd know if outbox mail has been sent successfully.. var client = new imapclient(); .... var folders = client.getfolders(client.personalnamespaces[0]); var folder = client.getfolder("已发送");//get sent mail floder in chinese var folderaccess = folder.open(folderaccess.readonly); string path = @"c:\temp\"; (int = folder.count - 1; >= 0; i--) { var message = folder.getmessage(i); } you can't send messages via imap, can send them via smtp. sending messages via smtp not put them imap folder. have put them there yourself.

Hosting a webpage in Google App Engine -

i don't have idea google app engine.i need host html static web page using app engine.how can it? does need install google app engine or can online? what steps need follow? does need install python? please give me idea. in advance

R: How to find the mean of a column in a data frame, that has non-numeric (specifically, dashes '-') as well as numeric numbers -

Image
example of entries in data frame: i need find mean of column in data frame, can't find mean says: " argument not numeric or logical: returning na" the non-numeric entries dash signs, have tried converting them na still struggling produce result mean. can help? try this, assuming data called dat : dat[dat == "-"] <- na mean(dat$population_and_people, na.rm = true]

properties - The 'Content' property is set multiple times -

i have created grid type uniformgrid, data : binding (a list of class sql) my list scrollable, it's great. but, need add fixed button in top , fixed label on bottom, when scroll want see button , label. i have error : 'content' property set multiple times. my code xaml : <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:plutus" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" x:class="plutus.mainwindow" title="mainwindow" height="523.725" width="898" background="#ff3a3939" windowstartuplocation="centerscreen" windowstate="maximized"> <window.resources> <style targettype="scrollbar"> ...

javascript - jQuery UI Snappable Not Returning only Inner Snaps with SnapMode Set -

Image
when set draggable object snap span (doing inner-snaps only) seeing returning adjacent snaps, despite being outside of them. notice snapmode , important part: $(".draggable").draggable({ snap: ".snap", snapmode: "inner", stop: function(event, ui) { /* possible snap targets: */ var snapped = $(this).data('draggable').snapelements; /* pull out snap targets "snapping": */ var snappedto = $.map(snapped, function(element) { return element.snapping ? element.item : null; }); /* display results: */ var result= ''; $.each(snappedto, function(idx, item) { result += $(item).text() + ", "; }); $("#results").html("snapped to: " + (result === '' ? "nothing!" : result)); } }); this based upon question: how find out "snapped to" element jquery ui draggable e...