View my complete profile

Thursday, July 16, 2009

What is AspJpeg?

AspJpeg is a server component that will help your ASP or ASP.NET applications with all their image-management needs. With AspJpeg, you can create high-quality thumbnails, logo-stamp photographs, extract metadata information from images, crop, enhance, rotate, convert, and much more. For the complete list of features..

Here i have share some Part of ASPJpeg it will help to more about ASPJpeg......

Introduction & Quick Start


1 What is AspJpeg?

AspJpeg is an advanced image management component to be used in a Microsoft IIS environment.
AspJpeg enables your ASP/ASP.NET application to dynamically create high-quality thumbnails of images in just a few lines of code. An original image may be in any of the following formats: JPEG, GIF, BMP, TIFF or PNG.

This component can be used in tandem with AspUpload, the leading file upload component from Persits Software, Inc., to create thumbnails of images as they are being uploaded to the Web server.

2 Feature Summary

* Supports JPEG, GIF, BMP, TIFF and PNG formats as input.
* Source images can be opened from disk, memory, or a recordset.
* Resized images can be saved to disk, memory or an HTTP stream.
* Supports three resizing algorithms: nearest-neighbor, bilinear, and bicubic.
* Drawing and typing on top of an image. Support for TrueType and Type 1 fonts.
* Automatic word wrapping, text alignment to the left, right, center and justified, * * rotation.
* Picture-in-picture support.
* Cropping, flipping, rotation, sharpening, grayscale conversion.
* Compression rate of output images can be adjusted for optimal quality/file size * * * ratio.
* EXIF and IPTC metadata extraction from JPEG images.
* Metadata preservation during resizing.
* IPTC metadata adding and editing.
* CMYK-to-RGB conversion.
* Sepia filter.
* Read/write access to individual pixels of an image.
* PNG alpha channel support.
* GIF transparency support.
* Brightness, contrast and saturation adjustment.
* GIF output, transparency and animation preservation.
* JPEG-to-GIF conversion.
3 System Requirements

Windows NT/2000/XP/2003/Vista/2008, and
IIS 4.0+ and ASP/ASP.NET, or
Visual Basic 5.0+, or
Visual C++ 5.0+, or
any development environment supporting COM.

4 Installation

The setup application aspjpeg.exe installs and registers the AspJpeg component along with documentation and samples in a directory of your choice. To install AspJpeg on another computer, it is sufficient to copy the file aspjpeg.dll to the other system and register it there using the regsvr32 command-line utility as follows:
c:\>regsvr32 c:\path\aspjpeg.dll

If that machine was already running an older version of the component, you should shut down and restart the IIS services to remove the old version of the DLL from memory, as follows:

c:\>net stop iisadmin /y
c:\>net start w3svc

The setup installs a 30-day evaluation copy of the AspJpeg component. The evaluation version is fully functional, i.e. no features are disabled or limited. After 30 days, the component will start throwing an expiration error unless/until a registration key is installed. A registration key can be purchased here. Once a key is obtained, you can import it into the system registry without re-installing the component. Your web server does not need to be shut down.

It is strongly recommended that NTFS permissions be adjusted on the \Samples directory and all subdirectories to avoid an "Access is denied" or other errors when running the code samples. Using Windows Explorer, right-click on the directory c:\Program Files\Persits Software\AspJpeg\Samples, select the Security tab and give the "Everyone" account full control over this folder. Click "Advanced..." and make sure the checkbox "Reset permissions on all child objects..." is checked, as follows:





5 Expiration Mechanism
Like other Persits Software components such as AspUpload and AspEmail, AspJpeg uses a registration key-based expiration mechanism. Once a copy of the product is purchased, the registration key is sent to the customer via email.
Once the key is obtained, it should be installed in the system registry under the location HKEY_LOCAL_MACHINE\Software\Persits Software\AspJpeg\RegKey as a default value. The AspJpeg.exe installer will place the key in this registry location automatically, or you may choose to do it manually using regedit.

Alternatively, the registration key can be specified in your code via the RegKey property of the top-level ASPJpeg object, as follows:

Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.RegKey = "12345-67890-12345"
...

The current expiration date of the component can be retrieved via the Expires property, as follows:

Set Jpeg = Server.CreateObject("Persits.Jpeg")
Response.Write Jpeg.Expires

If this property returns 9/9/9999 it means a permanent registration key is being used.





The following code sample opens an image from disk and creates a 50% scaled-down thumbnail of the image:

VB Script:
-------------------------------------------------------------------------------------

<%--<%--%>
' Create instance of AspJpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' Compute path to source image
Path = Server.MapPath("../images/apple.jpg")

' Open source image
Jpeg.Open Path

' Decrease image size by 50%
Jpeg.Width = Jpeg.OriginalWidth / 2
Jpeg.Height = Jpeg.OriginalHeight / 2

' create thumbnail and save it to disk
Jpeg.Save Server.MapPath("apple_small.jpg")
<%--%>--%>

-------------------------------------------------------------------------------------
C#
-------------------------------------------------------------------------------------
<%----%>

-------------------------------------------------------------------------------------

Leia Mais…

ASP.NET – How to call a server-side method from client-side JavaScript

Introduction

This is a tutorial on how to call a server-side ASP.NET method from a client-side JavaScript method.

If you are wondering when that could become useful, imagine the following scenario:

A Web Application having an implemented authentication system.
Users log in with their username and password.
At any point the user is able to log out by clicking on the respective “Log Out” button.
On the server-side, the log out action would trigger a cleaning up process of user’s temp data.

However, the user instead of clicking on the “Log Out” button, may simply close the browser window. Now since HTTP is a stateless protocol, the server-side cannot directly detect the user’s action. Therefore the client-side (browser) would have to notify the server that the user is closing the window.

A solution to this problem would be to call a JavaScript function when the client-side “onUnload” event is triggered. The JavaScript function would then be able to call the appropriate server-side method to clean up the data.

The exact required AJAX mechanism to accomplish that kind of communication is described on the “Hello World” project below.

Please note that for the purpose of this tutorial all methods are kept as simple as possible, so that you can easily modify them for your application.

1. Creating a new ASP.NET project

AJAX is required, thus a new “AJAX enabled ASP.NET Web Application” has to be created on Visual Studio 2005 or “ASP.NET Web Application” on 2008.



2. Modifying the server-side code

Every server-side method that is called from the client-side, must be declared as “static”, and also has to be decorated with the [System.Web.Services.WebMethod] tag.

Now let’s create a simple function that returns a string value.
--------------------------------------------------------------------
[System.Web.Services.WebMethod]
public static string Message()
{
return "Hello from the server-side World!";
}

---------------------------------------------------------------------
3. Modifying the ScriptManager

The “EnablePageMethods” attribute has to be added on the ScriptManager tag.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
4. Adding a simple HTML button

We are going to add a simple HTML button rather than a server-side ASP.NET button control. The “onClick” event is going to be associated with the JavaScript function “GetMessage”.
-----------------------------------------------------------------------------------

----------------------------------------------------------------------------------
5. Adding the JavaScript code

Let’s add the “GetMessage” JavaScript function, which is going to call our server-side “Message” method.
-----------------------------------------------------------------------------------
function GetMessage() {
PageMethods.Message(OnGetMessageSuccess, OnGetMessageFailure);
}
-----------------------------------------------------------------------------------
The “OnGetMessageSuccess” is the name of the JavaScript function that will be called if the request is successful. Whereas the “OnGetMessageFailure” will be called if an exception is thrown.

So let’s add these two functions:
-----------------------------------------------------------------------------------
function OnGetMessageSuccess(result, userContext, methodName) {
alert(result);
}

function OnGetMessageFailure(error, userContext, methodName) {
alert(error.get_message());
}

-----------------------------------------------------------------------------------
Please note that you can give to the functions any name you wish, as long as they match the PageMethods call parameters.

If there are no errors, the “OnGetMessageSuccess” will show a pop-up window with our server-side “Message” text. Else, the pop-up will have an exception message.

6. Running the Web Application

This is it, we are ready to run our Web Application. Everything seems to be working just fine on Internet Explorer (IE6 and IE7):



However if we run it on Firefox (currently the latest version is 3.0.4) the pop-up will display the following message:

The server method ‘Message’ failed.



7. Fixing the Firefox issue

We just need to modify the button’s onclick event a bit:
-------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------
And this would do the trick:




8. Here is the complete source code for your reference

Default.aspx

(Had to replace double quotes (”) with single quote (’) in order to post it correctly.)

------------------------------------------------------------------------------------
<%@ Page Language='C#' AutoEventWireup='true' CodeBehind='Default.aspx.cs' Inherits='AJAXEnabledWebApplication2._Default' %>





Page










-------------------------------------------------------------------------------------
Default.aspx.cs
-------------------------------------------------------------------------------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AJAXEnabledWebApplication2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
[System.Web.Services.WebMethod]
public static string Message()
{
return "Hello from the server-side World!";
}
}
}
-------------------------------------------------------------------------------------

Leia Mais…

Calling Java Code from ASP.NET Web Applications

Why Interoperate between ASP.NET and Java?

Why would you want to call Java code from your ASP.NET Web applications? The best way to answer that question is by examining a few real-world case studies:
A major Web search portal needed to construct an internal Web site for their sales staff. The vendor-supplied data feed they needed to use on this internal site was only accessible through a Java library supplied by the vendor. The portal company had to use the Java library, but for other reasons they needed to implement on ASP.NET for the internal Web site platform. They had no choice but to solve the Java/.NET interoperability problem.
In another case, a large US savings and loan bank was building a Web application to display digital images of checks that the bank had processed. (In the US, this is known as a “Check 21” application, named after the law that allows use of digital images instead of actual paper checks.) The application would be used both internally and by the public. The project’s architects had settled on ASP.NET as an implementation platform because of the superior tooling, but the bank’s back-end applications were all J2EE-based, and ran on WebSphere application servers. The Check 21 application would need to directly access the data through the back-end systems’ Enterprise Java Beans (EJBs).

There are many other scenarios that could require ASP.NET code to call Java. Your company might have invested in a Java library or application and need to use it with new .NET development. A merger or acquisition might require .NET and Java applications from the merged companies to work together. Or you just might want to get existing .NET and Java systems integrated to accomplish a business goal. In all these cases, you need to solve the problem of Java/.NET interoperability.

Approaches to .NET/Java Interoperability
There are two main ways to call Java code from .NET: Web services and bridging. The approaches are applicable whether the .NET application is an ASP.NET Web application, a Windows Forms or WPF-based rich desktop application, a console-based application, or a service.

Much has been written about Web services, so this article won’t go deep into the details. While there are other definitions, we’ll define Web services as remote procedure calls that are encoded using SOAP, transmitted using HTTP, and described to the outside world using WSDL. Web services are implemented according to established standards, so that any set of platforms that implement those standards can interoperate. However, standards-based Web services lead to a “least common denominator” approach, so that only the relatively small number of data types and other concepts supported by all the platforms can be used in the communication; many concepts must be left out. In addition, the service-oriented approach provided by a Web service typically allows access to a very narrow API — the service. While it may be possible to access an entire object-oriented API through a Web service, it is generally quite difficult to set up a Web service that offers such a broad API.

The alternative to Web services is a Java/.NET bridge. With a bridge, the .NET code still runs in a CLR (Microsoft .NET Common Language Runtime), and the Java code still runs in a JVM (Java Virtual Machine). Bridges generally take a proxy-based approach: you can create .NET-based proxies for the Java classes that will be accessed from .NET, or vice versa. The .NET code interacts with the proxy classes just as if they were the underlying Java classes. The proxies, along with the bridge infrastructure, manage the communications between the two sides, including object marshalling and unmarshalling, and object lifecycle management. Depending on the bridge, the Java and .NET sides can run in different processes and communicate over a socket-based connection, or can run in the same process. There are a number of different Java/.NET bridges available; the example in this article uses JNBridgePro, a .NET/Java bridge from JNBridge (http://www.jnbridge.com), which supports both socket-based communication and in-process interoperability using shared memory buffers for communication. Figure 1 shows the




Figure 1: Architecture of a .NET/Java bridge.

The choice of whether to use Web services or a bridge to implement a .NET/Java integration depends on the requirements of the application. Web services are standards-based and when they’re available they will usually just work. However, their performance is limited, and they are not well-suited to calling a rich object-oriented API or passing custom classes or exceptions or implementing callbacks, all of which is easily done with a bridge. It also is the case that not every application is Web services-enabled on the .NET and Java sides. Finally, for architectures where the Java code is in a simple library located on the same machine as the ASP.NET server, use of a Web service, which involves multiple processes and a socket-based connection, is overkill; running the Java in the ASP.NET process, as is available in several bridges, is a more appropriate solution.

Calling Java Code from an ASP.NET Web Application
The following example shows how to use a bridge to call a Java library from an ASP.NET Web application. The ASP.NET code supplied below is C#; the downloadable code also includes the equivalent VB.NET code (see end of article for download details).

To run this example, it is necessary to have Visual Studio 2008, a Java Runtime Environment (JRE) 1.4 or later, and a copy of JNBridgePro. Evaluation copies of JNBridgePro can be downloaded from http://www.jnbridge.com.

Let’s assume we have an existing Java library that retrieves names of authors and titles of books from a database. The library exposes an API including two classes: Author, encapsulating information about authors, and Book, encapsulating information about books. A simplified version of the code is as follows:

public class Author
{
public String firstName;
public String lastName;

public Author(String firstName, String lastName)
{
... // construct a new Author object
}

public static Author[] getAuthors()
{
... // return an array containing all the available Author objects in the database
}
}
public class Book
{
public String title;
public String publisher;
public String year;

public Book(String title, String publisher, String year)
{
... // construct a new Book object
}

public static Book[] getBooks()
{
... // return an array containing all the available Book objects in the database
}

public static Book[] getBooks(String firstName, String lastName)
{
... // return an array containing all books in the database by the given author
}
}

Full code for the Java library is available with the downloadable code.

We are going to provide an ASP.NET Web-based front-end that will display all authors in the database, and then, when the user clicks on the name of an author, will retrieve and display all books written by a specified author.

The first step in the process is to generate proxies for the Author and Book classes. Start by launching JNBProxy, JNBridgePro’s GUI-based proxy generator. When the “Launch JNBProxy” form is displayed, select “Create new .NET --> Java project,” as we are creating a project in which .NET code will be calling Java code. Once this is done, JNBProxy’s main form is displayed (see Figure 2).



Figure 2: JNBProxy.

We will need to proxy the Java classes Demo2.Author and Demo2.Book, so we will need to configure the Java classpath used by the proxy generator so that it can locate the desired classes. The classes Demo2.Author and Demo2.Book are contained in the files Author.class and Book.class, respectively, and they must both be located in a folder Demo2. We must add the folder containing Demo2 to the classpath. To do so, we use the menu command Project | Edit Classpath... and locate the necessary folder. When we are done, we will see an Edit Class Path dialog box similar to that shown in Figure 3.




Figure 3: After creating classpath.

The next step is to load the Author and Book Java classes, then generate proxies for those classes. To load the classes, use the menu command Project | Add Classes from Classpath... and enter the fully qualified class names Demo2.Author and Demo2.Book. It is not necessary to add supporting classes, as the only supporting classes needed to use Author and Book are arrays and strings, which are automatically converted to native .NET arrays and strings.

Loading the classes may take a few seconds. Progress will be shown in the output pane in the bottom of the window, and in the progress bar. When completed, Demo2.Author and Demo2.Book will be displayed in the Environment pane on the upper left of the JNBProxy window (see Figure 4).



Figure 4: After loading classes.

We wish to generate proxies for both of these classes, so when all the classes have been loaded into the environment, make sure that each class in the tree view has a checkmark next to it. Quick ways to do this include clicking on the checkbox next to each package name, or simply by selecting the menu command Edit | Check All in Environment. Once each class has been checked, click the Add button to add each checked class to the list of proxies to be exposed. These will be shown in the Exposed Proxies pane.

Finally, generate the proxies. Select the Project | Build... menu command, and choose a name and location for the assembly (.dll) file that will contain the generated proxies. The proxy generation process may take a few minutes, and progress and other information will be indicated in the Output pane. In this example, we will call the generated proxy assembly bookAccess.dll.

Now that the proxies are generated, we will write the ASP.NET Web application that uses them and accesses the Java classes through them.

First, create a new C# Web Application project. (Make sure that you have Internet Information Server installed and properly configured before you do this. Also note that the downloadable code contains a VB.NET version of this example, so you will be able to do this same example with Visual Basic.) Open the web.config file in the project. Add the following code to the section of Web.config:


type="System.Configuration.SingleTagSectionHandler, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

Immediately after the section, add the following section:

host="localhost"
port="8085" />


These changes configure the .NET side to communicate with the Java side using a socket-based approach. The Java side in this case will run in its own process. It also is possible to configure the project so that the Java side runs inside the ASP.NET process and sockets are not needed. This approach will be demonstrated at the end of the section.

Once the configuration file is edited, use the designer to create a simple Web form as shown in Figure 5. The two boxes in the Web form are ListBoxes, not ListViews, which are not available in Web forms. Make sure that the AutoPostBack property of the top ListBox is set to true.




Figure 5: Web form for example program.

Assuming that the top ListBox is named ListBox1, and the bottom ListBox is named ListBox2, add the following event handlers to the Web form’s code-behind:

using Demo2;
. . .
private void ListBox1_Load(object sender, System.EventArgs e)
{
if (ListBox1.Items.Count > 0)
{
return; // don't add anything more
}

// load the authors
Author[] authors = Author.getAuthors();
for (int i = 0; i < authors.Length; i++)
{
ListItem li = new ListItem();
li.Text = authors[i].lastName + ", " + authors[i].firstName;
ListBox1.Items.Add(li);
}
}

private void ListBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
// clear listBox2
ListBox2.Items.Clear();

// if nothing selected, return
ListItem li = ListBox1.SelectedItem;

if (li == null)
{
return;
}

// last, first names
string name = li.Text;
int separator = name.IndexOf(",");
string lastName = name.Substring(0, separator);
string firstName = name.Substring(separator+2);

// look up books
Book[] titles = Book.getBooks(firstName, lastName);

// write out books
for (int i = 0; i < titles.Length; i++)
{
ListItem li2 = new ListItem();
string theBook = titles[i].title + " (" + titles[i].publisher + ", " +
titles[i].year + ")";
li2.Text = theBook;
ListBox2.Items.Add(li2);
}
}

Again, note that the proxies for the Java objects of class Demo2.Author and Demo2.Book are used exactly as the original objects would be used in Java. This is where the interop occurs. Every call to a method in Author and Books, and every access of a field, is actually an access of the underlying method or field. If the application is set up properly, the cross-platform interoperation is transparent.

After entering the code, build the project to obtain the Web application.

Running the program is simple. First, make sure there is an ODBC data source called ‘BookDemo’ referencing the supplied Microsoft Access database books.mdb. Set up your Java environment by copying the files jnbcore.jar (the JNBridgePro Java-side runtime component) and jnbcore_tcp.properties (the Java-side configuration file specifying binary, socket-based communications) to the folder containing the folder Demo2 (which contains the Java class files). Then, open a console window, navigate to the folder containing Demo2, jnbcore.jar, and jnbcore_tcp.properties, and run the following command:

java -cp ".;jnbcore.jar" com.jnbridge.jnbcore.JNBMain /props jnbcore_tcp.properties

You should see the following output:

JNBCore v4.0.2
Copyright 2008, JNBridge, LLC

creating binary server

This indicates that the Java side is running.

Once the Java side is running, start the Web application by launching a browser and entering the URL of the Web application (for example, http://localhost/Demo2/WebForm1.aspx). The Web form will be displayed with author names, obtained through the Java class Author, displayed in the top list box (see Figure 6).



Figure 6: Initial Web form.

Clicking on any of the authors will cause books written by that author to be displayed (see Figure 7).



Figure 7: Web form after clicking on author.

It is possible to run the Java side in the same process as the .NET side, using a shared-memory communication mechanism. This has several advantages: it’s much faster than the socket-based mechanism, and it’s not necessary to explicitly start up the Java side — it’s automatically done before the first call to a proxy. To use shared memory, stop Java side (if it’s still running), then open the web.config application configuration file. Replace the element with the following:

jvm="C:\Program Files\Java\jdk1.5.0_09\jre\bin\client\jvm.dll"
jnbcore="C:/Program Files/JNBridge/JNBridgePro v4.0/jnbcore/jnbcore.jar"
bcel="C:/Program Files/JNBridge/JNBridgePro v4.0/jnbcore/bcel-5.1-jnbridge.jar"
classpath="C:\BooksDemo" />

You will need to edit the “jvm”, “jnbcore”, “bcel”, and “classpath” values to reflect the locations on your machine of jvm.dll (in your Java runtime environment), jnbcore.jar, bcel-5.1-jnbridge.jar (in your JNBridgePro installation), and the folder containing the folder Demo2 containing the files Author.class and Book.class. Once you have made the changes, build the project. Restart ASP.NET by issuing the command “iisreset” from a command-line prompt, then start the Web application. It will run as before, even though the Java side has not been explicitly started, because the Java side is now running inside the .NET process.

Conclusion
This example shows how Java classes can easily be used in an ASP.NET application through use of a Java/.NET bridge. The bridge allows the Java classes to be called directly from the ASP.NET code through proxies; to interact with a Java object, access the corresponding proxy object in exactly the same way. Interactions between the .NET and Java code are transparent, and use of proxies make the Java classes look as though they were written in a .NET language like C# or VB.NET.

Returning to the case studies introduced at the start of the article, the Web search portal company decided to use a bridge to directly access the data feed through their vendor’s Java API. Constructing a Web service around the API and accessing that seemed like overkill for the problem at hand. A bridge was more appropriate for direct access of the Java API.

For the savings and loan bank’s Check 21 application, the architects did consider a Web service, as the back-end WebSphere implementation did offer the option of Web services. However, they discovered that the Web service offered insufficient throughput, so they also settled on use of a bridge. The new application was up and running within a few weeks, certainly much more quickly than if they had decided to re-implement it with Java technologies, which was another option.

There are situations where a Web service would be a good solution for calling Java from .NET. If performance isn’t the most significant issue, or if the connection must pass through firewalls or reach some other organization over the Internet, Web services are a reasonable interoperability option.

If you are developing ASP.NET applications, ideally you would like to base the project exclusively on the .NET platform. However, there are practical reasons why a pure .NET implementation might not be an option. Knowledge of the various approaches to Java/.NET interoperability, particularly Web services and bridging, will often allow you to complete projects more quickly, and without the need to spend time rewriting legacy Java code.

Leia Mais…

Integrating User Controls with WebParts

In an earlier column -- "Create a Reporting Dashboard with WebPartZones (But Without WebParts)" -- I described how you could create a reporting dashboard that allows users to select reports from a catalog on the page. To do this, I took advantage of the WebPart framework in ASP.NET but, rather than go through the agony of creating an actual WebPart, I used something that ASP.NET developers do understand: User Controls.

But my solution wasn't complete. While a real WebPart displays descriptive information (a title and a subtitle, for instance), a User Control does not. In addition, I didn't address allowing the user to set values on the User Control to personalize the WebPart.
--------------------------------------------------------------------------------------
User Controls, having each user control display a title provides the easiest way to tell the user what each report does. In addition, a true WebPart would allow the user to provide input values to customize the report. For instance, while the default report might display sales for all regions, a user should be able to customize the report to display just the region the user is interested in.

Both of these options are available even when using user controls.

Implementing Descriptions
My first step in using a User Control as a WebPart is to have it implement the IWebPart interface, as in this example:

Partial Class AnnualSalesReportUserControl
Inherits System.Web.UI.UserControl
Implements IWebPart
The result of this change is the addition of six properties to my User Control: Title, Subtitle, Description, TitleUrl, CatalogIconImageUrl and TitleIconImageUrl. The first four are the easiest properties to implement as they only require a string value. In many ways, the Title and Subtitle are the most important because they are automatically displayed on the WebForm either on the WebPart itself or when the control is displayed in a catalog.

The user can change the Title property as part of customizing the WebPart but the Subtitle property is fixed. Because of that difference, you should use the Subtitle property to describe the WebPart independently of any personalization that you'll let the user implement (for instance, I'd give my WebPart report the name "Sales Report"). The Title property should default to a value that reflects the default settings for the report. For a sales report that, by default, shows sales for all regions but allows the user to select a specific reason, a good Title would be "Sales Report." Implementing those settings would require code like this:

