Author Archives: admin

N2 CMS

N2 is a Content Management System for ASP.NET 2.0. It’s modern, free and includes all source code.

I think N2 proposes an unusually nice model when creating content-enabled web 2.0 sites. The main feature is a developer-friendly way to define and encapsulate content data.

Scope
N2 wants to provide a solid, extendable and user friendly content management engine and edit interface. No templates or implementations are included (except examples).

Target audience
N2 is a tool for developers who need a CMS when building sites for organizations and small businesses.

Features

  • Type safe access of content data through custom classes. N2 promotes a domain centric content model.
  • Easy-to-use editor interface – all the usual stuff (create, edit, delete, copy/paste, versioning, file upload) is built in and there’s a plugin system when that isn’t enough.
  • Compact design – should be easy to get started with as long as you’re into object oriented programming and asp.net.
  • Extendable – NHibernate and it’s polymorphism features are used for content persistance
  • Clean database (two 3 tables) containing only content data. Types and constraints are defined with attributes in source code.
  • Non-intrusive – supports a clean separation between view and edit (N2 is just a convenient way to insert and retrieve content).
  • Friendly URLs & multiple domains.
  • Leverages on ASP.NET 2.0 standards and concepts.

http://n2.libardo.com

http://www.codeplex.com/n2

ASP.NET AJAX Control Toolkit

Atlas Logo

Além dos controlos finais para utilização, este pacote tem código fonte para que você possa criar seus controlos.

http://atlas.asp.net/atlastoolkit

http://ajax.asp.net/downloads/default.aspx?tabid=47

Lightbox JS

Lightbox JS is a simple, unobtrusive script used to overlay images on the current page. It’s a snap to setup and works on all modern browsers.

http://www.huddletogether.com/projects/lightbox/

http://www.huddletogether.com/projects/lightbox2/Â

Optimizando o pool de conecções com ADO.NET em aplicações ASP.NET

Tuning Up ADO.NET Connection Pooling in ASP.NET Applications
By Dmitri Khanine
Connection Pooling Basics
Opening a database connection is a resource intensive and time consuming operation. Connection pooling increases the performance of Web applications by reusing active database connections instead of creating a new connection with every request. Connection pool manager maintains a pool of open database connections. When a new connection requests come in, the pool manager checks if the pool contains any unused connections and returns one if available. If all connections currently in the pool are busy and the maximum pool size has not been reached, the new connection is created and added to the pool. When the pool reaches its maximum size all new connection requests are being queued up until a connection in the pool becomes available or the connection attempt times out.Connection pooling behavior is controlled by the connection string parameters. The following are four parameters that control most of the connection pooling behavior:

  • Connect Timeout – controls the wait period in seconds when a new connection is requested, if this timeout expires, an exception will be thrown. Default is 15 seconds.
  • Max Pool Size – specifies the maximum size of your connection pool. Default is 100. Most Web sites do not use more than 40 connections under the heaviest load but it depends on how long your database operations take to complete.
  • Min Pool Size – initial number of connections that will be added to the pool upon its creation. Default is zero; however, you may chose to set this to a small number such as 5 if your application needs consistent response times even after it was idle for hours. In this case the first user requests won’t have to wait for those database connections to establish.
  • Pooling – controls if your connection pooling on or off. Default as you may’ve guessed is true. Read on to see when you may use Pooling=false setting.
Common Problems and Resolutions
Connection pooling problems are almost always caused by a “connection leak” – a condition where your application does not close its database connections correctly and consistently. When you “leak” connections, they remain open until the garbage collector (GC) closes them for you by calling their Dispose method. Unlike old ADO, ADO.NET requires you to manually close your database connections as soon as you’re done with them. If you think of relying on connection objects to go out of scope, think again. It may take hours until GC collects them. In the mean time your app may be dead in the water, greeting your users or support personnel with something like this:


Exception: System.InvalidOperationException Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Source: System.Data at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() …

Exception: System.InvalidOperationException
Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source: System.Data


at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()

 
Closing your connections
When you intend to close your database connection, you want to make sure that you are really closing it. The following code looks fine yet causes a connection leak:

SqlConnection conn = new SqlConnection(myConnectionString);
conn.Open();
doSomething();
conn.Close();
If doSomething() throws an exception – conn will never get explicitly closed. Here is how this can be corrected:
SqlConnection conn = new SqlConnection(myConnectionString);
try
{
conn.Open();
doSomething(conn);
}
finally
{
conn.Close();
}

or


using (SqlConnection conn = new SqlConnection(myConnectionString))
{
conn.Open();
doSomething(conn);
}

