Tag Archives: windows

Implementation of HTTPS file server based on nginx in win2012

Nginx and openssl: http://nginx.org/en/download.html

http://slproweb.com/products/Win32OpenSSL.html
Environment variable:
c:\ openssl-win64 \bin
th variable add %OPENSSL_HOME%

openssl genrsa -des3 -out xxx.key 1024
openssl req -new -key xxx.key -out xxx.csr
cp xxx.key xxx.key.org
openssl rsa -in xxx.key.org -out xxx.key
openssl x509 -req -days 365 -in xxx.csr -signkey xxx.key -out xxx.crt

Start nginx after modifying nginx.conf

server {
        listen       443 ssl;
        server_name  localhost;
		ssl_certificate      C://nginx-1.18.0//ssl//xxx.crt;
	    ssl_certificate_key  C://nginx-1.18.0//ssl//xxx.key;
        
		#charset koi8-r;

        #access_log  logs/host.access.log  main;

	    ssl_session_cache    shared:SSL:1m;
	    ssl_session_timeout  5m;
	
	    ssl_ciphers  HIGH:!aNULL:!MD5;
	    ssl_prefer_server_ciphers  on;

     location /update {
	        alias C:/hy-8000;
			allow all;
			autoindex on;

	        proxy_set_header   X-Real-IP            $remote_addr;
	        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
	        proxy_set_header   Host                   $http_host;
	        proxy_set_header   X-NginX-Proxy    true;
	        proxy_set_header   Connection "";
	        proxy_http_version 1.1;
     }

Clion automatically adds add_ executable

CLion automatically adds add_executable
Install the C/C++ Single File Execution plugin, search for the C/C++ Single File Execution, find file-settings-plugins, and apply.
The preparations are complete. Next you can create a new C/ CPP file, enter the code, press Ctrl + Alt + Shift +E shortcut or right click in the code area and find Add Executable for Simple C/C++ File, then right click on the item area on the left and select Reload Cmake Project, select Auto-Reload so that it will automatically add to the executable after each right click on Add.

Mount windows NTFS partition under Linux

Mounting the Windows NTFS partition under Linux

How it works: Use the mount command to mount the partition under Windows into a directory under Linux.

1.uname -r View the current Linux kernel version.

2. Go to
http://www.linux-ntfs.org/ Download the same NTFS patch as the kernel version.

3. Install patch: RPM – the ivh kernel – the module – NTFS – 2. 7.0.x.x – x – 2.1.20-0. Rr. 4.10 i686. RPM

4. Use fdisk-l to view the partition information of the hard disk.

5.
5.
5.
5.
5.
5.

: mkdir/MNT /c corresponds to the C disk

mkdir/MNT /d corresponds to D disk

mkdir/MNT /e corresponds to e disk

6.mount -t NTFS /dev/xxx/MNT /x
6.mount -t NTFS /dev/xxx/MNT /x
6.mount -t NTFS /dev/xxx/MNT /x

: mount /dev/hda1/MNT /c

the mount -t NTFS/dev/hda5/MNT/d

the mount -t NTFS/dev/hda6/MNT/e
 

Running bat batch file in background

Scene:
When executing the bat file through the Windows timing task, the CMD window will pop up. If you do not want to be disturbed by the black box pop up, you can solve the problem by the following methods.
Solutions:
Add the following code at the beginning of the batch file:

if "%1"=="hide" goto CmdBegin
start mshta vbscript:createobject("wscript.shell").run("""%~0"" hide",0)(window.close)&&exit
:CmdBegin

 
 

Install / Remove of the Service denied! Error occurred when installing MySQL service

Mysqld –install /Remove of the Service Denied: install /Remove of the Service Denied: mysqld –install /Remove of the Service Denied: install /Remove of the Service Denied: Wrong. Strange.
 
This time, you need to right-click “Run as Administrator”, and then type mysqld –install
 
OK, the service is installed successfully!

Implementation of screen cleaning in Python idle

screen things too much, need clear screen, window screen clearing command in Windows is CLS, in Python IDLE is the shortcut Ctrl + L

but this shortcut is not the default, need to do some operation

> Copy and save the following code into your new ClearWindow.py

"""

Clear Window Extension
Version: 0.2

Author: Roger D. Serwy
        [email protected]

Date: 2009-06-14

It provides "Clear Shell Window" under "Options"
with ability to undo.

Add these lines to config-extensions.def

[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>


"""

class ClearWindow:

    menudefs = [
        ('options', [None,
               ('Clear Shell Window', '<<clear-window>>'),
       ]),]

    def __init__(self, editwin):
        self.editwin = editwin
        self.text = self.editwin.text
        self.text.bind("<<clear-window>>", self.clear_window2)

        self.text.bind("<<undo>>", self.undo_event)  # add="+" doesn't work

    def undo_event(self, event):
        text = self.text

        text.mark_set("iomark2", "iomark")
        text.mark_set("insert2", "insert")
        self.editwin.undo.undo_event(event)

        # fix iomark and insert
        text.mark_set("iomark", "iomark2")
        text.mark_set("insert", "insert2")
        text.mark_unset("iomark2")
        text.mark_unset("insert2")


    def clear_window2(self, event): # Alternative method
        # work around the ModifiedUndoDelegator
        text = self.text
        text.undo_block_start()
        text.mark_set("iomark2", "iomark")
        text.mark_set("iomark", 1.0)
        text.delete(1.0, "iomark2 linestart")
        text.mark_set("iomark", "iomark2")
        text.mark_unset("iomark2")
        text.undo_block_stop()
        if self.text.compare('insert', '<', 'iomark'):
            self.text.mark_set('insert', 'end-1c')
        self.editwin.set_line_and_column()

    def clear_window(self, event):
        # remove undo delegator
        undo = self.editwin.undo
        self.editwin.per.removefilter(undo)

        # clear the window, but preserve current command
        self.text.delete(1.0, "iomark linestart")
        if self.text.compare('insert', '<', 'iomark'):
            self.text.mark_set('insert', 'end-1c')
        self.editwin.set_line_and_column()

        # restore undo delegator
        self.editwin.per.insertfilter(undo)

3, then find the config in this directory – extensions. Def this file (idle configuration file extensions), open it in notepad

[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>

Clear shell window Ctrl +L

br>

In VS2010, the compiler cannot open the file “GL / glaux. H”: no such file or directory

 
We recently tested an example OpenGL program:
#include < GL/gl.h>
#include < GL/glaux.h>
#include “glos.h”
 
void main(void)
{
auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
,0,500,500 auxInitPosition (0);
auxInitWindow(“simple”);
 
GlClearColor (0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
GlColor3f (1.0, 0.0, 0.0);
GlRectf (0.5, 0.5, 0.5, 0.5);
 
glFlush();
_sleep(1000);
}
 
It runs normally under VC6.0, but under VS2010 there is a compilation error as follows:
1> D :\elec\mymfctest\vs2010p\openglapps\opengltest\opengltest.cpp(4): fatal error C1083: Could not open included file: “GL/glaux.h” : No such file or directory
It seems that this error can be found in versions VS2008 and above.
Only two Files can be seen in the path C:\Program Files\Microsoft SDKS \Windows\ V7.0 A\Include\gl after VS2010 installation
Gl. h and glu. H instead of glaux. H,
C:\Program Files\Microsoft Visual Studio\VC98\Include\GL
The next one has three files
H, glu. H, and glaux. H, so the relevant header files are not found in VS2010.
The glaux.lib library file is not found in the VC6.0 installation path C:\Program Files\Microsoft SDKS \Windows\ V7.0 A\ lib, but in the VS2010 installation path C:\Program Files\Microsoft SDKS \Windows\ V7.0 A\ lib.
The solution is to copy the glaux. H and glaux. Lib files from their respective folders to the path referenced by default in VS2010 if you have VC6.0 installed. It is possible that the application will also need glaux. DLL support at runtime, which can also be downloaded.

Windows 7 system, start to run input CMD, the window flashed by, disappeared

First of all, my system is Windows 7, this is also suitable for other systems, because my computer is Windows 7 of this problem, so I just in Windows 7, my computer is likely to be used with the first of a virus or Trojan and later killed and incomplete, but kill may have this problem, for example I will use the CMD window to view the IP ah, see ping network speed ah of what, don’t have the CMD feel very uncomfortable, but every time I enter CMD, one black car window is a flash is automatically shut down, no time to lose anything, Through checking the information, fumbled to find a solution, if you also have a similar problem, according to the following methods do not prevent to try.

The CMD command window is used in some special cases, such as PING to see if the network is connected. If you run commands such as Disk Format Conversion in the CMD window, enter CMD Enter and the black box of the CMD command will flash out and disappear, please refer to the following solution.

a, first check the C: \ WINDOWS \ SYSTEM32 of CMD EXE exists, the document date is normal;
test result is normal, same as other system file date, should not be this problem.

br>

%SystemRoot%;
view after found (if there is no need to add)

3, it is not in the above two common problems, should be modified is the registry.
registry:
ey_local_machine \Software\Microsoft\Command Processor\AutoRun
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
registry:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun (There is no numerical value, but a flash may be eXist, it can be cleared.)

, if it still doesn’t work, try using CMD /k, for example “CMD /k ipconfig /all” in the “Run” window.

MFC flash screen solution

These two days I have been doing UI design, because the company did not use commercial Direct UI and other interface libraries. So the developers had to draw their own controls, so the task of writing the UI fell to me as a new coder. Then the problem I had been avoiding came up against me. Smecta.

problem a, own drawing background is hiding the interface on the original control, in order to solve this problem, but get me hanging silk maxed out.

a, painted a background, and then the area of access to all controls, make it invalid. So the problem was solved, but a new problem came, is the flash screen problem. This problem is caused by overwriting the background and control color. In other words, this scheme is eunuch.

> For this kind of scheme, I just thought, should be OK. But it’s too difficult. I don’t have the ability to do it.

> Set the dialog’s clipChildren property to true. When you draw a window, you cut out the area of the control and copy it back when it is finished. This property is customized for the drawing, so the above problem is solved with just one click. The solution turned out to be so simple.

if draw refresh frequently, this there is no doubt that the splash screen will appear.

Scheme 1, the use of double buffer, no pressure. So every time I draw it, I just paste it on.

2, in painting background brush set for NULL_BRUSH background before you leave. The system could not draw.

3, to draw the background of function (OnEraseBkgnd (pDC) CDC *) content to watch out, with the return true replacement, and then system, there is no way to use the default brush to draw the background. However, the latter two methods solve the flicker, but the interface can be a mess.

using GDI resource summary:

first of all, we all know this law have borrow have also, so when learning c + + so follow this rule, otherwise you will hit a wall.

when using handle with H, for example: the HBITMAP etc, after using DeleteObject remember;

For GDI wrapped classes with C, this is not necessary because the system has already freed them during object destructing. If you leave the system resource handle with the class Detach, then you need to take over the management of the system resource, otherwise the system resource leak will occur.

when using CDC, if the memory DC created after running out also need DeleteDc…..