elmah - Error Logging Modules and Handlers for ASP.NET - 1 : 初体验
elmah(英文):https://code.google.com/p/elmah/
写作思路:先看结果,然后再说原理
elmah文章基本内容如下
1.安装
2.基本使用
3.详细配置讲解
简介
ELMAH是一个开源项目,其目的是记录和报告在ASP.NET Web应用程序未处理的异常。
早在2004年9月与Atif阿齐兹和斯科特·米切尔发表在MSDN Library,其目的是作为一个概念证明,编写自包含的功能与ASP.NET HTTP模块和处理程序是绝对有可能的,大多有这种特征可能是一篇文章插入没有重新编译和小的改动配置文件的现有应用程序。 为了展示这些概念的文章发表了示例项目,其目的是为了拦截,记录和通知ASP.NET应用程序中发生未处理的异常。 它被赋予ELMAH的名称,错误日志记录模块和处理程序。
1.安装
新建一个MVC项目,在nuget的控制台输入命令回车进行安装:Install-Package elmah
MVC项目详情如下
开发环境
vs 2012
sql server 2012
HomeController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc; namespace Jean.ElmahSample.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/ public ActionResult Index()
{
return View();
} }
}
Index View :
运行显示效果:
安装后 web.config 文件内容变为如下图-1-1所示(暂时先不要管里面的内容是什么意思,后面再慢慢解答)
图-1-1
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-Jean.ElmahSample-20140524091142;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-Jean.ElmahSample-20140524091142.mdf" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<elmah>
<!--
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
more information on remote access and securing ELMAH.
-->
<security allowRemoteAccess="false" />
</elmah>
<location path="elmah.axd" inheritInChildApplications="false">
<system.web>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<!--
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
more information on using ASP.NET authorization securing ELMAH. <authorization>
<allow roles="admin" />
<deny users="*" />
</authorization>
-->
</system.web>
<system.webServer>
<handlers>
<add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
</location>
</configuration>
2.基本使用
错误数据源(错误存储的地方)
2.1 存储在内存中
输入地址 http://localhost:5547/home/about
看下图结果
图2-1
输入地址 http://localhost:5547/elmah.axd (elmah.axd不是一个真实存在的文件,也不需要我们自己去新建)
看下图结果
图2-2
点击并试一试
RSS FEED
DOWNLOAD LOG
点击图2-2中Details 查看详情如下
默认情况下,错误存储在内存中,错误数量上限为15
修改web.config中elmah节点,并设置错误数量上限为5
(当第6个错误出现时,前面5个存在的错误有一个会被最新的错误记录替换)
<elmah>
<!--Storing errors in memory-->
<errorLog type="Elmah.MemoryErrorLog, Elmah" size="5" />
</elmah>
2.2 存储在xml中
修改web.config中elmah节点,如下图
<elmah>
<!--Storing errors in XML files-->
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logdata-path="~/App_Data" />
</elmah>
输入地址 http://localhost:5547/home/adjkf
看下图结果
2.3 存储在sql server中
2.3.1 修改web.config文件,关键信息如下
<elmah>
<!--Storing errors in SQL Server-->
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />
</elmah> <connectionStrings>
<!--Northwind为我测试的数据库名称-->
<add name="Elmah.Sql" connectionString="Data Source=.;Initial Catalog=Northwind;Trusted_Connection=True" />
</connectionStrings>
2.3.2 在数据库里执行一下下面sql脚本(我测试的数据库是Northwind)
执行后会创建一张表ELMAH_Error和3个存储过程
/* ELMAH - Error Logging Modules and Handlers for ASP.NET
Copyright (c) 2004-9 Atif Aziz. All rights reserved. Author(s): Atif Aziz, http://www.raboof.com
Phil Haacked, http://haacked.com Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */ -- ELMAH DDL script for Microsoft SQL Server 2000 or later. -- $Id: SQLServer.sql 677 2009-09-29 18:02:39Z azizatif $ DECLARE @DBCompatibilityLevel INT
DECLARE @DBCompatibilityLevelMajor INT
DECLARE @DBCompatibilityLevelMinor INT SELECT @DBCompatibilityLevel = cmptlevel
FROM master.dbo.sysdatabases
WHERE name = DB_NAME() IF @DBCompatibilityLevel <> 80
BEGIN SELECT @DBCompatibilityLevelMajor = @DBCompatibilityLevel / 10 ,
@DBCompatibilityLevelMinor = @DBCompatibilityLevel % 10 PRINT N'
===========================================================================
WARNING!
--------------------------------------------------------------------------- This script is designed for Microsoft SQL Server 2000 (8.0) but your
database is set up for compatibility with version '
+ CAST(@DBCompatibilityLevelMajor AS NVARCHAR(80)) + N'.'
+ CAST(@DBCompatibilityLevelMinor AS NVARCHAR(80)) + N'. Although
the script should work with later versions of Microsoft SQL Server,
you can ensure compatibility by executing the following statement: ALTER DATABASE [' + DB_NAME()
+ N']
SET COMPATIBILITY_LEVEL = 80 If you are hosting ELMAH in the same database as your application
database and do not wish to change the compatibility option then you
should create a separate database to host ELMAH where you can set the
compatibility level more freely. If you continue with the current setup, please report any compatibility
issues you encounter over at: http://code.google.com/p/elmah/issues/list ===========================================================================
'
END
GO /* ------------------------------------------------------------------------
TABLES
------------------------------------------------------------------------ */ CREATE TABLE [dbo].[ELMAH_Error]
(
[ErrorId] UNIQUEIDENTIFIER NOT NULL ,
[Application] NVARCHAR(60) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Host] NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Type] NVARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Source] NVARCHAR(60) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Message] NVARCHAR(500) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[User] NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[StatusCode] INT NOT NULL ,
[TimeUtc] DATETIME NOT NULL ,
[Sequence] INT IDENTITY(1, 1)
NOT NULL ,
[AllXml] NTEXT COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL
)
ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[ELMAH_Error] WITH NOCHECK ADD
CONSTRAINT [PK_ELMAH_Error] PRIMARY KEY NONCLUSTERED ([ErrorId]) ON [PRIMARY]
GO ALTER TABLE [dbo].[ELMAH_Error] ADD
CONSTRAINT [DF_ELMAH_Error_ErrorId] DEFAULT (NEWID()) FOR [ErrorId]
GO CREATE NONCLUSTERED INDEX [IX_ELMAH_Error_App_Time_Seq] ON [dbo].[ELMAH_Error]
(
[Application] ASC,
[TimeUtc] DESC,
[Sequence] DESC
)
ON [PRIMARY]
GO /* ------------------------------------------------------------------------
STORED PROCEDURES
------------------------------------------------------------------------ */ SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO CREATE PROCEDURE [dbo].[ELMAH_GetErrorXml]
(
@Application NVARCHAR(60) ,
@ErrorId UNIQUEIDENTIFIER
)
AS
SET NOCOUNT ON SELECT [AllXml]
FROM [ELMAH_Error]
WHERE [ErrorId] = @ErrorId
AND [Application] = @Application GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO CREATE PROCEDURE [dbo].[ELMAH_GetErrorsXml]
(
@Application NVARCHAR(60) ,
@PageIndex INT = 0 ,
@PageSize INT = 15 ,
@TotalCount INT OUTPUT
)
AS
SET NOCOUNT ON DECLARE @FirstTimeUTC DATETIME
DECLARE @FirstSequence INT
DECLARE @StartRow INT
DECLARE @StartRowIndex INT SELECT @TotalCount = COUNT(1)
FROM [ELMAH_Error]
WHERE [Application] = @Application -- Get the ID of the first error for the requested page SET @StartRowIndex = @PageIndex * @PageSize + 1 IF @StartRowIndex <= @TotalCount
BEGIN SET ROWCOUNT @StartRowIndex SELECT @FirstTimeUTC = [TimeUtc] ,
@FirstSequence = [Sequence]
FROM [ELMAH_Error]
WHERE [Application] = @Application
ORDER BY [TimeUtc] DESC ,
[Sequence] DESC END
ELSE
BEGIN SET @PageSize = 0 END -- Now set the row count to the requested page size and get
-- all records below it for the pertaining application. SET ROWCOUNT @PageSize SELECT errorId = [ErrorId] ,
application = [Application] ,
host = [Host] ,
type = [Type] ,
source = [Source] ,
message = [Message] ,
[user] = [User] ,
statusCode = [StatusCode] ,
time = CONVERT(VARCHAR(50), [TimeUtc], 126) + 'Z'
FROM [ELMAH_Error] error
WHERE [Application] = @Application
AND [TimeUtc] <= @FirstTimeUTC
AND [Sequence] <= @FirstSequence
ORDER BY [TimeUtc] DESC ,
[Sequence] DESC
FOR XML AUTO GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO CREATE PROCEDURE [dbo].[ELMAH_LogError]
(
@ErrorId UNIQUEIDENTIFIER ,
@Application NVARCHAR(60) ,
@Host NVARCHAR(30) ,
@Type NVARCHAR(100) ,
@Source NVARCHAR(60) ,
@Message NVARCHAR(500) ,
@User NVARCHAR(50) ,
@AllXml NTEXT ,
@StatusCode INT ,
@TimeUtc DATETIME
)
AS
SET NOCOUNT ON INSERT INTO [ELMAH_Error]
( [ErrorId] ,
[Application] ,
[Host] ,
[Type] ,
[Source] ,
[Message] ,
[User] ,
[AllXml] ,
[StatusCode] ,
[TimeUtc]
)
VALUES ( @ErrorId ,
@Application ,
@Host ,
@Type ,
@Source ,
@Message ,
@User ,
@AllXml ,
@StatusCode ,
@TimeUtc
) GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
浏览器输入地址http://localhost:5547/abc123ds
在数据库输入脚本并查看结果如下
SQLite与Oracle的配置与sql server类似,就不重复了,
相关脚本下载地址:https://code.google.com/p/elmah/downloads/list
2.4 手动记录错误
方法:
ErrorSignal.FromCurrentContext().Raise()
现在我们创造2个错误并记录
修改HomeController如下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Elmah; namespace Jean.ElmahSample.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/ public ActionResult Index()
{
try
{
var t = int.Parse("abc");
}
catch (Exception e)
{
ErrorSignal.FromCurrentContext().Raise(e); // error 1
ErrorSignal.FromCurrentContext().Raise(new ArgumentNullException()); // error 2
}
return View();
} }
}
重新生成
浏览器输入 http://localhost:5547
新开窗口输入 http://localhost:5547/elmah.axd
结果如下
elmah - Error Logging Modules and Handlers for ASP.NET - 1 : 初体验的更多相关文章
- ASP.NET MVC 初体验
MVC系列文章终于开始了,前段时间公司项目结束后一直在封装一个html+ashx+js+easyui的权限系统,最近差不多也完成了,迟些时候会分享源码给大家.当然这个MVC系列结束后如果时间允许还会另 ...
- Demystifying ASP.NET MVC 5 Error Pages and Error Logging
出处:http://dusted.codes/demystifying-aspnet-mvc-5-error-pages-and-error-logging Error pages and error ...
- An error occurred: No action handlers found - check JMeterHome and libraries
An error occurred: No action handlers found - check JMeterHome and libraries Writing log file to: D: ...
- Oracle 11g使用DML Error Logging来避免bulk insert故障
当使用带有子查询的insert语句来加载数据时如果出现错误.系统会终止该语句并回滚整个操作.这是非常消耗时间和资源的操作.如果insert这样的语句可以使用DML Error Logging功能来避免 ...
- nginx 编译某个模板的问题./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library stati
root@hett-PowerEdge-T30:/usr/local/src/nginx-1.9.8# ./configure --prefix=/usr/local/nginx --add-mod ...
- ASP.NET2.0组件控件开发视频 初体验
原文:ASP.NET2.0组件控件开发视频 初体验 ASP.NET2.0组件控件开发视频 初体验 录了视频,质量不是很好,大家体验下.我会重新录制的 如果不清楚,可以看看http://v.youku. ...
- ASP.NET Core 3.0 上的gRPC服务模板初体验(多图)
早就听说ASP.NET Core 3.0中引入了gRPC的服务模板,正好趁着家里电脑刚做了新系统,然后装了VS2019的功夫来体验一把.同时记录体验的过程.如果你也想按照本文的步骤体验的话,那你得先安 ...
- ELMAH--Using HTTP Modules and Handlers to Create Pluggable ASP.NET Components 77 out of 90 rated th
MSDN===http://msdn.microsoft.com/en-us/library/aa479332.aspx PROJECT==https://code.google.com/p/elma ...
- HTTP Message Handlers in ASP.NET Web API
https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/http-message-handlers A message ha ...
随机推荐
- DelphiXE7如何调用Java Class,JAR等文件?
源文地址:http://jingyan.baidu.com/article/e4d08ffdb61b040fd3f60d44.html 第一步,我们先在互联网上把java2pas这个工具下载下来. 下 ...
- elasticsearch 索引 类型 id
zjtest7-frontend:/usr/local/logstash-2.3.4/config# cat logstash_indexer01.conf input { redi ...
- discuz方法赏析
public static function limit($start, $limit = 0) { $limit = intval($limit > 0 ? $limit : 0); $sta ...
- 简单QT界面信号图形化输入输出
右键->转到槽,选择信号 就可以输入代码 右键->转到槽,选择信号 就可以输入代码 2个文本框接受输入数字,第3个文本框输出相加结果 void Dialog::on_pushButton_ ...
- iOS 性能测试 - FBMemoryProfiler
FBMemoryProfiler 是Facebook开源的一款用于分析iOS内存使用和检测循环引用的工具库. 脑补:http://www.cocoachina.com/ios/20160421/159 ...
- CM_RESOURCE_LIST structure
The CM_RESOURCE_LIST structure specifies all of the system hardware resources assigned to a device. ...
- jquery 浏览器放大缩小函数resize
<script> $(function(){ $(window).resize(function(){ var _height = $(window).height(); var _con ...
- CSS的W3C标准的盒子模型和低版本IE浏览器的盒子模型
CSS中盒子模型的组成由内容区(content).内边距(padding).边框(border).外边距(margin)组成.内边距可细分为 padding-top.padding-right.pad ...
- BST的删除
#include<iostream> #include<math.h> #include<stdio.h> #include<stdlib.h> #in ...
- BZOJ 2707: [SDOI2012]走迷宫( tarjan + 高斯消元 )
数据范围太大不能直接高斯消元, tarjan缩点然后按拓扑逆序对每个强连通分量高斯消元就可以了. E(u) = 1 + Σ E(v) / degree(u) 对拍时发现网上2个程序的INF判断和我不一 ...