SOAP Internal Error

I should use SOAP to call a web server function. I declared this parameters:

$this->parametriSOAP = [
        "location" => "",
        "login" => "UWT3CBXX",
        "password" => "PBUW9EBP",
        "authentication" => SOAP_AUTHENTICATION_BASIC,
        "trace" => true,
        "exceptions" => false
    ];

That’s my SoapClient instance:

$this->parametriSOAP["location"] = $endpoint;
        $wsdl = BASE_URL . "/storage/SistemaTS/" . $wsdl;
        $client = new SoapClient($wsdl, $this->parametriSOAP);

Instead this’s the function’s call:

$result = $client->__soapCall("EsitoInvii", [
        "DatiInputRichiesta" => [
            "protocollo" => "17080120163582925",
            "pinCode" => "0Gv1vsTpzlvRD9kBd8FVLo2/441rZ8rRZVf0Zi9eO6+L7kme0KC8Vx6ZjRj/4JjA4aHPTCi3D6YW9OtmYkIpW7sfchmhqHdVORBZHPitiPHdr5iIipAhIzBhFOQIPfpYasW5cQmU//uNB4GSWSNDIkaqdMrDjTPpIkbKKeoA4dQ="
        ]
    ]);

    if (is_soap_fault($result)) {
        var_dump($result->faultcode . " " . $result->faultstring);
        return false;
    }

    var_dump($result);

I receveid the error: env:Client Internal Error

Here there are WSDL and XSD schema: https://we.tlegiEBZ0vgT


Source: stackoverflow-php

Hot Module Replacement with multi entries

The console outputs Ignored an update to unaccepted module error, how to fix it?

log.js:25 Ignored an update to unaccepted module ./src/print.js -> 1
log.js:25 [HMR] The following modules couldn't be hot updated: (They would need a full reload!)
log.js:25 [HMR]  - ./src/print.js

the whole console message is:

log.js:23 [HMR] Waiting for update signal from WDS...
log.js:23 [HMR] Waiting for update signal from WDS...
client?cd17:64 [WDS] Hot Module Replacement enabled.
client?cd17:64 [WDS] Hot Module Replacement enabled.
client?cd17:67 [WDS] App updated. Recompiling...
client?cd17:67 [WDS] App updated. Recompiling...
client?cd17:67 [WDS] App updated. Recompiling...
client?cd17:67 [WDS] App updated. Recompiling...
client?cd17:193 [WDS] App hot update...
log.js:23 [HMR] Checking for updates on the server...
client?cd17:193 [WDS] App hot update...
log.js:23 [HMR] Checking for updates on the server...
log.js:25 Ignored an update to unaccepted module ./src/print.js -> 1
./node_modules/webpack/hot/log.js.module.exports @ log.js:25
onUnaccepted @ only-dev-server.js:25
hotApply @ bootstrap e5893b5…:437
(anonymous) @ only-dev-server.js:20
log.js:25 [HMR] The following modules couldn't be hot updated: (They would need a full reload!)
./node_modules/webpack/hot/log.js.module.exports @ log.js:25
./node_modules/webpack/hot/log-apply-result.js.module.exports @ log-apply-result.js:12
(anonymous) @ only-dev-server.js:39
log.js:25 [HMR]  - ./src/print.js
./node_modules/webpack/hot/log.js.module.exports @ log.js:25
(anonymous) @ log-apply-result.js:14
./node_modules/webpack/hot/log-apply-result.js.module.exports @ log-apply-result.js:13
(anonymous) @ only-dev-server.js:39
log.js:23 [HMR] Nothing hot updated.
log.js:23 [HMR] App is up to date.
index.js:8 Accepting the updated printMe module!
log.js:23 [HMR] Updated modules:
log.js:23 [HMR]  - ./src/print.js
log.js:23 [HMR] App is up to date.

The following is my code:

webpack.config.js:

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const webpack = require('webpack');

module.exports = {
  devtool: 'inline-source-map',
  devServer: {
    contentBase: path.resolve(__dirname, 'dist'),
    hotOnly: true,
  },
  entry: {
    app: './src/index.js',
    print: './src/print.js'
  },
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist'),
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Hot Module Replacement',
      filename: 'index.html',
    }),
    new CleanWebpackPlugin(['dist']),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
  ],
};

./src/index.js:

import _ from 'lodash';
import printMe from './print.js';

if(module.hot) {
  module.hot.accept('./print.js', function() {
    console.log('Accepting the updated printMe module!');

    document.body.removeChild(element);
    element = component();
    document.body.appendChild(element);
  });
}

