Posts

Showing posts from September, 2013

php - SimplePie on Azure not parsing https feeds -

i'm using compiled version of simplepie 1.4.2 (the last tagged version on github) aggregate rss/atom feeds (code below if needed). it works on couple of linux-based web hosts, when upload azure app services http feeds display correctly, https don't. why happens? no specific settings set on web app, using php 5.6 in both environments. no differences accessing azure web app through http or https. thanks everybody! <?php date_default_timezone_set('europe/rome'); set_time_limit(0); header('content-type: application/rss+xml; charset=utf-8'); require_once('simplepie.compiled.php'); [...] echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title><?php echo $feedtitle; ?>&l

osx - Playframework:activator command not found in mac -

i have set activator path in mac, when want create project said command not found.please help.here path. /documents/activator-1.3.10-minimal/bin:usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin and here error mac-score:activator-1.3.10-minimal mac-score$ activator new first-app play-java -bash: activator: command not found if using homebrew can paste following command on terminal: brew install typesafe-activator

angularjs - how update model value when input value is changed in Angularjs2 -

i want change model value input tag don't know how in best way. here code have done that. <div *ngfor='let l of list'> <input #temp [value]='l.test' (blur)='l.test=temp.value'/> <span (click)='check(l,temp.value)'></span> <div> angular code check(l,temp:string) { console.log(l.test); console.log(temp); } i want without blur event. please suggest me better way this. use can [(ngmodel)] on field, provide 2 way binding on field, type in change l.test value of particular element array. markup <div *ngfor='let l of list'> <input [(ngmodel)]='l.test'/> <div> since angular 2 rc-5 , make ngmodel 2 way binding working have import formsmodule in @ngmodule import { formsmodule } '@angular/forms'; ///..other imports @ngmodule({ imports: [ browsermodule, formsmodule ], //< added formsmodule here declarations: [ appcomponent ]

javascript - Second php file can't find Session started in first file -

Image
i can't php $_session variable work way want to. i've got 2 files. first 1 setting variable: <?php session_start(); header("access-control-allow-origin: *"); $_session['authenticated'] = "yes"; echo json_encode('authenticated successfully.'); ?> and second 1 trying retrieve it: <?php session_start(); header("access-control-allow-origin: *"); print '<pre>'; var_dump($_session['authenticated']); print '</pre>'; ?> but second file prints null when should print "yes" , new error recorded in server's log: [thu sep 22 12:52:47.763114 2016] [:error] [pid 26644] [client <ip_here>] php notice: undefined index: authenticated in <second_file> on line 5, referer: <client_url_here> both files accessed ajax calls javascript. the ajax code file 1 works following: $.ajax({ url: corrdomain + '/auth.ph

python - how to fill color cells with 2 percentage data from other cells -

i have 3 cells example: a1: has independent value b1: has percentage value of %30 b2: has percentage value of %70 what want is, filling a1 cell background 2 colors (yellow/green). yellow needs @ %30 left , green needs %70 right can understand looking a1 percentage ratio %30 %70 except don't know how , apparently google all of values coming python script using pandas module , writing excel file via xlsxwriter

c# - Why can't Microsoft.VisualStudio.TestTools.UnitTesting get the DbSet<T> returned from database -

project:web api run path: open testexplorer , right click item want test,and left click debug selected tests problem description: traced sql server sql server profiler, , sql server received requesting , returned items. tdd project nothing. below relevant code: // test project test [testmethod] public void getcategorytrees() { //arrange categorytreescontroller controller = new categorytreescontroller(); //act list<categorytree> result = controller.getcategorytrees(); //assert assert.arenotequal(0, result.count); } // real project code private applicationdbcontext db = new applicationdbcontext(); // get: api/categorytrees public list<categorytree> getcategorytrees() { db.categorytrees.load(); return db.categorytrees.tolist(); } when visit api/categorytrees in ie explorer, can items in immediate window. , there 14 items. when ran test project in previous mentioned run path, got nothing. please me, thank you. //below code code

python - redis.exceptions.ConnectionError after approximately one day celery running -

this full trace: traceback (most recent call last): file "/home/server/backend/venv/lib/python3.4/site-packages/celery/app/trace.py", line 283, in trace_task uuid, retval, success, request=task_request, file "/home/server/backend/venv/lib/python3.4/site-packages/celery/backends/base.py", line 256, in store_result request=request, **kwargs) file "/home/server/backend/venv/lib/python3.4/site-packages/celery/backends/base.py", line 490, in _store_result self.set(self.get_key_for_task(task_id), self.encode(meta)) file "/home/server/backend/venv/lib/python3.4/site-packages/celery/backends/redis.py", line 160, in set return self.ensure(self._set, (key, value), **retry_policy) file "/home/server/backend/venv/lib/python3.4/site-packages/celery/backends/redis.py", line 149, in ensure **retry_policy file "/home/server/backend/venv/lib/python3.4/site-packages/kombu/utils/__init__.py", line 243, i

