Nboxff's Blog

记录学习,记录生活

0%

PHP学习笔记(暂时先不更了…)

PHP Basic Rules

PHP文件默认的文件拓展名.php

The first PHP examle

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?>

</body>
</html>

The function is to print “Hello World!” to Browser.Each line ends with ;

annotate(注释)

Like C, PHP have two ways to annotate.

  • 单行注释,use // or #
  • 多行注释,use /* */

Variables

  • in PHP, variable must begin with $
  • Variable names are case-sensitive($a and $A are different variables)
  • Other rules of name are the same as C language
阅读全文 »

2022年9月27日,我很高兴也很荣幸能够参加高额奖学金的答辩。感谢学校和同学对我一年学习工作的认可。

在这次答辩中我也真正看到面面俱到的大佬们,无论是党团学习、志愿服务、团学工作、课程成绩、科研创新、社会实践还是技术积累,都取得了很优秀的成绩。

我还得继续努力,多参与活动与比赛,积极向党组织靠拢。

(花旗杯、微信小程序应用开发赛等我得考虑考虑了)

picture1

前段时间购入了一台华为Matepad11,真的非常的香。但是对于经常写代码又不想随时背着笔记本电脑的软院学生而言,遗憾的是,平板上并没有好的代码编辑器。

于是,在云服务器上部署一个online代码编辑器的想法诞生了。

本人用的是大一上学期双十一期间购入的腾讯云轻量应用服务器,最近还免费升级到了4核4G,很赞。

利用docker安装online vscode

1
2
3
4
5
6
7
8
9
10
11
docker run -d --name=code-server \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-e PASSWORD= \
-e SUDO_PASSWORD= \
-p 8080:8443 \
-v /path/to/appdata/config:/config \
-v /root/vscode:/vscode \
--restart unless-stopped \
lscr.io/linuxserver/code-server

设置腾讯云防火墙

启动docker以后还是无法在http:IP地址:8080中访问online vscode, 原因是没有在云服务器的防火墙中添加新的规则,开放端口

image-20220320212651339

现在再次访问http:IP地址:8080就可以跳转到登陆界面了,输入之前PASSWORD设置的密码就可以登陆了。

阅读全文 »

大一上C语言小作业——2048小游戏

项目要求:使用C语言编写2048小游戏

界面设置部分

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
void HideCursor() {            //隐藏光标
CONSOLE_CURSOR_INFO curInfo;
curInfo.dwSize = 1;
curInfo.bVisible = FALSE;
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorInfo(handle, &curInfo);
}

void Goto(int x, int y) { //光标移动到(x,y)位置
COORD pos;
pos.X = x;
pos.Y = y;
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(handle, pos);
}

void PreWork() {
system("title 2048"); //窗口标题为2048
system("mode con cols=40 lines=21"); //窗口大小
system("chcp 65001 > nul"); //中文支持
HideCursor(); //隐藏光标
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof cfi;
cfi.nFont = 0;
cfi.dwFontSize.X = 15;
cfi.dwFontSize.Y = 30;
cfi.FontFamily = FF_DONTCARE;
cfi.FontWeight = FW_NORMAL;
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
srand((unsigned) time(NULL)); //随机函数种子
}

游戏初始化

游戏”棋盘“初始化要做的事:

  • 清空“棋盘”
  • 生成两个数(2或4),其中生成2的概率较大
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void InitGameMap() {
score = 0;
memset(gameMap, -1, sizeof(gameMap));
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
gameMap[i][j] = 0;
}
}
int total = 0;
while (total < 2) {
int x = rand() % 4 + 1;
int y = rand() % 4 + 1;
int temp = rand() % 6 + 1; //temp 的范围是[1, 6]
int num = 2;
if (temp == 1) num = 4; //设置1/6的概率生成数字4
if (!gameMap[x][y]) {
gameMap[x][y] = num;
total++;
}
}
}
阅读全文 »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment