静态方法和方法重写

Have you ever found yourself in a situation where you have to optimize a piece of code(code with lots of objects) ? Well, don’t worry if you haven’t encountered yet, eventually you will. This post will be about a confusing scenario of Static methods and method overriding.

Read More

你不是被雇来写代码的

成为一个软件开发者不仅仅是写代码。在创业公司如雨后春笋的时代,软技能变得越来越重要了。

0_Ak5ZV239Jw20-syI.jpeg

Read More

汇编语言之排序并输出

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;--------------------------------------------
DATA SEGMENT
BUF DB 10H, 25H, 32H, 13H, 43H
DATA ENDS

;--------------------------------------------
STACK SEGMENT STACK 'STACK'
SB DB 100 DUP(?)
STACK ENDS

;--------------------------------------------

CODE SEGMENT
ASSUME CS:CODE, DS:DATA, SS:STACK

START:
MOV AX, STACK
MOV SS, AX
MOV AX, DATA
MOV DS, AX
LEA DI, BUF
MOV BL, 5

AGN:
MOV SI, DI
MOV CL, BL

AGN2:
MOV AL, [SI]
CMP AL, [SI + 1]
JNC AGN3
XCHG [SI + 1], AL
MOV [SI], AL

AGN3:
INC SI
DEC CL
JNZ AGN2
DEC BL
JNZ AGN

;-------------------------
MOV CH, 06H
MOV CL, 04H
MOV AH, 02H

NEXT:
MOV DL, [DI]
ROL DL, CL
AND DL, 0FH
CMP DL, 0AH
JB STORE
ADD DL, 07H

STORE:
ADD DL, 30H
INT 21H

;---------------
MOV DL, [DI]
AND DL, 0FH
CMP DL, 0AH
JB STORE2
ADD DL, 07H

STORE2:
ADD DL, 30H
INT 21H
MOV DL, ' '
INT 21H
INC DI
DEC CH
JNE NEXT

;-------------------------
MOV AH, 4CH
INT 21H
CODE ENDS

;--------------------------------------------
END START

Read More

Linux创建内存目录

创建内存目录的目的在于减少不必要的磁盘操作,加速软件的启动速度。

/etc/fstab

1
tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0

Read More

Top 10: Windows Firewall Netsh Commands

Top 10: Windows Firewall Netsh Commands

Configure Windows Server networking and firewall functions from the command line

Read More

enable/disable Windows firewall rules

enable firewall rule:

1
run, netsh advfirewall firewall set rule name="NameOfFirewallRule" new enable=yes

Read More

git设置代理

修改~/.gitconfig文件
增加如下代码:

1
2
[http]
proxy = socks5://127.0.0.1:1080

Read More

在 FreeBSD 10.1中安装 Mate 桌面

在 FreeBSD 10.1中安装 Mate 桌面

编译自:http://www.unixmen.com/install-mate-desktop-freebsd-10-1/
作者: M.el Khamlichi
原创:LCTT https://linux.cn/article-5385-1.html
译者: geekpi
本文地址:https://linux.cn/article-5385-1.html

Read More

让Ubuntu显示开关机详情

修改 /etc/default/grub

把GRUB_CMDLINE_LINUX_DEFAULT后面的quiet splash参数删除掉.当然你也可以注销掉这一行.

Read More

万能的豆神(题解)

万能的豆神(题解)


在每次放进去的时候直接和前一个进行比较,然后拿最小值作为放进去的即可。比如放进去的是5 4 6 3,那么从杯底到杯口的数值应该是5 4 4 3,以后每一次删除就只要删除一个即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
using namespace std;

int a[3000000];
int flag_ = -1;

int main (){
int n, value;
cin >> n;
char ch;
while (n--){
cin >> ch;
if ('+' == ch){
cin >> value;
flag_++;
if (0 == flag_){
a[flag_] = value;
}else{
a[flag_] = min(a[flag_-1], value);
}
cout << a[flag_] << endl;
}else{
if (flag_ >= 0){
flag_--;
}
if (flag_ >= 0){
cout << a[flag_] << endl;
}else{
cout << "-1" << endl;
}
}
}
return 0;
}

Read More