Categories
Mastering Development

store php variables of complex json return array from paypal api

I am using the PayPal API to give me information about specific transactions. I am using PHP and curl and everything is working fine. PayPal returns the result which is a JSON object. Here is a sample of the output that the JSON object gives me when I send it to print_r($JSON) after $JSON = […]

Categories
Mastering Development

Django + React Able to create new user in database, but token-auth returns 400 bad request

So I have an app that I’m writing. It’s working, for the most part, so far. I only currently have a login and signup setup, with a ‘homepage’ that just has a logout button and some text on it so I can test. When I do signup, it posts the user to the database, but […]

Categories
Linux Mastering Development

Comparing two csv files with different column names in Linux

I’ve 2 files with me having below columns: File1: PARTY_ID,EMAIL_ID,EMAIL_ADDRESS,SEQ,PARTY_NAME File2: PARTY_NAME The values in the PARTY_NAME column is a comma separated combination of "LastName, FirstName" for example: Spencer, Brian. Now the task here is to compare the PARTY_NAME columns in both of these files and create a third file which will have only unique […]

Categories
Database Development

Slow query when grouping and ordering

I have a query that is finding the latest documents for a user that are associated with another user having a high contact score. The documents table has 1.2M records and the document_service_contacts has 11M records. It seems that no matter how I rework the query (for example, using a window function instead of group […]

Categories
Mastering Development

KeyError 1 – Stopping after first excel row

New to coding… I’m sure that will be obvious as you read further. I’m trying to send emails for certain rows in an excel spreadsheet. This sends the email for the first row, but it stops. I’ve tried to find the answer in the pandas documentation, youtube tutorials, stackoverflow, the book I’m reading “Python Crash […]

Categories
Mastering Development

htmlentities ignores when using PHPmailer

Some times ago I made a contact form to send email. I had this: If ($validity !=’Good@Ripsi’){ $to = “contact-us@xx-xxxx.com”; $subject = “xx xxxx new Subscriber”; $email_address = htmlentities($_GET[’email_address’]); $headers = “xxxxxxxxxx” . “\r\n” . mail($to,$subject,$email_address,$headers); header(“Location: index.php”); } And that worked fine. After I read that although I don’t plan to send thousands of […]

Categories
Mastering Development

Mysql WHERE IN function returning the first match not all the matches

I have an email variable which contains a string, comma separated email addresses, so I want to match each and one of them with the existing user table using the email address. I’m using SELECT WHERE IN statement, but the problem i’m having is that it only returns the first match, and the remaining matches […]

Categories
Database Development

How do I manipulate date in SQL server?

SELECT [ORG_ID], [BUSINESS_UNIT_NAME], [MESSAGE_ID], [MESSAGE_NAME], [DEPLOYMENT_ID], [DEPLOYMENT_NAME], [SMS_ID], [SMS_NUMBER], [ACTION_TIMESTAMP], [CUSTOMER_KEY], [CARRIER], [LINK_NAME], [LINK_URL], [SERVICE_ID], [ACTION], [EVENT_TYPE], [CLIENT_ID], [CAMPAIGN_ID], [CAMPAIGN_NUMBER], [CONTACT_ID], [EMAIL_ADDRESS], [ISO_CODE], [POSTAL_CODE], [STATE], [ADD_DATE], [SOURCE], [UPDATE_DATE], [UPDATE_SOURCE], ‘CONTACT_ID DOES NOT EXISTS IN THE DATABASE’ as REASON FROM [dbo].[SMS_ACTY] WHERE CONTACT_ID NOT IN (SELECT CONTACT_ID FROM CONTACT) and cast(add_date as date) = CAST(@run_id AS […]

Categories
Development

Using Strong Parameters with a nested raw JSON parameter

I have an update form in my web application and I’m having trouble when permitting the params I receive from this form. This is how the params gets to the controller: <ActionController::Parameters {“company”=>{“description”=>”description”, “email_address”=>”contact@gmail.com”, “hours”=>”{\”fri\”:[],\”mon\”:[[\”09:00\”,\”16:00\”]],\”sat\”:[], \”sun\”:[[\”09:00\”,\”16:00\”]], \”thu\”:[[\”09:00\”,\”12:00\”], [\”13:00\”,\”16:00\”]], \”tue\”:[[\”08:45\”,\”16:00\”]],\”wed\”:[[\”09:00\”,\”16:00\”]]}”}, “controller”=>”my_controller”, “action”=>”update”} permitted: false> They all get to the controller as strings but hours is parsed […]

Categories
Development

The PHP code for my website Contact Form won’t work [closed]

I am working on a school project where I am making a website for my school to help promote their Cocurriculars. As a part of this website, they want me to have a page where the users could contact them from. I tried literally everything, exhausted all other sources, and yet the code won’t work. […]