Saturday, September 25, 2010

ASP test two simple functions external to submit


This article cites two simple test ASP-function external to submit examples of the first function is ChkPost (), it can detect whether the server name where the user is currently present in the source page, the second function is PostCheck (), it can Through a simple test to see whether the POST form submission.

Function ChkPost ()
Detect the user currently exists in the server name where the source of the page

Code is as follows: Function ChkPost ()

dim server_v1, server_v2
chkpost = False
server_v1 = Cstr (Request.ServerVariables ("HTTP_REFERER"))
server_v2 = Cstr (Request.ServerVariables ("SERVER_NAME"))
If Mid (server_v1, 8, Len (server_v2)) <> server_v2 Then
chkpost = False
Else
chkpost = True
End If
End function

Function PostCheck ()
Very simple test is to test whether the POST method to submit

Code is as follows: Function PostCheck ()

PostCheck = False
If Lcase (Request.ServerVariables ("Request_Method "))=" post" Then PostCheck = True
End Function






Recommended links:



YouTube to WMV



Registry combat Collection - "Operation" Change Collection



Wizard Languages Education



Good Pager Tools



FLV To PSP



Sony and NEC will merge the two departments



My favorite Firewall And Proxy Servers



The table border css syntax order



Forgot Win XP to resolve password problems



WATERPROOF Wall - terminology to explain



Beijing Matsushita employee dissatisfaction compensation FOR loss of containment of the company



"Cockroaches door", HP will lose?



from the pornographic see COMPUTER security



DivX to 3GP



The pressure of free memory



Guide Audio Speech



Tuesday, September 14, 2010

Aspect-oriented (AOP) and object-oriented (OOP) [3]



Exception Handling

Exception handling example I will not go into here, but this section of the code has been discussed by the above potential problems. When you call EmployeeRepository createEmployee object method, you may get a RepositoryException exception. The traditional solution is, in this class treatment. Another way is when the exception is thrown when RepositoryException createEmployee method returns null, catch block outside the class of other logic can deal with this error.

Error handling in different situations will be different. However, by AOP can be distinguished from each case.


Figure 3


Figure 3 describes the design of the AOP approach and a more abstract level, the interaction between classes. You can by comparing Figure 1 and Figure 3 to better understand the AOP.

Program aims to read the CSV file by BusinessUnit object record and fill in the class BusinessUnitService the map. Use AOP to fill this map is somewhat similar to the back door (backdoor) method - control is delegated to BusinessUnit to read the storage medium record.

AOP is to define some starting point (pointcut) and treatment (advice). An "entry point" is the source code in an execution point. Preceding example defines an "entry point" - class BusinessUnitService in findBusinessUnits method. a "treatment" by definition is when the Executive to a "starting point" when a piece of code. Class BusinessUnitPersistentAspect including advice method findAllBusinessUnits, the method of loading data from storage media, and then use the factory class to create BusinessUnit object. then the object is added map, map reference to the object obtained by BusinessUnitService object. "entry point" and "treatment" component of the so-called "aspect (Aspect)"

To read the data storage medium, OOP way through a DAO class to do. And AOP, you just define a "starting point" and corresponding "solutions" to read the data. AOP framework will the form of advice into the code, either in the implementation phase can also compile.

In short, when the class BusinessUnitService the findAllBusinessUnits method is called, AOP framework will be in the "entry point" into the treatment office, by BusinessUnit object map in advance to read data to populate the object. In this way, persistence layer's code can be moved to business outside of the code.

New methods in the "section"

This section discusses how to use AOP for the application of each "section" Modeling

Operational resources

Class BusinessUnitPersistenceAspect lasting method uses a buffered reader. You can even define "section" and "aspect", but for simplicity, here only concerned with the class to find methods.
@ Aspect ("perJVM")
public class BufferedFileReaderAspect (

@ Expression ("execution (* org.javatechnocrats.aop.withaop.aspects.Busi
\







Recommended links:



Quicktime mkv



Ps3 h264



Xvid To Divx Converter



mxf Converter