c# - ASP.NET Core publishing to IIS Blank Loading Screen -

i have published asp.net core 1.0 application iis version 8.5 new website. can able see login page. after successful login, getting blank page. perhaps routing not working perfectly.i don't have issues running app on dev machine.see config , startup public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) { loggerfactory.addconsole(configuration.getsection("logging")); loggerfactory.adddebug(); app.useapplicationinsightsrequesttelemetry(); app.usesession(); if (env.isdevelopment()) { app.usedeveloperexceptionpage(); app.usebrowserlink(); } else { app.useexceptionhandler("/home/error"); } app.useapplicationinsightsexceptiontelemetry(); app.usestaticfiles(); app.usemvc(routes => { routes.maproute( name: "default",

json - Ember Multitple belongTo relationships not working with JSONAPI -

i have following json api document: { "data": [ { "type": "haves", "id": "2708f443-0857-4ae9-9935-9aa4b4e9f721", "attributes": { "quantity": 1 }, "relationships": { "card": { "data": { "type": "cards", "id": "3be08f31-3361-404c-9977-23535ed837f3" } } } } ], "included": [ { "type": "cards", "id": "3be08f31-3361-404c-9977-23535ed837f3", "attributes": { "name": "name" }, "relationships": { "set": { "data": { "type": "sets", "id": "0fec70de-02e0-4646-bdcf-f86acea90d23" } } }

dataweave coersion string to array error -

i having issue in transforming message in dataweave, in mule 3.7. input xml has structure below: input xml dataweave code: dataweave code error below: exception stack is: 1. cannot coerce :string :array (com.mulesoft.weave.model.values.coercion.exception.unsupportedtypecoercionexception) com.mulesoft.weave.model.values.formatting.arrayformattypecoercionvalue:31 (null) 2. exception while executing: header_key : payload.data.header.key, ^ cannot coerce :string :array (com.mulesoft.weave.mule.exception.weaveexecutionexception) com.mulesoft.weave.mule.weavemessageprocessor$weaveoutputhandler:162 (null) root exception stack trace: com.mulesoft.weave.model.values.coercion.exception.unsupportedtypecoercionexception: cannot coerce :string :array @ com.mulesoft.weave.model.values.formatting.arrayformattypecoercionvalue.evaluate(arrayformattypecoercionvalue.scala:31) @ com.mulesoft.weave.model.values.formatting.arrayformattypecoer

python 2.7 - print only 5 links using loop of crawled link from website -

need print 10 brands name particular website mentioned in url please me from re import findall import csv import re import urllib bs4 import beautifulsoup def brand_name_link("https://priceraja.com/mobile/brands/"): htmlfile= urllib.urlopen(url) #htmltext = htmlfile.read() data=[] link=[] soup = beautifulsoup(htmlfile, 'html.parser') name_box = soup.find('ul', attrs={'class': 'top-brands'}) tag in name_box.find_all('img'): tag.replacewith('') link=tag link=name_box.find_all('a') print link def brand_name_link(url): htmlfile= urllib.urlopen(url) #htmltext = htmlfile.read() data=[] link=[] soup = beautifulsoup(htmlfile, 'html.parser') name_box = soup.find('ul', attrs={'class': 'top-brands'}) tag in name_box.find_all('img'): tag.replacewith('') link=t

android - Using version 1.0.0-alpha7 of the constraint library, which is obsolete -

i'm starting using android studio 2.2 , trying play constraintlayout when let android studio add automatically showed me error using version 1.0.0-alpha7 of constraint library, obsolete when try upgrade using quick fix error error:could not find com.android.support.constraint:constraint-layout:1.0.0-alpha8. i think bug in android studio. should fix it? my current solution suppress error. you need install constraintlayout android inside support repository package on sdk tools category of sdk manager .

javascript - Visibility of "this" in Arrow Functions -

this question has answer here: arrow function vs function declaration / expressions: equivalent / exchangeable? 3 answers i have 2 cases const test = { foo: function (){ this.bar(); }, bar: function (){ console.log('bar'); } } test.foo(); in case, works correctly. const test = { foo: () => { this.bar(); }, bar: () => { console.log('bar'); } } test.foo(); in second case error: uncaught typeerror: cannot read property 'bar' of undefined i know can wrote test.bar() in foo function, i'm interested why this not available in arrow functions scope in case. normally, value of this in function depends on how function called. arrow functions import value of this scope in function created. in middle of object literal, value of this depend on around ob

python - Issue trying to read spreadsheet line by line and write to excel (downsample) -

i trying write code downsample large excel file. needs copy first 4 lines exactly, on 5th line start taking every 40th line. have this import os import string import shutil import datetime folders = os.listdir('./') names = [s s in folders if "csv" in s] zips = [s s in folders if "zip" in s] folder in names: filename = folder shutil.move(folder, './archive') open(filename) f: counter = 0 line in f: counter += 1 f_out = open('./downsampled/' + folder + '.csv', 'w') if counter < 5: f_out.write(line) elif (counter+35) % 40 == 0: f_out.write(line) f_out.close() it moves files archive folder, not create downsampled version, ideas on doing wrong here? you're overwriting file on each iteration of previous file. move open(...) out of for loop: with open(filename) f, open('./downsampl

html - perl subroutine output appending "1" -

i'm playing sub routines. it's working should, i'm getting random returned value of: 1 @ bottom of page when call sub admin_view. home.pl #!/usr/bin/env -w perl no warnings 'experimental::smartmatch'; use cwd qw(abs_path); use feature qw(switch); use cgi::simple; use html::template; $cgi = cgi::simple->new; $action = $cgi->url_param('cmd') || ''; #set to: url/?cmd= $mode = $argv[0]; #accept entry terminal print $cgi->header; #make html appear if($action eq "") { #if url/?cmd= $mode = "home"; } if($action eq "admin_view") { #if url/?cmd=admin_view $mode = admin_view; } given($mode){ when(admin_view) { #html: admin mode & display posts use rawr::template qw(admin_view); print &admin_view; } when(home) { print "some home page"; } ##default message default { print "mode not implemented" } } template.pm package rawr::template; #template st

Powershell tail log to console while process is running -

i have process sends output log file. want write powershell script start process, wait finish, , whilst running, tail log file console in real time. i have tried this: $procs = start-process "some_process.exe" $logjob = start-job -arg "some_logfile.log" -scriptblock { param($file) get-content $file -wait | foreach { write-host($_) } } $procs | wait-process $logjob | stop-job ... , other similar arrangements, using jobs. looks output of jobs available either after job stopped, or sending 'events' it, sound they're not meant rapid things log messages (e.g. 100,000 lines in ~1 min). is there other way this? next option call 'tail' start-process , job done (i think - doesn't have same "wait stop" output behaviour), feels wrong. job output isn't displayed unless retrieve job. why don't reverse you're doing: start process job, , tail log file on console: $job = start-job -scriptblock { &

java - Android cameraSource.stop() causing app to freeze -

i building app has qr scanner using google vision api. having trouble stopping camera after qr code read. flow mainactivity -> qractivity once qr-code received detection app should return main activity. if not call camerasource.release() works fine device heats lot , has significant impact on battery drain. if release camera source mainactivity becomes un-responsive , app crash. why becoming unresponsive? , correct place release camera source? qractivity @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_qr); cancelbtn = (button) findviewbyid(r.id.cancel_button); cancelbtn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { onbackpressed(); } }); new qrreader(this); } qrreader class public class qrreader { private static final string tag = "qrreader"; private surfacevie

html5 - HTML 5 : Click to call by using tel in href for alternate numbers -

i implementing click call using href. <a href="tel:+919876543210">click here call</a> it working single number. need give 2 numbers in href alternate number. i have tried this, <a href="tel:+919876543210, +919876543211">click here call</a> i tried following approach, <a href="tel:+919876543210, tel:+919876543211">click here call</a> but takes first number. possible add 2 numbers in href? if yes how? when user click on random numbers should choosed. appreciated. in advance. you can use javascript :-) below code simple web page should solve problem <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>document</title> <scrip

