01 2013 档案

wxWidgets 中的 C 字符串 mb_str
摘要:wxWidgets 中的 C 字符串 在 wxWidgets 中处理 C 语言字符串真是一件令人头痛的事情,因为 wxWidgets 库是 C++ 编写的,类中的成员函数大多使用 wxChar*, wxString 作为参数。然而众所周知,在 C 语言里,字符串是以字符数组的形式存储,所以当 wxWidgets 需要和一些 C 库结合使用的时候,比如 Lua,难免会遇到将 C 字符串实例化成 wxString 或 wxChar* 对象的过程中出现乱码的问题。而且这种乱码的出现与一般编程中遇到的乱码不太一样,使用的转换方法不正确,不论是中文还是英文都会出现乱码,一视同仁。一开始,我都是按照文档. 阅读全文

posted @ 2013-01-24 17:19 Richard.FreeBSD

Git/github can't push to master
摘要:采用git clone方法构建本地库后,提交(git push)的时候出现错误:$ git pushfatal: remote error: You can't push to git://github.com/User/Proj.git Use git@github.com:User/Proj.git这时候,需要设置提交的路径来解决$ git remote set-url origin git@github.com:User/Proj.git或者每次提交的时候采用另一种方式:$ git push git@github.com:User/Proj.git或者更改.git中config的 阅读全文

posted @ 2013-01-24 10:52 Richard.FreeBSD

#pragma pack(push,1)与#pragma pack(1)的区别
摘要:这是给编译器用的参数设置,有关结构体字节对齐方式设置, #pragma pack是指定数据在内存中的对齐方式。这是给编译器用的参数设置,有关结构体字节对齐方式设置,#pragma pack是指定数据在内存中的对齐方式。#pragma pack (n) 作用:C编译器将按照n个字节对齐。#pragma pack ()作用:取消自定义字节对齐方式。#pragma pack (push,1)作用:是指把原来对齐方式设置压栈,并设新的对齐方式设置为一个字节对齐#pragma pack(pop) 作用:恢复对齐状态因此可见,加入push和pop可以使对齐恢复到原来状态,而不是编译器默认,可以说后者更优, 阅读全文

posted @ 2013-01-21 15:23 Richard.FreeBSD

linux 的 Magic SysRq key
摘要:在系统假死或者需要类似硬重启的时候可以使用reisub,这个方法可以在各种情况下安全地重启计算机。在Print Screen的地方有个SysRq,这个是按住Alt-PrintScreen相当于按住SysRq,然后依次按下reisub这几个键,按完b系统就会重启。SysRq是系统请求,这个时候输入的所有直接由Linux内核处理,可以进行许多低级操作。reisub的每个字母都是一个独立操作:unRaw 将键盘控制从X Server那里抢过来tErminate 给所有进程发送SIGTERM信号kIll 给所有进程发送SIGKILL信号Sync 将所有数据同步至磁盘Unmount 将所有分区umoun 阅读全文

posted @ 2013-01-16 17:19 Richard.FreeBSD

Linux下获取CPUID、硬盘序列号与MAC地址
摘要:ioctl系统调用,具体的调用方法,请查看手册页获取CPUID按照网上提供的说明,CPUID并不是所有的Intel CPU都支持的。如果支持,汇编调用为:eax置0000_0003,调用cpuid。以下为实现代码(在我的CPU上,并没有得到):#define cpuid(in,a,b,c,d) asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));static intgetcpuid (char *id 阅读全文

posted @ 2013-01-16 10:37 Richard.FreeBSD

英文VS2010安装中文版MSDN文档方法
摘要:正常安装MSDN:打开VS2010->Help->Manage Help Settings->Install Content from Disk选择ProductDocumentation文件夹的HelpContentSetup.msha文件安装中文MSDN:发现我们使用Help Library Manager指向cn_visual_studio_2010_ultimate_x86_dvd_532347.iso发现没有选项可以安装。安装方法在单独MSDN中文版没提供下载之前,我们可以用这种方法单独安装中文版MSDN文档。1.安装Help Library Manager中文语言 阅读全文

posted @ 2013-01-15 22:28 Richard.FreeBSD

Getting KVM to run on your machine
摘要:PrerequisitesYou will need (see download section):kvm-release.tar.gzA VT capable Intel processor, or an SVM capable AMD processorqemu prerequisites:o zlib libraries and headers o SDL libraries and headers o alsa libraries and headers (optional alsa support: disabled by default but can be enabled wit 阅读全文

posted @ 2013-01-15 15:10 Richard.FreeBSD

linux dir 树结构 find . -type d | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"
摘要:find . -type d | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/" 阅读全文

posted @ 2013-01-10 14:24 Richard.FreeBSD

Ubuntu下的文件安全删除工具
摘要:Shred 虽然shred命令有一些限制,但是shred命令可以很有效地彻底删除文件,使文件很难或者无法恢复。Shred是这样进行彻底删除的:通过使用数据模式对文件进行反复重写以实现最大程度的摧毁,这样即使使用高灵敏度的数据恢复设备也很难恢复数据了。 使用rm命令删除文件实际上并没有毁坏数据,它只是毁坏列有文件位置的索引,使文件的数据块还可以重复使用。因此,使用rm命令删除的文件可以 很容易使用特殊设备或者命令进行恢复,前提条件是文件释放的数据库还没有被重复利用。然而,如果在完全是硬盘驱动(HDD)的动态系统,释放的空间只能在 几分钟或者几秒钟内进行恢复。 Shred 语句 shre... 阅读全文

posted @ 2013-01-09 12:01 Richard.FreeBSD

在远程计算机上开启admin$共享
摘要:办法一:利用at计划任务,需先远程开启计划任务 net use \\ip /user:username "password"sc \\ip config schedule start= autosc \\ip start schedulenet time \\ipat \\ip TIME "cmd /c net share admin$"办法二:直接telnet远程控制,需先远程开启远程控制 net use \\ip /user:username"password" sc\\ip config tlntsvrstart=auto sc 阅读全文

posted @ 2013-01-04 21:03 Richard.FreeBSD

Can't access the ADMIN$ using a local user account
摘要:If you are attempting to access (either with PDQ Inventory or PDQ Deploy) a Windows 7, Windows Vista or Server 2008 computer you may get the"Access Denied - Failed to connect to ADMIN$ share" error, even when supplying the appropriate local user credentials that have Administrator access. 阅读全文

posted @ 2013-01-04 20:50 Richard.FreeBSD

How to silently and remotely remove Symantec Antivirus
摘要:Getting away from the Linux game a bit I thought I would share a gem from my Windows side of things. This is how to remotely and silently remove Symantec's Antivirus Corporate Edition from Windows computers.I wanted to remove the antivirus programs remotely because the computers are too far away 阅读全文

posted @ 2013-01-04 20:43 Richard.FreeBSD

ip_forward
摘要:On Linux, you can disable IP forwarding by doing :echo 0 > /proc/sys/net/ipv4/ip_forwardOn Windows, set the key 'IPEnableRouter' to 0 underHKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\ParameterOn Mac OS X, you can disable IP forwarding by executing the command :sysctl -w net 阅读全文

posted @ 2013-01-03 21:26 Richard.FreeBSD

导航