公司在阿里云的新服务器,系统C盘只有40G,装了一堆程序,配置好环境,只剩下大约3个G了,看着标红的C盘容量条,很不惬意,确定要清理一下。
习惯性手工清理 + CCleaner 清理,完了没有大多少。却发现Server 2012怎么没有“磁盘清理”这个功能按钮呢?
于是搜索引擎。。。
结果是,要在“服务器管理器”中打开勾选这个功能:
安装以后在磁盘属性页就可以找到“磁盘清理”的选项了!
希望世间永无欺骗
公司在阿里云的新服务器,系统C盘只有40G,装了一堆程序,配置好环境,只剩下大约3个G了,看着标红的C盘容量条,很不惬意,确定要清理一下。
习惯性手工清理 + CCleaner 清理,完了没有大多少。却发现Server 2012怎么没有“磁盘清理”这个功能按钮呢?
于是搜索引擎。。。
结果是,要在“服务器管理器”中打开勾选这个功能:
安装以后在磁盘属性页就可以找到“磁盘清理”的选项了!
方法一(推荐):开始菜单 ,在开始搜索框中 输入“疑难解答”
弹出疑难解答菜单 ,在系统和安全性一栏中 单击“使用Windows Update 解决问题” 单击下一步,系统会自动修复windows update的错误 (以下步骤等同方法二)
方法二:
开始菜单 ,单击“控制面板”
在“控制面板”中,单击查看方式,选择“大图标”(或者“小图标”)
向下翻,找到“疑难解答”
在系统和安全性一栏中 单击“使用Windows Update 解决问题” 单击下一步,系统会自动修复windows update的错误
特别补充步骤,控制面板 打开网络和Internet ,Internet选项,“连接”选项卡 单击局域网设置按钮,去掉“自动检测设置”前的√, 保证这三个勾都没有选中
这样可以大大提高windows update的成功率(尤其是装好MSDN原版系统后 ,首次更新时可修复代理)
重新启动电脑,一般情况下windows update就恢复正常了
【END】
在库内查询,可用于生成如下字段结构:
[表], [字段], [数据类型], [允许为空], [主键], [外键], [引用表], [说明描述]
SELECT TOP (100) PERCENT a.name AS 表, b.name AS 字段, c.name AS 数据类型, CASE WHEN b.isnullable = 0 THEN '-' WHEN b.isnullable = 1 THEN '是' END AS 允许为空,
CASE WHEN d .name IS NULL THEN '-' WHEN d .name IS NOT NULL THEN '是' END AS 主键, CASE WHEN e.parent_object_id IS NULL THEN 0 ELSE 1 END AS 外键,
CASE WHEN e.parent_object_id IS NULL THEN '-' ELSE g.name END AS 引用表, CASE WHEN h.value IS NULL THEN '-' ELSE h.value END AS 说明描述,
i.text AS 默认值
FROM sys.sysobjects AS a INNER JOIN
sys.syscolumns AS b ON a.id = b.id INNER JOIN
sys.systypes AS c ON b.xtype = c.xtype LEFT OUTER JOIN
(SELECT so.id, sc.colid, sc.name
FROM sys.syscolumns AS sc INNER JOIN
sys.sysobjects AS so ON so.id = sc.id INNER JOIN
sys.sysindexkeys AS si ON so.id = si.id AND sc.colid = si.colid
WHERE (si.indid = 1)) AS d ON a.id = d.id AND b.colid = d.colid LEFT OUTER JOIN
sys.foreign_key_columns AS e ON a.id = e.parent_object_id AND b.colid = e.parent_column_id LEFT OUTER JOIN
sys.objects AS g ON e.referenced_object_id = g.object_id LEFT OUTER JOIN
sys.extended_properties AS h ON a.id = h.major_id AND b.colid = h.minor_id LEFT OUTER JOIN
sys.syscomments AS i ON b.cdefault = i.id
WHERE (a.type = 'U') AND (c.name <> 'sysname')
ORDER BY 表, 字段
还有一个查全库表字段的,参见另一篇 《通过(sys.sysobjects)对象表,查询全库表的基础信息 :Sql Server 查询全库表信息》
源码管理服务器 Team Foundation Server(TFS) 的ip地址发生改变后, 解决方案连不上了.
解决方法是:
修改 LocationServerMap.xml 文件, 删除其中的 “location” = 原地址的条目.
今天安装 Team Foundation Server。
在安装结果信息中有点以为的收获:
信息
启动 Windows 服务时允许花费的时间已从 30 秒增加为 600 秒。这会影响此服务器上的所有 Windows 服务。(注册表值设置是 HKLM\SYSTEM\CurrentControlSet\Control\!ServicesPipeTimeout。)
通过设置此注册表键值,调整加载服务所允许使用的时间。
一段VB脚本,将“显示隐藏系统文件”加入到右键,如图。
Dim WSHShell Set WSHShell = WScript.CreateObject("WScript.Shell") WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\CLSID", "{13709620-C279-11CE-A49E-444553540000}", "REG_SZ" WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\method", "ShellExecute", "REG_SZ" if WSHShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt") = 0 then WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "0", "REG_DWORD" WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "2", "REG_DWORD" WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "1", "REG_DWORD" WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command", "显示扩展名及文件", "REG_SZ" WSHShell.SendKeys "{F5}+{F10}e" else WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ShowSuperHidden", "1", "REG_DWORD" WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden", "1", "REG_DWORD" WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt", "0", "REG_DWORD" WSHShell.RegWrite "HKCR\CLSID\{00000000-0000-0000-0000-000000000012}\Instance\InitPropertyBag\command", "隐藏扩展名及文件", "REG_SZ" WSHShell.SendKeys "{F5}+{F10}e" end if Set WSHShell = Nothing WScript.Quit(0)
存档一个今天用到的sql, 可以用来查询表中, 字段, 数据类型的sql.
SELECT OBJECT_NAME(c.id) AS 表名, c.name AS 字段名, t.name AS 数据类型, c.prec AS 长度 FROM syscolumns c INNER JOIN systypes t ON c.xusertype = t.xusertype WHERE (objectproperty(c.id, 'IsUserTable') = 1) AND (c.id = OBJECT_ID('你的表名'))
如果要查视图的话, 要修改一下where条件, 把where的objectproperty放到上面增加一个case判断, AS 出类型
SELECT CASE WHEN (OBJECTPROPERTY(c.id, 'IsUserTable') = 1) THEN 'Table' WHEN (OBJECTPROPERTY(c.id, 'IsView') = 1) THEN 'View' END AS 类型, OBJECT_NAME(c.id) AS 表名, c.name AS 字段名, t.name AS 数据类型, c.prec AS 长度 FROM sys.syscolumns AS c INNER JOIN sys.systypes AS t ON c.xusertype = t.xusertype WHERE (c.id = OBJECT_ID('View_1'))
(OBJECTPROPERTY(c.id, ‘IsUserTable’) = 1) 是表, (OBJECTPROPERTY(c.id, ‘IsView’) = 1) 是视图
关于 OBJECTPROPERTY 的详细用法和参数, 请查看: http://technet.microsoft.com/zh-cn/library/ms176105(v=sql.90).aspx
命名空间:System.Threading 程序集:mscorlib(在 mscorlib.dll 中)
C#支持通过多线程并行地执行代码,一个线程有它独立的执行路径,能够与其它的线程同时地运行。一个C#程序开始于一个单线程,这个单线程是被CLR和操作系统(也称为“主线程”)自动创建的,并具有多线程创建额外的线程。
1.使用线程的情况
2.多线程的并发执行 如果有多个线程在执行,单CPU只有一个,到底执行的哪个?
3.创建并启动线程
ThreadStart 线程启动委托名=new ThreadStart(方法名);
Thread 线程实例名=new Thread(线程启动委托名); 线程实例名.Start();
4.终止线程
5.休眠线程
6.挂起/恢复线程
7.串行化线程
8.线程的锁定机制 线程的锁定机制可以保证每次只有一个线程可以访问共享资源。 使用关键字lock
9.线程的优先级具有不可靠性,就是说不能用优先级来控制线程的执行顺序。
10.后台线程
Control.CheckForIllegalCrossThreadCalls = False;
要使用MethodInvoker委派,需要三个条件:
Thread thread=new Thread(new ThreadStart(Run)); thread.IsBackground=true; //把Thread设为后台线程 thread.Start();
public void Run() { int count = 0; try { MethodInvoker mi = new MethodInvoker(this.UpdateLabel); //创建一个委托,UpdateLabel是该委托所托管的代码,必须是声明为void 且不接受任何参数的任何方法。 while (true) { count++; //this.Invoke(mi);//同步执行委托 this.BeginInvoke(mi);//异步执行委托 Thread.Sleep(500); } } catch (ThreadInterruptedException e) { Console.WriteLine("Interruption Exception in Thread:{0}", e); } catch (Exception ex) { Console.WriteLine("Exception in Thread:{0}", ex); } }
public void UpdateLabel() { label1.Text=count.ToString(); }
2012年2月6日作者:enet
若要确定应用程序是否为控制台或 GUI,您必须分析该 EXEheader。标头包含一个称为子系统的字段。此字段确定是要在其下运行的应用程序子系统和它需要的接口的类型。值组成:
IMAGE_SUBSYSTEM_NATIVE 1
IMAGE_SUBSYSTEM_WINDOWS_GUI 2
IMAGE_SUBSYSTEM_WINDOWS_CUI 3
IMAGE_SUBSYSTEM_OS2_CUI 5
IMAGE_SUBSYSTEM_POSIX_CUI 7
IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
示例代码
#include <windows.h> #include <winnt.h> VOID main(int, char **); DWORD AbsoluteSeek(HANDLE, DWORD); VOID ReadBytes(HANDLE, LPVOID, DWORD); VOID WriteBytes(HANDLE, LPVOID, DWORD); VOID CopySection(HANDLE, HANDLE, DWORD); #define XFER_BUFFER_SIZE 2048 VOID main(int argc, char *argv[]) { HANDLE hImage; DWORD bytes; DWORD iSection; DWORD SectionOffset; DWORD CoffHeaderOffset; DWORD MoreDosHeader[16]; ULONG ntSignature; IMAGE_DOS_HEADER image_dos_header; IMAGE_FILE_HEADER image_file_header; IMAGE_OPTIONAL_HEADER image_optional_header; IMAGE_SECTION_HEADER image_section_header; if (argc != 2) { printf("USAGE: %s program_file_name\n", argv[1]); exit(1); } /* * Open the reference file. */ hImage = CreateFile(argv[1], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE == hImage) { printf("Could not open %s, error %lu\n", argv[1], GetLastError()); exit(1); } /* * Read the MS-DOS image header. */ ReadBytes(hImage, &image_dos_header, sizeof(IMAGE_DOS_HEADER)); if (IMAGE_DOS_SIGNATURE != image_dos_header.e_magic) { printf("Sorry, I do not understand this file.\n"); exit(1); } /* * Read more MS-DOS header. */ ReadBytes(hImage, MoreDosHeader, sizeof(MoreDosHeader)); /* * Get actual COFF header. */ CoffHeaderOffset = AbsoluteSeek(hImage, image_dos_header.e_lfanew) + sizeof(ULONG); ReadBytes (hImage, &ntSignature, sizeof(ULONG)); if (IMAGE_NT_SIGNATURE != ntSignature) { printf("Missing NT signature. Unknown file type.\n"); exit(1); } SectionOffset = CoffHeaderOffset + IMAGE_SIZEOF_FILE_HEADER + IMAGE_SIZEOF_NT_OPTIONAL_HEADER; ReadBytes(hImage, &image_file_header, IMAGE_SIZEOF_FILE_HEADER); /* * Read optional header. */ ReadBytes(hImage, &image_optional_header, IMAGE_SIZEOF_NT_OPTIONAL_HEADER); switch (image_optional_header.Subsystem) { case IMAGE_SUBSYSTEM_UNKNOWN: printf("Type is unknown.\n"); break; case IMAGE_SUBSYSTEM_NATIVE: printf("Type is native.\n"); break; case IMAGE_SUBSYSTEM_WINDOWS_GUI: printf("Type is Windows GUI.\n"); break; case IMAGE_SUBSYSTEM_WINDOWS_CUI: printf("Type is Windows CUI.\n"); break; case IMAGE_SUBSYSTEM_OS2_CUI: printf("Type is OS/2 CUI.\n"); break; case IMAGE_SUBSYSTEM_POSIX_CUI: printf("Type is POSIX CUI.\n"); break; case IMAGE_SUBSYSTEM_NATIVE_WINDOWS: printf("Type is native Win9x driver.\n"); break; case IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: printf("Type is Windows CE.\n"); break; default: printf("Unknown type %u.\n", image_optional_header.Subsystem); break; } } DWORD AbsoluteSeek(HANDLE hFile, DWORD offset) { DWORD newOffset; if ((newOffset = SetFilePointer(hFile, offset, NULL, FILE_BEGIN)) == 0xFFFFFFFF) { printf("SetFilePointer failed, error %lu.\n", GetLastError()); exit(1); } return newOffset; } VOID ReadBytes(HANDLE hFile, LPVOID buffer, DWORD size) { DWORD bytes; if (!ReadFile(hFile, buffer, size, &bytes, NULL)) { printf("ReadFile failed, error %lu.\n", GetLastError()); exit(1); } else if (size != bytes) { printf("Read the wrong number of bytes, expected %lu, got %lu.\n", size, bytes); exit(1); } }
2012年2月6日作者:enet
@echo off
color 3f
title 右键MS-DOS设置
:menu
cls
echo.
echo [1] 添加右键打开MS-DOS
echo [2] 删除右键打开MS-DOS
echo [0] 退出
set /p choice= 请选择(1;2;0):
if “%choice%”==”1″ goto add
if “%choice%”==”2″ goto remove
if “%choice%”==”0″ goto end
goto menu
:add
reg add “HKCR\*\shell\MS-DOS” /ve /d MS-DOS /f >nul 2>nul
reg add “HKCR\*\shell\MS-DOS\command” /ve /d “cmd.exe” /f >nul 2>nul
reg add “HKCR\Folder\shell\MS-DOS” /ve /d MS-DOS /f >nul 2>nul
reg add “HKCR\Folder\shell\MS-DOS\command” /ve /d “cmd.exe /k cd %%1″ /f >nul 2>nul
cls
echo 操作成功,按任意键返回……
pause>nul
goto menu
:remove
reg delete “HKCR\*\shell\MS-DOS” /f >nul 2>nul
reg delete “HKCR\Folder\shell\MS-DOS” /f >nul 2>nul
cls
echo 操作成功,按任意键返回……
pause>nul
goto menu
:end
cls
echo —————————————————–
echo 操作完毕,谢谢您的使用!
echo.
echo.
echo 按任意键退出…
echo —————————————————–
pause>nul
拷贝到文本文件。 后缀名为bat,执行即可。