<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    常用鏈接

    統計

    最新評論

    2011年2月16日 #

    Create Struts 2 Application in Eclipse : HTTP Status 500

    http://viralpatel.net/blogs/2009/12/tutorial-create-struts-2-application-eclipse-example.html 

    problem:

    HTTP Status 500 

    java.lang.NullPointerException 	
    org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
    com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
    resolve problem:
    1. struts.xml should under src
    2. in struts.xml:  
    <action name="login" method="excute"
    class="net.viralpatel.struts2.LoginAction">

    posted @ 2012-04-21 02:41 九寶 閱讀(399) | 評論 (0)編輯 收藏

    How to check file properties through WMI command line (fw)

    How to check file properties through WMI command line

    24.Sep.2009 | by Gusac | Filed in: Articles, Tutorials

    With the lack of Graphical Interface on Windows 2008 Core server there comes a need of performing a lot of task through command line. One of which is checking file properties like file version, path, product verision etc. Luckily we have a command that makes this task simple. On a side note, We can also run the same command on other operating systems like Windows Xp, 2003, vista.

    Here is the command:
    wmic datafile where name='c:\\windows\\system32\\notepad.exe'

    Click here to view the enlarged screenshot

    Notice that we have used two backslashes \\ in the file path. Also, notice that the path is enclosed in the single quotes.
    The output will be confusing to read in command prompt window. To read and understand it better, we can take the output in text format and read it in notepad.

    While doing so, please do NOT wrap the text.
    wmic datafile where name='c:\\windows\\system32\\notepad.exe' > out.txt

    Click here to view the enlarged screenshot

    The output will reveal the file properties like Hidden, Path, Drive, Version Caption, Access rights etc.

    To get one particular property of a file we need to modify the command a little bit. We need to use the GET Alias injunction to the command mentioned above. Let's say we want to check the version for the file notepad.exe. The command that is used for this is:
    wmic datafile where name='c:\\windows\\system32\\notepad.exe' get version

    Similarily, there is a list of properties that can be fetched through this command line. They are:

    Access Rights
    Caption
    Class Name
    Compressed
    Compression Method
    Computer System Class Name
    Computer System Name
    Creation Date
    Current File Open Count
    Description
    Drive
    Eight Dot Three File Name
    Encrypted
    Encryption Method
    File Extension
    File Name
    File System Class Name
    File System Name
    File Type
    Hidden
    Install Date
    Last Accessed
    Last Modified
    Manufacturer
    Name
    Path
    Readable
    Should Be Archived
    Size
    Status
    System File
    Version
    Writeable

    posted @ 2011-12-07 22:29 九寶 閱讀(360) | 評論 (0)編輯 收藏

    Windows Authentication

    from http://www.iis.net/ConfigReference/system.webServer/security/authentication/windowsAuthentication

    Overview

    The <windowsAuthentication> element defines configuration settings for the Internet Information Services (IIS) 7 Windows authentication module. You can use Windows authentication when your IIS 7 server runs on a corporate network that is using Microsoft Active Directory service domain identities or other Windows accounts to identify users. Because of this, you can use Windows authentication whether or not your server is a member of an Active Directory domain.

    Windows authentication (formerly named NTLM, and also referred to as Windows NT Challenge/Response authentication) is a secure form of authentication because the user name and password are hashed before being sent across the network. When you enable Windows authentication, the client browser sends a strongly hashed version of the password in a cryptographic exchange with your Web server.

    Windows authentication supports two authentication protocols, Kerberos and NTLM, which are defined in the <providers> element. When you install and enable Windows authentication on IIS 7, the default protocol is Kerberos. The <windowsAuthentication> element can also contain a useKernelMode attribute that configures whether to use the kernel mode authentication feature that is new to Windows Server 2008.

    Windows authentication is best suited for an intranet environment for the following reasons:

    • Client computers and Web servers are in the same domain.
    • Administrators can make sure that every client browser is Internet Explorer 2.0 or later.
    • HTTP proxy connections, which are not supported by NTLM, are not required.
    • Kerberos version 5 requires a connection to Active Directory, which is not feasible in an Internet environment.

    New in IIS 7.5

    The <extendedProtection> element was introduced in IIS 7.5, which allows you to configure the settings for the new extended protection features that have been integrated into Windows authentication.

    Compatibility

    Version Notes
    IIS 7.5 The <extendedProtection> element was added in IIS 7.5.
    IIS 7.0 The <windowsAuthentication> element was introduced in IIS 7.0.
    IIS 6.0 The <windowsAuthentication> element replaces portions of the IIS 6.0 AuthType and AuthFlags metabase properties.

    Setup

    The default installation of IIS 7 does not include the Windows authentication role service. To use Windows authentication on IIS, you must install the role service, disable Anonymous authentication for your Web site or application, and then enable Windows authentication for the site or application.

    Note: After you install the role service, IIS 7 commits the following configuration settings to the ApplicationHost.config file.

    <windowsAuthentication enabled="false" />

    Windows Server 2008 or Windows Server 2008 R2

    1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
    2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
    3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
    4. On the Select Role Services page of the Add Role Services Wizard, select Windows Authentication, and then click Next.
    5. On the Confirm Installation Selections page, click Install.
    6. On the Results page, click Close.

    Windows Vista or Windows 7

    1. On the taskbar, click Start, and then click Control Panel.
    2. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off.
    3. Expand Internet Information Services, then World Wide Web Services, then Security.
    4. Select Windows Authentication, and then click OK.

    How To

    How to enable Windows authentication for a Web site, Web application, or Web service

    1. Open Internet Information Services (IIS) Manager:
      • If you are using Windows Server 2008 or Windows Server 2008 R2:
        • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
      • If you are using Windows Vista or Windows 7:
        • On the taskbar, click Start, and then click Control Panel.
        • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
    2. In the Connections pane, expand the server name, expand Sites, and then the site, application, or Web service for which you want to enable Windows authentication.
    3. Scroll to the Security section in the Home pane, and then double-click Authentication.
    4. In the Authentication pane, select Windows Authentication, and then click Enable in the Actions pane.

    How to enable Extended Protection for Windows authentication

    1. Open Internet Information Services (IIS) Manager:
      • If you are using Windows Server 2008 or Windows Server 2008 R2:
        • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
      • If you are using Windows Vista or Windows 7:
        • On the taskbar, click Start, and then click Control Panel.
        • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
    2. In the Connections pane, expand the server name, expand Sites, and then the site, application, or Web service for which you want to enable Extended Protection for Windows authentication.
    3. Scroll to the Security section in the Home pane, and then double-click Authentication.
    4. In the Authentication pane, select Windows Authentication.
    5. Click Enable in the Actions pane.
    6. Click Advanced Settings in the Actions pane.
    7. When the Advanced Settings dialog box appears, select one of the following options in the Extended Protection drop-down menu:
      • Select Accept if you want to enable extended protection while providing down-level support for clients that do not support extended protection.
      • Select Required if you want to enable extended protection without providing down-level support.
    8. Click OK to close the Advanced Settings dialog box.

    Configuration

    The <windowsAuthentication> element is configurable at the site, application, or virtual directory level in the ApplicationHost.config file.

    Attributes

    Attribute Description
    authPersistNonNTLM Optional Boolean attribute.

    Specifies whether IIS automatically reauthenticates every non-NTLM (for example, Kerberos) request, even those on the same connection. False enables multiple authentications for the same connections.

    Note: A setting of true means that the client will be authenticated only once on the same connection. IIS will cache a token or ticket on the server for a TCP session that stays established.

    The default is false.
    authPersistSingleRequest Optional Boolean attribute.

    Setting this flag to true specifies that authentication persists only for a single request on a connection. IIS resets the authentication at the end of each request, and forces reauthentication on the next request of the session.

    The default value is false.
    enabled Required Boolean attribute.

    Specifies whether Windows authentication is enabled.

    The default value is false.
    useKernelMode Optional Boolean attribute.

    Specifies whether Windows authentication is done in kernel mode. True specifies that Windows authentication uses kernel mode.

    Kernel-mode authentication may improve authentication performance and prevent authentication problems with application pools that are configured to use a custom identity.

    As a best practice, do not disable this setting if you use Kerberos authentication and have a custom identity on the application pool.

    The default is true.

    Child Elements

    Element Description
    extendedProtection Optional element.

    Specifies extended protection options for Windows authentication.

    Note: This element was added in IIS 7.5.
    providers Optional element.

    Specifies security support providers used for Windows authentication.

    Configuration Sample

    The following default <windowsAuthentication> element is configured at the root ApplicationHost.config file in IIS 7.0, and disables Windows authentication by default. It also defines the two Windows authentication providers for IIS 7.0.

    <windowsAuthentication enabled="false">
       <providers>
          <add value="Negotiate" />
          <add value="NTLM" />
       </providers>
    </windowsAuthentication>

    The following example enables Windows authentication and disables Anonymous authentication for a Web site named Contoso.

    <location path="Contoso">
       <system.webServer>
          <security>
             <authentication>
                <anonymousAuthentication enabled="false" />
                <windowsAuthentication enabled="true" />
             </authentication>
          </security>
       </system.webServer>
    </location>

    Sample Code

    The following examples disable Anonymous authentication for a site named Contoso, then enable Windows authentication for the site.

    AppCmd.exe

    appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"False" /commit:apphost
    
    appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost

    Note: You must be sure to set the commit parameter to apphost when you use AppCmd.exe to configure these settings. This commits the configuration settings to the appropriate location section in the ApplicationHost.config file.

    C#

    using System;
    using System.Text;
    using Microsoft.Web.Administration;
    
    internal static class Sample {
    
       private static void Main() {
    
          using(ServerManager serverManager = new ServerManager()) { 
             Configuration config = serverManager.GetApplicationHostConfiguration();
    
             ConfigurationSection anonymousAuthenticationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Contoso");
             anonymousAuthenticationSection["enabled"] = false;
    
             ConfigurationSection windowsAuthenticationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Contoso");
             windowsAuthenticationSection["enabled"] = true;
    
             serverManager.CommitChanges();
          }
       }
    }

    VB.NET

    Imports System
    Imports System.Text
    Imports Microsoft.Web.Administration
    
    Module Sample
       Sub Main()
          Dim serverManager As ServerManager = New ServerManager
          Dim config As Configuration = serverManager.GetApplicationHostConfiguration
    
          Dim anonymousAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "Contoso")
          anonymousAuthenticationSection("enabled") = False
    
          Dim windowsAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Contoso")
          windowsAuthenticationSection("enabled") = True
    
          serverManager.CommitChanges()
       End Sub
    End Module

    JavaScript

    var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
    adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
    
    var anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso");
    anonymousAuthenticationSection.Properties.Item("enabled").Value = false;
    
    var windowsAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/windowsAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso");
    windowsAuthenticationSection.Properties.Item("enabled").Value = true;
    
    adminManager.CommitChanges();

    VBScript

    Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
    adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
    
    Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso")
    anonymousAuthenticationSection.Properties.Item("enabled").Value = False
    
    Set windowsAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/windowsAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso")
    windowsAuthenticationSection.Properties.Item("enabled").Value = True
    
    adminManager.CommitChanges()

    posted @ 2011-09-16 21:46 九寶 閱讀(645) | 評論 (0)編輯 收藏

    How To Determine if Your Computer Is 32-Bit or 64-Bit(forward)

    how to check window version

    run: Winver


    Here's How:
    1. Open the System Information

      Open the Start menu, and click on Programs -> Accessories -> System Tools -> System Information

       

    2. Look in the System Summary

      The System Information tool will display detailed information about your Windows operating system. Once opened it will show the "System Summary" – it’s an overview of your computer and operating system.

    3. Look for the System Type Item

      On the right hand side of the window you will see a list of items. Look for the item called "System Type".

      The value of this item will tell you whether your computer is 32-bit or 64-bit:

      • x86-based PC: It’s a 32-bit computer.
      • x64-based PC: It’s a 64-bit computer.

       

    posted @ 2011-09-16 03:34 九寶 閱讀(255) | 評論 (0)編輯 收藏

    ContentProvider分析

         摘要: ContentProvider何時創建呢?這是一個值得深思的問題?  據我這兩天的了解是在你要用到的時候才會調用ContentProvider的onCreate函數進行創建。你就會什么時候叫要用到的時候呢?比如你要查詢或刪除修改數據庫的時候通過ContentResolver的quire或delete來操縱數據時就會調用ContentProvider的onCreate函數,若已經創建了數...  閱讀全文

    posted @ 2011-02-18 14:51 九寶 閱讀(1862) | 評論 (0)編輯 收藏

    GestureDetector手勢識別類 (轉)

    View是在onTouchEvent(MotionEvent event)里對用戶的動作做了一定的分析,從而通知我們是發生了點擊還是長按等事件。

    我們需要創建一個GestureDetector的對象,傳入listener對象,view接收到的onTouchEvent中將event傳給GestureDetector進行分析listener會回調給我們相應的動作。其中GestureDetector.SimpleOnGestureListenerFramework幫我們簡化了)是實現了上面提到的OnGestureListenerOnDoubleTapListener兩個接口的類,我們只需要繼承它并重寫其中我們關心的回調即可。

    ,那么,這個類如何使用呢?以下是使用該類的一個范例:

    private GestureDetector mGestureDetector;

    @Override

    public void onCreate(Bundle savedInstanceState) {


      super.onCreate(savedInstanceState);


      mGestureDetector = new GestureDetector(this, new MyGestureListener());


    }


    @Override

    public boolean onTouchEvent(MotionEvent event) {

     return mGestureDetector.onTouchEvent(event); 

    /*  有關上面的 onTouchEvent方法,我們可以直接判斷MotionEvent的類型,

        對于手勢移動僅僅捕獲ACTION_MOVE即可,

        我們通過參數MotionEvent e1, MotionEvent e2,float distanceX, float distanceY可以獲取操作變化。

       比如 distanceX > 0 向右邊移動,distanceX < 0 則向左邊,distanceY > 0 向上滾動, distanceY < 0 向下滾動。

    */

    }


    class MyGestureListener extends GestureDetector.SimpleOnGestureListener{

      @Override

      public boolean onSingleTapUp(MotionEvent ev) {

        Log.d("onSingleTapUp",ev.toString());

        return true;

      }


      @Override

      public void onShowPress(MotionEvent ev) {

        Log.d("onShowPress",ev.toString());

      }


      @Override

      public void onLongPress(MotionEvent ev) {

        Log.d("onLongPress",ev.toString());

      }

    }

     


    更多的回調消息,方便的對用戶的動作進行響應

    public interface OnGestureListener {

                    // Touch down時觸發, edown時的MotionEvent

                    boolean onDown(MotionEvent e);

                    // Touch down之后一定時間(115ms)觸發,edown時的MotionEvent

                    void onShowPress(MotionEvent e);

                    // Touch up時觸發,eup時的MotionEvent

                    boolean onSingleTapUp(MotionEvent e);

                    // 滑動時觸發,e1down時的MotionEvente2move時的MotionEvent

                    boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY);

                    // Touch down之后一定時間(500ms)觸發,edown時的MotionEvent

                    void onLongPress(MotionEvent e);

                    // 滑動一段距離,up時觸發,e1down時的MotionEvente2up時的MotionEvent

                    boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);

    } 

    public interface OnDoubleTapListener {

                    // 完成一次單擊,并確定沒有二擊事件后觸發(300ms),edown時的MotionEvent

                    boolean onSingleTapConfirmed(MotionEvent e);

                    // 第二次單擊down時觸發,e為第一次down時的MotionEvent

                    boolean onDoubleTap(MotionEvent e);

                    // 第二次單擊down,moveup時都觸發,e為不同時機下的MotionEvent

                    boolean onDoubleTapEvent(MotionEvent e);

    }

    boolean  onDoubleTap(MotionEvent e)
    解釋:雙擊的第二下Touch down時觸發
    boolean  onDoubleTapEvent(MotionEvent e)
    解釋:雙擊的第二下Touch down和up都會觸發,可用e.getAction()區分。
    boolean  onDown(MotionEvent e)
    解釋:Touch down時觸發
    boolean  onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
    解釋:Touch了滑動一點距離后,up時觸發。
    void  onLongPress(MotionEvent e)
    解釋:Touch了不移動一直Touch down時觸發
    boolean  onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
    解釋:Touch了滑動時觸發。
    void  onShowPress(MotionEvent e)
    解釋:Touch了還沒有滑動時觸發
    (與onDown,onLongPress比較,onDown只要Touch down一定立刻觸發。而Touchdown后過一會沒有滑動先觸發onShowPress再是onLongPress。
    所以Touchdown后一直不滑動,onDown->onShowPress->onLongPress這個順序觸發。
    boolean  onSingleTapConfirmed(MotionEvent e)
    boolean  onSingleTapUp(MotionEvent e)
    解釋:上面這兩個函數都是在touch down后又沒有滑動(onScroll),又沒有長按(onLongPress),然后Touchup時觸發。
    點擊一下非常快的(不滑動)Touchup:
    onDown->onSingleTapUp->onSingleTapConfirmed
    點擊一下稍微慢點的(不滑動)Touchup:
    onDown->onShowPress->onSingleTapUp->onSingleTapConfirmed


    posted @ 2011-02-16 15:03 九寶 閱讀(540) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 色吊丝最新永久免费观看网站 | 国产亚洲人成A在线V网站| 亚洲男人天堂2018av| 成人免费激情视频| 亚洲一区在线视频观看| 中文字幕无码成人免费视频| 亚洲youjizz| 免费激情视频网站| 黄色a级免费网站| 亚洲性日韩精品一区二区三区| jizz免费在线观看| 国产成人精品日本亚洲| 久久伊人免费视频| 亚洲成年人免费网站| 精品香蕉在线观看免费| 亚洲精品无码久久久久A片苍井空 亚洲精品无码久久久久YW | 一级特黄a免费大片| 亚洲一级特黄大片无码毛片| 精品久久久久久国产免费了| 亚洲AV无码专区电影在线观看| 99热这里有免费国产精品| 亚洲免费网站在线观看| 国产美女a做受大片免费| 九一在线完整视频免费观看| 久久精品国产亚洲综合色| 91免费在线播放| 爱爱帝国亚洲一区二区三区| 亚洲中文字幕无码不卡电影| 在线观看免费av网站| 亚洲AV无码乱码在线观看代蜜桃 | 3344免费播放观看视频| 亚洲人成自拍网站在线观看| 亚洲熟伦熟女新五十路熟妇| 免费视频成人片在线观看| 亚洲A∨精品一区二区三区下载| 国产精品亚洲mnbav网站| 波多野结衣免费在线| 成人免费夜片在线观看| 亚洲综合色丁香麻豆| 亚洲欧洲中文日韩av乱码| 中文字幕免费在线|