Categories
Mastering Development System & Network

PHP fsockopen giving error with SSL

I am getting the error while connecting to fsockopen. echo $result = fsockopen(‘ssl://smtp.gmail.com’, 465, $error_no, $error_message, 5); //$result = fsockopen(‘tls://smtp.gmail.com’, 587, $error_no, $error_message, 5); if ($result === false) { echo "error no: $error_no error message: $error_message"; echo print_r($result, true); } else { echo ‘success’; } error no: 0 error message: I checked the manual here […]

Categories
Mastering Development System & Network

PHP fsockopen giving error

I am getting the error while connecting to fsockopen. echo $result = fsockopen(‘ssl://smtp.gmail.com’, 465, $error_no, $error_message, 5); //$result = fsockopen(‘tls://smtp.gmail.com’, 587, $error_no, $error_message, 5); if ($result === false) { echo "error no: $error_no error message: $error_message"; echo print_r($result, true); } else { echo ‘success’; } error no: 0 error message: I checked the manual here […]

Categories
CMS Magento Mastering Development

How to pass the card details for the Magento API [POST]: V1/carts/mine/payment-information for the payment method stripe_payments_checkout_card

I have an iOS native app which communicates through Magento Rest APIs with my Magento Store, I would like to know how to pass the card details (Token, CVV, Exp Year, Exp Month, Last 4) in JSON format for the payment method "method":"stripe_payments_checkout_card" in the Magento API: [POST] V1/carts/mine/payment-information Note: I use the Stripe Official […]

Categories
Mastering Development

SQL Server does not catch link server timeout error

I wrote a procedure that calls another procedure through link server, it has try catch block and catch block works very well in case of most of the errors, for example when I want to "insert a NULL value to a not null able column" catch block is executed successfully and log error result to […]

Categories
Mastering Development

Python ldap3 how to get all attributes plus sAMAccountName

class LDAPAPI(object): …. def __init__(self, host, user, password, connection_timeout=10): """Sets up a connection to AD, ready to be queried by any methods in the class. """ self.server = ldap3.Server( host, get_info=ldap3.ALL, connect_timeout=connection_timeout # never let it try longer than 10 seconds ) self.connection = ldap3.Connection( self.server, user=user, password=password, authentication=ldap3.NTLM, auto_bind=True, read_only=True, check_names=True, ) self.person_cls = […]

Categories
CMS Magento Mastering Development

Magento 2 add Estimate Shipping Form on Product Page

Following this post Magento 2 : How to display Shipping Rates on a Product Page i can get shipping rates for current product, tested with curl: curl -ik -X POST -H "Content-Type: application/json" -d "{""address"":{""country_id"": ""IT""}}" https://example.com/rest/V1/shipping/estimate/51003PRI got the following response: [{"carrier_code":"tablerate","method_code":"bestway","carrier_title":"Shipping Method","method_title":"Express Delivery","amount":0,"base_amount":0,"available":true,"error_message":"","price_excl_tax":0,"price_incl_tax":0}] Now i need to display a form in product page like […]

Categories
Database Development

Pass a table name as a parameter to a stored procedure

I am trying to create a Stored Procedure, and pass the name of a table as a parameter and I get this message:Must declare the table variable "@tblName". What do I have to change to make it work? CREATE PROCEDURE [usp_SaveToErrorLog] @tblName as nvarchar(50), @subject as nvarchar(30) AS BEGIN — SET NOCOUNT ON added to […]

Categories
Mastering Development

How to fetch values from an incoming WhatsApp message on a Flask application using Twilio?

So I am trying to create a Flask Application (TwiML) that will read the incoming WhatsApp message and store its details in a PostgreSQL database. Here is how my Flask application looks like: from flask import Flask, request from twilio.twiml.messaging_response import MessagingResponse import psycopg2 app = Flask(__name__) @app.route(“/sms”, methods=[‘GET’,’POST’]) def sms_reply(): msg = request.form.get(‘Body’) text_status […]

Categories
Database Development

How to connect to specific session id & serial# ? Blocked sessions

I have blocked sessions and see which session is blocking them, having session_id and serial#. Is it possible to connect to such session? How? Background: using V$SESSION_BLOCKERS I see sessions are blocked by each other by INSERT statements to one of two tables: _REQUEST and _RESPONSE Blocked sessions wait event: enq: TX – row lock […]

Categories
Mastering Development

Error with getting ForeignKey object from the object it is assigned under

I have two models in my models.py, Question and Choice. Since ForeignKey was used to link Choice as a child of Question, I assumed I could do the same for the built-in user object and the question object. I made a question object and linked it with the user I made, and all worked well […]