javascript - 'Can't find module fs' when running casperjs on js file -

i trying run casperjs on javascript file have, , when run > casperjs index.js it says 'caspererror: cant find module fs'. the first line of index.js is var fs = require('fs'); i have node, casperjs, , phantomjs installed, why can't find fs? if correct, fs node's file system? update: added nodejs $path, still no luck. did install phantomjs/casperjs modules node fs module in project? don't seem mix well. i ran issue installed of these modules , getting same error message mentioned above. caspererror: can't find module fs once uninstalled node 'fs' module, worked fine. npm uninstall fs

tmux + vim, clipboard failure after re-attach when ssh from Windows to Linux machine -

have been enjoying tmux + vim these days, except 1 problem cannot resolve every time. it's clipboard failure easy reproduce. vim's "+y "+p, copy or paste clipboard, work if create new tmux session , keep using either on linux machine or via ssh (i use mobaxterm supports x11 forwarding) windows. copy , paste surely stop working after switch 1 side other. i tried search cannot find answer maybe used wrong keywords. tip appreciated.

javascript - NG directives not working inside a ng-repeat that is inside another ng-repeat -

so have ng-repeat that's inside ng-repeat. tried use ng-class ng-hide , ng-show it's not working in child ng-repeat. work inside parent. example: <div class="product" ng-repeat="item in category.products"> <h2 class="product-name">{{item.name}}</h2> <ul class="product-variety"> <li ng-repeat="variation in item.variations" class="{{variation.name}}" ng-hide="true">{{variation.name}}</li> </ul> </div> the li ng-hide not work. how make work?