Did you notice that in the first example we called conn.Close() explicitly while in the second one we make the compiler generate an (implicit) call to conn.Dispose() immediately following the using block? The C# using block guarantees that the Dispose method is called on the subject of the using clause immediately after the block ends. Close and Dispose methods of Connection object are equivalent. Neither one gives you any specific advantages over the other.

When returning a connection from a class method – make sure you cache it locally and call its Close method. The following code will leak a connection:

OleDbCommand cmd new OleDbCommand(myUpdateQuery, getConnection());

intres = cmd.ExecuteNonQuery();

getConnection().Close(); // The connection returned from the first call to getConnection() is not being closed. Instead of closing your connection, this line creates a new one and tries to close it.

If you use SqlDataReader, OleDbDataReader, etc., close them. Even though closing the connection itself seems to do the trick, put in the extra effort to close your data reader objects explicitly when you use them.

Last but not the least, never Close or Dispose your connection or any other managed object in the class destructor or your Finalize method. This not only has no value in closing your connections but also interferes with the garbage collector and may cause errors. For more information see http://msdn.microsoft.com/library/en-us/cpguide/html/cpconprogrammingessentialsforgarbagecollection.asp.

 
Testing your changes
The only way to know the effect of your changes on connection pooling behavior is to load-test your application. If you have existing unit tests – use them. Running your unit tests repeatedly in a loop may create a fair bit of stress on application. If you don’t, use the Web load testing tool. There are plenty of commercial load testing tools on the market. If you prefer freeware, consider OpenSTA available at www.opensta.org. All you need to setup your load test is to install the tool, bring up your Web application and click your way through. OpenSTA will record your HTTP requests into test scenarios that you can run as part of your load test.Knowing that your application crashes under the load doesn’t often help to locate the problem. If the app crashes fairly quickly, all you may need to do is run several load tests – one for each module and see which one has a problem. However, if it takes hours to crash you will have to take a closer look.
Monitoring connection pooling behavior
Most of the time you just need to know if your application manages to stay within the size of its connection pool. If the load doesn’t change, but the number of connections constantly creep even after the initial “warm-up” period, you are most likely dealing with a connection leak. The easiest way to monitor the number of database connections is by using the Performance Monitor available under Administrative tools on most Windows installations. If you are running SQL Server, add SQL Server General Statistics -> User Connections performance counter (The counter is available on the SQL Server machine so you may need to put its name or IP address into the Select Counters From Computer box). The other way to monitor the number of database connections is by querying your DBMS. For example, on SQL Server run:

EXEC SP_WHO

Or on Oracle, run:

SELECT * FROM V$SESSION WHERE PROGRAM IS NOT NULL

.NET CLR Data performance counters

In documentation you may run into .Net CLR Data performance counters. They are great if you know what they can and cannot do. Keep in mind that they do not always reset properly. The following KB article sheds some light on the problem but in my opinion does not cover all the issues: http://support.microsoft.com/default.aspx?scid=kb;en-us;314429. Another thing to keep in mind is that IIS unloads app domains under stress so don’t be surprised when your number of database connections has dropped to zero while your min pool size is five!

 
Conclusion
In this article you’ve learned that the most common cause of connection pooling issues is database connections that are left open or not closed properly. You’ve learned that when you type “conn.Close()”, you almost always want to put that in the “Finally” block. You also learned not to interfere with the class destructor unless you use unmanaged resources. You’ve learned how to monitor your connection pool and diagnose a potential problem. You also learned how to keep a system with a connection leak in production if you really have to, until the problem is resolved. I hope this article has helped you resolve your connection pooling issue. However, there is more to connection pooling that is not covered in this article. Check out Bill Vaughn’s “Swimming in the .NET connection pool” at http://www.winnetmag.com/Article/ArticleID/38356/38356.html.
 
About the Author
Dmitri Khanine is senior web developer and architect working for a major Canadian Bank. His 10+ years of experience are mostly in backend and middle tier development of enterprise Web applications on Microsoft as well as J2EE platforms. Industry experience includes Banking, Finance, Automotive and software consulting. Dmitri’s areas of interest and expertise include rapid enterprise application development, MVC frameworks and code generation. Dmitri can be contacted at Khanine@hotmail.com.
 

KILL (T-SQL)

Terminates a user process based on the system process ID (SPID). If the specified SPID has a lot of work to undo, the KILL may take some time to complete.
Syntax

KILL {spid}
Arguments

spid
Is the SPID of the process to terminate. The SPID value is a unique integer (smallint) assigned to each user connection when the connection is made, but the assignment is not permanent.

Remarks