Private _title As String = "All Regions"

Public ReadOnly Property Subtitle() As String _
Implements System.Web.UI.WebControls.WebParts.IWebPart.Subtitle
Get
Return "Sales Report"
End Get
End Property

Public Property Title() As String _
Implements System.Web.UI.WebControls.WebParts.IWebPart.Title
Get
Return _title
End Get
Set(ByVal value As String)
_title = value
End Set
End Property
Implementing Personalization
The next step is to give the user the ability to customize how the User Control works. For a report, this might mean allowing the user to set the parameters that are passed to the report's selection criteria. The default parameter for the report could be an asterisk (to retrieve all regions) but, through a property, the user could be allowed to supply a specific region.

All that's necessary is to create the property that accepts the region and then add the Personalizable and WebBrowsable attributes to it, as in this example:

Private _region As String = "*"

_
_
Public Property Region() As String
Get
Return _region
End Get
Set(ByVal value As String)
_region = value
RegenerateReport(_region)
End Set
End Property
Adding a personalizable property isn't enough -- you also need to add the controls to the page that let the user set that property. Two controls are required: First you need to add to your page an EditorZone from the WebParts tab of your Toolbox. Then you need to drag a PropertyGridEditorPart into that zone (also from the WebParts tab).

Finally, you need to let the user put the control into Edit mode. To do that, you first need to add a button to the page that adds an Edit choice to the menu control that the WebPart framework adds to your User control. The code for that button looks like this:

Me.WebPartManager1.DisplayMode = WebPartManager.EditDisplayMode
Now, when the user wants to customize the WebPart/User Control, he or she clicks on the button and selects Edit from the menu that appears on the User control. At that point, the PropertyGridEditorPart will appear on the page, populated with a control for every property you've marked as customizable. The user can then enter the values to control the WebPart. ASP.NET's WebPart framework will then save the settings for the next time the user views the page.

Leia Mais…

Wednesday, July 15, 2009

Microsoft Unveils Next Version of Visual Studio and .NET Framework

Microsoft Corp. today provided the first look at the next version of its developer tools and platform, which will be named Visual Studio 2010 and the .NET Framework 4.0. Microsoft described the next release through the following five focus areas: riding the next-generation platform wave, inspiring developer delight, powering breakthrough departmental applications, enabling emerging trends such as cloud computing, and democratizing application life-cycle management (ALM).

Today’s announcement included an in-depth look at how Visual Studio Team System (VSTS) 2010 (code-named “Rosario”) will help democratize ALM with a unique solution that brings all the members of a development organization into the application development life cycle, and removes many of the existing barriers to integration. Additional details on the other focus areas will be disclosed over the product development cycle.

