Posts

Showing posts from May, 2015

java - Unable to change default font in Android app -

i trying change default font in app. not working. these steps have taken: 1) created class typefaceutil.java import android.content.context; import android.graphics.typeface; import android.util.log; import java.lang.reflect.field; public class typefaceutil { public static void overridefont(context context, string defaultfontnametooverride, string customfontfilenameinassets) { try { final typeface customfonttypeface = typeface.createfromasset(context.getassets(), customfontfilenameinassets); final field defaultfonttypefacefield = typeface.class.getdeclaredfield(defaultfontnametooverride); defaultfonttypefacefield.setaccessible(true); defaultfonttypefacefield.set(null, customfonttypeface); } catch (exception e) { log.e("customfontexception", "can not set custom font " + customfontfilenameinassets + " instead of " + defaultfontnametooverride); } } } 2) in class extending application : publ...

python - Get full result back from PeeWee query (for conversion to JSON) -

i trying render peewee query result json using following code: @app.route('/') def index(): c = category.select().order_by(category.name).get() return jsonify(model_to_dict(c)) doing 1 row query. i'm pretty sure issue use of get() , docs returns 1 row. use in place of get() fetch entire results back? this question below pointed me in right direction, is using get() peewee model json what use in place of get() fetch entire results back? modify code be: query = category.select().order_by(category.name) return jsonify({'rows':[model_to_dict(c) c in query]}) alternatively, do: query = category.select().order_by(category.name).dicts() return jsonify({'rows':list(query)})

mysql - Select record where id is one of collection id -