How to Clear the window in tkinter (Python)? -

i want hide/remove buttons window (temporarily) "hide_widgets" function can put them after not working me, have tried using grid_hide() , destroy() , have tried searching stackoverflow not worked either. here program far: from tkinter import * class application(frame): #gui application def __init__(self, master): #initialize frame frame.__init__(self,master) self.grid() self.create_widgets() def create_widgets(self): #create new game etc... #title self.title = label(self,text = "gnome") self.title.grid() #new game self.new_game = button(self,text = "new game") self.new_game ["command"] = self.create_new_game self.new_game.grid() #load game self.load_game = button(self,text = "load game") self.load_game ["command"] = self.display_saves self.load_game.grid() #setting

android - assembleDebug.dependsOn not working -

first of all: not duplicate of error:could not find property 'assembledebug' on project ':app' the problem: since update android studio 2.2 (gradle plugin 2.2) can no longer make task assembledebug or assemblerelease dependent on new task in way: assembledebug.dependson 'checkstyle' more details in issue it gives following error: error:could not unknown property 'assembledebug' project ':app' of type org.gradle.api.project. an alternative refer task in following way: tasks.whentaskadded { task -> if (task.name == 'assembledebug') { task.dependson 'checkstyle' } } update android tasks typically created in "afterevaluate" phase. starting 2.2, tasks include "assembledebug" , "assemblerelease". access such tasks, user need use afterevaluate closure: afterevaluate { assembledebug.dependson sometask } source: https://code.google.co

makefile - Generate debug versions of targets in a DRY method -

i using gnumake , have makefile targets defined , respective dependencies. create debug version of these targets, have this: target := b c all: $(target) a: a.o e.o $(cc) $(cflags) $(incdirs) -c $(^) -o $(@) b: b.o g.o $(cc) $(cflags) $(incdirs) -c $(^) -o $(@) -pthread c: f.o c.o $(cc) $(cflags) $(incdirs) -lm -c $(^) -o $(@) %.o: %.c $(cc) $(cflags) $(incdirs) -c $(^) -o $(@) so good, create debug versions of these rules, don't want have rewrite rules. want add additional flags -g -ddebug cflags variable , change names of targets. i tried static rule stuff $(target:%=debug_%): %: * #<--- not sure how specify dependencies # cflags += -g -ddebug <-- uncommenting line error this didn't work. wanted above rule match targets specified, add additional parameters cflags generate files debug_a , debug_b , debug_c etc. not sure if possible make way reasoning this. any appreciated, so found suitable solution: debug_targ

Including a library within a custom library in Arduino using c -

i'm creating library arduino in c , i'm having problems importing adafruit cc3000 library it. know i'll comment using c++, want c better me. think problem way i'm referencing everything, great if clear how should import , call external libraries within custom library. my files such: agent.h agent_init.c cc3000.h cc3000.c test_agent.ino the idea cc3000 optional piece of connectivity hardware can used setting required , in future can have different hardware files can compiled arduino code necessary. in agent.h , agent_init.c don't have references cc3000 files @ moment. did separate out, possibly change want use cc3000 functionality through agent code. (e.g. set variable agent_use_cc3000). in cc3000.h have got @ moment basic file: #ifndef __af_cc3000_h #define __af_cc3000_h #if arduino >= 100 #include "arduino.h" #else #include "wprogram.h" #endif #ifdef __cplusplus extern "c" { #endif adafruit_cc3000 cc3000; #ifde

How to secure HERE API keys? -

how prevent taking api keys client side javascript code , starting use here subscription other use. i noticed here provide option secure api keys domain on applications management page: "secure app credentials against specific domain". have set option , put domain there not see change on app behavior. the application still continue working fine on pc. shouldn't here api stop working web server running on localhost , not on defined domain. my app running on browser, , static files come server ( http://localhost:8083/index.html ). using here javascript api. i tested running app on external cloud service on different domain localhost. results same. conclusion setting "secure app credentials against specific domain" has no impact , not work. checked api response headers , origins accepted. access-control-allow-origin: *

