2011年8月16日

求一个数是否是偶数

摘要: 最近对内存的布局感兴趣,突然想到前几天面试时的一个附加小问题,虽然当时只是用简单的和2取余做运算,现在突然想到位运算,可以不用除法,据说除法是运行最慢的算术符,虽然以前见过类似的贴子,但当时不太理解也就没有太剖根究底了,现在自己想起来了,就自己写了一下,算是初学者的代码吧,欢迎个们拍砖。下面贴代码/// <summary> /// 是否偶数 /// </summary> /// <param name="i"></param> /// <returns></returns> static unsafe 阅读全文

posted @ 2011-08-16 23:19 林建明 阅读(252) 评论(0) 推荐(1)

2011年8月15日

面试题,找出每个产品的最新五个产品,还有其它方法吗

摘要: 下午去面试,碰到一题SQL题目,其实挺简单的,当时脑门是给挤了还是怎的都不知道,怎么也想不出来,晚上回来想了一下如下if not object_id('t_p') is nulldrop table t_pgoif not object_id('t_c') is nulldrop table t_cgocreate table t_p(id int,cid int,cdate datetime)gocreate table t_c(cid int,cname nvarchar(20))goinsert into t_c(cid,cname) values(1,& 阅读全文

posted @ 2011-08-15 22:22 林建明 阅读(337) 评论(2) 推荐(0)

2011年8月11日

在进程中注入dll

摘要: void InjectDLL(string dllname){ int ok1; //int ok2; //int hwnd; int baseaddress; int temp = 0; int hack; int yan; string dllname; int dlllength; dlllength = dllname.Length + 1; Process[] pname = Process.GetProcesses(); //取得所有进程 foreach (Process name in pname) //遍历进程 { //MessageBox.Show(name.ProcessN 阅读全文

posted @ 2011-08-11 00:56 林建明 阅读(203) 评论(0) 推荐(0)

防止从任务管理器中结束进程

摘要: [DllImport("kernel32")] private static extern IntPtr TerminateProcess(IntPtr hProcess, int uExitCode); [DllImport("kernel32")] private static extern IntPtr OpenProcess(Single dwDesiredAccess, bool bInheritHandle, int dwProcessId); [DllImport("kernel32")] private static 阅读全文

posted @ 2011-08-11 00:40 林建明 阅读(823) 评论(1) 推荐(0)

无聊时写的简单的植物僵尸的简单刷金币,把游戏开到冒险那级前就行

摘要: public partial class Form1 : Form { public Form1() { InitializeComponent(); } [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")] private static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam); [System.Runtime.InteropS 阅读全文

posted @ 2011-08-11 00:33 林建明 阅读(410) 评论(2) 推荐(0)

早前写的简单抓包,参考的文献找不到了,如有疑问请指教

摘要: class RawSocket { private bool error_occurred;//套接字在接收包时是否产生错误 public bool KeepRunning;//是否继续进行 private static int len_receive_buf;//得到的数据流的长度 byte[] receive_buf_bytes;//收到的字节 private Socket socket = null;//声明套接字 const int SIO_RCVALL = unchecked((int)0x98000001);//监听所有的数据包 public RawSocket() { error 阅读全文

posted @ 2011-08-11 00:14 林建明 阅读(352) 评论(0) 推荐(0)

反射生成T-SQL语句,欢迎大家批评指正,有待改进

摘要: /// <summary> /// 生成SQL语句 /// </summary> /// <typeparam name="T"></typeparam> public static class TSQLHelper<T> where T : new() { static Dictionary<string, Dictionary<CRUD, string>> tableCRUD = new Dictionary<string, Dictionary<CRUD, string&g 阅读全文

posted @ 2011-08-11 00:05 林建明 阅读(350) 评论(4) 推荐(0)

2011年7月12日

工作三年的感想,还是太嫩了

摘要: 突然觉得挺失落的,现在还有公司打电话叫我去面试,其实有一点心动,或许也没有那么好,只是现在这家公司没有我想像的那么好,太闷了,上班一点气氛也没有,都在自己做事,没有交流,还要尽量八小时都做公司的事,感觉还是很压抑,而且觉得自己没有发挥的空间,虽然只来了一个月不到,但我却觉得没什么意思,也没什么干劲,那现在又要换似乎太仓促了,也不是时候,现在身上已经没有多余的资金了,还是只能继续干下去,也多学点东西,多储备点资金,这次我真的大错了。总结一下陷入这种困境的原因,是在于找工作太浮躁,才找半个月就不安了,当然也跟我的自信有关系,因为在面试的时候问了很多相关技术,我都不懂,比如NHibernate,Ca 阅读全文

posted @ 2011-07-12 22:40 林建明 阅读(414) 评论(1) 推荐(0)

导航