python – The view insertemp.views.Insertrecord didn’t return an HttpResponse object. It returned None instead?

views.py
from django.shortcuts import render
from insertemp.models import Empinsert
from django.contrib import messages

def  Insertrecord(request):
    if request.method == 'POST':
        if request.POST.get('empname') and request.POST.get('email') and request.POST.get('country'):
            saverecord=Empinsert()
            saverecord.empname=request.POST.get('empname')
            saverecord.email=request.POST.get('email')
            saverecord.country=request.POST.get('country')
            saverecord.save()
            messages.SUCCESS(request,'your detail saved succeccfullt.......!')
            return render(request,"index.html")
    else:
            return render(request,"index.html")
urls.py
from django.contrib import admin
from django.urls import path
from . import views

urlpatterns = (
    
    path('', views.Insertrecord),

)
models.py
from django.db import models
class Empinsert(models.Model):

    empname=models.CharField(max_length=100)
    email=models.CharField(max_length=100)
    country=models.CharField(max_length=100)
    class meta:
        db_table="newemployeetable1"
settings.py
"""
Django settings for insertemp project.

Generated by 'django-admin startproject' using Django 3.1.7.

For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'n7#@rb50!g7yh9_aw@eud++4zv4ee9zgxvrbf0my34pxu=avmc'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ()


# Application definition

INSTALLED_APPS = (
    'insertemp',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
)

MIDDLEWARE = (
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',`enter code here`
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'insertemp.urls'
TEMPLATES = (
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS':(os.path.join(BASE_DIR, 'templates')),
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': (
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ),
        },
    },
)

WSGI_APPLICATION = 'insertemp.wsgi.application'


# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME':'sampledb1',
        'USER':'root', 
        'PASSWORD': '',
        'HOST': 'localhost',
        'PORT': '3306',
        'OPTIONS':{
            'init_command':"SET sql_mode='STRICT_TRANS_TABLES'"
        }
    }
}


# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = (
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
)


# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True




STATIC_URL = '/static/'

availability groups – The Windows Server Failover Clustering (WSFC) resource control API returned error code 19

Here are the details of that error code (19):

ERROR_WRITE_PROTECT

19 (0x13)

The media is write protected.

You need to consult the cluster log (use Get-ClusterLog to get that) for additional details about what writes failed within the cluster operation being performed. Check that out and update your question with any errors you see.

That being said, combined with this symptom:

…if you reboot second node, database wont up.

You might be experiencing disk problems. Check the Windows system event log and SQL Server error log for messages related to failed writes or corruption.

sp blitz – sp_Blitz – RegOpenKeyEx() returned error 2

I’m running the latest sp_Blitz script on a SQL 2016 Std server on a Windows Server 2016 physical box. I’m getting the following error. What could be causing this and how do I troubleshoot it?

RegOpenKeyEx() returned error 2, ‘The system cannot find the file specified.’
Msg 22001, Level 1, State 1
Warning: Null value is eliminated by an aggregate or other SET operation.
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.

sharepoint server – Search has encountered a problem that prevents results from being returned after Microsoft Windows (KB5001078) update

This Tuesday (30.03.2021) we have installed the Security Update for Microsoft Windows (KB5001078) on the SharePoint 2016 server, after that the SharePoint search has stopped working, getting this error “Search has encountered a problem that prevents results from being returned. If the issue persists, please contact your administrator.

Sorry something went wrong

Anyone experiencing the same issues? and what is the fix for this?

command line – Nothing returned from lsof -p on Macos M1 Apple Silicon

Firstly I get:

$ ps -Af|egrep "images.tz|PID"|grep -v grep
  UID   PID  PPID   C STIME   TTY           TIME CMD
    0 10638 10457   0  2:23pm ttys004   66:13.40 tar -xzf ../images.tz

So I ought, at least, to see the files ‘tar’,’images.tz’ and the current file it is unpacking. However, I get nothing:

$ arch -arm64 lsof -p 10638
$

I’ve put the architecture command to be certain it is using the right binary – but the result is the same without it.

Any suggestions as to how to fix it?

macos – Cannot mount UDIF read-only disk image: readDataFork returned error 29

# hdiutil attach -nomount -noverify -verbose /private/var/root/Desktop/Adobe_Zii_2019_4.1.3__TNT_.dmg
正在初始化…
DIBackingStoreInstantiatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score      100, CCarbonBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  6, score    -1000, CVectoredBackingStore
DIBackingStoreInstantiatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score      100, CCarbonBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  6, score    -1000, CVectoredBackingStore
DIFileEncodingInstantiatorProbe: interface  0, score    -1000, CMacBinaryEncoding
DIFileEncodingInstantiatorProbe: interface  1, score    -1000, CAppleSingleEncoding
DIFileEncodingInstantiatorProbe: interface  2, score    -1000, CEncryptedEncoding
DIFileEncodingInstantiatorProbe: interface  0, score      900, CUDIFEncoding
DIFileEncodingNewWithBackingStore: CUDIFEncoding
DIFileEncodingNewWithBackingStore: instantiator returned 0
DIFileEncodingInstantiatorProbe: interface  0, score    -1000, CSegmentedNDIFEncoding
DIFileEncodingInstantiatorProbe: interface  1, score    -1000, CSegmentedUDIFEncoding
DIFileEncodingInstantiatorProbe: interface  2, score    -1000, CSegmentedUDIFRawEncoding
DIDiskImageInstantiatorProbe: interface  0, score     1000, CUDIFDiskImage
DIDiskImageInstantiatorProbe: interface  1, score        0, CSparseBundleDiskImage
DIDiskImageInstantiatorProbe: interface  2, score        0, CSparseDiskImage
DIDiskImageInstantiatorProbe: interface  3, score     -100, CRawDiskImage
DIDiskImageInstantiatorProbe: interface  4, score        0, CDARTDiskImage
DIDiskImageInstantiatorProbe: interface  5, score        0, CDiskCopy42DiskImage
DIDiskImageInstantiatorProbe: interface  6, score    -1000, CNDIFDiskImage
DIDiskImageInstantiatorProbe: interface  8, score     -100, CShadowedDiskImage
DIDiskImageInstantiatorProbe: interface  9, score    -1000, CCFPlugInDiskImage
DIDiskImageInstantiatorProbe: interface 10, score     -100, CWrappedDiskImage
DIDiskImageNewWithBackingStore: CUDIFDiskImage
CCachedBackingStore::readDataFork returning 29
CUDIFDiskImage::setBackingStore unable to open resource fork (29)
DIDiskImageNewWithBackingStore: instantiator returned 29
正在装载…
Error 29 (非法查找).
即将完成…
DIHLDiskImageAttach() returned 29
hdiutil: attach failed - 非法查找
(1)#

I tried to remove the metadata using xattr -c and cp without -a or -p, but both does not work. I run a scan on it using Disk Drill (dd it onto a ram disk) and there is some plist/pngs related, so there is definitely data in the file. How can I mount this disk image/access the files inside?

django – Bad request returned from public IP address on Nginx server

In essence, I’ve been trying to set up a custom webserver for myself using Ubuntu 20.04 LTS on my Raspberry Pi 4. So far the configuration has gone well enough that I can access the ‘webpage’ the server is running from its local ip address, but I’m having trouble accessing it using my public IP address.

For my main set-up, I followed this tutorial from Digital Ocean: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04

There is almost nothing custom at this point, since I didn’t want to stray from a configuration that worked.

From using nmap to run a scan on the local ip, I get this returned:

aiden@AFox-Ivey:~$ nmap -sV 192.168.0.184

Starting Nmap 7.60 ( https://nmap.org ) at 2021-03-12 22:23 EST
Nmap scan report for 192.168.0.184
Host is up (0.079s latency).
Not shown: 997 filtered ports
PORT    STATE  SERVICE VERSION
22/tcp  open   ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0)
80/tcp  open   http    nginx 1.18.0 (Ubuntu)
443/tcp closed https
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 31.25 seconds

It makes sense, since I can view the contents of the webpage through the browser.

When I run another scan over nmap on the public ip address, I understandably get this:

aiden@AFox-Ivey:~$ nmap -sV xx.xxx.x.xx

Starting Nmap 7.60 ( https://nmap.org ) at 2021-03-12 22:25 EST
Nmap scan report for {my router's identification}
Host is up (0.011s latency).
Not shown: 990 closed ports
PORT     STATE    SERVICE            VERSION
22/tcp   filtered ssh
23/tcp   filtered telnet
53/tcp   open     tcpwrapped
80/tcp   open     http               nginx 1.18.0 (Ubuntu)
111/tcp  filtered rpcbind
139/tcp  open     netbios-ssn        Samba smbd 3.X - 4.X { } 
445/tcp  open     netbios-ssn        Samba smbd 3.X - 4.X { }
6881/tcp filtered bittorrent-tracker
8080/tcp filtered http-proxy
8081/tcp filtered blackice-icecap
Service Info: Host: {  }; OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 22.77 seconds

I’ve configured port-forwarding on my router to ensure that ports 80 and 443 should send any request to my local webserver. I’ve also set the webserver in a DMZ, for the purpose of minimizing any damage.

When I curl my {public} IP address at port 80 (which should be configured to pass it through to my local webserver), I get a strange return however:

aiden@AFox-Ivey:~$ curl xx.xxx.x.xx
<h1>Bad Request (400)</h1>

I checked this in the access.log file and it understandably showed the GET request from my user agent along with another set of requests from IP addresses I don’t know much about. My guess is that these are just webcrawlers.

192.168.0.103 - - (13/Mar/2021:15:17:38 +0000) "GET / HTTP/1.1" 400 37 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0"

Here are my thoughts as to what might have gone wrong, arranged roughly in descending order of likelihood.

  1. Django –> “settings.py” is configured improperly.
  2. I haven’t configured my router appropriately.
  3. Nginx is not configured properly.
  4. There is some fundamental problem with my system.
  5. There is a bug in one of the mentioned pieces of my system.

I would really appreciate any sort of guidance or ideas on what could be going wrong with this, as well as if anyone has tips on ensuring keeping my webserver and LAN safe from attackers.

Why I am getting "undelivered mail returned to sender" for emails that I never sent?

I am getting emails from my postmaster/mailer-deamon saying that the message can not be delivered. When I checked the original message it was sent from some (A) xyz@gmail.com(Tatyana Tanya) to (B) hueei@aol.com/hueei@live.de and it looks like dating spam. Can you tell me why I am getting this mail when it was sent from address A to address B?

Why is the reverse zone name appended to the returned domain names in reverse DNS lookup?

Not sure if I missed something when I set up the PTR records for the hostnames.

When I conducted the reverse DNS lookup against the reverse zone 2.10.10.in-addr.arpa, some returned domain names were appended with the reverse zone name, while others were not.

Here are two examples. 10.10.2.104 returned the hostname correctly, while 10.10.2.21 returned the hostname appended with the reverse zone name.

[root@rep02.ipa.example.com ~]# nslookup
> nginx02.prd.example.com
Server:     10.10.4.3
Address:    10.10.4.3#53

Name:   nginx02.prd.example.com
Address: 10.10.2.21
> 10.10.2.21
21.2.10.10.in-addr.arpa name = nginx02.prd.example.com.2.10.10.in-addr.arpa.
> tomcat.sbx.example.com
Server:     10.10.4.3
Address:    10.10.4.3#53

Name:   tomcat.sbx.example.com
Address: 10.10.2.104
> 10.10.2.104
104.2.10.10.in-addr.arpa    name = tomcat.sbx.example.com.

Can anyone shed some light on this? I tried several other tools, like dig and host, but I got the same results.

20.04 – Call to ‘pkg-config –libs-only-l Qt5Core Qt5Network Qt5Widgets returned exit status 1

Environment Information:

  • OS: Ubuntu 20.04
  • Node JS version: v9.6.1
  • npm version: 5.6.0
  • Qt – >Qt 5.9.9 (Custom Installation with including the options below)
    • Qt 5.9.9 -> Desktop gcc 64-bit
    • Qt 5.9.9 -> Qt Network Authorization
    • Qt 5.9.9 -> Qt Script (Deprecated)
  • qtwebkit version: 5.212

I have installed Qt and along with QtWebkit plugin. The installation was successful and i am able to open the QtCreator gui.

I running and npm install command on node project that uses Qt. The command ends with following error:

Package 'Qt5WebKit' has no Description: field
gyp: Call to 'pkg-config --libs-only-l Qt5Core Qt5Network Qt5Widgets Qt5Gui Qt5WebKit Qt5WebKitWidgets Qt5Test' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/rando/.nvm/versions/node/v9.6.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 5.8.0-44-generic
gyp ERR! command "/home/rando/.nvm/versions/node/v9.6.1/bin/node" "/home/rando/.nvm/versions/node/v9.6.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/rando/Desktop/git/master-node/node/browser_engines/src/browsers/webkit
gyp ERR! node -v v9.6.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! company-browser-webkit@0.2.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the company-browser-webkit@0.2.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rando/.npm/_logs/2021-03-02T16_42_43_655Z-debug.log

I have configured the environment variables as below:

export QT_HOME=/opt/Qt/5.9.9/gcc_64
export PATH=$PATH:$QT_HOME/bin
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$QT_HOME/lib/pkgconfig;

I also try it without any luck to create sym links QtCore.pc, QtGUI.pc, and QtNetwork.pc for Qt5Core.pc, Qt5GUI.pc, and Qt5Network.pc. This didn’t solve my issue.

I will appreciate any help or guide.

Regards,

Rando.