Posts

Showing posts from January, 2010

javascript - Why ng-class-even required extra quotes -

i working on angularjs codes fine stuck @ 1 place cant find why quotes required in ng-class-even directive. in line <tr ng-repeat="x in records" ng-class-even='"striped"'> why striped written "'striped'" instead of "striped" .striped { color:white; background-color:black; } <body ng-app="myapp"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <table ng-controller="myctrl"> <tr ng-repeat="x in records" ng-class-even="'striped'"> <td>{{x.name}}</td> <td>{{x.country}}</td> </tr> </table> <script> var app = angular.module("myapp", []); app.controller("myctrl", function($scope) { $scope.records = [ { "name" : "alfreds futterkiste", "country"

oledb - get column names Jet OLE DB in vb.net -

i've written function reads csv files , parametrizes them accordingly, therefore have function gettypessql queries sql table @ first data types , therefore adjust columns later inserted in sql. problem when set hdr=yes in jet ole db column names f1, f2, f3. circumvent issue i've set hdr=no , written loops empty strings, problem? here code: private function getcsvfile(byval file string, byval min integer, byval max integer) datatable dim constr string = "provider=microsoft.jet.oledb.4.0;data source=" & textbox1.text & ";extended properties=""text;hdr=no;imex=1;fmt=delimited;characterset=65001""" dim conn new oledb.oledbconnection(constr) dim dt new datatable dim da oledb.oledbdataadapter = nothing getdata = nothing try dim cmd string = "select * " & _table & ".csv" da = new oledb.oledbdataadapter(cmd, conn) da.fil

itunesconnect - iOS build not showing up for testflight beta testing -

Image
i building ipa (via fastlane distribution profile). entitlements show beta-reports-active=1 : upload apploader successful - it's not showing testing: the build shows under "activity" though - showing "missing beta entitlements" looking build details on itunes connect entitlements seem missing beta entitlements: anyone clue missing? the problem fastlane gym (in case) creating ipa invalid. ditched , building through xcodebuild without problems. both payload/*.app/embedded.mobileprovision , codesign -d --entitlements :- payload/*.app need have beta-reports-active = 1 set. wasn't case gym . see github issue explaining details without use_legacy_build_api: true gym has trouble picking right provisioning profile .

rest - Managing a nested resource in Jax-RS/Jersey that sometimes should behave as a non-nested resource -

i developing simple apis jax-rs jersey. let's considering domain of items sold stores in country. my design includes these 2 calls : /webapi/items /webapi/store/1/items both of them should return list of items, first 1 should return items sold in country, second 1 should return items sold store number 1. i have of course 2 resources, itemresource handles requests regarding items, , storeresource handles requests regarding stores. @path("items") class itemresource { @get public list<item> getallitems(){ } . @path("stores") class storeresource @get @path("/{storeid}/items") public list<item> getitemssoldbystore(@pathparam("storeid") long storeid) { } what pass second request itemresource, in order avoid coupling between storeresource , model class item or database interfaces (like daos) created manage items. know can consider itemresource sub-resource, or nested resource of storeresource, point not true, s

architecture - When a Service delegates data retrieval to a Data Mapper, which one should return a Model? -

i have set basic architecture, in service delegates retrieval of data data mapper (pseudocode below). productservice->fetchbyid(123); class productservice { public function fetchbyid(id) { product = productmapper->fetch('id', id); // or product = new product(productmapper->fetch('id', id)) ? return product; } } class productmapper { public function fetch(bysomething, value) { // fetch stuff db. // return new product or raw data? } } what best practice here if want end with, let's say, productcollection, or product? should data mapper create instances of these models , return them service, passes them along actor? or should data mapper give raw data service, instantiates models data before passing them caller? i think responsibility of data access code convert raw data query i.e. sql object. datamapper mapping if didn't return object? i'm not clear why need ser

html - Is it possible to have a DIV fit responsive content of an unknown size in a grid? -

i'm trying create responsive css grid following specifications: responsive content blocks left aligned content wrapper fits content blocks (this part may not possible) content wrapper vertically , horizontally centered pure css i have following code: * { padding: 0; margin: 0; line-height: 1; box-sizing: border-box; } .tiles, .tile, .tile { padding: 10px; } body { background: blue; } .tiles { display: flex; flex-flow: flex; flex-wrap: wrap; background: red; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } .tile { height: 100px; width: 100px; background: green; } .tile { display: block; height: 100%; background: yellow; } <div class="tiles"> <div class="tile"> <a>item</a> </div> <div class="tile"> <a>item</a> </div> <div class="til

java - NullPointer Exception - JSF Event Handling ( ValueChangeListener ) -

i learning jsf event handling , when try run sample code, getting null pointer exception. this index.xhtml snippet, <h:form> <h2>implement valuechangelistener</h2> <hr /> <h:panelgrid columns="2"> selected locale: <h:selectonemenu value="#{userdata.selectedcountry}" onchange="submit()"> <f:valuechangelistener type="com.cyb3rh4wk.test.localechangelistener" /> <f:selectitems value="#{userdata.countries}" /> </h:selectonemenu> country name: <h:outputtext id="countryinterface" value="#{userdata.selectedcountry}" /> </h:panelgrid> </h:form> userdata.java @managedbean(name = "userdata", eager = true) @applicationscoped public class userdata implements seria

ImportError: No module named shutil_get_terminal_size IPython -

i having error ipython version on redhat. $ ipython --version traceback (most recent call last): file "/usr/bin/ipython", line 7, in <module> ipython import start_ipython file "/usr/lib/python2.7/site-packages/ipython/__init__.py", line 48, in module .core.application import application file "/usr/lib/python2.7/site-packages/ipython/core/application.py", line 24, in <module> ipython.core import release, crashhandler file "/usr/lib/python2.7/site-packages/ipython/core/crashhandler.py", line 28, in module ipython.core import ultratb file "/usr/lib/python2.7/site-packages/ipython/core/ultratb.py", line 121, in module ipython.utils.terminal import get_terminal_size file "/usr/lib/python2.7/site-packages/ipython/utils/terminal.py", line 27, in module import backports.shutil_get_terminal_size **importerror: no module named shutil_get_terminal_size** could please me resol

ruby on rails - REASSIGN/DROP OWNED BY for all databases on postgres server -

i have situation trying remove list of roles particular database, role in use on multiple databases on server. as per the documentation dropping roles , have followed instructions: reassign owned doomed_role successor_role; drop owned doomed_role; -- repeat above commands in each database of cluster drop role doomed_role; the documentation states: because reassign owned [and drop owned] cannot access objects in other databases, necessary run in each database contains objects owned role. as expected, when run above commands: conn = activerecord::base.connection conn.execute("reassign owned viewer_role postgres") conn.execute("drop owned viewer_role") conn.execute("drop role if exists viewer_role") i getting error message: activerecord::statementinvalid: pg::dependentobjectsstillexist: error: role "viewer_role" cannot dropped because objects depend on detail: 35 objects in database inst2 35 objects in database inst3 35 objec

java - File upload HttpClient -- no file in selected folder -

i'm using loopj/android-async-http lib upload files in server. my android code: file myfile = new file(getrealpathfromuri(settintsactiviy.this, selectedimage)); requestparams params = new requestparams(); try { params.put("uploaded_file", myfile); params.put("name", "adfadfa"); params.put("tmp_name", "fadfadfa"); } catch (filenotfoundexception e) { e.printstacktrace(); } asynchttpclient client = new asynchttpclient(); client.post("http://localhost:8081/html/upload.php", params, new asynchttpresponsehandler() { @override public void onsuccess(int statuscode, header[] headers, byte[] responsebody) { system.out.println("statuscode "+statuscode);//statuscode 200 } @override public void onfailure(int statuscode, header[] headers, byte[] responsebody, throwable error) { } }); my upload.php <?php $file_path = "/images/"; $file_path = $file_p

android - Viewpager load fragments 1 by 1 -

Image
i have few tabs in app each of them have big network calls it's not practical load them @ starting application. how can implement thing load fragments 1 1 when user switch tab load etc. i tried setoffscreenpagelimit(1) it's not working. below complete code add fragments view pager. since demonstration have used textview , each fragment added have random colour.on clicking button can add many fragments want.on clicking page can remove view pager.you can move 1 page in view pager swiping right or left . mainactivity.java import android.graphics.color; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentactivity; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentstatepageradapter; import android.support.v4.view.viewpager; import android.view.view; import android.widget.button; import java.util.arraylist; import java.util.random; public class mainactivity extends fragmentactiv

java - JavaFX FXMLoader IllegalStateException: Location is not set -

Image
i try load fxml file mainview.fxml did in other projects. "illegalstateexception: location not set." pretty sure pass in right location. have other ideas wrong? have no ideas anymore. mainview.fxml in package view. app.java , view on same level. code: fxmlloader loader = new fxmlloader(getclass().getresource("/view/mainview.fxml")); parent root = loader.load(); scene scene = new scene(root); pathtree: output: /library/java/javavirtualmachines/jdk1.8.0_45.jdk/contents/home/bin/java -didea.launcher.port=7532 "-didea.launcher.bin.path=/applications/intellij idea ce.app/contents/bin" -dfile.encoding=utf-8 -classpath "/library/java/javavirtualmachines/jdk1.8.0_45.jdk/contents/home/lib/ant-javafx.jar:/library/java/javavirtualmachines/jdk1.8.0_45.jdk/contents/home/lib/dt.jar:/library/java/javavirtualmachines/jdk1.8.0_45.jdk/contents/home/lib/javafx-mx.jar:/library/java/javavirtualmachines/jdk1.8.0_45.jdk/contents/home/lib/jconsole.ja

PHP to C# Exchange Currency Rates -

hi trying exchange rates data below website c# application. if scroll down in below link there developers section , code in php. don't know if can implemented in c# new php. any on different ways implement or how make php code works in c# application. important use website official euro foreign exchange rates. http://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html how can extract data , manage data c# applications <gesmes:envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref"> <gesmes:subject>reference rates</gesmes:subject> <gesmes:sender> <gesmes:name>european central bank</gesmes:name> </gesmes:sender> <cube> <cube time="2016-07-05"> <cube currency="usd" rate="1.1146"/> <cube currency="jpy" rate="113.50"/> </cube> </cube> </gesmes:envelope&g

php - Seding images over json and result in distorted image -

Image
i sending images using php 5.6 encoding them base64 , putting in json encoded object additional data, browser (firefox 47 chrome 52). there create data uri. data receive correctly images distorted having stripes. [ php: the database contain raw image binary. querytableobj() method creates array of objects containing database rows. $aml = $oml->querytableobj(" select maengel.idmaengel, maengel.pos, . . . maengel.photo1, maengel.photo2, maengel.photo3, maengel.photo4, maengel.mime1, maengel.mime2, maengel.mime3, maengel.mime4 maengel left join beteiligte on maengel.idbeteiligte=beteiligte.idbeteiligte maengel.idprojekt=$idprojekt order pos "); if ($oml->rows > 0) { ($n=0; $n<count($aml); $n++) { ($i=1; $i<5; $i++) {

javascript - What purpose does this serve? IIFE assignment to var in Snap.svg.js -

my self-directed javascript study has led me reading libraries found following snippet (truncated brevity). i'm using firefox firebug on windows apache server (xampp). i figured snippet below suffice if needs it, entire library can found here: snap.svg.js on github var snap = (function(root) { snap.version = "0.4.0"; function snap(w, h) { // can either width, height or if (w) { if (w.nodetype) { // deterimines if parameter dom element return wrap(w); } if (is(w, "array") && snap.set) { // deterimines if parameter array return snap.set.apply(snap, w); } if (w instanceof element) { // deterimines if parameter snap.element return w; } if (h == null) { // elimination determines if parameter dom element id. w = glob.doc.queryselector(string(w)); return wrap(w); } } <numerous public , private properties , method

python - If a django migration is migrated to db, what is the best practice if the migration is deleted at a later date? -

while shouldn't happen not impossible. so in event migration has been run database , migration file has been deleted , not recoverable? this assumes database cannot dropped. the first approach i'd try check out last commit , recreate model changes in question migration regenerated , checked in. and while it's have contingency plan things this, if it's real concern i'd suggest evaluating deployment process make issue less likely.

PHP Composer does not clone symfony/assetic-bundle properly -

i trying install symfony on centos linux wih php 5.6 , cpanel installed. when run composer require symfony/assetic-bundle , once adding bundle appkernelphp, symfony (app/console too) stops working , keeps logging error: [10-jun-2016 22:00:57 utc] php fatal error: class 'symfony\bundle\asseticbundle\asseticbundle' not found in /home/avid24/public_html/app/appkernel.php on line 19 after checking vendor directory, turns out composer has downloaded single compressed file random name, extract unzip. problem still exists! this environment works on windows , update symfony , components using composer. any help? same experience ? well, figured out problem! i enabled suhosin extension prevents composer , other similar command prompt php scripts proper execution. as temporary solution copied php.ini , disabled unnecessary extensions , put next project , call composer way $php -c ../composer-php.ini ~/composer ...... i'll create script make life easie

javascript - Highcharts: Placement of data labels in the middle of sections of Pie Chart -

i want data labels of pie chart displayed in middle of sections irrespective of: whether section has been sliced or not whether size attribute in plotoptions has been mentioned or not solution 1 for this, tried using distance attribute of plotoptions. got radius series[0].points[0].shapeargs.r in load() event of chart. , use following: series[0].update({ datalabels: { distance: -(radius/2) } }); http://jsfiddle.net/k94x958d/2/ but poses 2 problem: pie chart loading animation lost , if section sliced, data labels not placed correctly http://jsfiddle.net/k94x958d/3/ solution 2 to resolve animation issue, tried using above logic distance , setting in series[0].options.datalabels in overridden drawdatalabels() method of highcharts library. did not work. is there way can achieve placement of data labels in middle of pie sections irrespective of size, slicing etc? we can use following code in load event: series[0].update({ animation:

jquery - Link PHP with Ajax Magento 2 -

i'm trying create simple "register interest" action. have front end working i'm not sure how link ajax php file. put php file? my current code ajax is: $.ajax({ url: "register-interest.php", type: "get", datatype: "json", data: { type : "registerinterest", email : useremaillog, user : usernamelog, product : producttitle, sku : productsku }, success: function (response) { json.stringify(response); }, error: function (err) { json.stringify(err); }, complete : function() {

Nginx URL rewriting issue -

i need nginx rewriting. have script running follows http://domain.com:2095/secretkey/something now above command takes user ip address automatically , want rewrite follows https://subdomain.domain.com/secretkey/something i using following rule not working. server { listen ip:443; server_name subdomain.domain.com location / { rewrite ^(.*)$ $1?ip=$remote_addr break; proxy_pass http://127.0.0.1:2095; } }

How to disable certain rows selection using GWT Datagrid 2.4 -

Image
i using gwt 2.4 version. how disable row selection in gwt datagrid. in grid have mixed records, based on condition need disable row selection in datagrid. for example : have 2 rows below values emp name| emp id | status abc | 1001 | active abc | 1001 | in active when user click on 2nd row should not selected. how achieve this. please let me know. i able achieve default checkbox selection event manager . by default have checkboxcell handle row selection. trick can override render() method of checkboxcell , do not render checkbox if corresponding row not allowed selected not calling super.render() method. below full working code example. can not select rows not active. please, notice parameters of constructor new checkboxcell(true, false) - important. public widget test() { datagrid<datagridtype> grid = new datagrid<datagridtype>(); final multiselectionmodel<datagridtype> selectionmodel = new multiselectionmode

html - Placing a div below a wrapper containing multiple divs -

Image
this might easy one. below structure want create: but end either this: or this: here code: html .newdiv2, .newdiv3, .newdiv4, .newdiv5 { width: 25px; height: 25px; margin-bottom: 5px; border: 3px solid black; } .newdiv6 { width: 150; height: 150; border: 3px solid black; } .newdiv { height: 250px; width: 450px; float: left; border: 3px solid black; } .divwrapper { float: left; border: 3px solid blue; } .mainwrapper { display: block; } <div class="mainwrapper"> <div class="newdiv"></div> <div class="divwrapper"> <div class="newdiv2"></div> <div class="newdiv3"></div> <div class="newdiv4"></div> <div class="newdiv5"></div> </div> </div> <div class="newdiv6"></div> this looks second image above (in

matrix - Matlab: merging a new script with inbuilt code to compare the execution time -

please, have code determinant runs not display output time display. can gurus in house me out. function determ=calll(a) a=input('rand()'); [rows, columns] = size(a); tic; if rows==2:size(a); m11=a(2:end,2:end); m1n=a(2:end,1:end-1); mn1=a(1:end-1,2:end); mnn=a(1:end-1,1:end-1); m11nn=a(1:end-2,1:end-2); deter=(m11)*(mnn)-((m1n)*(mn1)); determ=deter./deternew(m11nn); end end toc disp('determinant =') the real issue that i want incorporate random matrix in code when run it, random matrix used me specify order of matrix because can not input 1000 1000 matrix manually. an inbuilt matlab code determinant should embedded in script. time of execution should included code , inbuilt matlab code. in all, when run program, should ask order (since random matrix must used) , compute determinant using code , inbuilt matlab code concurrently. note determinant of code , matlab same time of execution different. output

javascript - How to scroll div contents vertically in a loop like news feed in php page -

i'm making php webpage right , have little "news" div on right. has auto scrolling vertical text page loads. but, below code not working in php page. <html> <head> <script src="https://code.jquery.com/jquery-3.0.0.js" integrity="sha256-jrplz+8vdxt2fne1zvzxckccebi/c8dt5xyaqbjxqio=" crossorigin="anonymous"> </script> <style> span { display:block; width:350px; word-wrap:break-word; } .display { height:200px; border:none; overflow: hidden; padding:5; } </style> </head> <body onload="scroll()" style="background-color: black;"> <!---***************** php code start ************************---> <?php error_reporting(e_all ^ e_deprecated); //********************* db configuration code ****************

c# - System.AccessViolationException when calling Print() on a FlowDocumentScrollViewer -

we have wpf application targeting .net framework 4. here short explanation actions cause exception: 1) application receive string xaml content db. 2) content converted flowdocument via converter (xamlreader.parse method). 3) document presented user in flowdocumentscrollviewer. 4) user prints document calls print() method on flowdocumentscrollviewer object. 5) application crashes. it's important notice exception occurs on computers inside specific organization. never had exception elsewhere. we tried replace direct call print() other implementations (e.g. calling the printdialog manually) , still no luck. the thing sort of worked (and not permanently) install windows features under .net 3.5.1 on specific computer. here summary of trace: framework: v4.0.30319 system.accessviolationexception in- ms.internal.printing.unsafenativemethods.printdlgex(intptr) in- ms.internal.printing.win32printdialog.showdialog() in- system.windows.controls.printdialog.showdial

python libclang bindings on Windows fail to initialize a translation unit from sublime text -

short description : using libclang autocomplete code not work python comes bundled sublime text 3. details : small verifiable example in repo on github in essence, there script uses changed cindex.py (compatible python 3 , clang 3.8) , builds translation unit test source file. reparses , tries complete. the script works expected on using python 3.3.5 powershell. when put packages folder on sublime text 3 produces error. python version reported sublime text 3 3.3.6. error: traceback (most recent call last): file "c:\program files\sublime text 3\sublime_plugin.py", line 78, in reload_plugin m = importlib.import_module(modulename) file "./python3.3/importlib/__init__.py", line 90, in import_module file "<frozen importlib._bootstrap>", line 1584, in _gcd_import file "<frozen importlib._bootstrap>", line 1565, in _find_and_load file "<frozen importlib._bootstrap>", line 1532, in _find_and_load_

java - Notify when source is updated -

i have 2 cells in sheet in java program (a kind of excel program) , want make method repeat everytime these cells updated. more specifically, every time user changes cells on sheet have repeat method import information of cells list. need repeat method automatically x times, depending on cells behavior. any ideas how this? add listener (for jtextfeild documentlistener ) text field(or whatever cell is), automatically created you. // listen changes in text textfield.getdocument().adddocumentlistener(new documentlistener() { public void changedcell(documentevent e) { update(); } public void removecell(documentevent e) { update(); } public void addcell(documentevent e) { update(); } public void update() { if (integer.parseint(textfield.gettext())<=0){ // update } } });

ios - View controller in storyboard always gets presented from bottom -

i have view controller in storyboard in , image i'd included following code show particular view controller , problem is, no matter code use make transition, if it's being pushed side of screen(like xib's push ), shows bottom. uistoryboard * storyboard = self.storyboard; dashboardviewcontroller * dbvc = [storyboard instantiateviewcontrollerwithidentifier:@"navigforhomepage"]; [self.navigationcontroller showviewcontroller: dbvc sender:self]; i tried pushviewcontroller(also xcode says push deprecated), navigation bar disappears. my storyboard has navigationcontroller initially, i'd linked other view controller's ctrl+drag , storyboard segue kind show(e.g.push), in-between - dashboardviewcontroller, included navigationcontroller different navigation bar, mistake? i couldn't understand concept, question how normal push transition? appreciated thanks. uistoryboard * storyboard = self.storyboard; dashboardviewcontroller * dbv

javascript - how to declare that a given class implements an interface in Facebook Flow? -

i have following code using flow: // @flow 'use strict'; import assert 'assert'; declare interface ipoint { x: number; y: number; distanceto(other: ipoint): number; } class point { x: number; y: number; distanceto(a: ipoint): number { return distance(this, a); } constructor(x: number, y: number) { this.x = x; this.y = y; } } function distance(p1: ipoint, p2: ipoint): number { function sq(x: number): number { return x*x; } return math.sqrt( sq(p2.x-p1.x)+sq(p2.y-p1.y) ); } assert(distance ( new point(0,0), new point(3,4))===5); // distance ( new point(3,3), 3); // flow complains, expected assert((new point(0,1)).distanceto(new point(3,5))===5); // (new point(0,1)).distanceto(3); // flow complains expected running npm run flow yields no complains expected, whereas commented-out lines give rise warnings (again, expected). so all's world except don't know how make e

html - Extend element to bottom of screen with vertical offset -

i have simple layout took mdn's flexbox page . has header , main content area. <header>header</header> <div id='main'> <article>article</article> <aside>aside</aside> </div> i have main content area extend bottom of viewport or further if needs accommodate children. tried fiddling flexbox still can't specify want take space vertically can horizontally. the 2 options can think of are: a) javascript calculate required height b) tiling background image on body make appear though content area extended way down can think of alternatives fill viewport , contain children if children extend past bottom of n screen? https://jsfiddle.net/1cpcsvjr/5/ ** update ** amended jsfiddle more content in article sub element. content bleed out of flex container. #main { height: 100vh; } 100vh means 100% of viewport height, can change value if need to.

php - Codeigniter + Ion Auth - Are "groups" relevant in my case? -

i using codeigniter homemade authentification system switch ion auth. every user's account attached company's account. company's account can have > 1 user's account attached. example: - company 1 => user id 1, user id 2, user id 3 - company 2 => user id 4 etc is "groups" function in ion auth relevant storing company data? can, therefore, use "users" table in order save users , "groups" table in order save companies. choice relevant? you can use groups define company , create additional fields in users table (or separate) company data; then can use below check if user in particular company/group if ($this->ion_auth->in_group("company1")){ //your company stuff here }

javascript - What is the best way to check if a bunch of variables are equal to some value? ie. are a,b,c,d are all equal to 3 -

i have few variables, , if of them equal 3, executing function. there performance hit, or there better way of doing this- if (a === 3 && b === 3 && c === 3 && d === 3) { //do } an obscure technique put variables array , check every. if ([a, b, c, d].every(e => e === 3)) { // code true }

mysql - SQL database backup and restore on user id -

i have database contains details user information.the database contains 20 tables users specific details.every table contains user foreign key. want able backup specific user data database , restore backup. possible restore backup on different database has same tables. working on not able find documentation or article on this. if me on if doing possible. thank in advance you need write sql export data. can use number of techniques example: gather data using views, stored procedures or combination of both. export data using linked servers, import export or ssis. there no backup , restore functionality subset if data. (p.s. sql server. have 3 different database engines in tags.)

apache kafka - Consuming from a replica -

kafka replicates each partition of topic up-to specified replication factor. as far know, write , read requests routed leader of partition. there way consume followers not leader? is replication in kafka fail-over? you can consume leader -- design. replication fault-tolerance only. if leader fails, followers elect new leader. have @ blog post more details: http://www.confluent.io/blog/hands-free-kafka-replication-a-lesson-in-operational-simplicity/

How can I detect if docker for mac is installed? -

i have makefiles of stuff should run without configuration. these makefiles have used docker-machine in past. is there away detect in bash if user using docker mac instead of docker-machine ? the best way check existence of docker environment variables: docker_host docker_machine_name docker_tls_verify docker_cert_path all 4 of these set when eval $(docker-machine env) run , required use docker-machine. the beta not require of them being set , in fact requires unset them in order function properly. you can check in docker info command looking "moby" (the name of docker mac vm): docker info | grep -q moby && echo "docker mac beta" || echo "not docker mac beta" this going dependent on consistency in docker info results, however.

node.js - Twitter API, "Unable to verify your credentials." -

exactly says on tin. by means, code should working. it's following https://dev.twitter.com/oauth/application-only page says. yet, keeps returning {{"errors":[{"code":99,"message":"unable verify credentials","label":"authenticity_token_error"}]} [finished in 0.551s] , , have no idea why. var request = require('request'); var options = { url: 'https://api.twitter.com/oauth2/token', method: 'post', headers: { "authorization": "basic " + new buffer("[key]:[secretkey]").tostring('base64'), "content-type":"application/x-www-form-urlencoded;charset=utf-8" }, body: "grant_type=client_credentials" }; request.post(options, function(error, response, body){ console.log(body); }); as quick note, key , secretkey omitted code here due inherent sensitivity of being present. can place own key/secretkey in there try i

android - How to notifydatasetchanged between two activities -

i have 2 activities each contain fragments. activity has fragment listview. rows of listview obtained sqlitedatabase. activity b contains fragment enables entries of database edited. when user edits database entry, saves data, returns activity via backbutton or: actionbar = getsupportactionbar(); actionbar.setdisplayhomeasupenabled(true); actionbar.sethomebuttonenabled(true); how notify listview in activity there has been change database? understand how communicate between activity , it's fragments, how implement notifydatasetchanged when fragments in 2 different activities? i suspect going activity via button recalling view stack, view has changed when there database change. you call notifydatasetchanged in onresume in activity a. when close or go activity b a, update data. don't forget check if adapter different null, otherwise crash first time open app. you make public function in activity updates list , call activity b. class activitya public

r - manipulating two data frames based on string with different lengths -

i have asked question here finding index based on 2 data frames of strings , got perfect answer. have been facing problem not solve it. if second data more 1 column can solve based on setdt(strs)[, c('colids1','colids2') := lapply(.sd, function(x) tostring(which(colsums(lut == x, na.rm=true) > 0))), = 1:nrow(strs)][] this ok long second data (strs) has same length in columns if vary (not in same length) not work , give me error. so let first data lut <- structure(list(v1 = c("o75663", "o95400", "o95433", na, na), v2 = c("o95456", "o95670", na, na, na), v3 = c("o75663", "o95400", "o95433", "o95456", "o95670"), v4 = c("o95456", "o95670", "o95801", "p00352", na), v1 = c("o75663", "o95400", "o95433", na, na), v2 = c("o95456", "o95670", na, na, na),

c# - Automatically parallelize a .net application -

i know if there way automatically parallelize .net application in order use multi core cpu. i know if it's possible coding, but, there tools or "runtime?" able run application in parallel (multi threading) without manually ? thanks lot :) no - there no way parallelize .net application. programmer must build multi-threaded/parallel ground up, , application areas not suited parallelization.

mqtt - Is it sensible to version topic strings? -

there seem best practices concerning mqtt topics. laid out on hivemq website (amongst other things): don’t use leading forward slash don’t use spaces in topic keep topic short , concise an example topic was myhome/livingroom/temperature my question: could idea include version level in topic string? example: v1/myhome/livingroom/sensor/1/temperature v2/myhome/livingroom/sensor/2/temperature i thinking little bit of versions in rest apis here. in version 1 send temperature simple string. later have decided want use json format message payload newer sensors. the receiving clients check version , handle payload accordingly. if don't need support multiple versions @ once, don't it. if absolutely have to, i'd suggest @ sensor level, not root. gives flexibility on replacing sensors, not others e.g.: myhome/livingroom/sensor/1/v1/temperature or myhome/livingroom/sensor/1/temperature/v1

python - Frequency Response Scipy.signal -

Image
i'm learning digital signal processing implement filters , using python implement test ideas. started using scipy.signal library find impulse response , frequency response of different filters. currently working through book "digital signals, processors , noise paul a. lynn (1992)" (and finding amazing resource learning stuff). in book have filter transfer functions shown below: i divided numerator , denominator in order following equation: i implemented scipy using: numeratorzcoefs = [1, -1, 1, -1] denominatorzcoefs = [1, 0.54048, -0.62519, -0.66354, 0.60317, 0.69341] freqresponse = scipy.signal.freqz(numeratorzcoefs, denominatorzcoefs) fig = plt.figure(figsize = [8, 6]) ax = fig.add_subplot(111) ax.plot(freqresponse[0], abs(np.array(freqresponse[1]))) ax.set_xlim(0, 2*np.pi) ax.set_xlabel("$\omega$") and produce plot shown below: however in book frequency response shown following: they same shape ratio of peaks @ ~2.3 , 0.5 differen