let element = component();

function component() {
  const element = document.createElement('div');
  const btn = document.createElement('button');

  element.innerHTML = _.join(['Hell', 'webpack'], ' ');

  btn.innerHTML = 'Click me and check the console!';
  btn.onclick = printMe;

  element.appendChild(btn);

  return element;
}

document.body.appendChild(element);

./src/print.js:

export default function printMe() {
  //console.log('I get called from print.js!');
  console.log('Updating print.js...')
}

package.json:

{
  "name": "webpack-demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "webpack",
    "start": "webpack-dev-server --open"
  },
  "keywords": [
    "webpack",
    "demo"
  ],
  "author": "",
  "license": "MIT",
  "dependencies": {
    "lodash": "^4.17.4"
  },
  "devDependencies": {
    "clean-webpack-plugin": "^0.1.16",
    "html-webpack-plugin": "^2.29.0",
    "webpack": "^3.4.1",
    "webpack-dev-server": "^2.6.1"
  }
}

other environment:

  • node v7.4.0
  • npm 4.0.5
  • macOS Sierra 10.12
  • Chrome v59.0.3071.115

please give me help.


Source: stackoverflow-javascript

Vue js – Define prop as a specific type

I’m building a vuejs component which accepts a prop by the name of idFieldType

Now I want this prop to accept only a Number Type or a String Type

So I wrote it as follows

idFieldType: {
    Type: Function,
    default: function() {
        return Number;
    },
    validator: function() {
         if(value == String || value == Number) {
               return true;
         }

         return false;    
    }
}

I also tried replacing the type to Object.

My question is how can I write a prop that accepts only specific types ?


Source: stackoverflow-javascript

Angular 2 – how to update model