“With Visual Studio 2010 and the .NET Framework 4.0, we are focused on the core pillars of developer experience, support for the latest platforms spanning client, server, services and devices, targeted experiences for specific application types, and core architecture improvements,” said S. “Soma” Somasegar, senior vice president of the Developer Division at Microsoft. “These pillars are designed specifically to meet the needs of developers, the teams that drive the application life cycle from idea to delivery, and the customers that demand the highest quality applications across multiple platforms. You can expect to hear a lot more about Visual Studio 2010 and the .NET Framework 4.0 in the coming months.”

Democratizing Application Life-Cycle Management

Today, much of application development remains siloed throughout the enterprise, leading to decreased productivity and lengthy product development cycles. With VSTS 2010, Microsoft is taking the next step forward in giving individuals and development organizations an advanced solution that enables them to integrate effectively and build and deliver high-quality applications.

This includes new capabilities that make it easier for all contributors on the software team to participate throughout the life cycle — from the core developers and testers to the wider team of project managers, designers and business analysts. Highlights include the following:

• Modeling tools. With VSTS 2010 Architecture, Microsoft will enable both technical and nontechnical users to create and use models to collaborate and to define business and system functionality graphically. The new version supports both Unified Modeling Language and Domain Specific Language support, so development organizations will have the right tool for right job. The new modeling capabilities in VSTS 2010 are a core part of the larger Microsoft modeling platform, which will also include the “Oslo” repository, tools and language.

• Improved efficiency throughout the test cycle. With VSTS 2010, Microsoft has made a significant investment in testing features and dramatically simplifying the tools required to integrate testing across the life cycle. New features include the ability to eliminate nonreproducible bugs, fast setup and deployment of tests to ensure the highest degree of completeness of test, focused test planning and progress tracking, and ensuring that all code changes are properly tested.

• Substantial improvements in collaboration capabilities. Microsoft has made major investments in the capabilities and scalability of Team Foundation Server (TFS) including significant improvements that allow teams to configure and adopt any flavor of Agile development processes. Teams can track and trace work more easily with richer linking of work items enabling hierarchical work item relationships. In the source code management system, TFS now provides visualization tools for tracking changes across branches and into the production build. VSTS 2010 also introduces workflow-based builds that catch errors before they have a chance to affect the rest of the team or, worse, enter production. Finally, administrators will find dramatically simpler TFS deployment and management.


“The application life cycle is an integral part of today’s business. Regardless of core competencies, all organizations are driven by software that is created and customized to deliver a competitive advantage,” said Theresa Lanowitz, founder of voke, inc. “Enterprises that invest in an ALM solution can decrease their total cost of ownership of applications in their IT portfolio, and bring about a global approach that is an integrated and expansive system consisting of people, processes and technology. This global approach to ALM facilitates collaboration and takes the risk out of software development to produce predictable and reliable results for an optimized business outcome. Solutions such as VSTS are poised to take advantage of market opportunity by offering an application life-cycle platform to help enterprises realize this ROI benefit.”

In another move to increase integration across the life cycle, Microsoft also announced that VSTS 2010 will provide a unified VSTS Development and Database product. As a benefit to existing Software Assurance (SA) customers, those who currently own Visual Studio Team System 2008 Development Edition or Visual Studio Team System 2008 Database Edition will receive all the following products starting Oct. 1, 2008, for free:

• Visual Studio Team System 2008 Development Edition

• Visual Studio Team System 2008 Database Edition

• Visual Studio 2005 Team System for Software Developers

• Visual Studio 2005 Team System for Database Professionals


The products will be available to SA customers through their normal Microsoft Developer Network channel. More information can be found at http://www.microsoft.com/licensing/sa.

More information about Visual Studio 2010 and the .NET Framework 4.0 is available at http://www.microsoft.com/visualstudio/2010/overview.mspx.

Founded in 1975, Microsoft (Nasdaq “MSFT”) is the worldwide leader in software, services and solutions that help people and businesses realize their full potential.

Note to editors:If you are interested in viewing additional information on Microsoft, please visit the Microsoft Web page at http://www.microsoft.com/presspass on Microsoft’s corporate information pages. Web links, telephone numbers and titles were correct at time of publication, but may since have changed. For additional assistance, journalists and analysts may contact Microsoft’s Rapid Response Team or other appropriate contacts listed at http://www.microsoft.com/presspass/contactpr.mspx.

Leia Mais…

Monday, July 13, 2009

SQL Function Split Function which Help you to Splite values with Particular Seprator.

Here is the Function of SQL SERVER which Helps you split with special Character and Return Table

USE [Database]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER FUNCTION [dbo].[Split] (@text varchar(8000), @delimiter varchar(20) = ' ')

RETURNS @Strings TABLE
(
Position int IDENTITY PRIMARY KEY,
PositionValue varchar(8000)
)

AS
BEGIN
While (Charindex(@delimiter,@text)>0)
Begin
Insert Into @Strings (PositionValue)
Select Value = ltrim(rtrim(Substring(@text,1,Charindex(@delimiter,@text)-1)))
Set @text = Substring(@text,Charindex(@delimiter,@text)+len(@delimiter),len(@text))
End
Insert Into @Strings (PositionValue)
Select Value = ltrim(rtrim(@text))
Return


-------------------------------------------------------------
You can Use E.G
SELECT Position,PositionValue FROM Split(@DatabaseField,'||')

Leia Mais…

Thursday, July 9, 2009

Trigger For Table when Data Insert ,Update

When we want to Fire some Trigger on Table in Sql server when Data is Insert and Update
Then

