Posts

Showing posts from September, 2012

hibernate - Jhipster upgrade -

in our organization have several jhipster generated projects, done version 3.0.0 , haven't upgraded them since. i've been working on upgrading 1 of them past 5 days, please find breakdown below: i have tried 3 different approaches: 1.- use jhipster:upgrade tool steps: this process break down several steps such as: 1.- creating local npm folder able install generators different jhipster versions no persmission issues 2.- erasing old installations of yo , jhipster 3.- cloning project , creating dev branches 4.- erase .jhipster folder entities not affected upgrade 5.- once upgrade code runs, need tweak several files/dependencies mvn clean/install works complications after applying these steps, find 2nd level cache hibernate refuses work, asking me include classes in cache, try several fixes/workarounds such as: 1.- deleting liquibase project 2.- configuring databaseconfiguration.java old settings , downloading old versions of libraries ...

html - javascript get scroll of child div -

i have structure this: <div> <div id="scrollid" style="height:100px;"> content here </div> </div> <script> document.getelementbyid("mydiv").addeventlistener("touchstart", myfunction); function myfunction() { // want position } </script> i want distance top, when user start scrolling (actually touching in mobile). final purose implementing pull refresh child div . any idea? try following. <div> <div id="scrollid" style="height:100px;" onscroll="myfunction();"> content here </div> </div> <script> document.getelementbyid("mydiv").addeventlistener("touchstart", myfunction); function myfunction() { document.getelementbyid("scrollid").scrolltop; // want position } </script>

amazon web services - Angular 4 sending extra request for picture element with remote sources -

i developing angular 4 application , using picture element holding images respective pixel densities (1x, 2x, 3x..). storing images in amazon s3, requesting them on oninit() method , using property binding srcset element set source. here's code picture element, <picture> <source srcset="{{image1xwebp}} 1x, {{image2xwebp}} 2x, {{image3xwebp}} 3x" type="image/webp"/> <source srcset="{{image1xdef}} 1x, {{image2xdef}} 2x, {{image3xdef}} 3x" type="image/png"/> <img [src]="image2xdef"/> </picture> but in chrome developer console, in network tab, see additional request before image request name: 1x (or 2x or 3x depending on downloading photo), status: 200 , type: ' text/html url: localhost:3000/1x not requesting url anywhere in code. it doesn't happen when store images locally, instead of amazon s3. and doesn't happen when statically write url in picture element ...

Microsoft.mshtml execCommand("Copy", false, null) returns false on Windows 2012 Server -

i using following code save image c# webbrowser control in windows forms application. use microsoft.mshtml ihtmldocument2 achieve this the following code works fine in windows 8 pc not working in windows 2012 server while running on server 'imgrange.execcommand("copy", false, null);' returns false. , 'bmp' null causing null reference exception. i have google search , did not find solution. anybody please help.. many thanks ihtmldocument2 doc =(ihtmldocument2)webbrowser.document.domdocument; ihtmlcontrolrange imgrange = (ihtmlcontrolrange((htmlbody)doc.body).createcontrolrange(); foreach (ihtmlimgelement img in doc.images) { if (img.src == "image url") //identify image { imgrange.add((ihtmlcontrolelement)img); **imgrange.execcommand("copy", false, null);** //returns false in 2012 server using (bitmap bmp = (bitmap)clipboard.get...

Issue while Fetching data's from DB(DB2) using UDP Value -

i couldn't fetch (select) data db using udp value, whereas i'm able insert data in db. note passing dsn through udp value query set outputroot.xmlnsc.result.data[] = passthru('select empid,name database.{udpvalue}.{schema_name}.{table_name}');

python - pandas and nltk: get most common phrases -

fairly new python , i'm working pandas data frames column full of text. i'm trying take column , use nltk find common phrases (three or 4 word). dat["text_clean"] = dat["description"].str.replace('[^\w\s]','').str.lower() dat["text_clean2"] = dat["text_clean"].apply(word_tokenize) finder = bigramcollocationfinder.from_words(dat["text_clean2"]) finder # bigrams appear 3+ times finder.apply_freq_filter(3) # return 10 n-grams highest pmi print finder.nbest(bigram_measures.pmi, 10) the initial comments seem work fine. however, when attempt use bigramcollocation, throws following error. n [437]: finder = bigramcollocationfinder.from_words(dat["text_clean2"]) finder traceback (most recent call last): file "<ipython-input-437-635c3b3afaf4>", line 1, in <module> finder = bigramcollocationfinder.from_words(dat["text_clean2"]) file "/users/abrah...

javascript - How to increase Column value with Numeric -

i have implemented below component rowid alphabets, need change numberic. in component have implemented there column called rowid, rowid increase when click on + button, if press on ++ parent rowid+starts starting alphabet. following component have implemented. mycomponent. i need implement rowid numberic because alphabets working z only,after z rowid coming special charecters.so need implement functionality numeric.so overcome problem. var newrow = { "rowid": "a" } $scope.componentlist = []; $scope.componentlist.push(angular.copy(newrow)); $scope.addparentrow = function(rowid) { var newgridrow = angular.copy(newrow); var lastchar = getlistofsamelevel(rowid, true); //isparentrow var parentid = rowid.length > 1 ? rowid.slice(0, rowid.length - 1) : ""; newgridrow.rowid = parentid + getnextchar(lastchar); $scope.componentlist.push(newgridrow); } $scope.addchildrow = function(rowid) { var newgridrow = angu...

python - using leaky relu in Tensorflow -

how can change g_h1 = tf.nn.relu(tf.matmul(z, g_w1) + g_b1) leaky relu? have tried looping on tensor using max(value, 0,01*value) typeerror: using tf.tensor python bool not allowed. i tried find source code on relu on tensorflow github can modify leaky relu couldn't find it.. you write 1 based on tf.relu , like: def lrelu(x, alpha): return tf.nn.relu(x) - alpha * tf.nn.relu(-x)

extends - Typescript - How to access base class properties -

i know there others questions subject, issue not same them : checked class , use same way them. extends class class b, , can't access public properties in b. here (simplified) code : export class { propertya: string; constructor() { this.propertya = "some text"; } } import {a} "./a"; export class b extends { constructor() { super(); } static method() { console.log(this.propertya); } } you cannot access this static method. remove static , should work.

php - Displaying Total Stock Valuation By Product Category In WooCoomerce -

Image
i trying total stock valuation category in woocoommerce. anyone have clue how can done? i know it's simple code can't figure out. thanks updated: not simple @ all… but it . see screenshot below: 1) data , calculate: here custom function bit complex sql query each product category related products stock quantity. in foreach loop, add stock quantities product category total stock valuation category. /** * total stock valuation category. * * @param integer $category_id (optional) * @return array category id (int) key , total stock quantity (int) value */ function get_product_cats_stock_qty( $category_id = 0 ){ global $wpdb; // db tables involved $term_tax = $wpdb->prefix . "term_taxonomy"; $term_rel = $wpdb->prefix . "term_relationships"; $postmeta = $wpdb->prefix . "postmeta"; if( 0 != $category_id ) { // 1 defined category $one_category_only = "and $term_tax.te...

Memory issues: Cluster-analysis with very large multi-scaled data in R using Gower distance and k-medoids -

i have large dataframe named 'data' 350000 rows , 138 columns use k-medoids clustering. using code page: http://dpmartin42.github.io/blogposts/r/cluster-mixed-types this code: packages <- c("dplyr", "islr", "cluster", "rtsne", "ggplot2") if (length(setdiff(packages, rownames(installed.packages()))) > 0) { install.packages(setdiff(packages, rownames(installed.packages()))) } rm(packages) library(dplyr) # data cleaning library(islr) # college dataset library(cluster) # gower similarity , pam library(rtsne) # t-sne plot library(ggplot2) # visualization data <- read.csv("data.csv", sep = ";") ## creation of dissimilarity matrix using "gower distance" mixed data ##types gower_dist <- daisy(data, metric = "gower", type = list()) gower_mat <- as.matrix(gower_dist) #write.table(gower_mat, file = "dissimilarity.csv") #summar...

facebook - Marketing API: New ads stops delivery on the entire ad account -

we have been creating new campaigns + couple of ad sets , single ad within each ad set using marketing api. while ad accounts work fine when create ads using facebook interfaces, created using api causes entire account stop delivering ads approximately 24 hours. magically starts working. is there documented or practical reason why happen? access tokens application owners obtained , extended using graph api explorer. updates , read calls api works without issues. it's creating ads causing issues. any ideas? edit: did contact ads support team , said there not seem issues accounts.

sourcemap-explorer shows extra bits and pieces from @ng-bootstrap -

i have been playing around tool called sourcemap-explorer, , noticed when import ngbdateparserformatter , ngbdatepickermodule @ng-bootstrap/ng-bootstrap , sourcemap-explorer shows getting accordion, carousel, tabset, popover, tooltip, etc. thought idea of importing individual module avoid grabbing whole package. has else run this? edit 1: i'm importing: import { ngbdateparserformatter, ngbdatepickermodule } '@ng-bootstrap/ng-bootstrap'; this use it: <input class="form-control" placeholder="mm/dd/yyyy" formcontrolname="effectivedate" ngbdatepicker #sd="ngbdatepicker"> <div class="input-group-addon" (click)="sd.toggle()"> <i class="fa fa-calendar"></i> </div> depending on packager / bundler use, might end more code needed if import catch-all module path ( @ng-bootstrap/ng-bootstrap ). to bump chances of getting used code (the fin...

javascript - yesno check is not working in jsp -

i have below jsp yesnocheck works slot specific search condition not working product search <td>slot search</td> <td> <input type="radio" onclick="javascript:yesnocheck();" name="yesno" id="yescheck"/>yes <input type="radio" onclick="javascript:yesnocheck();" name="yesno" id="nocheck"/>no <div id="ifyes" style="display:none"> slot start time: <input type='text' id='start' name='starttime'><br> slot end time: <input type='text' id='end' name='endtime'><br> </div> </td> </tr> <tr> <td>product search</td> <td> <input type="radio" onclick="javascript:yesnocheck();" name="yesno1" id="yescheck1"/>yes <input type="radio" onclick="javascript:yesnocheck();...

Django rest framework add custom validator to many=True serializer class -

below serializer class has 1 many=true field itemserializer class dataserializer(serializers.serializer): items = itemserializer(many=true) now want apply validation on field items , tried items = itemserializer(many=true, validators=[my_custom_validator]) below validator(function based) def my_custom_validator(value): # check , validation , raise appropriate validation error but problem validator applied each item 1 one instead of whole list @ once. so example want check length of items list , if exceed predefined length, should able raise error before executing validation on each item. i've tried override to_internal_value got valueerror: many values unpack (expected 2) def to_internal_value(self, data): if len(data.get('items')) > 42: raise serializers.validationerror('length shouldnt more 42') return super(dataserializer, self).to_internal_value(data) note itemserializer can nested serializer itself, mean usin...

java - Having @ModelAttribute in links when using Spring HATEOAS -

i'm building urls controller methods using tools spring hateoas provides. problem see that, can't generate link necessary request parameters when use @modelattribute aggregate these parameters. use @modelattribute not work lot of request parameters in service: @getmapping("/entities") public resource<entity> get(@modelattribute criteria criteria) { } when try build link method, not include accountid have in model attribute. expect have request parameter. linkto(methodon(mycontroller.class).get(new criteria(accountid))) is there way add @modelattribute fields request parameters? sent request parameters, expected spring automatically.

android - Install Receiver's onReceiver never called -

i have custom receiver handles install_referrer intents when application installed. called once or twice during testing doesn't called @ all. using emulator testing , have gone through instructions in this test documentation broadcast install intent emulator. have made sure hooked android sdk adb emulator, should receiving broadcasts. in terminal, says broadcast succeeded, when launch app fresh install onreceive never called. here skeleton of receiver: public class customreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { //do stuff //log stuff } } and here manifest: <receiver android:name="path.to.customreceiver" android:exported="true"> <intent-filter> <action android:name="com.android.vending.install_referrer"/> </intent-filter> </receiver> i've tried starting new emulator make sure wasn't bl...

c# - HttpPostedFileBase is Null Every Time -

i saw many questions , searched through other cases on stackoverflow answer why case , none of them applied. can see correct far. name file input tag same variable name on create method in controller. added enctype form. see below: html: @using (html.beginform(new { enctype = "multipart/form-data" })) { @html.antiforgerytoken() <div class="form-horizontal"> <p><input type="file" name="file" id="file" /></p> <p><input type="submit" value="update" class="btn btn-default" /></p> </div> } controller: [httppost] [validateantiforgerytoken] public actionresult create(httppostedfilebase file) // it's null { if (modelstate.isvalid) { io io = new io(); if (file != null) { updatelog updatelog = io.updateit(file); db.updatelogs.add(u...

netflix feign - JHipster AuthorizedFeignClients for microservice to microservice -

i'm using jhipster v4.5.5 , i'm working through examples @ https://jhipster.github.io/using-uaa/ . have 2 microservices trying communicate. secured 1 microservice method these annotations: @secured({authoritiesconstants.user, authoritiesconstants.admin}) i tried contact service microservice using authorizedfeignclients: @authorizedfeignclient(name = "microservice2") public interface microservice2client { @requestmapping(method = requestmethod.get, value = "/api/demo/string") public string getstring(); ... when try it, get: an unexpected error occurred: status 403 reading microservice2client#getstring(); content: {"message":"error.accessdenied","description":"access denied","fielderrors":null} what credentials / user feignclient trying use? "internal" client defined in application*.yml under jhipster.security.client-authorization settings? if so, annotations should use on m...

python - Trying to Query on Login and based on email and password return First Name -

i have sqlite database with: first_name email password andrew t@t.com abcde i using check if there matching email , password: if user.usermanager.filter(email = postdata['email'], password = postdata['password']): name = user.usermanager.filter(email = postdata['email'], password = postdata['password']) print name.get('first_name') return "success" when try print first_name query did above error 'too many values unpack' this happening because get() method expecting keyword arguments: https://docs.djangoproject.com/en/1.11/ref/models/querysets/#get the queryset returned filter() method contain more 1 entry: https://docs.djangoproject.com/en/1.11/ref/models/querysets/#filter , should specify expected value requested field. one of ways access value is: print name.get(first_name='andrew').first_name on other hand, limit filter query: user.userm...

How to replace a substring with a link(http) in swift 3? -

i have string , substring(http) , want replace substring don't know when substring end. mean want check until 1 space not coming , after want replace it. checking if string contains http string want replace when space come. here below example :- let string = "hello.world http://www.google.com way good". this string can dynamic mean in above string http there, want replace " http://www.google.com " "website". string = "hello.world website way good" a possible solution regular expression the pattern searches http:// or https:// followed 1 or more non-whitespace characters word boundary. let string = "hello.world http://www.google.com way good" let trimmedstring = string.replacingoccurrences(of: "https?://\\s+\\b", with: "website", options: .regularexpression) print(trimmedstring)

c++ - C++11: how to write a template function that works like get<tuple>... but receives param pack? -

i know in c++11, get<> template function works std::tuple indexed value of tuple, resolved @ compile time. but requirement have template function called get<> receives parameter pack, code should below: #include<iostream> using namespace std; template<typename head, typename ... tail> auto get(size_t index, head&& t, tail&&...tail){ return get(index-1, tail...); } template<typename head, typename ... tail> head get<0>(head&& t, tail&&...tail){ return t; } int main(){ cout<<get(3,"abc",'x',27,"hello")<<endl; cout<<get(2,"abc",'x',28,"hello")<<endl; return 0; } well doesn't compile, sure, don't know how write such "get" template function. wish main function run , print below: hello 28 so question: how implement "get" template mentioned above? thanks! do really need able s...

php - AJAX action not happening after clicking the submit button -

html code <form class="ajax-form" id="contactform" method="post" action="assets/php/contact.php"> <div class="form-group"> <input type="text" class="form-control" id="name" name="name" placeholder="your name..." value="" required> </div> <div class="form-group"> <input type="email" class="form-control" id="email" name="email" placeholder="your email..." value="" required> </div> <div class="form-group"> <input type="phone" class="form-control" id="phone" name="phone" placeholder="your phone..." value="" required> </div> <div class="form-group"> <textarea class="fo...

Django Retrieve all Certifications based on names of the certificate -

i want retrieve prospects have of certifications example, if certifications a, b & c, prospects have a, b & c should returned. if have more abc or less abc, should ignored. in model.py class certification(models.model): name = models.charfield(max_length=200, null=true, blank=true) def __str__(self): return "%s" % self.name class prospect(models.model): certification = models.manytomanyfield(certification, blank=true, related_name="certification_prospects") how can write django query retrieve prospects have strictly certification of a, b & c? from django.db.models import count certificates = certification.objects.count() prospect = prospect.objects.annotate(total=count('certification')).filter(total=certificates) prospect var return object have certificates

php - Sorting Woocommerce products by sku only for a specific product category -

i need sort products specific category sku in woo-commerce. did research on , found bellow solution: add_filter('woocommerce_get_catalog_ordering_args','spring_woocommerce_calog_orderby'); function spring_woocommerce_catalog_orderby($args) { global $post; $arg['category'] = 'rings'; $args['meta_key'] = '_sku'; $args['orderby'] = 'meta_value'; $args['order'] = 'desc'; return $args; } it's sort products category in desc order. hintson how specific category ? thanks !

javascript - Getting this jquery error on document click (intermediate value)).handle || c.handler).apply is not a function -

