Posts

Showing posts from April, 2015

Azure Logic Apps - HTTP Listener -

i working on logic apps http listener , tried below option rather creating api controller. referring below urls https://azure.microsoft.com/en-us/documentation/articles/app-service-logic-http-endpoint/ i created logic app "http request" , processing , send response caller. working expected. but 1 thing wanted know , when create http request, provides default url below, https://prod- ****.logic.azure.com:443/workflows/*******69a5b764/triggers/request/run?api-version=2015-08-01-preview&sp=%2ftriggers%2frequest%2frun&sv=1.0&sig=*****2mcootkzu shall define custom url instead default one, below please advise.

javascript - mongodb: how to multiply a field by a constant in an if else branket -

i have runningpnl field , description field date field. want do: if description "breakup" multipliedpnl=2*runningpnl otherwise multipliedpnl=runningpnl code is: db.getcollection('user0').aggregate( [ { $project: { thedate: 1, realpnl: { $cond: { if: { $gte: [ "$description", "breakup" ] }, then: {$multiply:[$runningpnl,2]}, else: $runningpnl} } } } ] ) theres reference error : runningpnl not defined. whats wrong code? thx lot in advance help! can try $mul? mongodb version? reference: https://docs.mongodb.com/manual/reference/operator/update/mul/ an example documentation this db.products.update( { _id: 1 }, { $mul: { price: 1.25 } } )

python 3.x - Displaying Pandas Series with Asian text in index -

Image
if index of pandas series in 1 of asian languages , has variable lengths, print-out not aligned correctly. import pandas pd ipython.display import display df = pd.series( range(2), index = [ 'ミートボールスパゲッティ', 'ご飯' ] ) display(df) print(df) df note happens series , dataframe display can display content nicely. how can fix output here? convert series dataframe display. currently , series have no to_html() method. therefore, cannot displayed in format directly. import pandas pd ipython.display import display df = pd.series( range(2), index = [ 'ミートボールスパゲッティ', 'ご飯' ] ) df.to_frame()

typescript - Angular 2 loading unknown components -

i new angular 2 , wondering how solve problem more elegant. unfortunately not find solution problem. requirement i have tree many nodes. each node can provide own ui (template + data). when loading tree don't know nodes ui. have ask every node @ runtime. node decide ui , data provide. the old way without angular 2, when user clicks on node ask webserver send me html of node. webserver ask node provide html. node maybe load template, put data in , send browser - done. my try angular 2 currently, have components (created typescript) , every node can decide component show. loading nodes component when user clicks on node using componentresolver. asking webserver , webserver asking node. node knows "transpiled components js file" has read hard disk sending browser. every node can provide own component. now struggling problems: i don't want node has modify transpiled js. easy node provide data. node write data in components template. of course, don

android - what is the step by step process to implement an chat application using firebase -

i looking api develop chat application android using firebase. found sample examples web application. please provide link , if step wise instruction lists. regards, satya the firebase android codelab takes step step through building chat app firebase on android.

git - Confused how to revert all files as per master branch -

i created new branch ( git branch working ) , switched branch ( git checkout working ). added new files/folders , edited existing files. now want how things before creating 'working' branch. ie: want remove new files/folders added, , undo changes made existing files. i checked out master ( checkout master ) nothing reverted how was. im misunderstanding here. if git status while on 'master' branch get: changes not staged commit: (use "git add/rm <file>..." update committed) (use "git checkout -- <file>..." discard changes in working directory) here existing files edited untracked files: (use "git add <file>..." include in committed) here new files/folders added i thought checking out master, revert before created 'working' branch. need @ point? also, once i've reverted how in master,...what if wanted checkout 'working' again. new files/folders , changes there still? (ie:

node.js - Unexpected list element termination(Sender/MalformedInput) Amazon mws ListOrders API -

i using meteor access amazon mws api's , trying access orders trying hit listorderapi following parameters:- app.getpendingordersapi({'createdafter':startdate,'marketplaceid':'a21tjruun4kgv'},function(err,res){ if(err){ console.log("error is..."); console.log(err); } }) as can seen passing createdafter parameter , marketplaceid parameters both required pass both of them . using orders api version /orders/2013-09-01 try orders throw error follows:- <errorresponse xmlns="https://mws.amazonservices.com/orders/2013-09-01"> i20160706-15:40:07.238(5.5)? <error> i20160706-15:40:07.238(5.5)? <type>sender</type> i20160706-15:40:07.239(5.5)? <code>malformedinput</code> i20160706-15:40:07.239(5.5)? <message>unexpected list element termination</message> i20160706-15:40:07.239(5.5)? </error> i20160706-15:40:07

