Showing posts with label Thủ thuật. Show all posts
Showing posts with label Thủ thuật. Show all posts

4.10.11

Tạo key

Visual Studio Command Prompt
makecert -r -pe -a sha1 -n "CN=KeyName" -b 01/01/2000 -e 01/01/2099 -eku 1.3.6.1.5.5.7.3.3 -ss My

2.6.09

IIS lỗi không start được - Unexpected error 0x8ffe2740 occurred

Lỗi này la do xung đột với sky, thằng sky mà "nhanh hơn" khi khởi động là nó vồ luôn cổng 80 nên không thể start được IIS (báo lỗi "Unexpected error 0x8ffe2740 occurred" ), tắt thằng Sky phát là khởi động được luôn.
Chắc ăn thì vào sky/tool/options/advance/connection
bỏ chọn Use Port 80 and 443 as alternative for incoming connections.

Mà hình như cứ bị chiếm cổng 80 là nó báo lỗi này

27.2.09

Một số thứ linh tinh

Lấy Version ClickOnce
ApplicationDeployment.CurrentDeployment.CurrentVersion

Thêm column cho table của access

OleDbConnection con = new OleDbConnection(connectionString);
con.Open();
try
{
string sql = "SELECT TOP 1 * FROM TableName";
OleDbDataAdapter da = new OleDbDataAdapter(sql, con);
DataTable table = new DataTable();
da.Fill(table);
int i = table.Columns.IndexOf(fileldName);
if (i == -1)
{
string sqlAdd = "ALTER Table TableName Add Column fileldName DataType(Leght)";
OleDbCommand cmd = new OleDbCommand(sqlAdd, con);
cmd.ExecuteNonQuery();
}
table.Dispose();
con.Close();
con.Dispose();
}

3.12.08

Load cursor from file - using user32.dll

Đảm bảo Cursor màu mè rất đẹpsengihnampakgigi
using System.Runtime.InteropServices;
using System.Reflection;
using System.Windows.Forms;
using System;

namespace myNamespace
{
public class cCursor
{
[DllImport("user32.dll")]
public static extern IntPtr LoadCursorFromFile(string filename);
public static Cursor GetColorCursor(string pathCursor)
{
Cursor mycursor = new Cursor(Cursor.Current.Handle);
//dinosau2.ani is in windows folder??
IntPtr colorcursorhandle = LoadCursorFromFile(pathCursor);
mycursor.GetType().InvokeMember("handle", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, mycursor, new object[] { colorcursorhandle });
return mycursor;
}

}
}