crt

Python3 网易有道词典结合PyInstaller,tkinter制作一个简单的中英文翻译exe文件

别等时光非礼了梦想. 提交于 2019-12-05 17:17:41
这是自己的一个小想法,但是最后还是经过2天的瞎鼓捣实验成果了。虽然界面很丑,但是我很喜欢它,因为有Dos黑窗口,少去了安装步骤,更多的是少去了广告,基于有道翻译里面的api接口,所以我不怕翻译的不准确啦 首先这里分三大步进行肢解: 一: 有道词典的API接口爬取: 二:tkinter 各种控件的使用: 三:PyInstaller 打包成exe文件,直接在桌面上进行应用: 首先:我们来获取有道词典的API接口; 打开网址: 网址 http://fanyi.youdao.com/ 这里通过HttpFox 拦截请求中我们可以看到,我们在网址: http://fanyi.youdao.com/ 中输入中国的时候,调用了post接口,这里的post 参数我把它特别的截出来了,其中key 为i 的value值 是一个乱码的,这里后面会一会就有讲到,里面post参数都有罗列。 相对于中文的翻译,英文的就很好的看到了, 我们可以直接看到对于i的value值为china 通过查看网页源代码的方式查看有道翻译的js文件,来查看salt和sign是怎么生成的 这里的sign值是进行了md5加密来着 贴上有道API代码的获取: # -*- coding: utf-8 -*- # @Time : 2017/8/28 0:42 # @Author : 蛇崽 # @Email : 17193337679@163

Visual Studio 2015: Compile C/C++ without a runtime library

久未见 提交于 2019-12-05 15:38:51
问题 Is there a way of compiling C/C++ with Visual Studio 2015 without using any runtime library? I need to compile without a runtime library because I'm creating my own runtime library (for my OS). There are options on C/C++->Code Generation->Runtime Library but I want an option that says "none". I'm aware of loosing a lot of features that are in the CRT. 回答1: To compile your app without C-Runtime Library (CRT) use /MT , /NODEFAULTLIB linker options and redefine entry point at Linker -> Advanced

When building a DLL; what type of CRT should I link to?

▼魔方 西西 提交于 2019-12-05 11:58:59
In windows; there are 2 options to link to a CRT: Multithreaded, static link Multithreaded, dynamic link Can someone shed some light on what is the best practice here? Should I link 'statically' to the CRT or do a dynamic link? If i do a dynamic link, and I write a program that uses my DLL + another 3rd party DLL (which is doing a static link to CRT), is that an issue? This is a Big Deal when you use DLLs in your application. It is very important that the EXE and the DLLs use the same memory allocator. In case you return pointers or C++ objects (like std::string) from a DLL function that needs

Assertion error in CRT calling _osfile() in VS 2008?

本小妞迷上赌 提交于 2019-12-05 09:21:59
I have a C++ code base that has been working for a long time. The code base was a legacy VS 2003 set of projects that I recently migrated to VS 2008. The migration seemed to be successful in that the resulting program built, and run. I reinstalled my OS and all applications on a fresh drive, and now when I attempt to debug the program within the debugger, I receive an assertion error inside the CRT's chsize (really, _chsize_s ). Specifically (cropped to essentials, ignoring safety checks): FILE * testfile = fopen("P:\\_Dan\\local\\foogoo.txt", "w"); int filehandle = fileno(testfile); chsize

Convert .crt file to .cer and .key

≯℡__Kan透↙ 提交于 2019-12-05 08:55:57
I was asked to help converting a certificate for a renewal. I was given the domainname.crt file along with some intermediate .crt files, but no .key file. They want me to convert the CRT to both a .CER and a .KEY file. I have looked at the following (among many other sites) but they either say I need the .key file, which I don't have, or that I have to install it locally and then export it, but when using MMC and trying to export it the .PFX option is grayed out. http://community.spiceworks.com/topic/367133-i-cant-convert-a-ssl-crt-to-pfx-i-need-help-with-this I also tried the OpenSSL command

【资料整理】Security Features in the CRT