java - Spring: When getting a ManyToOne entity, reference entity (OneToMany) is not showing in JSON -

when send request in postman child entity (town) parent entity (province) not shown in json response. this controller. @requestmapping(value ="api/v1/town",method = requestmethod.get) public responseentity<list<town>> getalltowns() { list<town> towns = townservice.getalltowns(); if(towns.isempty()) { return new responseentity<list<town>>(httpstatus.no_content); } return new responseentity<list<town>>(towns, httpstatus.ok); } and these entities. parent class @entity @table(name = "province") public class province { @id @generatedvalue(strategy = generationtype.auto) @column(name = "province_id") private long id; private string name; @onetomany(fetch = fetchtype.lazy, cascade = cascadetype.all, mappedby = "province", targetentity = town.class) @jsonmanagedreference("province-town") private list<town> towns; public

sapui5 - Amazon ses.sendEmail - how to attach pdf file? -

i trying attach pdf in email using amazon ses.sendemail. don't know param key it. without attachment working perfectly. here have tried. ` var ses = new aws.ses() var params = { destination: { toaddresses: [ 'xxx', ] }, message: { body: { html: { data: msg, charset: 'utf-8' } }, subject: { /* required */ data: 'test mail', charset: 'utf-8' } }, attachment:{ }, source: 'yyy' }; ses.sendemail(params, function(err, data) { if (err) {// error occurred} odialog.c

hdfs - SolrJ CloudSolrClient incompatible with Hadoop fs Path -

the goal upload index config files hdfs solr via oozie workflow (java action). cloudsolrclient.uploadconfig() accepts java.nio.file.paths object in first parameter. running on hdfs (through oozie launcher), cannot resolve config path unless use org.apache.hadoop.fs.path. how can around this? there version of cloudsolrclient accepts hadoop.fs.path parameter?

php - MySQL Great Circle Distance (Haversine formula) -

i've got working php script gets longitude , latitude values , inputs them mysql query. i'd make solely mysql. here's current php code: if ($distance != "any" && $customer_zip != "") { //get great circle distance //get origin zip code info $zip_sql = "select * zip_code zip_code = '$customer_zip'"; $result = mysql_query($zip_sql); $row = mysql_fetch_array($result); $origin_lat = $row['lat']; $origin_lon = $row['lon']; //get range $lat_range = $distance/69.172; $lon_range = abs($distance/(cos($details[0]) * 69.172)); $min_lat = number_format($origin_lat - $lat_range, "4", ".", ""); $max_lat = number_format($origin_lat + $lat_range, "4", ".", ""); $min_lon = number_format($origin_lon - $lon_range, "4", ".", ""); $max_lon = number_format($origin_lon + $lon_range, "

c# - Listview not appearing right away xamarin forms -

the third or page in app contains listview, list reason doesn't display until either toggle view (which switches views itemsource list) or rotate screen. if toggle twice (so original starting state) listview there still. seems bug haven't been able find on it. public partial class reviewrequestspage : contentpage { private readonly list<requestcell> closedrequestcells = new list<requestcell>(); private readonly list<requestcell> openrequestcells = new list<requestcell>(); public reviewrequestspage() { initializecomponent(); navigationpage.sethasnavigationbar(this, false); bindingcontext = new svgimagesviewmodels(); new footer().setgesturerecognizers(null, notifications, help, home, this); loadrequestlists(); toggleswitch.propertychanged += (o, ea) => { handletoggle(((switch) o).istoggled); }; } .... private void loadrequestlists() { userdialogs.instance

pom.xml - Maven and and Eclipse integration -

Image
i have few questions maven , eclipse not know them. i'm new these tools. let me describe i've done: 1 - installed apache-maven-3.3.9 on window , placed @ "c:\program files (x86)\apache-maven-3.3.9". 2 - added maven_home (and m2_home) environment variables. 3 - added "c:\program files (x86)\apache-maven-3.3.9\bin" path environment variable. 4 - set proxy maven download creating xml file under ${user.home".m2]settings.xml. content of settings.xml is: <settings> <proxies> <proxy> <active>true</active> <protocol>https</protocol> <host>www.github.com</host> <port>8080</port> <nonproxyhosts>www.google.com</nonproxyhosts> </proxy> </proxies> </settings> 5 - tested , see if maven installed: c:\>mvn --version c:\ apache maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5 2015-11-10t11:41:47-05:00) mav