batch file - how to block social medias from windows -

i block social medias pc according time. block after 9 pm , unblock after 11 (like parental control) have tried following failed. created block.bat file @echo off (get-content c:\windows\system32\drivers\etc\hosts) | foreach-object { $_ -replace "#127.0.0.1 facebook.com", "127.0.0.1 facebook.com" } | set-content c:\windows\system32\drivers\etc\hosts created unblock.bat file @echo off (get-content c:\windows\system32\drivers\etc\hosts) | foreach-object { $_ -replace "127.0.0.1 facebook.com", "#127.0.0.1 facebook.com" } | set-content c:\windows\system32\drivers\etc\hosts and added these 2 bat file task scheduler. block run @ 11 , unlock @ 9 pm. i getting error powershell: set-content : input object cannot bound because did not contain information required bind mandatory parameters: path @ line:1 char:140 + ... e "#127.0.0.1 facebook.com", "127.0.0.1 facebook.com" } | set-content +

Convert jQuery slick.js to angularjs directive -

i trying convert jquery angularjs directive, don't know doing wrong in code below, can tell doing wrong? new angular , dont understand why code not working? html: <div class="slider"> <div class="slide-block"> <i class="fa fa-lg fa-exchange"></i> <h4>1</h4> </div> <div class="slide-block"> <i class="fa fa-lg fa-exchange"></i> <h4 > 2</h4> </div> </div> js: angular.module('components').directive('slick', [ 'jquery', function slick($) { 'use strict'; var scope = {}; function link($scope, $element) { $('.slider').slick({ centermode: false, infinite: false, centerpadding: '2px', slidestoshow: 6, speed: 200, index: 2, variablewidth: true,

javascript - Summernote works on local, but not on production -

what possible reason of summernote.js library working on local, not on production? use cdn it, check code: <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <meta name="csrf-token" content="{{ csrf_token() }}" /> <title>{{ env('app_name') }} | @yield('title')</title> <!-- favicon --> <link rel="favicon icon" href="{{ asset('public/favicon.ico') }}"> <!-- styles --> <!-- include libraries(jquery, bootstrap) --> <link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet"> <!-- include summernote css/js--> <link href="http

WCF client cannot connect to WCF service hosted in IIS via ServiceHost? -

i have scheme: iis hosts: operatorservice.svc (connects clientservice ) global.asax (on start): hosts clientservice via servicehost wpf client connects clientservice if go operatorservice service activated, web application started, , clientservice hosted @ http://localhost:8020/clientservice . far good. i can access clientservice in aforementioned url in browser, can add through add service reference . it's there - running. but when try connect via generated client (looks ok), doesn't work. throwing: there no endpoint listening @ http://localhost:8020/clientservice accept message. caused incorrect address or soap action. see innerexception, if present, more details. moreover operatorservice connects clientservice (it wsdualhttpbinding provide notifications). subscribes correctly service (calling method) , works (same url wpf client). why can't connect wpf client? wpf client config (only relevant sections): <client> <endpo

php - How to install extension from Magento 2 official marketplace -

can't find out right way install extension. example of extension can't find in system > integrations "magento connect manager". right way install , similar extensions? provided example of magento1.x ( magento connect used ) and asking magento2,x https://marketplace.magento.com/extensions.html url magento2's extension here need purchase extension , after have download link in account on sales order history you need login in magento admin (system -> web setup wizard :: component manager) , login using public & private access key magento account. than after can sync purchases magento installation or else you can download , install manually via command line for command line installation need follow these steps 1) upload new module app/code/ 2) php bin/magento module:enable emizentech_newmodule 3) php bin/magento setup:upgrade make sure change namespace of module

python - Fill Pyspark dataframe column null values with average value from same column -

with dataframe this, rdd_2 = sc.parallelize([(0,10,223,"201601"), (0,10,83,"2016032"),(1,20,none,"201602"),(1,20,3003,"201601"), (1,20,none,"201603"), (2,40, 2321,"201601"), (2,30, 10,"201602"),(2,61, none,"201601")]) df_data = sqlcontext.createdataframe(rdd_2, ["id", "type", "cost", "date"]) df_data.show() +---+----+----+-------+ | id|type|cost| date| +---+----+----+-------+ | 0| 10| 223| 201601| | 0| 10| 83|2016032| | 1| 20|null| 201602| | 1| 20|3003| 201601| | 1| 20|null| 201603| | 2| 40|2321| 201601| | 2| 30| 10| 201602| | 2| 61|null| 201601| +---+----+----+-------+ i need fill null values average of existing values, expected result being +---+----+----+-------+ | id|type|cost| date| +---+----+----+-------+ | 0| 10| 223| 201601| | 0| 10| 83|2016032| | 1| 20|1128| 201602| | 1| 20|3003| 201601| | 1| 20|1128| 201603| | 2|

