PERFECT BLUE

Essays


  • 首頁

  • 關於

  • 標籤

  • 分類

  • 歸檔

  • 站點地圖

  • 檢索

Windows10重建索引以释放空间

發表於 2020-03-25 | 分類於 巨硬 , 技巧 |
字數統計: 764 | 閱讀時長 ≈ 2

今天电脑又蓝屏了,似乎是ACPI.sys引起的,刚刚baidu了这个东西,似乎和核显与外接显示器有关,而且这玩意儿高资源占用和引发蓝屏似乎多发于显示器。

蓝屏了,那么就要清理错误文件;说到清理,那往往是C盘红了;C盘红了,那么常规方法往往不起作用,得来点歪门邪道。在这串毫无正常逻辑的思考的最后,我想到了这个,锵锵——重建索引。

閱讀全文 »

dotNET_WinForms调用C语言DLL等问题

發表於 2020-01-05 | 分類於 Program , 帮助 |
字數統計: 120 | 閱讀時長 ≈ 1

System.BadImageFormatException”类型的未经处理的异常在 xx.exe 中发生

  1. 有很大的可能性是因为平台目标(X86、X64)不一致
  2. 配置文件版本问题

读取文本内容

一次将文本内容全部读完,并返回一个包含全部文本内容的字符串
1
string str = File.ReadAllText(@"c:\temp\ascii.txt", Encoding.ASCII);

参考资料

  1. C# winfrom 读取txt文本内容
  2. System.BadImageFormatException”类型的未经处理的异常在 xx.exe 中发生

VisualStudio2019ASP.NET引用DLL指南

發表於 2020-01-01 | 分類於 Program , 帮助 |
字數統計: 160 | 閱讀時長 ≈ 1

环境:.net Framework 4.7.2

1. 创建C#语言的DLL项目

Visual Studio提供了多种C#语言的类库,这里ASP.NET预定使用.net Framework 4.7.2,所以我这里选择 类库(.net Framework) C# 项目模板,这里尤其要注意的是框架版本的一致。

2. 编写DLL

类的访问权限
必须是PUBLIC
默认访问权限为internal

3. 导入DLL

  1. 在ASP.NET解决方案下,右击网站,添加->引用..,添加DLL文件
  2. 在需要的CS文件下添加using DLL名字和DLL文件所需的命名空间
  3. 现在,只需类名.方法名即可使用所需的方法

相对路径中dotdot与dot的区别

發表於 2019-12-31 | 分類於 Program , 帮助 |
字數統計: 304 | 閱讀時長 ≈ 1

. means “current directory” and .. means “parent directory”.
For example, if your directory is C:\Users\Bob, . refers to C:\Users\Bob and .. refers to C:\Users.
You will find that this is universal in programming and computers in general.

C语言检查当前的current directory是什么:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
char* _getcwd( char *buffer, int maxlen );  
// 功 能 : 获得当前工作目录.
// 头文件 : #include <direct.h>
// 返回值 : 成功返回指向buffer的pointer
// 失败返回NULL,且设置errno为以下三个值之一:
// ENODEV 无该设备
// ENOMEM 内存不够
// ERANGE 结果超出范围
// 注 意 : 当第一个参数为 NULL 时, 第二个参数 maxlen 长度设置无效,且函数
// 使用 malloc 分配足够内存, 需要将函数返回值传递给 free() 函数来
// 释放内存. 当第一个参数不为 NULL 时,maxlen 指定长度不够函数返回
// 错,设置errno为ERANGE

//实例
#include <stdio.h>
#include <direct.h>
#define MAXPATH 1024
int main()
{
char buffer[MAXPATH];
_getcwd(buffer,MAXPATH);
printf("%s",buffer);
return 0;
}

Visual Studio 2019与2017的当前目录判定似乎有些不一样,2019版会将工程目录认为是当前目录,2017版则不一样。总之,开始编码前进行确认是必要的。

参考资料

  1. What does dot and dotdot means
  2. C语言获取当前工作路径

VisualStudio2019C#引用C++DLL

發表於 2019-12-31 | 分類於 Program , 帮助 |
字數統計: 178 | 閱讀時長 ≈ 1

