2009年11月9日星期一

“快速启动”里的显示桌面没了!怎么添加?

可以使用记事本等文本编辑器,重新用以下内容建立一个“显示桌面.scf”文件。 

[Shell]
Command=2
IconFile=explorer.exe,3

[Taskbar]
Command=ToggleDesktop

将文件存到文件夹“C:\Document and Settings\Administrator\Application Data\Microsoft\Internet Explorer\Quick Launch”中或创建快捷方式直接拖拽至任务栏中即可。


其中的Administrator是登陆的用户名

2009年10月28日星期三

2009年10月18日星期日

Filter Servlet控制用户权限

//过滤器代码

package cn.cslg.labsys.filter;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.naming.NamingException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.cslg.labsys.db.DBPoolException;
import cn.cslg.labsys.db.JndiBean;

/**
* 过滤器,对用户登录情况进行检查,如果用户未登录,则转到登录页面处理
*
* @author jimshen
*
*/
public class SessionChecker implements Filter {

    private String targetURI;

    public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {
        // 取得HTTP request/response/session对象
        HttpServletResponse httpResponse = (HttpServletResponse) response;
        HttpServletRequest httpRequest = (HttpServletRequest) request;
        HttpSession session = httpRequest.getSession(false);

        // 如果用户已登录,按既定流程运行
        try{
        if (session != null) {
            String user = (String) session.getAttribute("TNum");
            if (user != null) {
                String url = httpRequest.getRequestURI();
                if(pright(url,user)){
                    chain.doFilter(request, response);
                    return;
                }else
                    return;
            }
        }
        }catch(DBPoolException e){
            throw new ServletException(e);
        }catch(NamingException e){
            throw new ServletException(e);
        }catch(SQLException e){
            throw new ServletException(e);
        }
        httpResponse.sendRedirect(targetURI);

    }

    private boolean pright(String url, String tnum) throws DBPoolException,
            NamingException, SQLException {
        Connection conn = null;
        try {
            conn = JndiBean.getConnection();
            String sql="select * from priviledge where  locate(module,?)<>0 and Tnum=?";
            PreparedStatement pstmt=conn.prepareStatement(sql);
            pstmt.setString(1,url);
            pstmt.setString(2, tnum);
            ResultSet rs=pstmt.executeQuery();
            if(rs.next())
                return true;
            rs.close();
            pstmt.close();
            sql="select * from priviledge where locate(module,?)<>0";
            pstmt=conn.prepareStatement(sql);
            pstmt.setString(1,url);
            rs=pstmt.executeQuery();
            if(rs.next())
                return false;
            return true;
        } finally {
            if (conn != null)
                conn.close();
        }
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        targetURI = filterConfig.getInitParameter("targetURI");
    }

    public void destroy() {
    }
}

