show variables like 'datadir';
Wednesday, January 18, 2023
MYSQL 5.6 data directory in windows
DB file location in mysql 5.6 in windows
The default data directory location is C:\Program Files\MySQL\MySQL Server 5.6\data , or C:\ProgramData\Mysql on Windows 7 and Windows Server 2008. The C:\ProgramData directory is hidden by default.
Wednesday, January 4, 2023
Create a object of class in c# from string input dynamically from user
You can use the following code to create object from a class which name is provided by the user in program run time.
Type type = Type.GetType("Employee");
object instance = Activator.CreateInstance(type);
just for reference sharing the URL of the static class Activator which is part of system namespace.
https://learn.microsoft.com/en-us/dotnet/api/system.activator?view=net-7.0
Tuesday, January 3, 2023
python code to import xlsx file in mysql and validate also each column and rows before import
import mysql.connector
import openpyxl
# Open the .xlsx file
wb = openpyxl.load_workbook('data.xlsx')
sheet = wb.active
# Connect to the MySQL database
cnx = mysql.connector.connect(user='user', password='password', host='host', database='database')
cursor = cnx.cursor()
# Validate and import the data
for row in sheet.rows:
# Validate each cell in the row
if row[0].value == None:
print("Error: Missing value in column 1")
elif row[1].value == None:
print("Error: Missing value in column 2")
else:
# If the data is valid, insert it into the database
sql = "INSERT INTO table (column1, column2) VALUES (%s, %s)"
val = (row[0].value, row[1].value)
cursor.execute(sql, val)
# Commit the changes to the database
cnx.commit()
# Close the connection
cnx.close()
Monday, January 2, 2023
logout from linux ssh from windows powershell
To exit the Bash session, type "exit" without quotes and then the Enter key.
That should exit the SSH session and get you back to the PS C:\Windows\system32 prompt.
Just close the Powershell session by clicking on the X at the upper right corner of the window.
bash: apt-get: command not found CentOS 7
Amazon Linux it's CentOS-based, which is RedHat-based. RH-based installs use yum not apt-get. Something like yum search httpd should show you the available Apache packages - you likely want yum install httpd24.
how to make sure node is installed or not in window 10 ?
To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type node -v . This should print the version number so you'll see something like this v0. 10.35
ASP.NET Core
Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...
-
The error message you encountered ("DeleteService FAILED 1072: The specified service has been marked for deletion") indicates tha...
-
replace html of a div using jquery this is simple . just use .html() method of jquery to set new html for a div . $ ( "#divID&q...
-
declare @ProductIds nvarchar(50)='18,19' SELECT * FROM products Where (',' + @ProductIds +',' LIKE '%,' ...