1 : First Connect Sql Server
2 : Open Database
3 : Double Click on Table
4 : You can fine Columns,Keys,Constrains,Triggers ETC
5 : Right Click on Triggers then Select New Trigger you can find Template

Then you can modified as Per your Requirement of Trigger Like "Instead of " and After Trigger.

Here is one Example of After Insert,Update Trigger

when ever Data is inserted and Updated in Table the Trigger is Fire on that and Last modified date field in Table and its is Updated when ever Data inserted and Updated in Table


USE [DATABASENAME]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[TRIGGERNAME]
ON [dbo].[TABLENAME]
AFTER INSERT,UPDATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
UPDATE TABLENAME SET TABLEDATEFIELD = GETDATE() WHERE TABLEIDFIELD in (SELECT TABLEIDFIELD FROM INSERTED)


END
In the above example all thing is Generalized like you can enter your Database Name,Table Name ,Table field as you have in table
and More Important thing is that "Inserted " key word is get id last Inserted and Updated record of your Table like Primary key of table...

Leia Mais…

Wednesday, July 8, 2009

How To Access Localhost Application URL Link in another Computer if There LAN Available

Here is One Interesting thing i Found when doing Programming.
if you want to access another Computer Link in your Computer to if LAN is available and if you find error Like internet Explorer could not find Page
Then do Following Steps:
1 : Go To Control Panel
2 : Then Select Windows FireWall
3 : select Tab "Exceptions"
4 : Add Port
5 :In Name write 'iis' or 'Localhost' and In Port numner write '80'

then save the Page
now you can Check the Link is working of another computer Url....
E.g http://ComputerName/ProjectName/PageName.aspx

Leia Mais…

Tuesday, July 7, 2009

To create a Facebook application

I am happy to share new concept of Facebook,you can made application In face book

Before we begin, there are a few things you need to know. In order to create a Facebook application, you should know or need the following:

You should be well versed in PHP or some other coding language — such as Ruby on Rails, JavaScript, or Python — especially one that has a client library for our API.
You need to have a basic understanding of the Internet, SSH, MySQL, and Unix
You need to be familiar with Web hosting fundamentals and have a place to host your application. You can read some fundamentals about hosting

1. First you need to log in to the Facebook Developer application:

Click Here to Login in Facebook developers

After following the link, click “Allow” to let the Developer application access your profile.
2: Begin setting up a new application. Go to the Developer application and click “Set Up New Application”. Give your application a name, check to accept the Terms of Service, then click Submit. You'll see some basic information about your application, including:

Your API key: this key identifies your application to Facebook. You pass it with all your API calls.
Your application secret: Facebook uses this key to authenticate the requests you make. As you can tell by its name, you should never share this key with anyone.



3 :Now we need to configure a few more settings before we can get into the code. Click "Edit Settings". Notice that the support and contact email addresses are pre-populated with the email address associated with your Facebook account.
4 :Enter a callback URL. This is the address where your application lives on your server, or the server where the application is being hosted.
5 :Enter a canvas page URL. A canvas page is the address where your application lives on Facebook. When users access your application on Facebook, they're taken to your canvas page. It's a good idea to use your application name or something similar. It must be at least 7 characters long and include only letters, dashes and underscores.
6 :You want users to be able to put your application on their profiles, so select “Yes” at “Can your application be added on Facebook?”
7 :Believe it or not, this is all we really need to get a simple application ready to go. Click "Save and continue".

Configuring Your Application on Your Host

Before you configure your application on your server, you need to make sure your server is ready to host a Facebook application.

If you're using a hosting service like Joyent, it actually comes with the Facebook PHP client library installed, along with MySQL and memcached
.

If you're not using a hosting service that provides you with a preconfigured environment for Facebook applications, then you need to upload the client library and install MySQL.


Once your host is configured, you can copy the sample code to the server:


1 :Go back to the Developer application, and click the example code link under your application information. You'll see a basic PHP file, but notice that this sample code already includes your application's API key and secret.
2 :Copy the contents of this file and paste it into a file called index.php on your server in the same directory where the Facebook client library resides.
3 :Your application is ready for testing. Go back to a browser and enter your canvas page URL (or click the link in step 3 of the Quick Creation Guide in the Developer application).
4 :You should see a page containing your first 25 Facebook friends.

And that's it. This was a simple demonstration on how to quickly build a Facebook application. It demonstrated some basic Facebook Platform concepts, as well as the Platform API and FBML, Facebook's markup language.
I didn't cover integration points, which is how you can weave your application deeper into Facebook so you can provide your users with a richer experience. Our sample application, Smiley, includes all the integration points. And you can see them explained in

anatomy of a Facebook application

Leia Mais…

Monday, July 6, 2009

Using Java script You can Disabled Table row in asp.net

