Using web Theme to change web skin

Wednesday, July 16 2008         No Comments
<link rel="stylesheet" type="text/css"
 title="ThemeA" href="a.css" />

<link rel="alternate stylesheet" type="text/css"
 title="ThemeB" href="b.css" />

 

the js code

 function setStyle(title) {
   var i, links;
   links = document.getElementsByTagName("link");
   for(i=0; links[i]; i++) {
     if(links[i].getAttribute("rel").indexOf("style") != -1 && links[i].getAttribute("title")) {
       links[i].disabled = true;
       if(links[i].getAttribute("title").indexOf(title) != -1)
         links[i].disabled = false;
     }
   }
}
 

 

lock mouse and keybody using c#

Wednesday, July 16 2008         No Comments

lock mouse and keybody:

using System.Runtime.InteropServices;

namespace sln_BlockInput
{
    public partial class Form1 : Form
    {

        // API define 
        [DllImport("user32.dll")]
         static extern void BlockInput(bool Block);

         public Form1()
         {
             InitializeComponent();
         }

         private void button1_Click(object sender, EventArgs e)
         {
             BlockInput(true); // lock
             System.Threading.Thread.Sleep(10000); // wait for 10 second
             BlockInput(false); // unlock
         }
     }
}

 

the code above can't lock Ctrl+Alt+del

Add the code below to lock Ctrl+Alt+Delete

using Microsoft.Win32;

private void TaskMgrCtrl(bool Locked)
{
    int intValue=0;

    if (Locked)
    { intValue = -1; }
    else
    { intValue = 0; }
    
     string key = @"software\microsoft\windows\currentversion\policies\";

     Registry.CurrentUser.OpenSubKey(key + "system", true).SetValue("DisableTaskMgr", intValue);
     Registry.CurrentUser.OpenSubKey(key + "Explorer", true).SetValue("NoLogoff", intValue);
     Registry.CurrentUser.OpenSubKey(key + "Explorer", true).SetValue("NoClose", intValue);
     Registry.CurrentUser.OpenSubKey(key + "system", true).SetValue("DisableLockWorkstation", intValue);
     Registry.CurrentUser.OpenSubKey(key + "system", true).SetValue("DisableChangePassword", intValue);
     Registry.CurrentUser.OpenSubKey(key + "Explorer", true).SetValue("NoViewContextMenu", intValue);
     Registry.CurrentUser.OpenSubKey(key + "Explorer", true).SetValue("NoChangeStartMenu", intValue);
     Registry.CurrentUser.OpenSubKey(key + "Explorer", true).SetValue("NoRun", intValue);
     Registry.CurrentUser.OpenSubKey(key + "Explorer", true).SetValue("NoSetTaskbar", intValue);


 

TaskMgrCtrl(true);//lock

// TaskMgrCtrl(false); // unlock

C# using base structure function

Tuesday, July 08 2008         No Comments

public DiyLastPlayed(int saveNum):base(saveNum)
{
}

 do it like this you will be using base structure function

Online IP,AreaNo,MobileNum etc.smart search

Sunday, July 06 2008         No Comments

Online IP,AreaNo,MobileNum etc.smart search

http://www.ip26.com

input the query in one input text box the will smartly get the result

this site biulder at  07-01-2008

智能搜索:IP,区号,手机段,域名IP 等.

所有搜索参数输入一个 文本框,回车就能得到结果.

 

iis mysql php

Sunday, July 06 2008         No Comments

must to do this when using unzip php

copy libmysql.dll %systemroot%\libmysql.dll

MsSql union update

Sunday, July 06 2008         No Comments

update djfiles set sortid=sort.sortid from sort where sort.id=djfiles.id

dotnet reflection example using vb.net

Sunday, July 06 2008         No Comments

Sub AutoCreatePropertysControls(ByVal obj As Object)
            
Dim p As PropertyInfo() = obj.GetType.GetProperties()


            
For Each pi In p
                
Dim lt As New Literal
                lt.Text 
= "<li>"
                ph.Controls.Add(lt)

                
Dim pty As String = pi.PropertyType.ToString
                
Dim lb As Label = New Label
                lb.Text 
= pi.Name
                ph.Controls.Add(lb)
                lb.Dispose()
                
If (pi.PropertyType Is GetType(Boolean)) Then
                    
Dim cb As New CheckBox
                    cb.ID 
= "tb_" & pi.Name
                    cb.Checked 
= pi.GetValue(obj, Nothing)

                    ph.Controls.Add(cb)
                    cb.Dispose()
                
Else
                    
Dim tb As TextBox = New TextBox
                    tb.ID 
= "tb_" & pi.Name
                    tb.Text 
= pi.GetValue(obj, Nothing)

                    ph.Controls.Add(tb)
                    tb.Dispose()
                
End If
               

                
Dim lt2 As New Literal
                lt2.Text 
= "</li>"


            
Next
        
End Sub

Sql Convert String to int

Sunday, July 06 2008         No Comments

select   cast('37200'   as   int)

select   convert(int,'1548877')   

others...

select day(getdate())   ---Current daynum(int)

select month(getdate()) --- current monthnum (int)

Table Rows To Object Propertys using c#

Sunday, July 06 2008         No Comments

1  protected static ConfigInfo Get()
 2         {
 3             var ci = new ConfigInfo();
 4             IDataReader dr =ExecuteReader("**"null);
 5             var ht = new Hashtable();
 6             while (dr.Read())
 7             {
 8                 ht.Add(dr["name"], dr["value"]);
 9             }
10             dr.Close();
11             PropertyInfo[] p = ci.GetType().GetProperties();
12             foreach (PropertyInfo pi in p)
13             {
14                 pi.SetValue(ci, Convert.ChangeType(ht[pi.Name], pi.MemberType.GetTypeCode()), null);
15             }
16             HttpContext.Current.Trace.Warn((string) ht[""]);
17             foreach (object o in ht.Keys)
18             {
19                 HttpContext.Current.Trace.Warn((string) o);
20//http://ysoho.cnblogs.com             }
21             return ci;
22         }

First

Sunday, July 06 2008         No Comments

the first test