狂风中的少年 提交于 2019-12-05 05:16:24
本文简要整理了 MSDN 上关于 “ Security Features in the CRT ” 方面的内容。详细参考 官网 。 许多老旧的 CRT 函数都有更新且更加安全的后续版本。在安全版本存在的情况下,老旧版本都会被标识为废弃(deprecated)的状态,而安全版本都会以 "_s" 作为后缀。 注意 :上面提到的废弃的状态 不代表 函数已经从 CRT 中被移除,而是 表示 不推荐使用。而安全版本同样不能阻止或者自行修正安全错误,而是其能够在这类错误发生时将错误进行捕获,因为这类函数会对发生的错误条件进行额外的检查。 【消除废弃警告】 方法一:定义 _CRT_SECURE_NO_WARNINGS 宏,或者直接使用 #pragma warning( disable : xxxx ) 。这种方法只能起到眼不见心不烦的效果。 方法二:使用 “ 安全模板重载(Secure Template Overloads,) ”的方法。这种方法是通过重载的方式将老旧版本替换为新的安全版本来真正做到安全增强的,与此同时,老旧版本函数的名字仍旧可以照常使用。使用该方式时,需要定义宏 _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 。对于默认不存在“安全模板重载”的那些函数,需要自行手动更新你的代码来达到使用安全版本的效果。 方法三

解决方案warning C4996: 'fopen': This function or va...

送分小仙女□ 提交于 2019-12-05 05:16:10
Visual Studio 2005 移植 - WINVER,warning C4996, error LINK1104 一、WINVER Compile result: WINVER not defined. Defaulting to 0x0502 (Windows Server 2003) windows server 2003 winver>=0x0502 windows xp winver>=0x0501 windows 2000 winver>=0x0500 windows nt 4.0 winver>=0x0400 windows me winver>=0x0500 windows 98 winver>=0x0410 windows 95 winver>=0x0400 二、编译警告:warning C4996 与 Security Enhancements in the CRT 将过去的工程用VS2005打开的时候。你有可能会遇到一大堆的警告:warning C4996。 比如: warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO

How can fopen_s be more safe than fopen?

别等时光非礼了梦想. 提交于 2019-12-04 23:51:43
I'm working on legacy code for Windows platform. When I compile the code in VS2013 , it give following warning: error C4996: ' fopen ': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." And it will also give samiliar warning for sprintf . I understand sprintf_s is more safe than sprintf because of buffer overflow. But how can be fopen_s be more safe than fopen , there is no chance of buffer overflow because fopen doesn't accept an buffer. Can anyone provide an case fopen is unsafe, and

【C++】sprintf 与sprintf_s

主宰稳场 提交于 2019-12-04 21:37:35
(转自: http://blog.sina.com.cn/s/blog_4ded4a890100j2nz.html) 将过去的工程用VS2005打开的时候。你有可能会遇到一大堆的警告:warning C4996。比如:warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.      原因是Visual C++ 2005使用了更加安全的run-time library routines。新的Security CRT functions(就是那些带有“_s”后缀的函数): http://msdn2.microsoft.com/en-us/library/wd3wzwts(VS.80).aspx 那么如何搞定这些警告呢: 方法一:手工将原来的旧函数替换成新的Security CRT functions。 方法二:屏蔽这个警告。 在预编译头文件stdafx.h里(注意:一定要在没有include任何头文件之前)定义下面的宏: #define _CRT_SECURE_NO_DEPRECATE或者#param warning(disable

CRT initialization and DLLMain

自作多情 提交于 2019-12-04 12:57:51
Quotes: From the document "Best Practices for Creating DLLs" http://download.microsoft.com/download/a/f/7/af7777e5-7dcd-4800-8a0a-b18336565f5b/DLL_bestprac.doc of Microsoft: "DLLs often have complex interdependencies that implicitly define the order in which they must be loaded. The library loader efficiently analyzes these dependencies, calculates the correct load order, and loads the DLLs in that order." [1] "(within DLLMain) Use the memory management function from the dynamic C Run- Time (CRT). If the CRT DLL is not initialized, calls to these functions can cause the process to crash." [2]