I receive data model using a service:

  return this.http.get(queryUrl, opts)   .map((response: Response) => {
    return (<any>response.json()).data.map(el => {
      return new User({
        id: item.id,
        name : item.name
      });
    })   

This gets accesed from component

      makeRequest() {
          this.result = this.myService.loadData()
      }

And passed down as result: Observable<User[]>; to a form, this on Submit sends a post request which gets saved to the backend,all this works. The problem is that my model/website doesn’t get updated this way.

Probably it’s a silly question but, how do I update my model (now after saving to backend the app still holds the old data)? What ar the strategies? Do I have to pass updated data object back to top component and then update?


Source: stackoverflow-javascript

How to disable too many logs of actions-on-google – api.ai

this code is giving me un expected logs, my question is how can i remove these logs then it will be easy for me to point out my own developer log

here is my code:

process.env.DEBUG = 'actions-on-google:*';
import * as admin from 'firebase-admin';
const Assistant = require('actions-on-google').ApiAiAssistant;
import * as functions from 'firebase-functions';
import data from './../../db/index';
import { Request, Response } from "express";
import * as functionRequest from 'request';

// API.AI Action names
const SUBMIT_REPORT = 'submitReport';
const NEXT_QUESTION = 'next_question';

export const webhook = functions.https.onRequest(async (request: Request, response: Response) => {
    const assistant = new Assistant({ request: request, response: response });

    let actionMap = new Map();

    actionMap.set(SUBMIT_REPORT, submitReport);
    actionMap.set(NEXT_QUESTION, next_question);

    assistant.handleRequest(actionMap);

    function submitReport(assistant: any) {

        console.info("user ask for submit report, request body: ", request.body);

        let dataRef = request.body.originalRequest.data.user;
        let userData = {
            groupId: dataRef.groupId,
            subgroupId: dataRef.subgroupId,
            userId: dataRef.userId
        }
        //console.log("userdata: ", userData)
        let botRef = data.db.ref('subgroup-bot-chat-mode/' + userData.groupId + '/' + userData.subgroupId + '/' + userData.userId)
        botRef
            .once('value', function (snapshot) {
                let data = snapshot.val()
                //console.log("here is recieved data: ", data)
                if (data == null) {
                    let entry = {
                        'userAgreed': true,
                        'askedForReport': true,
                        'timestamp': admin.database.ServerValue.TIMESTAMP,
                        'reportIndex': 0,

                    }
                    botRef
                        .set(entry, function (error) {
                            if (!error) {
                                //console.log("Data save successfully at subgroup-bot-chat-mode/")

                                // start asking questions
                                const fullfillment = {
                                    "speech": "qedfqwedf",
                                    "followupEvent": {
                                        "name": "ESOX_WRITE_STANDUP_REPORT_NOW"
                                    },
                                    "contextOut": [
                                        {
                                            "name": "quiz",
                                            "lifespan": 5,
                                            "parameters": {
                                                "index": "0"
                                            }
                                        },
                                        {
                                            "name": "sendReportNow-followup",
                                            "lifespan": 5,
                                        },
                                    ]
                                }
                                response.send(fullfillment);
                                return;
                            }
                        }).catch((e) => {
                            console.error("1. an error occured when getting data from db");
                            response.send({
                                speech: "error on db"
                            })
                            return;
                        })

                } else {
                    response.send({
                        speech: "already"
                    })
                    return;
                }
            }).catch((e) => {
                console.error("2. an error occured when getting data from db");
                response.send({
                    speech: "error on db"
                })
                return;

            })

    }
    function next_question(assistant: any) {

        let dataRef = request.body.originalRequest.data.user;
        let userData = {
            groupId: dataRef.groupId,
            subgroupId: dataRef.subgroupId,
            userId: dataRef.userId
        }

        let questionIndex = request.body.result.contexts[0].parameters.index;
        console.log("index: ", questionIndex);

        // if question index == 0 it means it is first time, we will send first question to user
        // if question index > 0 it means it means user is answered th index
        if (questionIndex == 0) {
            console.log("going to send first question");
        } else if (questionIndex > 0) {
            //todo: process answer here
            console.log("answer: ", request.body.result.parameters.answer);
            let answer = request.body.result.parameters.answer;


            // data.db.ref('subgroup-progress-reports/' + userData.groupId + '/' + userData.subgroupId + '/' + userData.userId + '/' + reportId + '/answers/' + reportIndex)
            //     .set(answer)


        }


        // start asking questions
        functionRequest({
            url: 'https://us-central1-luminous-torch-4640.cloudfunctions.net/getReportQuestions',
            method: 'POST',
            json: {
                'groupId': userData.groupId,
                'subgroupId': userData.subgroupId,
                'userId': userData.userId
            }
        }, function (error, res, body) {
            if (!error && response.statusCode == 200) {
                //console.log("hello: ", res.body)
                switch (res.body.status) {

                    case 'EOF':
                        response.send({
                            "speech": "EOF",
                            "contextOut": [
                                {
                                    "name": "quiz",
                                    "lifespan": 0
                                },
                                {
                                    "name": "sendReportNow-followup",
                                    "lifespan": 0,
                                }
                            ]
                        })
                        break;

                    case 'OK':
                        //sending question back
                        let botRef = data.db.ref('subgroup-bot-chat-mode/' + userData.groupId + '/' + userData.subgroupId + '/' + userData.userId)
                            .update({
                                reportIndex: res.body.reportIndex,
                                reportId: res.body.reportId
                            })

                        response.send({
                            "speech": res.body.question,
                            "contextOut": [
                                {
                                    "name": "quiz",
                                    "lifespan": 5,
                                    "parameters": {
                                        "index": res.body.reportIndex,
                                        "reportId": res.body.reportId
                                    }
                                },
                                {
                                    "name": "sendReportNow-followup",
                                    "lifespan": 5,
                                }
                            ]
                        })

                        break;
                    case 'ALREADY_ASKED_FOR_TODAY':
                        response.send({
                            "speech": "you are already submited the report for today",
                            "contextOut": [
                                {
                                    "name": "quiz",
                                    "lifespan": 0
                                },
                                {
                                    "name": "sendReportNow-followup",
                                    "lifespan": 0,
                                }
                            ]
                        })
                        break;
                    default:
                        console.error("Unknown case");
                        //http request failed
                        response.send({
                            "speech": "Something went wront on question server",
                            "contextOut": [
                                {
                                    "name": "quiz",
                                    "lifespan": 0
                                },
                                {
                                    "name": "sendReportNow-followup",
                                    "lifespan": 0,
                                }
                            ]
                        })
                        return;
                }
            } else {
                //http request failed
                response.send({
                    "speech": "Something went wront on question server",
                    "contextOut": [
                        {
                            "name": "quiz",
                            "lifespan": 0
                        },
                        {
                            "name": "sendReportNow-followup",
                            "lifespan": 0,
                        }
                    ]
                })
            }
        })
    }

})//end of webhook http trigger

logs of firebase functions are here:

2:10:34.707 PM info webhook Sat, 05 Aug 2017 09:10:34 GMT
actions-on-google:debug map of intents
2:10:34.707 PM info webhook Sat, 05 Aug 2017 09:10:34 GMT
actions-on-google:debug name=next_question 2:10:34.707 PM info
webhook Sat, 05 Aug 2017 09:10:34 GMT actions-on-google:debug key is
id 2:10:34.706 PM info webhook Sat, 05 Aug 2017 09:10:34 GMT
actions-on-google:debug name=submitReport 2:10:34.706 PM info webhook
Sat, 05 Aug 2017 09:10:34 GMT actions-on-google:debug key is id
2:10:34.706 PM info webhook Sat, 05 Aug 2017 09:10:34 GMT
actions-on-google:debug invokeIntentHandler_: handler=[object Map],
intent=next_question


Source: stackoverflow-javascript

Not able to populate dummy data in phosphorum/phalcon forum initial install

Installed phosphorum(phalcon forum) successfully on my WHM server(shared hosting). But when populating database using command usr/bin/php /home/xxxx/public_html/forum/forum seeder:populate , I am getting this message in command prompt(using putty SSH)

Start X-Powered-By: PHP/5.6.31 Content-type: text/html; charset=UTF-8

But no entries in database. When i check app/logs/application.log, it says,

[04-Aug-2017 17:53:34][DEBUG] [boot] Parsed options:
[“seeder:populate”] [04-Aug-2017 17:53:34][DEBUG] [boot] Task
definition: {“task”:”seeder”,”action”:”populate”,”params”:[]}
[04-Aug-2017 17:53:34][ERROR] WhoopsExceptionErrorException:
fwrite() expects parameter 1 to be resource, string given in file
/home/xxxx/public_html/forum/forum

on line 28 Stack trace:

WhoopsExceptionErrorException->()
/home/xxxxx/public_html/forum/forum:28 fwrite()
/home/xxxx/public_html/forum/forum:28

I googled, did not get any solution. Tried different ways to my knowledge without success. Did anyone get this kind of error while installing? if so, any solutions?Is there any manual way/.sql to populate data?
Phosphorum Version 3.2.1
PHP version 5.6
OS – Linux version 2.6.32


Source: stackoverflow-php

how to get data from database using date between?

Database stored date

item 1: date from :- 10-07-2017 date to :- 20-07-2017
item 2: date from :- 02-07-2017 date to :- 02-08-2017
item 3: date from :- 01-06-2017 date to :- 20-08-2017

input date

start date:- 05-07-2017 end date :- 25-07-2017

here I gave an input date to get data from database. database stored date is the data I want to print. thing is that, which are the items date included in the input date

condition
this are the condition I want to work

start_date < date from && end_date > date_to 
start_date > date from && end_date > date_to 
start_date < date from && end_date < date_to 
start_date > date from && end_date < date_to 

exception case

start_date < end_date < date_to
start_date > end_date > date_to

I want a codeignitor solution . below am giving my model class structure

public function getDate( $start_date = "",$end_date = """)
{
$this->db->select('*');
$this->db->from('user_details');
$this->db->where('');
}


Source: stackoverflow-php

Why reading undeclared variable gives reference error but undeclared object property returns undefined in javascript?

In below code, if I print this.property2 on console, JS engine prints undefined, if I replace the statement to print only property2 compiler
throws a reference error
if I declare the variable property2 then the compiler will return undefined.

function foo() {
  var property;
  console.log(this.property2)
  console.log(this.property2 === property2)
  console.log(property2)
}

foo.property="property value";
var property2; // modified to resolve reference error
foo();
console.log(foo.property);

As I have shown in the code this.property2 is equal to property2 so why javascript behaves differently for the same variable.

Coming to my question are both variables different? (this.property2 and property2) if they are different why the comparison returns true?
and if they are not different then why I have to declare property2 to get the return value and this.property2 returns values without
declaration.

am I missing anything?


Source: stackoverflow-javascript

PayPal split payment between buyer and more then 15 sellers. Any solution?

I’m trying to implement a marketplace website with multiple sellers. But unfortunately I can’t figure out how to implement the payout system for multiple sellers (buyer pay direct to sellers) because Paypal have this limitation of 6 receivers.

I know that is a lot of scripts (cart scripts) on web but I’m not sure if they have this limitation.
Maybe somebody can help me with some ideas?

Thanx


Source: stackoverflow-php

PHP: JSON Api Tenor

how can i get all url-s from https://api.tenor.com/v1/trending?key=LIVDSRZULELA&limit=8 (results->media->nanomp4->url)

if($json = cURLGetContents("https://api.tenor.com/v1/trending?key=LIVDSRZULELA&limit=8")) {
    $obj = json_decode($json);
    echo $obj->results->{"media"}->{"nanomp4"}->{"url"};
}

Function cURLGetContents($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}


Source: stackoverflow-php