-
Install Xcode 3.2.6 on Lion & Mountain Lion
Although I figured out how it works by myself, I still wanted to find some simpler procedures. Finally, I found these 2 tutorials from Eugene’s blog, which are so perfect that I’d like to share them.
The original URLs are:
http://hamstergene.github.io/blog/2012-04-03-xcode3-lion
http://hamstergene.github.io/blog/2012-11-13-xcode3-mountain-lion
In case they are not available one day in the future (best not, it’s hosted on github…), I copied its content here as a backup.
Read More »No Comments -
X61通过u盘移动硬盘不需要光驱安装Vista
昨晚研究了很久,终于解决了没有光驱安装vista的方法。当然,很多人是直接安装xp后再从xp上升级安装的。因为vista不允许从移动设备上安装,很多人即便从移动设备引导启动了WinPE也无法安装vista。但,如果WinPE安装到本地磁盘呢?我的操作方法如下- 网上下载了老毛桃做的Mini WinPE安装镜像 (搜BootCD_070911.ISO大概可以搜到。)
- 在U盘里或者移动硬盘里做了引导分区后,通过移动设备引导进入WinPE
- 然后在这个WinPE里,加载老毛桃的Mini WinPE安装镜像,重新在本地磁盘的活动分区上安装一遍这个WinPE
- 重启后进入本地磁盘的这个WinPE,然后加载Vista的ISO镜像(比如我用的OEM版Vista,在我的X61上安装是免激活的)
- 然后就可以开始装了,没有错误提示了。通过虚拟光驱安装vista是可以的。
-
C#中关闭子窗口时父窗口也关闭
实现方法: 在子窗口中声明事件:public event childclose closefather;
然后在它的关闭事件中触发本事件:
private void Form1_Closed(object sender, System.EventArgs e)
{
//用事件去关闭主窗口
closefather();
}在父窗口中(登陆窗口中):
在窗口类之前,在共同的命名空间之后声明代理:
public delegate void childclose();
然后弹出子窗体的地方这样写:Form1 ff=new Form1();
ff.closefather+=new childclose(this.closethis); //closethis()是父窗体中的一个方法
ff.Show();定义方法:
public void closethis()
{
this.Close();
}————————————————发现这么添加,系统不会自动在Form2.Designer.cs文件中加入事件关联,于是手动加入(Form2是我程序中的子窗口)this.Closed += new System.EventHandler(this.Form2_Closed); -
关于几个WinXP的美化
之前不是装了Vista嘛,但是,实在在我电脑上存在各种各样的问题,而不得不删除它(还没法删除……直接格式化了分区……)然后用XP,越发感到不美化一下不行了(本来一直用Windows经典主题的,也就是Win98的界面-_-b)上网下载了对系统要求比较低的仿Vista的美化包(VistaShow-v4.0.rar,这里下载)这套美化包,除了有仿vista的主题外,还有仿vista的登录界面,系统全图标美化,任务栏透明效果,任务栏按钮的预览效果,仿苹果的Dock栏等。我只用了里面的主题,其他的太占资源,不用,呵呵再下载了一套可爱好看的鼠标指针,说明如下:图例
提取版共提供两套鼠标,分别是“Comix White Normal”和“Comix White Slim”,置于相应文件夹内。顾名思义,两者的区别是“Slim”版的轮廓线条细于“Normal”版。
如何使用
在 install.inf 文件上单击右键,在弹出菜单中选择“安装”;在控制面板的“鼠标”对话框的“指针”选项卡的下拉菜单中选择相应主题即可。下载
UploadFiles/2006-8/815498374.rar black系列
UploadFiles/2006-8/815699877.rar white系列
然后就是我现在的桌面(电脑配置不高,没美化很多,高手请绕道,呵呵):
点击打开或者保存后看原始大小~
-
基于Active Directory的用户验证
项目要求需要用C#结合win2003和Oracle数据库,实现Oracle用户通过ActiveDirectory来验证找到资料如下:通过C#写的一个AD管理的类:http://www.c-sharpcorner.com/Code/2002/Sept/ADClass.asp
1. 基于AD的用户验证public static bool IsUserValid (string UserName, string Password){using (DirectoryEntry deUser = new DirectoryEntry(ADPath, UserName, Password, AuthenticationTypes.Secure)){try{// The NativeObject call on the DirectoryEntry object entry is an attempt to bind to the object in the directory.// Since this call forces authentication, you will get an error if the user does not exist.// If the user is a valid user in the domain, the call will succeed.Object native = deUser.NativeObject;return true;}catch{return false;}}}根据UserName/Password验证用户的合法性。需要注意的是:ADSI每次都会尝试Kerberos和NTLM验证,因此系统会记录2次验证记录。在设置Domain Password Policy时,需要考虑到上述的限制。否则,如果Bad Password Count超过限定的Domain Password Policy时,该帐户会Locked out。(注:后面有Article介绍如何判断/如何Lock/Unlock帐户)2. 验证用户账号Active/Disable/// <summary>/// This will perfrom a logical operation on the userAccountControl values/// to see if the user account is enabled or disabled. The flag for determining if the/// account is active is a bitwise value (decimal =2)/// </summary>/// <param name="userAccountControl"></param>/// <returns></returns>public static bool IsAccountActive(int userAccountControl){int userAccountControl_Disabled= Convert.ToInt32(ADAccountOptions.UF_ACCOUNTDISABLE);int flagExists = userAccountControl & userAccountControl_Disabled;//if a match is found, then the disabled flag exists within the control flagsif(flagExists >0){return false;}else{return true;}}3. 示例代码:调用上述IsUserValid()和IsAccountActive()方法/// <summary>/// This method will not actually log a user in, but will perform tests to ensure/// that the user account exists (matched by both the username and password), and also/// checks if the account is active./// </summary>/// <param name="UserName"></param>/// <param name="Password"></param>/// <returns></returns>public static ADHelper.LoginResult Login(string UserName, string Password){//first, check if the logon exists based on the username and password//DirectoryEntry de = GetUser(UserName,Password);if(IsUserValid(UserName,Password)){DirectoryEntry de = GetUser(UserName);if(de !=null){//convert the accountControl value so that a logical operation can be performed//to check of the Disabled option exists.int userAccountControl = Convert.ToInt32(de.Properties["userAccountControl"][0]);de.Close();//if the disabled item does not exist then the account is activeif(!IsAccountActive(userAccountControl)){return LoginResult.LOGIN_USER_ACCOUNT_INACTIVE;}else{return LoginResult.LOGIN_OK;}}else{return LoginResult.LOGIN_USER_DOESNT_EXIST;}}else{return LoginResult.LOGIN_USER_DOESNT_EXIST;}}4. 相关enum数据类型:ADAccountOptions和LoginResult#region Enumerationspublic enum ADAccountOptions{UF_TEMP_DUPLICATE_ACCOUNT = 0x0100,UF_NORMAL_ACCOUNT =0x0200,UF_INTERDOMAIN_TRUST_ACCOUNT =0x0800,UF_WORKSTATION_TRUST_ACCOUNT = 0x1000,UF_SERVER_TRUST_ACCOUNT =0x2000,UF_DONT_EXPIRE_PASSWD=0x10000,UF_SCRIPT =0x0001,UF_ACCOUNTDISABLE=0x0002,UF_HOMEDIR_REQUIRED =0x0008,UF_LOCKOUT=0x0010,UF_PASSWD_NOTREQD=0x0020,UF_PASSWD_CANT_CHANGE=0x0040,UF_ACCOUNT_LOCKOUT=0X0010,UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED=0X0080,}public enum LoginResult{LOGIN_OK=0,LOGIN_USER_DOESNT_EXIST,LOGIN_USER_ACCOUNT_INACTIVE}#endregion具体用户界面User Interface,请参考如下Reference 1
http://www.c-sharpcorner.com/Code/2002/Sept/ADClass.asp -
最近需要解决的问题
处理一个输入法的码表treo上的输入法原始码表是:的de
一yi
那na 里li
暗an 暗an目标码表是:de的
yi一
na’li那里
an’an暗暗目前在用C#写。碰到的问题是:虽然学过C、C++、C#、Java以及各种网页语言,但真的要写这种很基本的东西,还真是不行。文件读入输出,数据流怎么一行行处理,如何按Unicode编码读取,如何判断中英文符号,都是我现在需要现学现用的有一个之前请一个研究生学长写的维基百科的处理程序,java写的。我用微软提供的java转C#的工具转了一下,然后在C#下修改,打算在这个基础上修改成我需要的程序程序不难,思路也不复杂。只是没有地方可以turn to,只好自己研究研究了Oracle10g,也要弄。现在先搁一下,编程的同时,看看oracle的理论知识了。