KILL is commonly used to terminate a process that is blocking other important processes with locks, or to terminate a process that is executing a query that is using necessary system resources. System processes and processes running an extended stored procedure cannot be terminated.

Use KILL very carefully, especially when critical processes are running. You cannot kill your own process. Other processes not to kill are:

* AWAITING COMMAND
* CHECKPOINT SLEEP
* LAZY WRITER
* LOCK MONITOR
* SELECT
* SIGNAL HANDLER

Execute sp_who to get a report on valid SPID values. Use @@SPID to display the SPID value for the current session.
Permissions

KILL permissions default to the members of the sysadmin fixed database role, and are not transferable.
Examples

This example shows how to terminate SPID 10.

KILL 10

sp_who

Provides information about current Microsoft® SQL Server™ users and processes. The information returned can be filtered to return only those processes that are not idle.

Syntax

sp_who [[@login_name =] login]

Arguments

[@login_name =] login

Is a user login name on SQL Server. login is sysname, with a default of NULL. If no name is specified, the procedure reports all active users of SQL Server. login can also be a specific process identification number (SPID). To return information on active processes, specify ACTIVE. ACTIVE excludes from the report processes that are waiting for the next command from the user.

Return Code Values

0 (success) or 1 (failure)

Result Sets

sp_who returns a result set with the following information.

MSDN LINK

read more »

Criando links de MailTo em GridView

Quando temos campos contendo e-mails, frequentemente desejamos que já sejam exibidos como um link mailto:, abrindo directamente o envio de e-mail para a pessoa.

Para fazer isso sem sermos obrigados a transformar toda a coluna em template podemos configurar a propriedade DataFormatString da coluna.

Esta propriedade determina a formatação da informação, mas nos permite montar inclusive conteúdo em HTML, veja um exemplo :

CODE


Onde {0} indica o local onde desejamos que a informação (o e-mail) apareça no resultado.

Preenchendo a dataFormatString desta forma geraremos os links de mailto.

texto originalÂ

http://thespoke.net/blogs/zabotinsky/default.aspxÂ

Compilação de sites no VS 2005

Sempre que se corre o site pelo Visual Studio ele faz uma compilação geral do site. Podemos mudar isso re-configurando o projecto.

  • Clique com o botão direito no site, na janela solution explorer.
  • Selecione a opção “Property Pages” .
  • Selecione a opção “Build
  • Na opção “Before Running Start Page“, encontra-se por default como “Build Web Site“, altere para “Build Page
  • Desmarque a opção “Build Web Site as part of the solution

Com essas alterações o VS não irá mais checar todas as páginas do site a cada execução que você fizer, passando a checar apenas a página actual e com isso melhorando a performance no trabalho com o VS.

Shockwave Player Download Center

shockwave.png
File size: 2,539 K
Download Time Estimate: 6 minutes @ 56K modem
Platform: Windows
Version: Shockwave 10.1.4.020
Browser: Netscape or Netscape-compatible and Internet Explorer
Date Posted: 9/28/2006
Language: English, French, German

http://www.adobe.com/shockwave/download/download.cgi?

Microsoft Shared Computer Toolkit

60251_519x230_toolkit1_F.jpg

É uma ferramenta de software avançadas para computadores compartilhados em escolas, bibliotecas, Internet cafés e outros locais públicos. O Shared Computer Toolkit facilita a configuração, a proteção e o gerenciamento de computadores compartilhados confiáveis que executam o Windows XP.

A Microsoft criou o Shared Computer Toolkit para ajudar a tornar os computadores compartilhados mais confiáveis e mais rápidos de serem administrados. Ao contrário dos computadores pessoais, os computadores compartilhados são:
• Usados por várias pessoas que, em geral, não se conhecem e não confiam umas nas outras
• Usados em locais públicos onde a privacidade pessoal e a segurança são aspectos muito importantes
• Sujeitos a desgaste e falhas maiores devido ao uso freqüente e à disponibilidade pública

O Shared Computer Toolkit é ideal para computadores em escolas, bibliotecas públicas, centrais tecnológicas de comunidades e Internet cafés. Ele permite que as pessoas envolvidas com o gerenciamento de computadores compartilhados nesses ambientes facilmente:
• Protejam os computadores compartilhados contra alterações não autorizadas em seus discos rígidos.
• Restrinjam o acesso dos usuários às configurações e aos dados do sistema.
• Aprimorem a experiência dos usuários em computadores compartilhados.

links:

http://est.ualg.pt/estinf/index.php?option=com_content&task=view&id=39&Itemid=33

http://www.microsoft.com/brasil/windowsxp/sharedaccess/default.mspxÂ