php - jpgraph x-axis scale in date(Gi) max 2359 not showing data -

when using jpgrap , set x-axis scale 2400 $graph->setscale('intint',0,$max,0,2400); then insert data format key date('gi'),hour minute $ydata = array(1820=>5000,1955=>1000,2315=>7500); $lineplot=new lineplot($ydata); i not line drawn. when use swatch time (000 ~999) shows line. $ydata = array(154=>5000,587=>1000,768=>7500); am missing something? okey found answer myself, $graph->setscale('intint',0,$max,0,2400); $lineplot=new lineplot($ydata); needs be: $graph->setscale('intint'); $graph->xaxis->setticklabels(array_keys($ydata)); $lineplot=new lineplot(array_values($ydata));

r - How do I replace exact set of words? -

this question has answer here: making gsub replace entire words? 2 answers i have set of words exclude analysis. example, trash<- c("de" , "do", "das", ...., "da") # set can n elements also, have data.frame named matc 2 variables v1 , v2 apply replacements of each word in trash nothing. when tried using following code: for(k in 1:length(pr_us)) { matc$v1<- gsub(pr_us[k], "" , matc$v1 ) matc$v2<- gsub(pr_us[k], "" , matc$v2 ) } the replacement isn't exact. in other words, if matc$v1 "maria da graça madalena", result "maria graça malena" , following result "maria graça madalena". tried this for(k in 1:length(pr_us)) { matc$v1<- gsub( paste0(pr_us[k], "\bb") , "" , matc$v1 ) matc$v2<- gsub( paste0(pr_us[k], "\b

c# - Xamarin iOS CGPath draw polygon with curved/rounded corners -

Image
i'm trying create class draws polygon in custom uiview subclass. have working, want smooth corners rounding them off , i'm not sure how that. here have far: public class myview : uiview { private list<cgpoint> points; public myview(cgrect frame, list<cgpoint> points) : base (frame) { this.points = points; } public override draw (cgrect rect) { cgcontext context = uigraphics.getcurrentcontext(); context.setlinewidth(2); uicolor.black.setstroke(); uicolor.green.setfill(); cgpath path = new cgpath(); path.addlines(points.toarray()); path.closesubpath(); context.addpath(path); context.clip(); using (cgcolorspace rgb = cgcolorspace.createdevicergb()) { cggradient gradient = new cggradient (rgb, new cgcolor[] { new cgcolor(0, 1, 0), new cgcolor(0, 0.5f, 0), new cgcolor(0

Cannot install vet package with go get -

i'm running following command: $ go -u golang.org/x/tools/cmd/vet package golang.org/x/tools/cmd/vet: cannot find package "golang.org/x/tools/cmd/vet" in of: c:\development\software\go\src\golang.org\x\tools\cmd\vet (from $goroot) c:\development\software\go\downloaded_packages\src\golang.org\x\tools\cmd\vet (from $gopath) i can't understand how cannot find package makes sense get . supposed package internet. why looking locally? @jimb summed in comments - don't need install go vet separately. but completeness, direct answer op question code go vet command no longer lives @ golang.org/x/tools/cmd/vet (see https://golang.org/doc/go1.2#go_tools_godoc - , since code has moved github). so when run: go -u golang.org/x/tools/cmd/vet appears git cloning golang.org/x/tools/cmd package , trying compile golang.org/x/tools/cmd/vet resulting in error ("cannot find package...") because "vet" part doesn&

java - Get value out JSON Object containing JSON arrays -

how can value of "distance" out of following json object java? { "destination_addresses" : [ "new york city, new york, verenigde staten" ], "origin_addresses" : [ "washington d.c., district of columbia, verenigde staten" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "225 mijl", "value" : 361714 }, "duration" : { "text" : "3 uur 51 min.", "value" : 13877 }, "status" : "ok" } ] } ], "status" : "ok" } i tried: json.getjsonarray("rows").getjsonobject(0).getjsonobject("distance").tostring(); but org.json.jsonexception: jsonobject["distance"] not found. i think

android - Passing data between fragment in tabhost -

i create tabhost 2 fragment mtabhost = (fragmenttabhost)rootview.findviewbyid(r.id.tabhost1); mtabhost.setup(getactivity(), getchildfragmentmanager(), r.id.tabcontent1); mtabhost.addtab(mtabhost.newtabspec("fragmentb").setindicator("stations"), ligne11tram.class, null); mtabhost.addtab(mtabhost.newtabspec("fragmentc").setindicator("info trafic"), infotrafictram.class, null); i want send data first fragment(ligne11tram) 2nd fragment (infotrafic) , please can tell me how do well passing info between fragments on same activity, easiest method calling function in acitivity 1st , passing info second. kind of on first fragment. ((activityclass) getactivity()).functonwithvaraiblestopasstosecond(variables); in activity class pubic void functonwithvaraiblestopasstosecond(variables) { secondfragment.funcitontoacceptvariables(varaibles); }

ios - DLNA/UPNP video cast error of DMR -

i ios developer. developing dlna/upnp ios application. target directly cast video iphone samsung smart tv without middleware. using upnpx library that. wireframe below. iphone download videolink server. , directly cast video tv. of course, server not dms. in here issue videos played on tv. videos not played on tv. audio played. miss on implementing app? hope best solution everybody. thank you. this how selected dmr: mediarenderer1device *render = (mediarenderer1device*)device; [[playback getinstance] setrenderer:render]; [[playback getinstance] play:0]; /*choosed dmr urn 'urn:schemas-upnp-org:device:mediarenderer:1' */ //play func -(int)play:(nsinteger)position { if([[renderer avtransportservice]isobserver:basicupnpserviceobserver*)self]== no){ [[renderer avtransportservice] addobserver:(basicupnpserviceobserver*)self]; } nsstring *uri = @"http://parstvco.files.wordpress.com/2015/11/dandoon-tala-10.mp4&q

node.js - HandleBars - How to Iterate 2 Collections -

i know how iterate single collection, how iterate multiple collections using handlebars? below routing file employeepayslip.find({"employeename":""+name}, function(err, db_payslip){ if(err) throw err; salaryitems.find({"employeename":""+name}, function(err,db_salaryitems){ if(err) throw err; res.render('adminview/pages/examples/payslip-details',{ payslip:db_payslip, salaryitem:db_salaryitems }); }); }); }); how do below, {{each payslip}} <label>{{employeename}}</label> {{each salaryitem}} <label>{{item}}</label> {{/each}} {{/each}} if use 1 each , iteration works, if nested it, not seem display data. how display data both collection?

