Laravel How to store payment gateway response url data value in database

Uncategorized
Question: Currently, i'm integrating a new payment gateway in laravel. In response url, I am getting a datastring from the payment gateway like:http://www.example.com/payment/response?txn_status=00&txn_msg=success&txn_err_msg=NA&clnt_txn_ref=000000&tpsl_txn_id=000000&txn_amt=1.00&hash=0000000000000000000 I want to store the url datastring value into a database How should I able to do it in laravel? Answer: As url string contains the get parameters, so your route will be 'get'. Then you have to write this:$GetData = Input::get(); //To print echo ""; print_r($GetData); //To log the response Log::info("Payment response : ".print_r($GetData, true)); Now, to insert this response, use laravel eloquent or the simple query. Read more
Read More

Cannot add foreign key constraint – MySQL ERROR 1215 (HY000)

Uncategorized
Question: I am trying to create database for gym management system, but I can't figure out why I am getting this error. I've tried to search for the answer here, but I couldn't find it. ERROR 1215 (HY000): Cannot add foreign key constraint CREATE TABLE sales( saleId int(100) NOT NULL AUTO_INCREMENT, accountNo int(100) NOT NULL, payName VARCHAR(100) NOT NULL, nextPayment DATE, supplementName VARCHAR(250), qty int(11), workoutName VARCHAR(100), sDate datetime NOT NULL DEFAULT NOW(), totalAmount DECIMAL(11,2) NOT NULL, CONSTRAINT PRIMARY KEY(saleId, accountNo, payName), CONSTRAINT FOREIGN KEY(accountNo) REFERENCES accounts(accountNo) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT FOREIGN KEY(payName) REFERENCES paymentFor(payName) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT FOREIGN KEY(supplementName) REFERENCES supplements(supplementName) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT FOREIGN KEY(workoutName) REFERENCES workouts(workoutName) ON DELETE CASCADE ON UPDATE CASCADE ); ALTER TABLE sales…
Read More

How to compute cosine similarity between two words in Word2Vec model in pyspark

Uncategorized
Question: When I use the python library gensim and train a Word2Vec model, I can call the function like this word2vec_result.similarity('apple','banana') to get the cosine similarity between apple and banana at local machine. But in pyspark(version2.2), I can't find the same function in the document after the model built. Code:#!/usr/bin/env python # -*- coding: utf-8 -*- from pyspark.mllib.feature import Word2Vec from pyspark.mllib.feature import Word2VecModel from pyspark import SparkConf, SparkContext import logging directory = "data_path" inp = sc.textFile(directory).map(lambda row: row.split(" ")) model = word2vec_run(inp) model.save(sc, "/data/word2vec_model") Are there any simple ways to achieve the goal? Answer: Read more
Read More

how to show a live graph against a particular jira label

Uncategorized
Question: We are working on some framework. We need to measure how useful that framework is, leadership says key measure point is how much time developers are spending before and after framework. Fox example: before implementing framework developers used to spend x amount of time on doing UI tasks and after implementation of framework they are spending y amount of time on UI tasks. Currently we are putting label xyzlabel-UI-Task on each UI task. How can I show a live graph for time logged against those tasks? Is it doable? Answer: Read more
Read More

JFreechart series movement with fixed x-axis

Uncategorized
Question: First question here. I'm doing an Arduino serial port plotter with Java and JFreeChart. Everything's working fine with the DynamicTimeSeries dataset, as I'm able to plot data nice and softly. What I need to do now is this: given an established period of time (let's say 60 seconds) I want to plot the DynamicTimeSeries dataset on the chart for that period without moving the axis; I mean, like drawing a line for 60 seconds on the fixed chart. Is there any way to do this? Every example I've watched shows the x-axis (time axis) start running along with the series. If I'm not clear enough please let me know. Any help will be deeply appreciated! Thanks! PS: my code is based on this: Using JFreeChart to display recent changes…
Read More

how can I install a library with conda without affecting other libraries in Python

python
Question: I give the following example to illustrate my question. I plan to install libpng 16 on my Ubuntu machine with the following command: conda install libpng. However, this will update the following packages:cairo: 1.12.18-3 --> 1.12.18-6 fontconfig: 2.11.1-3 --> 2.11.1-6 freetype: 2.5.2-1 --> 2.5.5-2 libgfortran: 1.0-0 --> 3.0.0-1 libpng: 1.5.13-1 --> 1.6.27-0 numpy: 1.8.2-py27_1 --> 1.11.3-py27_0 opencv: 2.4.9-np18py27_0 --> 3.1.0-np111py27_1 pixman: 0.26.2-0 --> 0.32.6-0 scikit-image: 0.9.3-np18py27_0 --> 0.13.0-np111py27_0 scipy: 0.14.0-np18py27_0 --> 0.19.0-np111py27_0 I do not want to update these libraries for some reasons. May it be possible that libpng will be updated alone? Answer: Read more
Read More

Node js request module get different type (format) of return value from server?

Uncategorized
Question: I use request library to access web service, but I found that the return value can be different. exports.getUserByEmail = function(req, res) { request.get(endPoint + req.params.email, function(error, response, user) { console.log((typeof user)) // type of user is string ... some logic }) } exports.login = function(req, res) { request.post(endPoint + 'login', {json: { email: req.body.email, password: req.body.password }}, function(error, response, user) { console.log((typeof user)) // type of user is object ... some logic }) } On the server side, it returns a JSON, e.g. { username: "user", password: "hashedPassword", ...... } Can anyone tell me why .get and .post method gives me different types of return value? Answer: I figured that out, sorry about this stupid question. Forgot to set {json:true} as option in get method. Read more
Read More

Can I disable bootstrap carausel which is in background for one of the 4 tabs in angular project?

Uncategorized
Question: I've single page tab based angular website with bootstrap carausel in the background. In that there is a separate component for the background and have a in app.html to make it work. This works perfect for all 4 tabs of my website, but I want to disable this background carausel one one tab out of 4 tabs. I tried restructuring code where I inserted only in required tabs but it didn't seem to have worked. So in a nutshell, is there a way that I can disable the background carausel for only one tab? Any help is appreciated. Apologies that I couldn't paste the code snippet as there are different bits of components and pasting everything would not be good idea. Answer: Yes you can, since you didn't post…
Read More

Run selenium from client side

Uncategorized
Question: Hello I have built an asp.net web app which implements selenium driver my problem is that all the tests are running fine on local machine but after deployment and logging into my website as client and start the test the driver does not launch or make any reaction neither on the server machine nor the client machine some of log file Software: Microsoft Internet Information Services 8.5 Version: 1.0 Date: 2017-08-15 02:24:24 Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username >c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status >time-.taken 2017-08-15 02:24:24 10.0.2.15 GET / - 80 - 217.55.249.44 Mozilla/5.0+>>(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+>(KHTML,+like+Gecko)+Chrome/60.0.3112.90+Safari/537.36 - 200 0 0 534 2017-08-15 02:24:24 10.0.2.15 GET /pages/css/Datafinderstyle.css - 80 - >217.55.249.44 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+>>(KHTML,+like+Gecko)+Chrome/60.0.3112.90+Safari/537.36 >http:/// 200 0 0 198 2017-08-15 02:24:24 10.0.2.15 GET /favicon.ico - 80 - 217.55.249.44 >Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+>(KHTML,+like+Gecko)+Chrome/60.0.3112.90+Safari/537.36 >/…
Read More