function disabledTr(id)
{ <--- If any String you send form Server site you can split here and then disable in -->
var tr_array = id.split(",");
for(j= 0;j {

var myTable = document.getElementById(tr_array[j]);
if (myTable != null)
{
var controls= myTable.getElementsByTagName("input");
myTable.disabled ='disabled';
for(i = 0; i < controls.length; i++)
{ control = controls[i];
control.disabled = 'disabled';
}
}
}
}

Leia Mais…

Enable/Disabled and Visible true false Control Using Recursive Functions and any file.

Public Shared Function FindControlRecursive(ByVal Root As Control, ByVal Id As String) As Control
If Root.ID = Id Then
Return Root
End If
For Each Ctl As Control In Root.Controls
Dim FoundCtl As Control = FindControlRecursive(Ctl, Id)
If TypeOf FoundCtl Is HtmlControl Then
FoundCtl = DirectCast(FoundCtl, HtmlControl)
ElseIf TypeOf FoundCtl Is Label Then
FoundCtl = DirectCast(FoundCtl, Label)
ElseIf TypeOf FoundCtl Is CustomValidator Then
FoundCtl = DirectCast(FoundCtl, CustomValidator)
ElseIf TypeOf FoundCtl Is TextBox Then
FoundCtl = DirectCast(FoundCtl, TextBox)
ElseIf TypeOf FoundCtl Is RequiredFieldValidator Then
FoundCtl = DirectCast(FoundCtl, RequiredFieldValidator)
ElseIf TypeOf FoundCtl Is CompareValidator Then
FoundCtl = DirectCast(FoundCtl, CompareValidator)
ElseIf TypeOf FoundCtl Is DropDownList Then
FoundCtl = DirectCast(FoundCtl, DropDownList)
ElseIf TypeOf FoundCtl Is CheckBox Then
FoundCtl = DirectCast(FoundCtl, CheckBox)
End If
If FoundCtl IsNot Nothing Then
Return FoundCtl
End If
Next
Return Nothing

----------------------------------------------------------------------------------------------
Using above function You can find any control having Master Page and also control to convert appropriate contrl.
----------------------------------------------------------------------------------------------
Dim sr As StreamReader
Private Sub SetControlStatus(ByVal FormName As String)
Dim Strings As String()
Dim second As String
Dim first As String
Dim third As String
Dim Fourth As String
Dim line As String
Dim ctrl As Control

'If File.Exists(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) & "\" & FormName & ".cif") Then
If File.Exists(Server.MapPath("Program" & "\" & FormName & ".cif")) Then
' Check to see if the file exists and if not, do not proceed

Try
' Create an instance of StreamReader to read from a file.
'sr = New StreamReader(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) & "\" & FormName & ".cif")
sr = New StreamReader(Server.MapPath("Program" & "\" & FormName & ".cif"))

Do While sr.Peek() <> -1
line = sr.ReadLine()
If Not line Is Nothing Then

Strings = line.Split(" ")
first = Strings(0)
second = Strings(1)
third = Strings(2).ToLower()
Fourth = Strings(3).ToLower()

'For Enable disable controls

If third.Trim.StartsWith("True") Or third.Trim.StartsWith("true") Then
ctrl = FindControlRecursive(Me.Master.FindControl("divContainer1"), first)
Call EnableDisableControls(ctrl, True)

Else
ctrl = FindControlRecursive(Me.Master.FindControl("divContainer1"), first)
Call EnableDisableControls(ctrl, False)
End If

'For Visibility

If Fourth.Trim.StartsWith("True") Or Fourth.Trim.StartsWith("true") Then
ctrl = FindControlRecursive(Me.Master.FindControl("divContainer1"), first)
ctrl.Visible = True
Else
ctrl = FindControlRecursive(Me.Master.FindControl("divContainer1"), first)
ctrl.Visible = False
End If

End If
Loop

If Not trtable = String.Empty Then
Page.ClientScript.RegisterStartupScript(Me.GetType(), "disabledTr", "disabledTr('" + trtable + "' )", True)
End If
sr.Close()
Catch ex As Exception
showError("Reading File", ex.Message)
sr.Close()
End Try
End If
End Sub
------------------------------------------------------------------------------------------------
Using above Function you can Read any control in file Like cif or notpad file if Format of file

ControlName TR True True
and do Process of Unable and Disable Control

-----------------------------------------------------------------------------------------------
Public Sub EnableDisableControls(ByVal ctrl As Control, ByVal val As Boolean)
Select Case ctrl.GetType().ToString()
Case "System.Web.UI.WebControls.TextBox"
Dim txt As TextBox = New TextBox
txt = CType(ctrl, TextBox)
txt.Enabled = val
Case "System.Web.UI.WebControls.Label"
Dim lbl As Label = New Label
lbl = CType(ctrl, Label)
lbl.Enabled = val
Case "System.Web.UI.WebControls.CheckBox"
Dim chk As CheckBox = New CheckBox
chk = CType(ctrl, CheckBox)
chk.Enabled = val
Case "System.Web.UI.HtmlControls.HtmlTableRow"
Dim html As HtmlTableRow = New HtmlTableRow
html = CType(ctrl, HtmlTableRow)
If val = False Then
If trtable = String.Empty Then
trtable = html.ClientID.ToString
Else
trtable = trtable + "," + html.ClientID.ToString()
End If
End If
Case "System.Web.UI.WebControls.DropDownList"
Dim ddl As DropDownList = New DropDownList
ddl = CType(ctrl, DropDownList)
ddl.Enabled = val
Case "System.Web.UI.WebControls.RequiredFieldValidator"
Dim Rfv As RequiredFieldValidator = New RequiredFieldValidator
Rfv = CType(ctrl, RequiredFieldValidator)
Rfv.Enabled = val
Case "System.Web.UI.WebControls.CustomValidator"
Dim cv As CustomValidator = New CustomValidator
cv = CType(ctrl, CustomValidator)
cv.Enabled = val
Case "System.Web.UI.WebControls.CompareValidator"
Dim cov As CompareValidator = New CompareValidator
cov = CType(ctrl, CompareValidator)
cov.Enabled = val
End Select
End Sub
------------------------------------------------------------------------------------------------
from the above function you can find control any in .Net and Enabled and Disabled Controls
------------------------------------------------------------------------------------------------

Leia Mais…
Site Meter