in spring mvc application have 3 database tables (including 1 mapping table) , 2 corresponding java entities. the entities are:- public class user { private long id; private string username; @manytomany(fetch = fetchtype.eager) @jointable(name = "user_location", joincolumns = {@joincolumn(name = "user_id", referencedcolumnname = "id")}, inversejoincolumns = {@joincolumn(name = "location_id", referencedcolumnname = "id")} ) private set<location> location; } public class location { private long id; private string locationcode; } three tables users, location , user_location. i want select user location id equal particular id. since user can have multiple locations not sure how write hibernate query this. tried few combinations below either getting exception, illegal attempt dereference collection [{syntheti...

javascript - Overlap of labels for MarkerWithLabel on custom marker on Google Maps -

Image
i used infobox create label marker custom icon. scenario of overlapping markers, labels became illegible , had solution or alternative. it suggested in previous question should make use of markerwithlabel. helps, if markers overlap exactly, can see label still coming through after setting opacity 1 , making background same custom marker. .labels { background-color: #ff5959; } gmarker = new markerwithlabel({ position: somecenterposition, icon: customimageurl, draggable: false, raiseondrag: false, map: map, title: sometitle, labelcontent: atitle, labelanchor: new google.maps.point(someoffsetx, someoffsety), labelclass: "labels", // css class label labelstyle: {opacity: 1} }); the 2 marker behind's label , 15 should displayed on front marker. need have 2 , background behind marker label of 15.

swift - Casting a class to subclass fails -

edit - sorry guys, don't think gave enough detail: in parse's ios framework, class called pfobject (classa). framework allows subclass (classb) pfobject . and, if scenario such 1 gave should occur, no issue. my question how possible? understand subclass contain variables/methods not present in main class, making process of casting class subclass unreasonable/unsafe. they have protocol defined pfsubclassing, don't see how allows behaviour occur. i've got following in playground: class classa: nsobject { } class classb: classa { } let objecta = classa() let objectb = objecta as! classb // <- crashes questions: why crash occurring? is there way around this? you know how inheritance works right? class b inherits class a. when make instance of classa , try cast class b, many different things might happen because undefined behavior. problem here what's called slicing. compiler refuses cast down parent class child class because knows ...

gradle - React native android code push installRelease build fails -

i trying add code push react native app, , followed steps mentioned in https://github.com/microsoft/react-native-code-push after doing it, debug build works fine use : $ ./gradlew installdebug but release build fails given following command : $ ./gradlew installrelease which gives following error : :app:generatereleaseresources :app:mergereleaseresources :app:bundlereleasejsandassets failure: build failed exception. * went wrong: not list contents of '/users/jayshah/documents/testdir/exampleapp/node_modules/.bin/_mocha'. github microsoft/react-native-code-push react-native-code-push - react native plugin codepush service. i use following command generate bundle : curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" my react native version 0.18, code push version 0.16 turns out problem encountered when upgrading in react native pre 0.15 post 0.1...

angularjs - Validation message displayed by default -

i enter page , can see validation message immediately. <div ng-class="{'has-error': test.$invalid}" class="form-group" > <input id="field" name="field" required class="form-control" ng-model="field" type="text"/> <div class="help-block error" ng-show="test.field.$error.required">required</div> </div> link how can avoid ? your issue respect fact condition ng-show test.field.$error.required . what's problem this? even when page loads, field still not valid email id. so, what's fix? you need check user has clicked on field , field no longer pristine . how that? in ng-show , add following condition. test.field.$error.required && test.field.$dirty here working demo

html - How do I include youtube videos in a carousel on Google sites using embedded custom code? -

the html box embed feature on google sites great. google provides example of how build 3-slide carousel text or logos content. however, i'm struggling how add youtube videos content. i've tried putting in content section: iframe width="420" height="315" src="https://www.youtube.com/embed/ski_4n0dffi" frameborder="0" allowfullscreen>/iframe but google sites complains src tag not allowed here. suspect sort of security restriction. just try. <object data="https://www.youtube.com/embed/ski_4n0dffi"> cannot load video. </object> or <embed src="https://www.youtube.com/embed/ski_4n0dffi">

amazon web services - PHP echo is not working when added AWS headers -

i working on project have server. server connect amazon-cognito identity id , token. here php code. test.php: include 'aws.phar'; //require 'vendor/autoload.php'; use aws\cognitoidentity\cognitoidentityclient; use aws\sts\stsclient; use aws\credentials\credentials; use aws\s3\s3client; echo "ok"; $client = cognitoidentityclient::factory(array( 'version' => 'latest', 'profile' => 'project1', 'region' => 'ap-northeast-1' )); $result = $client->getopenidtokenfordeveloperidentity(array( 'identitypoolid' => 'xxxxxxxxxxxx', 'logins' => array( 'login.blupinch.app' => 'sandesh-004', ), 'tokenduration' => 3600, )); echo $token = $result['token']; //echo null; when opened browser , type url of server, see "ok" not value of $token . interestingly, see "ok" , $token value if command line: ...

javascript - Element not found when following the page object style guide -

as per my previous question creating question. followed guidelines in style guide when told, elements not found on page. in pageobject, have defined fields , get-function. when perform get-function, chrome still on blank page because it's start of test. before performing get-function, protractor seems want initialize fields have declared, throwing no element found exception. does have experience this? can't seem head around it. i suspect problem might come this part of style guide - if making actions on found in page object constructor elements right there in page object constructor - need put page object initializations beforeeach() instead of having them directly under describe : var userpropertiespage = require('./user-properties-page'); var menupage = require('./menu-page'); var footerpage = require('./footer-page'); describe('user properties page', function() { var userproperties, menu, footer; before...

loadrunner - Upload csv files with comma inside it -

as per requirement, need upload .csv file application. trying simulate using loadrunner. issue encoutering csv file in below format header - aa,bb,cc data-xyz,"yyx,zzy",xxz on using below statement upload file, getting error ""line 2 contains 4 columns instead of 3" web_submit_data("upload", "action=xxx/upload", "method=post", "enctype=multipart/form-data", "reccontenttype=text/html", "referer=xxx", "snapshot=t86.inf", "mode=html", itemdata, "name=utf8", "value=✓", enditem, "name=token", "value={token_1}", enditem, "name=upload_file", "value={newparam_5}", "file=yes", "contenttype=text/csv", enditem, "name=button1", "value=upload", enditem, last); as per information provided in how deal string comma in csv, when have read data using loadrunner? , tried updating .pr...

cumulocity - Java Client extracting from Measurements -

how can extract measurements c8y_motionmeasurement c8y_analogmeasurement c8y_signalstrength the attributes java client? example c8y_motionmeasurement content: "c8y_motionmeasurement":{ "x":{ "unit":"m/s^2", "value":0.046882 }, "y":{ "unit":"m/s^2", "value":0.140647 }, "z":{ "unit":"m/s^2", "value":0.984529 } } thanks you can take @ device-capability-model project. includes lot of commonly used fragments. if fragments need exist can in java: measurement m = ... // measurement c8y signalstrength s = m.get(c8y.signalstrength.class); if fragment not exist in device-capability-model recommend creating class fragment in project. of course can handle map , fragment (as object) key. m.get("c8y_signalstrength")

Python/Django TypeError: relative imports require the 'package' argument -

after years of writing in c , c++, feel bit of dunce when comes python , django. can't seem simple work. concede error has been discussed in number of posts. i started going through django tutorials have run 'django-admin startproject mysite' has created 'mysite' folder. i've installed django_extensions i'm trying use 'runscript'. have more complex script want run later now, i'm trying invoke simple user script found online via mechanism i.e. mysimplescript.py: def run(*script_args): print script_args it located in 'scripts' folder structure follows, outer mysite/ root directory container project: mysite/ manage.py mysite/ __init__.py settings.py urls.py wsgi.py scripts __init__.py mysimplescript.py when run script follows, relative imports error. python manage.py runscript .scripts.mysimplescript.py --script-args testing 123 /usr/lib/python2.7/site-packages...

javascript - Trying to change Divs and then revert -

i want able click on 1 of <div class="col-md-4'> 's , turn <div class="col-md-12"> smoothly while smoothly getting rid of remaining md-4's. when click again on md-12 want smoothly opposite.. can't work out what's going on. when click col-md-4 it'll want, minus smoothness, won't revert back. if hav col-md-12 default , remove col-md-4 code col-md-12 revert 4.. no luck 4 12 4. why this? $(document).ready(function(){ $('.col-md-4').click(function(){ $(this).switchclass("col-md-4", "col-md-12", 1000).removeclass('col-md-4'); $('.col-md-4').addclass('profiles-gone'); }); $('.col-md-12').click(function(){ $(this).removeclass('col-md-12'); $('.col-md-4').removeclass('profiles-gone'); $(this).addclass('col-md-4'); }); }); .col-md-12 { background-color: #a9f5bc } <link rel="styleshee...

mysql - How can I deal with the sub category in database? -

i have csv file in following format: 1043374544±collectibles 1043374544±decorative & holiday 1043374544±decorative brand 1043374544±christopher radko 1043397455±collectibles 1043397455±decorative & holiday 1043397455±decorative brand 1043397455±enesco 1043397455±precious moments and number itemid , '±' delimiter, after delimiter category item belongs. , each category in bottom previous one's sub category. it's collectibles --> decorative & holiday --> decorative brand --> christopher radko in case. problem items have different numbers of categories. so how can create table can able enquire , know items in each category or sub-category. when item can have number of categories , category can include number of items, have commonly referred n:m relation. the usual method solve issue adding third table "relation" primary key table of 2 others. here example (* means column part of primary key) table products id* | nam...

android - Auto-update process in the background -

is there way schedule android app update developers side, or process update in background (not closing/stopping app)? have app, not updated while working/playing, or @ least update has invisible , shouldn't involve user's interactions (press agree or sth that) i don't think there way update app while open. have closed update happen.

python - Use compiled .mexw64 function without matlab -

this may due inexpertise in area, i'm looking way use function compiled in .mexw64 in language or program different matlab. so far, i've found plenty of ways create code in other languages compile .mexw64 further use in matlab, here want use compiled .mexw64 function (given else) in, lets say, scilab (or other language matter). i have no interest in looking @ code (although plus), want use black box input needs , normal output of it. solution allows me in program or language other matlab welcomed. don't know if possible or if lost cause.

Can I import a Kony Visualizer project directly into Kony Studio from a Visualization Cloud? -

i thinking part of cloud offering can't figure out how it. is way import studio visualizer use local copy of visualizer project file? it looks feature. kony not providing feature.

javascript - jQuery Mobile - slider cannot be moved -

i using jquery slider cannot move handle. the html structure: <div id="map" class="map" style="position: relative;"> <div id="legend" class="legend" style="position: absolute; top: 0px; right: 0px; width:300px; z-index: 100;"> <div style="width:290px; height: 150px; padding: 5px;"> <label class="checkbox-label"><input name="gai_max_v" id="gai_max_v" class="runoff" type="checkbox"><image src="icons/icona_land_use.png"/><p id="legend_text">soil runoff capacity (1955)</p></input></label> <div id="div-slider"> <input type="range" name="slider-1" id="slider-1" value="80" min="20" max="100" step="20" data-highlight="true"> </div> <div style=...

python 2.7 - Trouble with pandas merge function -

i trying merge 2 panda's data frame using merge function. here top few lines of both data frames. newdf 0 1x 0 1 farm products 1 11 field crops 2 112 cotton, raw 3 1129 raw cotton, nec 4 1131 barley and df_2012 0 1 2 3 4 0 1 657042 52539820 103009 10818958 1 11 613499 51051986 99650 10525341 2 112 10710 233790 0 0 3 1121 0 0 0 0 4 1131 13276 998109 3560 0 when merge following command: pd.merge(newdf, df_2012, on = [newdf.columns[0]], how = 'right') i getting following: 0 1x 1 2 3 4 0 1 nan 657042 52539820 103009 1 11 nan 613499 51051986 99650 2 112 nan 10710 233790 0 0 3 1121 nan 0 0 0 0 0 4 1131 nan 13276 998109 3560 i don't understand why new merged data frame's '1x' column has nan s. thought keys doesn't appe...

javascript - Angularjs child cannot update parent variable -

i have 2 controllers: app.controller('maincontroller',['$scope','$templatecache','$route','$location',function($scope, $templatecache,$route,$location) { $scope.clear = function(){ //console.log("clicked"); //console.log($route.current.originalpath); $( "#activewarning" ).show(); $templatecache.removeall(); $route.reload(); $location.path( $route.current); } }]); and app.register.controller('settingscontroller', function ($scope) { $(document).ready(function(){ $("#btnsubmitaccountsetting").click(function(e){ e.preventdefault(); swal({ title: 'are sure?', text: 'your account switched unverified until verify account updated documents.', type: 'warning', showcancelbutton: true...

angularjs - How to create grid list of infinitely scrollable data? -

i working on building web page display grid list of infinitely scrollable products. have implemented following markup achieve : <md-grid-list md-cols-gt-md="3" md-cols-md="2" md-cols-sm="1" md-gutter="12px" md-row-height="1:1"> <div infinite-scroll="loadmore()" infinite-scroll-disabled="busy"> <md-grid-tile ng-repeat="p in products"> <md-grid-tile-header> <h3>{{p.id}}</h3> </md-grid-tile-header> </md-grid-tile> </div> </md-grid-list> (all code forms part of md-tab-body ) the problem facing here function loadmore() gets called automatically. doesn't wait me scroll bottom of page. how solve issue? loadmore() misplaced in html? check https://material.angularjs.org/latest/api/directive/mdvirtualrepeat from material.angular.org md-virtual-repeat specifies e...

javascript - Prevent a promise from triggering a global 'unhandled rejection' event -

i'm writing library. @ 1 point create promise , swoop in later add then/catch handlers it. it's possible promise fail before i've attached error handler it. fine me; promise can exist in schrödingers-cat-like state until later maybe decide @ it. the problem is, environments trigger global event if any promise gets rejected while has no error handler. maybe 1 of users has done drastic this in node: process.on('unhandledrejection', function(reason){ console.error('oops', reason); process.exit(1); }); i don't want rejected promise trigger if know i'm going go , check result later. is there official way can mark promise exclude global 'unhandled rejection' event, or have synchronously attach error handler every promise avoid this? file bug on environment (node). environment has no business acting on in way that's observable script. in firefox , chrome there no script-observable consequences afaik. even thou...

javascript - Confused on ordering of function calls and debugging -

i trying debug function call in jsp program , confused on ordering of how things worked. using netbeans. when run project in debug mode, goes '$("#searcheft").mouseup(function ()' function , trace through of it. 'searcheft' button using access servlet. when process page , click 'searcheft' button, hits function call based on getting right alert doesn't trace in debug. why doing that? first call of function on load setting check when user mouseclick? this function outside of '$(document).ready(function ()' @ top , function call after button declaration in jsp. edit: here jsp code: <head> <script> $(document).ready(function () { $(function () { $("#cmdcreationdate").datepicker({ dateformat: "yy-mm-dd" }); }); }) ; window.onbeforeunload = confirmexit; function confirmexit() ...

json - 411 Response on Post from WSO2 API Manager to REST endpoint -

i have setup rest endpoint in wso2 calls out rest endpoint. when call made receiving 411 response code. request contains json body, content type , accepts header set application/json. can curl backing service wso2 accessing directly same params , works correctly. seems wso2 stripping or not sending content-length. why content length not being sent rest endpoint being accessed? sending content-length disabled default because can cause performance degradation. can enable adding following api's insequence. (see https://docs.wso2.com/display/am1100/adding+mediation+extensions on adding custom sequence api) <property name="copy_content_length_from_incoming" value="true" scope="axis2"/> <property name="force_http_content_length" scope="axis2" value="true"></property> following sample sequnce <sequence xmlns="http://ws.apache.org/ns/synapse" name="contentlengthadd...

html - How to loop an embeded YouTube video? -

i embedding youtube video without playback controls, or video title, want autoplay , loop. works except loop. doing wrong? <div class='embed-container'><iframe src="https://www.youtube.com/embed/yo19zho7cac?autoplay=1&loop=1&cc_load_policy=1rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe></div> you shoud add playlist=video_id @ src <div class='embed-container'> <iframe src="https://www.youtube.com/embed/yo19zho7cac?autoplay=1&loop=1&cc_load_policy=1rel=0&amp;controls=0&amp;showinfo=0&playlist=yo19zho7cac" frameborder="0" allowfullscreen></iframe> </div>

html - div between floats works in Firefox, but not in IE11 -

this excerpt more complex problem, issue comes down this: code works on ff43, not on ie11. after 2 days, have determined can ff output ie output reducing width of outer wrapper. i've tried variants on position, float, display, etc., no avail. the goal was, content grows, content div resize horizontally first (expanding wrappers), , resize content div vertically when outer width limits reached. ideas? <!doctype html> <style> .wrapper { xwidth:480px; border:1px solid violet; } .formbox { display: inline-block; font-family: verdana,geneva,arial,helvetica,sans-serif; background: #ffffff; border:1px solid black; } .row { display: block; border: 1px solid #ccc; margin:3px; padding:4px; clear:both; position:relative; } .label { float:left; display:inline-block; width:120px; text-align:right; padding-right:4px; border:1px solid red; } .icons { float:right; width:40px; border:1px solid red; text-align:center; } .input { display:inline-block; border: 1px solid green; } ...

c# - WCF wsHttpBinding Client Certificate Authentication without using store in client -

Image
i have wcf service registered such using wshttpbinding hosted in iis https binding valid , active certificate: <?xml version="1.0"?> <configuration> <system.webserver> <security> <access sslflags="ssl, sslnegotiatecert, sslrequirecert"/> <authorization> <add users="*" accesstype="allow" /> </authorization> </security> </system.webserver> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> <system.servicemodel> <protocolmapping> <add scheme="https" binding="wshttpbinding" /> </protocolmapping> <bindings> <wshttpbinding> <binding name="mynamespace.webservice_transportsecurity"> <security mode="transport"> <transport c...

apache - 500 Error when trying to pass Python object to HTML using Flask/mod_wsgi -

i've got flask application running on top of apache using mod_wsgi. i'm trying pass object i've created template this: @app.route('/<user>') def viewuser(user): return render_template('viewuser.html', user = builduser(user)) where builduser returns instance of class 'user' based on username. viewuser.html accesses of fields of 'user' this: hello, {{ user.name }}! this runs fine on local flask server, browser returning '500 internal server error' when try access http://myurl.com/testuser . templates otherwise working fine - example if change view function return value to: return render_template('test.html', user = user) and test.html contains: hello, {{ user }}! everything displays correctly. ( http://myurl.com/testuser displays 'hello, testuser!') does have idea why passing simple values works on apache mod_wsgi, passing objects works on non-production flask server?

python - bash equivalent for os.walk? -

i using 2to3 fix script library, , seems command line thing, not shell thing. i want files /home/me/scripts downward, assuming end in .py . there easy way 2to3 -y filename each file under folder in shell? there's find command: find /home/me/scripts -iname "*.py" -exec 2to3 {} \; the -exec argument tell execute command follows after argument, 2to3 {} in case. each file found, {} replaced name of file.

ios - After Counting data how can i move to next textField. Where to put code to resign first responder? -

func textfield(textfield: uitextfield, shouldchangecharactersinrange range: nsrange, replacementstring string: string) -> bool { let currentcharactercount = textfield.text?.characters.count ?? 0 if (range.length + range.location > currentcharactercount){ return false } let newlength = currentcharactercount + string.characters.count - range.length return newlength <= 1 } where should resign firsttextfield ? need move 1 text field textfield user enter 1 character only assign tags textfields in sequence want them active 1 after other. next textfield based on current textfield tag , make first responder. here code this. func textfield(textfield: uitextfield, shouldchangecharactersinrange range: nsrange, replacementstring string: string) -> bool { let currentcharactercount = textfield.text?.characters.count ?? 0 if (range.length + range.location > currentcharactercount){ return false } let newlength = cur...

hyperlink - Ruby Sinatra storing variables -

in code below, initial '/' contains form, action post '/'. when user inputs number, should converted variable used call game class, have generated action reveal new form @ '/game'. variable generated in post method not being stored. how can both store variable created in post , link '/game' action? require 'sinatra' require 'sinatra/reloader' @@count = 5 dict = file.open("enable.txt") class game attr_accessor :letters, :number, :guess, :disp @@count = 5 def initialize (number) letters = find(number) end def find (n) words =[] dictionary = file.read(dict) dictionary.scan(/\w+/).each {|word| words << word if word.length == n} letters = words.sample.split("").to_a letters end def counter if letters.include?guess correct = check_guess(guess, letters) else @@count -= 1 end end end '/' ...

User authentication PHP mySQL not working -

so building user authentication system using php , mysql in xampp. i have managed recognize if user exists email address, other functions don't seem working. example check if user has activated account or not comes haven't if change active status 1 in database. or login function if both email , password correct incorrect. here login.php script <?php include 'init.php'; function sanitize($data){ return mysql_real_escape_string($data); } //check if user exists function user_exists($email){ $email = sanitize($email); //$query = mysql_query("select count('id') 'register' 'email' = '$email'"); return (mysql_result(mysql_query("select count(id) register email = '$email'"),0) == 1)? true : false; } //check if user has activated account function user_activate($email){ $email = sanitize($email); //$query = mysql_query("select count('id') '...

printf - How to display one dot every second in C before quitting the process? -

i trying display ... (three dots), each dot second delay second dot second delay third dot. i tried for(int = 0;i < 3;i++) { sleep(1); printf("."); sleep(1); } but waits 6 seconds , prints 3 dots don't want that. there fix this. want . second delay . second delay . but appear ... try: #include <stdio.h> #include <unistd.h> int main() { for(int = 0;i < 3;i++) { printf("."); fflush(stdout); sleep(1); } } printf() prints stdout bufferred. flush out buffer after each printf() . << flush; c++ equivalent this.

ruby on rails - erb to haml conversion to apply body class -

i have theses 2 line in erb <body class="<%= yield (:body_class) %>"> <% content_for :body_class, "my_class" %> i have tried - content_for :body_class my_class for above haml conversion i'm not sure - correct or not ! , not able figure out haml conversion for <body class="<%= yield (:body_class) %>"> any appreciated you do: %body{ class: "#{yield (:body_class)}" } and - content_for :body_class my_class

javascript - Angular UI Tree - Allow only drag & drop into second level (children nodes) -

i using angular ui tree . my object: [ { "id": 1, "title": "class1", "students": [ { "id": 11, "title": "student1.1", }, { "id": 12, "title": "student1.2" } ] }, { "id": 2, "title": "class2", "students": [] }, { "id": 3, "title": "class3", "students": [ { "id": 31, "title": "student3.1" } ] } ] what want achieve allow students drag & drop inside classes (the classes not have draggable, , ...

java - spring async rest client orchestrate few calls -

i have following problem in service building object x in order build need make few http calls in order required data fill (each rest fills part of object.) in order keep performance high thought nice make call async , after calls done return object caller. looks this listenablefuture<responseentity<string>> future1 = asyctemp.exchange(url, method, requestentity, responsetype); future1.addcallback({ //process response , set fields complexobject.field1 = "parserd response" },{ //in case of fail fill default or take ather actions }) i don't know how wait features done. guess standard spring ways of solving kind of issue. in advance suggestions. spring version - 4.2.4.release best regards adapted waiting callback multiple futures . this example requests google , microsoft homepages. when response received in callback, , i've done processing, decrement countdownlatch . await countdownlatch, "blocking" current thread unti...

devise - SSO architecture/gems for Rails SaaS -

i looking advice on tools (gems, or third party idaas) should use implement following: - have rails app saas app (using devise , cancan) - clients want use sso employees using our app not have create accounts. these users capture email address or information can send emails them - other clients not sophisticated enough , rely on generate user accounts them (which have in place , continue using) so question is: simplest/most efficient set of gems/tools should consider this

How am I supposed to use a Postgresql docker image/container? -

i'm new docker. i'm still trying wrap head around this. i'm building node application (rest api), using postgresql store data. i've spent few days learning docker, i'm not sure whether i'm doing things way i'm supposed to. so here questions: i'm using official docker postgres 9.5 image base build own (my dockerfile adds plpython on top of it, , installs custom python module use within plpython stored procedures). created container suggedsted postgres image docs: docker run --name some-postgres -e postgres_password=mysecretpassword -d postgres after stop container cannot run again using above command, because container exists. start using docker start instead of docker run. normal way things? use docker run first time , docker start every other time? persistance: created database , populated on running container. did using pgadmin3 connect. can stop , start container , data persisted, although i'm not sure why or how happening. can s...

ruby on rails - WebsocketRails Authentication with tiddle -

i'm developing ionic project uses rails api. authentication i'm using gem tiddle , ionic application pass x-user-email , x-user-token request readers. how proceed websocketrails authentication strategy?

Why is a `for` over a Python list faster than over a Numpy array? -

so without telling long story working on code reading in data binary file , looping on every single point using loop. completed code , running ridiculously slow. looping on around 60,000 points around 128 data channels , taking minute or more process. way slower ever expected python run. made whole thing more efficient using numpy in trying figure out why original process ran slow doing type checking , found looping on numpy arrays instead of python lists. ok no major deal make inputs our test setup same converted numpy arrays lists before looping. bang same slow code took minute run took 10 seconds. floored. think did change numpy array python list changed , slow mud again. couldn't believe went more definitive proof $ python -m timeit -s "import numpy" "for k in numpy.arange(5000): k+1" 100 loops, best of 3: 5.46 msec per loop $ python -m timeit "for k in range(5000): k+1" 1000 loops, best of 3: 256 usec per loop what going on? know numpy ar...