一定要确保解决方案平台一致(x64/x86),这个可能会导致很多不同的问题形式,但只要设定为一样的平台,即可解决

DLL头文件

1
extern "C" __declspec(dllexport) void printText(int year, int month, int day, int hour, char station[6]);		//不加"C"会出现找不到函数的问题

数据类型

由于C语言编写的DLL文件不支持String类型,调用DLL内函数需用char类型,故需转换常用的String至char

1
2
3
4
5
string str="content";
char[] c=str.toArray();

//顺便贴个char[]转字符串
str=new String(c);

参考资料

  1. VS2017中 C# dll引用(C生成dll,C++生成dll)小结
  2. c++创建dll导出函数名称
  3. c# char[]数组和字符串之间互转

IDEA项目配置Hibernate

發表於 2019-12-19 | 分類於 Program , 故障 |
字數統計: 55 | 閱讀時長 ≈ 1
  1. Database使用Windows认证提示找不到sqljdbc_auth.dll
    解决方案:不要选择Windows认证,选择用户名和密码认证。

参考资料

  1. sqljdbc_auth.dll was not found inside JAR. (under IntelliJ)
  2. Connecting to SQL Server - Windows authentication - sqljdbc_auth.dll not found

阿里云Debian部署MariaDB

發表於 2019-12-18 | 分類於 Program , 帮助 |
字數統計: 63 | 閱讀時長 ≈ 1
  1. 执行完GRANT并重启后Workbench连不上,但过了一会儿就可以了(玄学)
    1
    GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "password";

参考资料

  1. 关于workbench远程连接阿里云Centos上的Mysql数据库报错10060解决办法
  2. Ubuntu18.04 安装MySQL

C#窗体实现FTP上传困难小记

發表於 2019-12-11 | 分類於 Program , 帮助 |
字數統計: 217 | 閱讀時長 ≈ 1

向其他类传递Form窗体内控件的解决方案

  1. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    //Form1里写
    public string LableText
    {
    get{return this.label.Text;}
    set{this.label.Text = value;}
    }
    //打开form2时把自己传过去
    new Form2(this).Show();

    //Form2构造:
    pubilc Form2(Form1 f1)
    {
    ....
    }
    //按钮事件:
    this.f1.LabelText = "aaaaaaaaa";
  2. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    //用event 

    Class Form1
    {
    public Form1()
    {
    Form2 form = new Form2();
    form.TestBtn.Click += new System.EventHandler(this.Form2ButtonClicked);
    }

    private Form2ButtonClicked(object sender, EventArgs e)
    {
    this.label1.Text = "Clicked";
    }
    }

    Class Form2
    {
    public Button TestBtn= new Button();
    }

这只是最基本的实现方法 (当然不是好方法),等你明白event 和 delegate 以后,自己就会有更好的答案了。

Visual Studio 2019
注释: 先CTRL+K,然后CTRL+C
取消注释: 先CTRL+K,然后CTRL+U

参考资料

  1. c#怎么修改另一窗体中控件的属性
  2. c# 大文件分割 复制 Filestream 进度条
  3. C# 实现FTP文件的上传和下载

J2EE_dojo库使用问题一览

發表於 2019-12-09 |
字數統計: 81 | 閱讀時長 ≈ 1
  1. 1
    2
    3
    4
    5
    <head>
    <title>欢迎使用</title>
    <s:head />
    <sx:head/>
    </head>

在使用dojo标签时一般会加上sx.head用于支持动态处理。如果不加会发现Uncaught ReferenceError: djConfig is not defined

<@sx.head parseContent=”true”/>

参考资料

  1. FreeMaker及SiteMesh中引用Tag,及互相引用 总结

在阿里云上搭建Pure-FTPD

發表於 2019-12-09 | 分類於 Program , 帮助 |
字數統計: 44 | 閱讀時長 ≈ 1
  1. 开放21端口
  2. 创建用户-> 参考blog
  3. 若想在内网(e.g. 校园网)连接FTP,建议采用Passive模式,FTP配置内绑定阿里云公网IP
1…12131415

Kronos

148 文章
165 分類
82 標籤
RSS
© 2019 — 2023 Kronos
由 Hexo 強力驅動
|
主題 — NexT.Gemini v5.1.4