Stacking one column while duplicating other column in Excel or Stata -

i working on huge dataset in excel file. data has daily stock returns of 380 companies 2016 2000. each company has 3800 observations. first column has dates in excel format in descending order. successive columns have returns of companies correspond dates. i have import dataset stata panel data analysis , unfortunately above arrangement not in that. have rearrange data either in stata or in excel , can't seem automatically. rearrangement: i looking sort data 3 columns only. first column have company names stacked below each other. the second column has dates duplicate whenever new company starts. the third column should have returns of companies stacked below each other. illustration it converting data long form in stata. not sure if excel able handle since each company have 3800 rows , there 380 companies. in excel, developed macro stack columns of returns not not make dates column , company names move along it. in stata, tired reshape command gives mismatch e

Building boost with Intel C++ Composer XE 2013 -

i have installed intel c++ composer xe 2013, , i'm trying build boost (1_61_0) (on windows 8). followed steps on official website here , modified files suggested on related topic here (also modifying 12.0 13.0 in intel-user-config.jam, , going src instead of v2 folder). command b2 --user-config=intel-user-config.jam --toolset=intel seemed work properly. however, build.bat still not work (so did not build properly): @echo off set currentdir=%cd% @call "c:\program files (x86)\intel\composer xe 2013\bin\iclvars.bat" ia32 icl /fast helloworld.cpp pause the error message being related boost: catastrophic error: cannot open source file "boost/math/distributions/normal.hpp" do need else in .cpp file in order use boost? or did not installed properly? maybe it's version of boost? i'm new c++, compilers, etc. have been trying figure out make boost work days , still unable use it. have tried suggested on other topics without success.

javascript - Node.js undefined properties -

i'm trying create log in window. code simple. var employees = { '1' : { firstname: '', lastname: '', login: 'qwerty', password: '12345', }, '2' : { login: 'asdfg', password: '12345', }, }; app.post('/main', function(req, res) { if (!req.body) return res.sendstatus(400); console.log(req.body); for (var key in employees) { console.log(key['login']); console.log(key['password']); if ((key.login == req.body.login) && (key.password == req.body.password)) { res.render('main'); } else { app.get('/', function(req,res) { res.send(createindexpage()); }); }; }; }); why key.login , key.password return undefined? , why else block not run when if statement wrong? look @ value of key is: var employees = { '1': { firstname: '', lastname: '',

java - Efficiently merging and re-sorting sorted lists -

this isn't classic "merging 2 sorted" lists questions, fairly trivial in linear time. what i'm trying merge 2 lists of (key, value) pairs, sorted value , there objects same key in both lists: such objects should have value s merged (added), may change sort order. i'm interested in how sort can efficiently performed using information sorted lists, since sort slowest part of algorithm. let's take concrete example. imagine list of student objects: class student { final string name; final int score; ... } given input 2 list<student> sorted score , i'd create new merged list of students, student (identified student.name ) appearing in both lists appears once in final list, score equal sum of score in both lists. original lists should left unmodified. e.g., list 1: {"bob", 20} {"john", 15} {"mark", 14} list 2: {"bill", 11} {"mark", 9} {"john", 1} result: {"mark&q

Create XSLT for copy of entire XML but update few tags with static value -

i want create xslt copying same input xml want change few xml tags static value. i had tried self building xslt, can see output xml same input xml. here input xml file <?xml version="1.0" encoding="utf-8"?> <document xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" systemversion="7.00.3.71.03" system="hubbroker" version="101" xmlns="http://rep.evenex.dk/schema/evenex/ebusiness_01"> <header> <senderendpointid qualifier="cvr">00000000</senderendpointid> <receiverendpointid qualifier="ean">6564654656546</receiverendpointid> <createddate>2016-04-07</createddate> <createdtime>12:25:59</createdtime> <edirefno>24721</edirefno> <test>false</test> <acknowledgementrequest>yes</acknowledgementrequest&

osx - Is there a way to get NSPanel “Non activating” style functionality on an NSWindow? -

nspanel has “non activating” option hud panels. i’d same functionality working on nswindow , i.e. want window accept clicks not take focus away whatever active app (by mean app active before clicking on window activated app—in case sketch). i have tried creating nswindow subclass , setting canbecomemainwindow , canbecomekeywindow no doesn’t seem working—i think because settings apply windows within same app . what i’m trying here prevent this flickering . i’m pretty sure doable apps alfred seem doing it. if else comes across this, whilst not exact answer question, can indeed make nspanel go light adding nsvisualeffectview view controller , setting light.

What is difference between char* and int* data type to create array of pointers in C++? -

while creating array of pointers int data type following code works: int var[] = {10, 100, 200, 1000}; int *ptr[] = {&var[0], &var[1], &var[2], &var[3]}; while creating array of pointers char data type following legal: char *names[] = {"mathew emerson", "bob jackson"}; but if create array of pointers int data type follows: int var[] = {10, 100, 200, 1000}; int *ptr[] = {var[0], var[1], var[2], var[3]}; i compiler error. understand why getting compilation error in above method of declaration array of int data type, var[i] not reference variable pointer must point i.e. address, shouldn't error same logic in declaration of char array of pointer. what reason acceptable in char array of pointers? is " a string value " address of pointer can point or const string value. char *names[] = {"mathew emerson", "bob jackson"}; is not legal in c++. string literal has type of const char[] i

terminal - Cannot Install CocoaPods -

i having trouble installing cocoapods. when try sudo gem install cocoapods , gives me error saying error: error installing cocoapods: activesupport requires ruby version >= 2.2.2. you can make work manually installing compatible activesupport first. sudo gem install activesupport -v 4.2.6 sudo gem install cocoapods

Android App + Cordova + HTML5 + Google Drive Api -

i developed html5 page list google drive files , test phonegap server. works fine, because created oauth2 http://localhost:3000 configured. when tried test apk file, sha1 (also configured on oauth2 in google drive console), received error: refused display 'https://accounts.google.com/o/oauth2/auth?client_id=<key>' in frame because set 'x-frame-options' 'sameorigin'. understand error because oauth2 doesn't expect origin. origin not http, if file know... (file:///android_asset/www/index.html). googleapi console doesn't accept 'file' protocol... 'http'. how can solve this? according solution given in post - refused display in frame because set 'x-frame-options' 'sameorigin' , regarding error encountered: this not related disabling security in chrome browser. believe there might me issues xampp windows local host.deploying same application in node.js server or hosting dropbox/google drive web app

javascript - pass input attribute data to other input function parameter - angular -

is possible pass ng-disabled data other input function parameter: <div ng-repeat="item in properties"> <input type="checkbox" ng-click="checkdisable(isdisable)"> <input type="checkbox" ng-disabled="properties[$index].isdisabled"> </div> plunkr: here use item value in loop <div ng-repeat="item in properties track $index"> <input type="checkbox" ng-click="checkdisable(item.isdisabled)"> <input type="checkbox" ng-disabled="item.isdisabled"> </div> plunker