is there way see function causing error? or button i'm binding isn't on page? ive got 7+ js files linking php page , can't seem find binding, or missing function causing error. i checked out link uncaught type error , found 2 different issues. doesn't tell me how search issue. chrome give me line number when i've got syntax error or otherwise.

javascript - Canvas click particle explosion effect not targeting mouse position -

Image
i'm trying simple particle explosion effect when user clicks somewhere on app get's user click position, create canvas, create explosion effect , remove canvas. i'm totally new canvas , got idea site: canvas example the case it's not getting te click position right explosion effect, should start center @ clicked area. farther go left/top corner, farther down screen effect shown. so here's code: in app.components.ts (whose main file, need work on every page, decided put code here) have following: import { particle } './particle'; // import particle function // these particle options public angle: number = 90; public speed: number = 8; public particle_size: number = 1; public number_of_particles: number = 20; public range_of_angle: number = 360; public particle_lifespan: number = 15; public particle_color: string = 'rgb(255,0,0)'; public particles: any[] = []; public pctxwidth: number = window.innerwidth; // not using public pctxheight...

json - Return Postgres json_build_object as variable field from table -

postgesql returns json_build_object parent each grouped json array this: { "stories": [{ "json_build_object": { "cnn": [] } }, { "json_build_object": { "fox": [] } }, { "json_build_object": { "huffpost": [] } },... postgresql returns "json_build_object" key. possible replace stories.source value returned group by? tried alias returned error. select json_build_object(source, json_agg(stories.*)) stories group stories.source order source; optimal solution response this: stories: cnn: [], fox: []... i'm sure i'm missing best practice returning json in postgresql...

Haskell: State Monad -

i'm trying learn haskell. wrote code uses global state , can change using 2 functions (i.e. change1 , change 2). also, have included lens can learn too. problem last line of code. don't understand why cannot include 2 last lines in main. it'd run if remove either of them. {-# language templatehaskell #-} module dd (main, ma, change1,change2, dp(dp)) import control.lens import control.monad.state import control.monad.io.class (liftio) data dp = dp {_sr :: int , _fl :: int} deriving (show) makelenses ''dp plus :: dp -> dp plus = on (sr) (+90) mult4 :: dp -> dp mult4 = on (fl) (*100) change1 :: state dp () change1 = modify plus change2 :: state dp () change2 = modify mult4 ma :: state dp () ma = change1 change2 main = runstate ma (dp 2 3) evalstate ma (dp 2 3)-- here problem edit: i'm bit confused: why below code runs without error? data dp = dp {_sr :: int , _fl :: int} deriving (show) makelenses ...

Get the total count of employees reporting to the Supervisor MYSQL -

i have table called employee has following columns. desc employee; +-----------+-------------+------+-----+---------+-------+ | field | type | null | key | default | | +-----------+-------------+------+-----+---------+-------+ | fname | varchar(15) | no | | null | | | minit | char(4) | yes | | null | | | lname | varchar(15) | no | | null | | | ssn | char(9) | no | pri | null | | | bdate | date | yes | | null | | | address | varchar(50) | yes | | null | | | sex | char(4) | yes | | null | | | salary | int(11) | yes | | null | | | super_ssn | char(9) | yes | mul | null | | | dno | int(11) | no | mul | null | | +-----------+-------------+------+-----+---------+-------+ super_ssn foreign_key refers ssn in same table. have first , last name of employee supervisor. able achie...

javascript - Natural sorting object of indexed arrays -

i have structure, have no control over, , need sort clients. index of various arrays relate each other, i.e. client[0] relates suites[0]. can structure sorted in way ? current structure : 'client' : [ bravo,alpha, 1 delta, 2 charlie], 'locations' : [ 2,1,3,4 ], 'suites' : [ b,a,c,d ], 'ids' : [ 16,18,25,65 ] expected output: 'client' : [ 1 delta, 2 charlie, alpha,bravo ], 'locations' : [ 3,4,1,2 ], 'suites' : [ c,d,a,b ], 'ids' : [ 25,65,18,16 ] you use sorting map , string#localecompare options sensitivity which differences in strings should lead non-zero result values. possible values are: "base" : strings differ in base letters compare unequal. examples: a ≠ b , a = á , a = a . "accent" : strings differ in base letters or accents , other diacritic marks compare unequal. examples: a ≠ b , a ≠ á , a = a . "case" : strings differ in base lette...

Error on Call on state 4 Xamarin.android MediaPlayer -

i try play music stream url, have code class audioimplementation : isound { private mediaplayer mediaplayer; public audioimplementation() { } public context applicationcontext { get; private set; } public void initializer() { mediaplayer = new mediaplayer(); mediaplayer.setaudiostreamtype(stream.music); } public void play(string aux) { if (mediaplayer == null) { initializer(); } try { mediaplayer.setdatasource(aux); mediaplayer.prepare(); mediaplayer.start(); } catch (exception ex) { //unable start playback log error console.writeline("unable start playback: " + ex); } } } but getting error start called in state 4, mplayer error. can please me or point me in right direction? you set ionpreparedlistener mediaplayer , start() method called after mediaplayer prepared. code : mediaplayer.setdatasource(aux); mediaplayer.prepare(); mediaplayer.setonprepare...

mongodb - Filter by referenced property in the mongoose -

this question has answer here: querying after populate in mongoose 5 answers i'm having hard times trying discovery right way query in mongoose when have relationship. basically have 1 document objectid relating document (as can see bellow). but when try filter property of reference, nothing works anymore. basically, problem line " .where({ "recipe.title": new regexp("*") }) " // const configs const config = require('./config'); // mongodb setup const mongoose = require('mongoose'); mongoose.connect(config.database); var schema = mongoose.schema // recipe schema const recipeschema = mongoose.schema({ title: { type: string }, description: { type: string }, complaints: [{ type: mongoose.schema.types.objectid, ref: 'complaint' }], }); const recipe = mongoose.model('recipe', recipeschema); ...

python - Copying a Single Row From One Pandas Dataframe to Another Results in Missing Values -

i trying append values single row in 1 pandas dataframe another. 2 dataframes have same number of rows, did not expect cause issues. however, while throws no errors, output problematic. it results in last 2 rows of appended columns being nan values, , 1 of values in row being omitted in process. here first dataframe `ds1': +----+-----------+-------+-----------+------------+--------------------+ | | unique id | zip | revenue | population | revenue_per_person | +----+-----------+-------+-----------+------------+--------------------+ | 1 | 179 | 75208 | 67789037 | 30171 | 2246.827649067 | | 2 | 186 | 75208 | 62488032 | 30171 | 2071.1289649001 | | 3 | 180 | 75212 | 107230739 | 24884 | 4309.2243610352 | | 4 | 182 | 75212 | 81768596 | 24884 | 3285.9908374859 | | 5 | 181 | 75137 | 93296769 | 18861 | 4946.5441386989 | | 6 | 183 | 75237 | 79177044 | 17101 | 4629.9657329981 | | ...

multithreading - Python explicit next() slower than a for loop in multithreaded producer-consumer paradigm -

suppose have following code runs 10 iterations , calls generator gen_next_img_batch : for _ in get_next_img_batch(train_data_paths, classes, batch_size): pass now, suppose replace following, equivalent (to mind) iteration: for in range(10): next(get_next_img_batch(train_data_paths, classes, batch_size)) the conundrum have first snippet takes 17 seconds, while second takes 42 seconds. moreover, every iteration of second snippet takes more time previous iteration. is, iteration i+1 of second snippet takes longer iteration i. iterations of first snippet take same time. an important fact seems generator gen_next_img_batch iterated on takes data python queue populated in background thread. more specifically, in background, separate thread loading data queue, , every call next() yields object queue. when asynchronous behaviour omitted, both snippets take same time. they not equivalent. specifically, first fragment calls get_next_img_batch() once, while sec...

C# LINQ join between multiple lists -

Image
i have linq joining statement in c# i'm trying linq list of structs 2 lists of strings: public struct ll { public int index; public string one; public string two; } public list <ll> list1; //{"0,a, ", "1,," , "2,a,dog" , "3,,horse"} public list <string> list2; //{"a","b"} public list <string> list3; //{"cat","mouse","dog"} the idea in list1 not structs contains value, on index 0 list1.one has value being "a", list1.two empty. on index 1 both list1.one , list1.two empty. on index 2 both list1.one , list.two have values. on index 3 list.two has value. with below i'm trying join 3 lists var query = x in list1 join y1 in list2 on x.one equals y1 join y2 in list3 on x.two equals y2 select x.index; with statement join done if list1.one matches item in list2 , list1....

Programmatically add XML property source to current environment in Spring -

i'm trying import xml config programmatically current environment in spring application. here code: @springbootapplication public class application { public static void main(string[] args) { configurableapplicationcontext app = springapplication.run(application.class, args); try { app.getenvironment().getpropertysources().addlast(new resourcepropertysource("classpath:conf.xml")); } catch (ioexception e) { system.out.println("there error" + e.getmessage()); } catch (exception e) { system.out.println("there error" + e.getmessage()); } } } here's conf.xml : <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd...

javascript - External jQuery file loop skips over first or last item -

i'm loading information page external javascript file. file finds divs on page class name, populates div's content based on custom attribute, link api. function in external file loops through each div class , dynamically populates div's id. here code divs on page: <div class="classname" data-apisrc="www.someapi1.com" id="box1"></div> <div class="classname" data-apisrc="www.someapi2.com" id="box2"></div> <div class="classname" data-apisrc="www.someapi3.com" id="box3"></div> here code in external file: $(function() { $("div.classname").load("https://...somewebsite.com.html div.box-container"); var i=0; var box = $("div.classname"); $(box).each(function(apisrc, div_id) { i++; var apisrc = $(this).attr("data-apisrc"); var div_id = 'box'+i; $(th...

Spring Batch Not reading from DB nor writing to file -

i want use multiple datasources, 1 spring batch metadata , other business data. batch job runs , not try connect secondarydatasource. can point out wrong configuration? @configuration @enablebatchprocessing public class batchconfiguration extends defaultbatchconfigurer { @override @autowired public void setdatasource( @qualifier("batchdatasource") datasource batchdatasource) { super.setdatasource(batchdatasource); } } public class springbatchconfig { @autowired private jobbuilderfactory jobs; @autowired private stepbuilderfactory steps; private static final string query_find_students = "select * ..."; @bean itemreader<dotdetailsdto> reader( @qualifier("secondarydatasource") datasource datasource) throws sqlexception { jdbccursoritemreader<dotdetailsdto> databasereader = new jdbccursoritemreader<>(); databasereader.setdataso...

correlation - Why am I only getting 1 and -1 from the cor() function in R? -

i'm trying perform pearson correlation cor() function, output gives me 1 , -1, not coefficient itself. when go plot matrix corrplot(), see 1 , -1 values. how fix this? dataset can found here , , see script down below: ##must load libraries need! if have not installed packages, before start. library("corrplot") ##load in datasets d1=bpt5test ##if don't have y (i.e, want same thing in both axis), leave blank d2= ##run spearman correlation. if want pearson, change "spearman "pearson" ##if have 0s in dataset, set use = "complete.obs", if have no 0s, set use = "everything" cortest=cor(d1, use = "everything", method = "pearson") ##let's plotting! ##lots of changing can do! #method can "circle" "square" "pie" "color" #colorramppalette can changed, "blue" being negative, "white" being '0', , "red" being positive #change title what...