Posts

Showing posts from January, 2015

javascript - Undefined in store reducer -

im trying write reducer action in angular ngrx store architecture: this reducer: export const registration = (state: any, {type, payload}) => { switch (type) { case 'register_user': console.log('reducer ' + payload, type); return payload; default: return state; } }; and function calling reducer register(user: registrationuser) { return this.http.post(global.api_url+'/register', user) .map(response => response.json()) .map(data => ({type: 'register_user', data})) .subscribe(action => {this.store.dispatch(action); console.log(action)}); } the problem im having in payload undefined. console.log(action); returns object. , console log reducer returns proper action type undefined object 'reducer undefined register_user' i think need map data payload: data: register(user: registrationuser) { return this.http.post(global.api_url+'/register', user) ...

c# - Is there any sense in separating Identity models from business models to separate projects? -

a rather newbie question best asp.net mvc solution architecture is there sense in separating identity models business models separate projects? are there bigger advantages? thanks help i agree coding yoshi business models should have business logic in them. believe asking if should keep identity models , if identity models security logic sure should have identity models encapsulated other business logic. allow business protection , if need update security reason have @ least possible layer business rules , possible business secrets. check out this link best practices identity answers.

javascript - Random Aframe environment -

i want have random scenarios every time enter website. i'm trying return pickscenario variable js script aframe in line <a-entity environment="preset: pickscenario"></a-entity> here's code: <a-entity environment="preset: pickscenario"></a-entity> <script> var scenarios = ['ocean', 'universe', 'forest']; var pickscenario = scenarios[math.floor(math.random()*scenarios.length)]; return pickscenario; </script> i bet quite simple haven't figure out yet. for scripts take effect advised write components, this: <script type="text/javascript"> aframe.registercomponent('randomscenario', { init: function(){ var scenarios = ['ocean', 'universe', 'forest']; var pickscenario = scenarios[math.floor(math.random()*scenarios.length)]; this.el.setattribute('enviro...

java - Unable to mock the findAll() method from JPA Repository with JMockit -

i have service implementation method getone makes call findbyid @ repository layer. (my repository extends jparepository, did not have implement findall myself.) have tried mock findall return new facility code below. new mockup<facilityrepository>() { @mock public facility findbyid(int id) { return new facility(1, new date(), "active"); } }; my issue when invoke getone service implementation, expected mock findall called , mock facility returned. doesn't , leaves me stumped. why isn't mock method being called? very new jmockit, appreciated.

How to disable unit testing for Connect SDK Lite on Android project? -

i have added connect sdk lite sources android project , looking use stream apple tv. chose use sources because project has bunch of libraries sources , dependencies connect sdk conflicting these libraries. way rid of them manually edit connect sdk gradle file. i want disable unit testing connect sdk because don't find relevant small function going using for. our build machines keep failing our project build because of unit tests in connect sdk module failing. don't want bother fixing tests since i'm looking use sdk's functionality. changes can make build.gradle these tests aren't run? here gradle file connect sdk: buildscript { repositories { jcenter() } dependencies { //classpath 'com.android.tools.build:gradle:1.2.3' //classpath 'org.robolectric:robolectric-gradle-plugin:1.1.0' } } allprojects { repositories { jcenter() } } apply plugin: 'com.android.library' //apply plugin...

How to setup multiple gemfire/geode WAN clusters on one machine for testing? -

what's needed run multiple gemfire/geode clusters on 1 machine? i'm trying test using wan gateways locally, before setting on servers. i have 1 cluster (i.e. gemfire.distributed-system-id=1) , running 1 locator , 1 server. i trying setup second cluster (i.e. gemfire.distributed-system-id=2), receive following error when attempting connect locator in cluster 2: exception caused jmx manager startup fail because: 'http service failed start' i assume error due jmx manager running in cluster 1, i'm guessing need start second jmx manager on different port in cluster 2. correct assumption? if so, how setup second jmx manager? your assumption correct, exception being thrown because first members started services ( pulse , jmx-manager , etc.) using default ports already you want make sure properties http-service-port , jmx-manager-port (non extensive list, there other properties need at), different in second cluster. hope helps. cheers. ...

java - After ends method doPost() runs method doGet() without calling this method in StartServlet -

this question has answer here: change default homepage in root path servlet doget 2 answers i want validate information user. if user has been entered , trying enter /login page, forward userpage. as of moment have this: startservlet public class startservlet extends httpservlet { @override protected void doget(httpservletrequest req, httpservletresponse resp) throws servletexception, ioexception { userdto userdto = (userdto) req.getsession().getattribute("userdto"); if (userdto == null) { req.getrequestdispatcher(req.getcontextpath() + "/web-inf/pages/login.jspx").forward(req, resp); } else { req.getrequestdispatcher(req.getcontextpath() + "/checklogin").forward(req, resp); } } } validateservlet public class validateservlet extends httpservlet { @overrid...

c# - Conversion failed when converting date and or time from character string -

i getting error conversion failed when converting date , or time character string when perform following insert c# code: private void updatelatestdatetimeontable(string status, datetime starttime, datetime completetime) { var command = $"insert {datamallproxydbaccessor.proxysynchistorytable}" + " " + " values" + " " + "(" + $"'@id'," + $"'@status'," + $"'@starttime'," + $"'@completetime'" + ")"; var sqlcommand = new sqlcommand(command) { connection = _proxydbconnection, transaction = _datamallsqltransaction }; sqlcommand.parameters.addwithvalue("@id", guid.newguid()); sqlcommand.par...

PHP MongoDB driver, exceptions not showing -

hey! writing simplified mongodb class side project. trying create , check if connection has been made (within construct), exceptions not being thrown when connection uri badly formatted. using constants credentials/host information. the class; class mongodiy { private $_mdbc = null; public function __construct($options = array()) { try { $this->_mdbc = new mongodb\client("mongodb://" . mdb_user . ":" . mdb_pass . "@" . mdb_host . ":" . mdb_port . "/" . mdb_name, $options); } catch (exception $e) { echo "exception:" . $e->getmessage() . "\n"; } } } ` the dump; mongodiy object ( [_mdbc:mongodiy:private] => mongodb\client object ( [manager] => mongodb\driver\manager object ( [uri] => mongodb://<username>:<password>@<dead-ip>:27017/app ...

python - restoring weights of an already saved Tensorflow .pb model -

i have seen many posts restoring saved tf models here, none answer question. using tf 1.0.0 specifically, interested in seeing weights inceptionv3 model publicly available in .pb file here . managed restore using small chunk of python code , can access graphs high-level view in tensorboard : from tensorflow.python.platform import gfile inception_log_dir = '/tmp/inception_v3_log' if not os.path.exists(inception_log_dir): os.makedirs(inception_log_dir) tf.session() sess: model_filename = './model/tensorflow_inception_v3_stripped_optimized_quantized.pb' gfile.fastgfile(model_filename, 'rb') f: graph_def = tf.graphdef() graph_def.parsefromstring(f.read()) _= tf.import_graph_def(graph_def,name='') writer = tf.train.summarywriter(inception_log_dir, graph_def) writer=tf.summary.filewriter(inception_log_dir, graph_def) writer.close() however, failed access layers' weights. tensors= tf.import_gra...

Restrictions vs Permissions -

this strange question, trying work out how create right "permissions" users , came conclusion "restrictions" might better approach, except cannot see method online. assume doing logically wrong. i have system of shipments. has several types of users/roles/perspectives(?). admin (see all) supplier (shipment owner) factory (shipment receiver) they can edit shipments. but supplier allowed edit under conditions, example shipment hasn't been shipped already! admin , factory worker however, can whatever want. suppliers , factories can edit shipments related them. so @ first came these permissions: editshipments ( admin , factory , supplier ) but wait, works admins, don't want factories editing shipments of other factories (perhaps through editing post data or playing api). same supplier. editanyshipment ( admin ) editownreceivedshipments ( factory ) editownsentshipments ( supplier ) now when doing edit, have determine if user own...

php - How to upload image in codeigniter, Error Number: 1136 -

the controller want user can upload image database in table "invoices" or "orders" column "bukti_trnsfr" thanks public function payment_confirmation($invoice_id = 0 ) { $data['get_sitename'] = $this->model_settings->sitename_settings(); $data['get_footer'] = $this->model_settings->footer_settings(); $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); $this->form_validation->set_rules('invoice_id_input','invoice id','required|integer'); $this->form_validation->set_rules('amount_input','amount transfered','required|inte...

recursion - Recursively Delete Even Items from Doubly Linked List C++ -

here same question asking: deleting nodes doubly link list c++ the difference is, want understand wrong code. don't want have accept different approach without understand why code doesn't work. here 2 versions of code know wrong both. both of them give me segmentation fault. int removeeven(node *&head) { if(!head) //base case: end of list reached return 0; int count = removeeven(head->next); //recurse end of list if(head->data % 2 != 0) return count; else{ ++count; if(head->next){ head->next->previous = head->previous; } if(head->previous){ head->previous->next = head->next; } if(!(head->previous)){ node* temp = head; head = head->next; delete temp; } else delete head; } return count; } this second 1 takes count = 0 default arg. int removeeven(node *&head, int count) if(head && head->data % 2 != 0) //not null, n...

java - unable to generate a log file using log4j inspite everything is kept -

unable create log file. web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/applicationcontext.xml</param-value> </context-param> <context-param> <param-name>log4j-config-location</param-name> <param-value>/web-inf/log4j.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.con...

python - I want to implement a regularization technique "Shakeout" in CNTK -

there paper "shakeout: new approach regularized deep neural network training" can found here: http://ieeexplore.ieee.org/abstract/document/7920425/ a new regularization technique introduced in paper, can replace dropout layers in more functional way. working on deep learning problem , want implement "shakeout" technique, problem not understand actual pipeline paper. there mathematics still struggling understand. so far, have seen 1 open source implementation based on "caffe", new practitioner of deep learning , learning use cntk. not possible start working on caffe. have implemented "shakeout" in cntk? or if can provide pseudo-code shakeout? shakeout implementation on caffe: https://github.com/kgl-prml/shakeout-for-caffe github issue: https://github.com/kgl-prml/shakeout-for-caffe/issues/1 from quick @ paper dense layer combined shakeout layer following: def densewithshakeout(rate, c, outputs): weights = c.parameter((c.in...

swift - Cast value to Generic Protocol -

i have protocol public protocol responselistdto: mappable { associatedtype data: mappable var data: [data]! { } } a once time need cast value protocol, default data type mappable . try this if var value = value as? mappable { /// calc code // let value = value as? responselistdto - error if let value = value as? responselistdto, responselistdto.data == mappable { // - error let item in value.data { item.mapping(map: map) } } else { value.mapping(map: map) } } but have error time. protocol 'responselistdto' can used generic constraint because has self or associated type requirements associated type 'data' can used concrete type or generic parameter base how can resolve it?

mysql - Using query results in a list from one class to another in Java -

i retrieving data database in class. want use data , process it, separate different sections (i have timestamps, , count frequency of names in between specific dates). having trouble finding out how use data retrieved in class. here source code retrieval: package test; import java.sql.drivermanager; //import java.sql.resultset; import java.sql.sqlexception; import java.util.arraylist; //import java.util.arrays; import java.util.list; import javax.sql.rowset.cachedrowset; import javax.sql.rowset.rowsetprovider; import com.mysql.jdbc.connection; import com.mysql.jdbc.statement; public class enterd { private static string url = "url"; private static string user = "user"; private static string password = "pass" ; private static string sqlquery1 = "select component_type, ctime table;"; public static list<mydatatype> retrievefromdb() throws sqlexception { list<mydatatype> datalist = new arraylist<>(); try (co...

kibana - WSO2 EI with ELK integration not working as expected -

i followed instructions @ publish wso2 carbon logs logstash/elasticsearh/kibana (elk) using log4j socketappender not working , didn't see logs in kibana dashboard. can please me correct configuration of xxxx.conf file? i didn't follow approach elk integration. used filebeat on wso2 server, add wso2carbon.log file input can forward either logstash or directly elastic a sample filebeat config filebeat.prospectors: - input_type: log paths: - /srv/wso2/wso2ei-6.1.1/repository/logs/app*.log document_type: wso2-logs scan_frequency: 30s fields: application: wso2-ei #for logstash output.logstash: hosts: ["localhost:5044"] #for elastic output.elasticsearch: hosts: ["myelastichost:9200"] then logstash template depend on format of logs

html - Bootstrap css Aligns the text to the center by the text length of the other div -

Image
i want use css, bootstrap align first line align left, , second line center on text length of first line. i tried many ways not. code follow <div class="col-md-6"> <a href="/" style="text-decoration:none"> <div class="col-md-12 row-eq-height" style="padding:0;"> <div class="col-md-2" style="padding:0"> <img src="/content/images/logo.png" class="img-responsive" alt=""> </div> <div class="col-md-10 tex-center" style="padding-right:0;"> <div style="padding:0"> <div class="line1-bold">this first long headline</div> <div class="line2"...

android - How to change the hint color property dynamically when its unfocsed state? -

Image
i need change hint color property dynamically when unfocused. possible change hint color dynamically(not in focused state). actual design and xml i can't change hint color property programmatically when unfocused. stuck. possible do? please me. here code - btnsignup.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { final string email = emailedittext.gettext().tostring(); final string pass = passedittext.gettext().tostring(); if (email.isempty()) { inputlayoutemail.sethint("email required login"); inputlayoutemail.sethinttextappearance(r.style.edittextlayout); inputlayoutemail.seterror(" "); emailedittext.sethinttextcolor(getresources().getcolor(r.color.primary_dark)); } if (pass.isempty()) { inpu...

Get dates between two dates in UTC c# in scheduling system -

i creating 1 scheduling software people booking meeting schedule. in case stored booking time in utc format. because multiple clients have own time zone. but issue unable convert client local time utc , not getting date range. please code bellow public class dateranage { public datetime fromdatetime { get; set; } public datetime todatetime { get; set; } } this class store , time i getting , date time in javascript time format //convert date time var from_dt = new datetime(1970, 1, 1, 0, 0, 0, 0, datetimekind.utc); var fromutcdate= from_dt.addseconds(math.round(fromjstime / 1000)); //convert date time var to_dt = new datetime(1970, 1, 1, 0, 0, 0, 0, datetimekind.utc); var toutcdate= to_dt.addseconds(math.round(tojstime / 1000)); assume fromjstime , tojstime javascript time ticks my question how date range fromutcdate , toutcdate , store in dateranage list object. please me.

mysql - How to parse every object in my array in json in java without using loop? -

i have data in json format : { "father" :"conor", "children" : [ { "name":"cindy", "age": 11 }, { "name":"heart", "age" :12 }, { "name":"cindy", "age" :13 } ] } my problem how going check every object in array children if there name , age field. currently, looped out check if 2 field supplied/exist, slows down app(especially when inserting database). there way don't have loop out? you can use jsonpath api in java code , provides various filters on stream of json array. can give try https://github.com/json-path/jsonpath

xamarin.android - Xamarin Forms | Android: BitmapDescriptor Error - Image must be a Bitmap -

i trying use groundoverlayoptions add custom image android.gms.maps bitmapdescriptor image = bitmapdescriptorfactory.frompath("fire2.bmp"); groundoverlayoptions newarkmap = new groundoverlayoptions().invokeimage(image); newarkmap.position(e.point, 8600f, 6500f); map.addgroundoverlay(newarkmap); despite fire2.bmp being bitmap, still receiving error: java.lang.illegalargumentexception: failed decode image. provided image must bitmap. what missing? i suggest use bitmapdescriptorfactory.fromresource. if @ compile time don't errors means resource exists , found @ runtime

to char - extract month and year in oracle -

why below query work successfully? select to_char(sysdate,'mm-yyyy') dual; but following queries give invalid number error: select to_char('28-jul-17','mm-yyyy') dual; select to_char('7/28/2017','mm-yyyy') dual; though, below query gives same date format. select sysdate dual; -- 7/28/2017 11:29:01 because function to_char() accepts date or timestamp values. however, neither '28-jul-17' nor '7/28/2017' dates or timestamps - strings . oracle gently tries convert these stings date values. implicit conversion may work or may fail, depends on current session nls_date_format , resp. nls_timestamp_format settings. as given in other answers have convert string explicitly: to_date('28-jul-17', 'dd-mon-rr') to_date('7/28/2017', 'mm/dd/yyyy')

Why doesn't google chrome print the text() of my XPath query? -

Image
i trying extract texts of xpath query, $x('//td[@class="first"]/a/text()') in chrome when run command see text opposed actual text value of anchor links. when run s.tostring() seeing [object text],[object text],[object text],[object text]... . how can string value in xpath? because $x() returns array of html or xml elements matching given xpath expression. means shortcut document.evaluate(). if want exact element, position out of array $x(element)[0] this help: https://getfirebug.com/wiki/index.php/$x if want print(or other stuff) text elements found locator in console - can call foreach function) $x('//a/text()').foreach(function(el){console.log(el)})

android - Google Chrome inspect devices? -

Image
i'm trying inspect device google chrome chrome://inspect/#devices basically i'm not able recognize connected device. instead i'm getting i did adb kill-server adb start-server it restarted , did not work how inspect element devices? i have faced similar issue. please try below methods go device - developer options - click on revoke usb debugging autorizations , enable developer options , usb debugging. again ask accept debugging session on device on device. inspect work on debug mode , not on release mode . if using android studio can change below in screenshot.

c# - How to work with down arrow key in Auto Suggest Box? -

in auto suggest box when pressing down arrow in suggestion list suggestion list getting closed automatically in no time. i want keep open list until user presses enter key. xaml code <autosuggestbox x:name="recipient" keyup="recipient_keydown" fontsize="18" height="50" textchanged="recipient_textchanged" suggestionchosen="recipient_suggestionchosen" x:uid="recipienttextplaceholder" horizontalalignment="left" background="white" verticalalignment="center" margin="30,20,0,0" style="{staticresource autosuggestboxstyle2}"> <autosuggestbox.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition width="auto"/> <columndefini...

Java: Why does SSL handshake give 'Could not generate DH keypair' exception? -

when make ssl connection irc servers (but not others - presumably due server's preferred encryption method) following exception: caused by: java.lang.runtimeexception: not generate dh keypair @ com.sun.net.ssl.internal.ssl.dhcrypt.<init>(dhcrypt.java:106) @ com.sun.net.ssl.internal.ssl.clienthandshaker.serverkeyexchange(clienthandshaker.java:556) @ com.sun.net.ssl.internal.ssl.clienthandshaker.processmessage(clienthandshaker.java:183) @ com.sun.net.ssl.internal.ssl.handshaker.processloop(handshaker.java:593) @ com.sun.net.ssl.internal.ssl.handshaker.process_record(handshaker.java:529) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:893) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.performinitialhandshake(sslsocketimpl.java:1138) @ com.sun.net.ssl.internal.ssl.sslsocketimpl.starthandshake(sslsocketimpl.java:1165) ... 3 more final cause: caused by: java.security.invalidalgorithmparameterexception: prime si...

PHP neo4j OGM - Recursion detected -

i'm using entitymanager in project. can successfuly read/add entites , relations between them db have 1 problem. i have 2 nodes employee , document , relationship between them employee has document. php class emloyee: <?php namespace app\models; use graphaware\neo4j\ogm\annotations ogm; use \graphaware\neo4j\ogm\common\collection; /** * * @ogm\node(label="employee") */ class employee implements \jsonserializable { public function __construct() { $this->documents = new collection(); $this->addresses = new collection(); } /** * id * @var int * @ogm\graphid() */ protected $id; /** * name * @var string * * @ogm\property(type="string") */ protected $name; /** * lastname * @var string * * @ogm\property(type="string") */ protected $lastname; /** * personalidnumber * @var string * * @ogm\p...

php - Woocommerce Change schema rich snippet from product to course -

i have wordpress woocommerce installed sell courses, not product, have problem schema rich snippet, google find product show in google results in price , product label (instead of course label). i change code, not install other plugin. understand the schema informations here: /wp-content/yourtheme/woocommerce/content-single-product.php --here label product? /wp-content/yourtheme/woocommerce/single-product/price.php /wp-content/yourtheme/woocommerce/single-product/rating.php /wp-content/yourtheme/woocommerce/single-product/review.php how can change schema label show course instead of product in google result page?

javascript - JQuery and HTML Getting the value of a <td> from the every first <tr> of a table to increment it -

Image
i have html table provide data mysql server, , have inital tr contains text boxes add more. , append them same table. the problem first td of each row should increment. so if last td value 5, when add new row , append new line, it's first td value should 6. here html table: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <tr id="after_tr"> <th colspan="4" style="text-align: center">diabetes assessment result patient <?php echo $res[0]['patient_name_en'] ?></th> </tr> <tr class="bg-info"> <th>#</th> <th>date of assessment</th> <th>assessment result</th> <th colspan="5...

OneSignal - Send Notification to all devices of some users -

i'm developing app/website user has logged in, can identify them via email. in app user can register push-notifications different topics. i'm filtering target-users via onesignal's tag feature. since user can logged in 1 account on multiple devices, notifications should sent of user's devices. is there way this? update: found information on following link: https://documentation.onesignal.com/docs/internal-database-crm but prefer solution, doesn't require storing playerids in database.

angular - How to return custom catch error in Observable Http? -

i have observable function, request: public send(): observable<isms[]> { if (this.usedattempts < this.maxattempts) { return; // here return custom error } } i take observable as: this.sms.send().subscribe( response => { console.log(response); }, error => { console.log(error); } ); } i need check if user can send sms if yes, send, otherwise return error. just use throw() operator: if (this.usedattempts < this.maxattempts) { return observable.throw('error description'); } don't forget import it: import 'rxjs/add/observable/throw'; here the docs say : creates observable emits no items observer , emits error notification.

google maps - How to select a location with a button? (Android) -

i have button in function selecting location. once user click button, can select location wants. how in android? thank you! hope me! you can use placepicker of google places api : https://developers.google.com/places/android-api/placepicker

entity framework - EntityFramework Code First - Sql Server Database Id Error -

Image
when insert new record,sql server database table not save well-order auto increment.how can solve it? w in order prevent collisions in rapid insertions, sql server provides default cache value auto incremented column. should not rely on order of column insert sequence of records. can use sequence generator no cache setting explained here

React Native: ListView item does not scale full width -

Image
i create simple listview component simple text item. import react "react"; import { stylesheet, text, view, listview } "react-native"; export default class notelist extends react.component { constructor(props) { super(props); this.ds = new listview.datasource({ rowhaschanged: (r1, r2) => { r1 !== r2; } }); } render() { return ( <listview datasource={this.ds.clonewithrows([ { title: "note 1", body: "body 1", id: 1 }, { title: "note 2", body: "body 2", id: 2 } ])} renderrow={rowdata => { return ( <view style={styles.itemcontainer}> <text style={styles.itemtext}> {rowdata.title} </text> </view> ); }} /> ); } } const styles = stylesheet.create({ itemcontainer: { flex: 1, flexdirec...

android - Detecting overscroll in NestedScrollView -

i want vertical overscroll in nestedscrollview trigger 1 of methods, displays contentloadingprogressbar while retrieving data device. the swiperefreshlayout widget not app , there not seem way of customizing actual animation (see this question). i have tried subclassing nestedscrollview , overriding onoverscrolled: @override public void onoverscrolled(int scrollx, int scrolly, boolean clampedx, boolean clampedy) { super.onoverscrolled(scrollx, scrolly, clampedx, clampedy); if (clampedy && scrolly == 0) { log.d("mynestedscrollview", "top overscroll detected"); // mytopoverscrollmethod(); } else if (clampedy && scrolly > 0) { log.d("mynestedscrollview", "bottom overscroll detected"); // mybottomoverscrollmethod(); } } however, logging messages printed 5-10 times per overscroll since gesture not instantaneous , takes while complete. i looking way of recognizing overscroll gesture in order di...

python - Outer product with arrays of multiple dimensions -

i have d numpy arrays of shape (2, s, t, ...) , , i'd multiply each of them each other such output has shape (2, ..., 2, s, t, ...) d 2 s. example, d==3 : import numpy d = 3 = numpy.random.rand(d, 2, 7, 8) out = numpy.empty((2, 2, 2, 7, 8)) in range(2): j in range(2): k in range(2): out[i, j, k] = a[0][i]*a[1][j]*a[2][k] if s, t, ... not present (which use case), classical outer product. i thought meshgrid can't quite work. any hints? i use numpy.einsum c = a[0] in range(d-1): #adds 1 dimension in each iteration c = np.einsum('i...,...->i...', a[i+1],c) this gives same result yours, axes in reverse order: c.swapaxes(0,2)==out #yields true you can either reverse first few axes or adapt rest of code, whatever works better you.

javascript - React native stlying -

Image
i having trouble figuring out how layout views react native. i have container view want hold 3 views a,b , c. i want , b views on top of each other visible. when user presses b view should slide out underneath until hits end of container, whilst going on view c isnt visible anymore. when user presses b inside of b view slide under showing c again. i have tried using position absolute doesnt work intended , still leaves views b , c on same level, instead of b being above c. i cant seem figure how arrangement looking , wondering if had ideas might help.

ios - Relationship between CarPlay and External Accessory and Wireless Accessory Configuration -

for current project supposed develop iap2 on usb connectivity head unit (mfi certified) developed 3rd party. the requirement continuously uses term 'carplay connectivity' feature. without being able dig deeper carplay documentation (which restricted mfi enrolled developers only) left speculate if carplay right term. external display + car input + audio explicitly not requested. doubt carplay correct term, can not 100% sure. i have developed iap2 on bluetooth , want use same iap2 protocol on usb. so questions are: what difference between carplay , pure use of external accessory framework? is there difference between externalaccessory on bluetooth , externalaccessory on usb concerning entitlements , declaration of iap2 protocol identifiers? how wireless accessory configuration capability related carplay?

javascript - Slide in absolute positioned Modal -

i've created background div hosts modal div. i have set modal div have css: .modal { opacity: 0.01; top: 20px; transition: ease-in 200ms; } then created class add in order show it .modal-open { top: 50px; opacity: 1; } however, when open class added div, chrome shows properties being striked out (a.k.a not taking effect or overridden). see codepen demonstration. can click on background hide modal again. why isn't transitioning properly? because placed .model-open before .modal in css. .modal { position: absolute; z-index: 101; transition: 300ms ease-in-out; top: 20px; opacity: 0.01; width: 500px; background-color: white; left: 50%; margin-left: -250px; } .modal-open { top: 50px; opacity: 1; } https://codepen.io/anon/pen/kvdzma

ajax - Spring - POST parameters with vanilla javascript -

i'm trying make ajax call using plain javascript spring controller. call fails "required string parameter 'allowedroles' not present" the controller: @requestmapping(path = "/updateroles", method = requestmethod.post) public string updateroles(@requestparam("allowedroles") string allowedroles, final map<string, object> model) { return "services"; } and ajax call: var xhttp; if (window.xmlhttprequest) { // code modern browsers xhttp = new xmlhttprequest(); } else { // code ie6, ie5 xhttp = new activexobject("microsoft.xmlhttp"); } xhttp.open("post", "/services/updateroles", true); xhttp.setrequestheader("content-type", "application/json"); xhttp.send({"allowedroles":allowedroles}); i have tried xhttp.send("allowedroles=" + allowedroles); but result same try json: //create json data var jsondata = {allowedroles:...

javascript - Is there an interest to use double boolean negation? -

as beginner in javascript, have question may seem bit weird. using external lib found on web in found code below : if('useholes' in c){ this.config.useholes = !!c.useholes; } is there interest use double exclamation mark or clumsy code ? couldn't find answer yet guess can remove them wanted 100% sure. with double ! force object return " boolean-able ", if null or else, can evaluated bool true or false .

How to pass parameters to another process in c# -

i created application launches processes following code string [] args = {"a", "b"};              process.start ("c: \ \ demo.exe" string.join ("", args)); i able pass parameters application process i've launched. where have enter parameters in project of process i've launched? tried put them in static void main (string [] args) {... but not available in other forms. help process p= new process(); p.startinfo.filename = "demo.exe"; p.startinfo.arguments = "a b"; p.start(); or process.start("demo.exe", "a b"); in demo.exe static void main (string [] args) { console.writeline(args[0]); console.writeline(args[1]); } you asked how save these params. can create new class static properties , save these params there. class paramholder { public static string[] params { get; set;} } and in main static void main (string [] args) { paramholder.params = args; } t...

camera - Measure real distance between two known lines with OpenCV -

Image
i have problem measuring real world length of line between 2 known lines 1 single image. please have @ sketch: the following steps realized: calibrated camera detect line end points in image undistored points calibrated camera data perspective correction vanish lines i have tried solve problem rectify image (removing projection , affine distortions) solution image rectification: remove projective , affine distortions rong zhang. but in case, there missing second pair of orthognal lines (diagonals), because of unknown length of c. so there question: possible measure real length of line c on single image, calibrated camera , known paramters (descripted in sketch) ?

apache - Gitlab docker behind proxy - relative path problems -

i trying gitlab running te following setup: in docker (using gitlab/gitlab-ce:latest , docker-compose) on relative path https://my.domain.com/git behind proxy (apache) handles ssl. i tried many different configs, keep failing running correctly behind proxy. seems gitlab ignores relative path. according https://docs.gitlab.com/omnibus/settings/configuration.html should work. tried old environment option gitlab_relative_url_root: '/git', didn't change anything. docker-compose.yml looks this: web: image: 'gitlab/gitlab-ce:latest' restart: hostname: 'myhostname' environment: gitlab_omnibus_config: | external_url = 'https://my.domain.com/git' gitlab_rails['lfs_enabled'] = true nginx['listen_port'] = 80 nginx['listen_https'] = false nginx['proxy_set_headers'] = { 'x-forwarded-proto' => 'https', 'x-forwarded-ssl' => 'on' } ...