//过滤器配置(web.xml)
<!-- filter to check user privilidge -->
    <filter>
        <filter-name>SessionChecker</filter-name>
        <filter-class>cn.cslg.labsys.filter.SessionChecker</filter-class>
        <init-param>
            <param-name>targetURI</param-name>
            <param-value>/LabSys/index.jsp</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>SessionChecker</filter-name>
        <url-pattern>/outlines/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>SessionChecker</filter-name>
        <url-pattern>/labfile/*</url-pattern>
    </filter-mapping>

//priviledge表结构
TNum(用户名)    module(模块名,即目录名)
s09002        labfile
s09025        labfile

Remove WPF plugin from FireFox

MS released another .NET extension into Firefox. Mozilla is fighting back and disabling the extension.
http://www.ghacks.net/2009/10/17/mic...n-for-firefox/
Your Firefox may have blocked it already, but here's how to remove it.
* Make sure Firefox is closed
* Del "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Windows Presentation Foundation\DotNetAssistantExtension\*"
* Run regedit and go to “HKEY_LOCAL_MACHINE\SOFTWARE\MozillaPlugins"
* Delete the microsoft.com/WPF,version=3.5 folder

2009年5月30日星期六

Aptana Plugin For Eclipse 1.2.7 破解

针对最新的aptana_update_024747,可以从 http://www.aptana.com/download/下载并安装。

安装完成后,在eclipse/plugins目录中找到 com.aptana.ide.core_1.2.7.024747.jar

用jad或者相关反编译软件反编译 com.aptana.ide.core.licensing.ClientKey 这个类,我用的是 http://proglife.yo2.cn/articles/eclipse%E4%B8%8B%E7%9A%84%E5%8F%8D%E7%BC%96%E8%AF%91%E6%96%B9%E6%A1%88.html 里边的方案进行反编译的。

新建一个Java类ClientKey,将反编译出来的代码粘贴到这个类中,并修改如下:

package com.aptana.ide.core.licensing;

import java.util.Calendar;
import java.util.TimeZone;

public final class ClientKey
{
  public static final String BEGIN_LICENSE_MARKER = "--begin-aptana-license--";
  public static final String END_LICENSE_MARKER = "--end-aptana-license--";
  public static final int PRO = 0;
  public static final int TRIAL = 1;
  private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
  public static final String EMAILS_NON_MATCHING = "EMAILS_NON_MATCHING";
  public static final ClientKey EMPTY_KEY = new ClientKey(1, "any@gmail.com", 0L);
  private String email;
  private long expiration;
  private int type;

  public ClientKey(int type, String email, long expiration)
  {
    this.type = type;
    this.email = email;
    this.expiration = expiration;
  }

  public boolean isCloseToExpiring()
  {
    return false;
  }

  public boolean isValid()
  {
    return true;
  }

  public boolean isCloseToMatching()
  {
    return true;
  }

  public boolean isExpired()
  {
   return false;
  }

  public String getEmail()
  {
      return "any@gmail.com";
  }

  public Calendar getExpiration()
  {
    Calendar expirationCal = Calendar.getInstance();
    expirationCal.add(Calendar.YEAR, 50);
    return expirationCal;
  }

  public boolean isTrial()
  {
    return false;
  }

  public boolean isPro()
  {
    return (!(isTrial()));
  }

  public boolean shouldProPluginsRun()
  {
    if (isPro())
    {
      return true;
    }
    return (!(isExpired()));
  }

  public static String trimEncryptedLicense(String encrypted)
  {
    String newEncrypted = encrypted;
    newEncrypted = newEncrypted.trim();
    newEncrypted = newEncrypted.replaceAll("--begin-aptana-license--", "");
    newEncrypted = newEncrypted.replaceAll("--end-aptana-license--", "");
    newEncrypted = newEncrypted.replaceAll("\\s+", "");
    return newEncrypted;
  }
}

注意红色的是修改的部分。

编译该文件,并用生成的class文件替换com.aptana.ide.core_1.2.7.024747.jar中的ClientKey.class文件。(可用winrar打开后直接拖进去覆盖)。

重新启动eclipse即可生效。效果图如下:

1

2009年5月28日星期四

[整理] 解决digital tv link多换台几次后无声或者无响应的方法

1、在换台前,点击播放器的停止播放按钮停止当前频道的播放,然后用digital tv link 换台,最后点击播放器的播放按钮来播放;

2、经过检查发现,digita tv link 播放时会在dm500s中创建2个streampes 进程,换台时又会再创建2个,这样多次换台,你的dm500s的资源就将耗尽,并出现无声等现象。而,停止键会关闭创建的streampes进程, 这样就不会出现耗费资源的状况了。

你也可以telnet 到dm 上把无响应的streampes进程kill掉,不用重启主机也可以了.

killall streampes

2009年4月30日星期四

[原创]Maya 2009

using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.IO;

namespace MayaReg
{
    class Program
    {
        static void Main(string[] args)
        {
            ManagementObjectSearcher sysinfo = new ManagementObjectSearcher(new SelectQuery("Win32_NetworkAdapterConfiguration"));
            foreach (ManagementObject mo in sysinfo.Get())
            {
                if ((bool)mo["IPEnabled"])
                {
                    String hardInfo = mo.Properties["MacAddress"].Value.ToString().ToLower();
                    hardInfo = hardInfo.Replace(":", "");
                    //Console.Write(hardInfo);

                    String s ="FEATURE MayaUnltd sgiawd 2009.000 permanent uncounted 0 \\\n HOSTID=111111111111";
                    s=s.Replace("111111111111", hardInfo);
                    using (StreamWriter sw = new StreamWriter("C:\\FLEXLM\\aw.dat"))
                    {
                        sw.Write(s);
                    }

                    System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                    Info.FileName = "awkeygen.exe";
                    Info.Arguments = "aw.dat";
                    Info.WorkingDirectory = "C:\\FLEXLM";
                    System.Diagnostics.Process Proc;
                    try
                    {
                        Proc = System.Diagnostics.Process.Start(Info);
                    }
                    catch (System.ComponentModel.Win32Exception e)
                    {
                        Console.WriteLine("系统找不到指定的程序文件。\r{0}", e);
                        return;
                    }
                }
            }
            Console.Write("Maya破解完成,按Enter键退出");
            Console.Read();
        }
    }
}