Categories
Mastering Development

How can I make the php files inside an includes/ folder readable by the website but not downloadable by file download managers?

I have a small PHP/MySQL project I would like to upload to our subdomain. The project has an includes/ folder that contains some PHP files that have information about the database name, username, password and login function. How can I make the files of this directory readable by the website (so when someone comes to […]

Categories
Mastering Development System & Network

Unable to connect to CloudSQL from GKE without CloudSQL Proxy – SQLSTATE[HY000] [2002] Operation timed out

I have GKE cluster created with following command: gcloud container clusters create stage1 \ –enable-ip-alias \ –release-channel stable \ –zone us-central1 \ –node-locations us-central1-a,us-central1-b Now I wanted to connect my PHP application to cloud SQL. To authorize access to the cloud SQL from the PHP application running in the pod, i have done following steps […]

Categories
Mastering Development

Using Wildcards alongside special characters in SQL query via Python

Still a bit new to Python, so bear with me. I’m writing a Python script to perform an audit of several MySQL databases to specifically pull variable information with a directory in the value column. Simple query via MySQL is SHOW VARIABLES WHERE VALUE LIKE ‘/%’;, which is what I’m trying to convert and get […]

Categories
Mastering Development System & Network

Using LDAP: how to log in with SSH, mounting the Samba home directory with autofs?

I have spent some time setting up LDAP-based authentication in my MacOS, iOS and Linux network, taking account of the special quirks of MacOS and Synology (my NAS). SSH login (SSH keys etc.) works and Samba share mounts work. It was all quite fiddly, and I now know more about LDAP than I ever anticipated. […]

Categories
Mastering Development

Update MySQL query doesn’t do anything when trying to submit data from HTML edit field to MySQL in PHP

EDIT: I have added prepared statements in functions.php script for SQL Injection prevention. I am writing a URL Shortener, and I am having a problem with updating shortened URL into database. I am using MySQL, plain PHP, plain JavaScript, Apache Web Server. SELECT and INSERT INTO statements are working perfectly fine with the first button […]

Categories
Mastering Development System & Network

multipart/mixed content type and boundary refused by Amavis

I’m writing a Ruby script that send SMTP email. The email is divided onto 3 parts: headers, body and attachment. Unfortunatly, I’m struggling to satisfy an Amavis requirement: properly writing the encapsulation boundary. This header, added by Amavis, noticed the issue: X-Amavis-Alert: BAD HEADER SECTION, MIME error: error: multipart boundary is missing, or contains CR […]

Categories
Mastering Development

I am getting error in php mysqli function saying data base not found

Using wamp server version 3.2.0 The Error- Warning: mysqli::__construct(): (HY000/1049): Unknown database ‘mywebsite’ in E:\wamp64\www\biren\php_DB_linking\2_Linking_to_DB.php on line 7 I have the data base created in PHP Myadmin in my local host constantly showing this error <?php $servername ="localhost"; $username="root"; $password=""; $dbname="mywebsite";//name of my DB //creating the connection. $connect= new mysqli($servername,$username,$password,$dbname);//Error line if($connect->connect_error){ die("connection failed".$connect->connect_error); } […]

Categories
Mastering Development

Spring boot java mail with template html

I am using an html template which is used as content in my JavaMail. the problem is The font-family is not working. if i run the html program on the browser, it works. but when sent as email content, this font does not work. the system uses the default font instead. Content html : <!DOCTYPE […]

Categories
Arduino Ask Engineering

MQTT connection not being recognised in the void loop

I am trying to publish MPU 9250 readings in the adafruit io sending the data from ESP 32. The WiFi connection is being established, but the code is not going inside the "if(mqtt.connected())" inside the ‘void loop’ whereas the its going inside the same command inside the ‘void setup’. I am sure there is no […]

Categories
Mastering Development

Can I output boolean based on values in a list?

Edit: I used the solution provided by @peak to do the following: $ jq -r –argjson whitelist ‘["role1", "role2"]’ ‘ select(has("roles") and (.roles[] == "role1" or .roles[] == "role2")) | (reduce ."roles"[] as $r ({}; .[$r]=true)) as $roles | [.email, .username, .given_name, .family_name, ($roles[$whitelist[]] | . != null)] | @csv ‘ users.json Added the select() […]