Yahoo! updates their browser toolbar for Mozilla Firefox

Yahoo! updates their browser toolbar for Mozilla Firefox

Just days after Google updated their search toolbar for the Internet Explorer web browser; Yahoo! has released an updated version of their toolbar for the Mozilla Firefox browser. The new toolbar comes as an extension for the Firefox browser and brings better integration with the various Yahoo! services.

The Yahoo! Toolbar for Mozilla Firefox is offering capabilities to interact with Yahoo! services directly from right clicking on a webpage. Users can now send web page details to their buddies on Yahoo! Messenger, Blog about the page on Yahoo! 360 and even add them to their Yahoo! My Web service.

The company also added some new functionality to their My Web 2.0 personal portal, which is currently running under beta testing. The homepage provides access to user’s three most recently saved Web pages, and the ability to search pages saved by everyone on the network. However, the feature we like the best about it is the integration of an AntiSpyware utility in the toolbar itself, which helps the user to scan their systems for any malware presence.

Checkout: Yahoo! Toolbar for Mozilla Firefox

ASP.net 2.0 fundamental part 2

The Common Type System (CTS)

A number of types are supported by the CLR and are described by the CTS. Both value types are supported—primitive data types and reference types. The primitive data types include Byte, Int16, Double and Boolean while Reference types include arrays, classes and object and string types. Reference types are types that store a reference to the location of their values. The value is stored as part of a defined class and is referenced through a class member on the instance of a class.

User defined value types and enumerations are derived from the value types mentioned above.

Language compilers implement types using their own terminology.

The process of converting a value type to a reference type and vice versa is called boxing and unboxing. The implicit conversion of a value type to a reference type is referred to as boxing. The explicit conversion of an object type into a specific value type is referred to as unboxing.

The Common Language Infrastructure (CLI)

A subset of the .NET framework is the CLI. The CLI includes the functionality of the Common Language Runtime and specifications for the Common Type System, metadata and Intermediate language. A subset of the Framework Class Library incorporates the base class library, a Network library, a Reflection library, an XML library and Floating point and Extended Array Library. The shared source implementation of the CLI is available for both the FreeBSD and Windows operating Systems.

The Common Language Specification (CLS)

The CLR supports the CLS which is a subset of it. Additionally the CLR supports a set of rules that language and compiler designers follow. It provides robust interoperability between the .NET languages and the ability to inherit classes written in one language in any other .NET language. Cross language debugging also becomes a possibility in this scenario. It must be noted that the CLS rules apply only to publicly exposed features of a class.

Classes

A blueprint of an object is called a class. All definitions of haw a particular object will be instantiated at runtime, its properties and methods and storage structures are defined in the class. Classes are used by developers for creating instances of the class at runtime using the keyword “New”.

Namespaces

This is the key part of the .NET Framework. It provides scope for both preinstalled framework classes and custom developed classes. Vb.NET uses the “Imports” keyword to enable the use of member names from the namespace declared. C# uses the “using” keyword. In both cases the System Namespace is also imported so that the Console window can be written without explicitly referring to the System.Console.

Assemblies

Assemblies are also known as managed DLLs. They are the fundamental unit of deployment for the .NET platform. The .NET framework itself is made of a number of assemblies. An assembly contains the Intermediate language generated by the language compiler, an assembly manifest, type metadata and resources. They can be private or public. They are self describing and hence different versions of the same assembly can be run simultaneously.

Intermediate language (IL)

This is a processor independent representation of executable code. It is similar to assembly code and specific to the CLR. It is generated by the language compilers that target the CLR. At runtime, the CLR just-in-time compiles the IL to native code for execution. The tool ngen.exe which is part of the .NET framework pre-compiles assemblies to native code at install time and caches the precompiled code to the disk.

Managed execution

This refers to code whose execution is managed by the CLR. It includes memory management, access security, cross-language integration for debugging and exception handling etc. These assemblies are required for the creation of metadata on the code and the assemblies so that the CLR can manage the execution of the code.

Manifests, Metadata and Attributes

 

Metadata and manifests are key aspects of managed code execution. The portions of an assembly that contains descriptive information about the types contained in the assembly, the members exposed by the assembly and the resources required by the assembly are called manifests. Metadata is contained within the manifest. This metadata describes the assembly and some of it is generated by the language compiler at compile time. Other metadata may be added by the developer at design time. Declarations added to the code to describe or modify some aspect of the code’s behavior at runtime are known as Attributes. These are stored with an assembly as metadata. They serve many useful purposes in the .NET Framework

Object Orientation in the .NET Framework

Objects are the core of Object oriented programming. Classes are blueprints of objects and contain all the methods and properties of the object. Encapsulation, inheritance and polymorphism are attributes of an object. Encapsulation means the ability of an object to hide its internal data from outside view and allow access to only that data that is publicly available. Inheritance is the ability to derive one class from another.

New classes can be created from existing classes and the new class inherits all the properties and methods of the old class and new methods and events can be added to the new class. This is useful when users want to create specialized classes. Polymorphism is the ability of multiple classes derived from the same base class to expose methods in the same name, regardless of the underlying process of implementation.

Rapid Development and Reuse

The object orientation of the .NET Framework provides for faster development and deployment of applications. The use of classes, derived classes to provide common functionality has gone a long way in reducing development time. Object orientation is also the crucial element in the development of the code-behind concept and the latest code beside concept. Code behind allows developers to separate executable code form the HTML markup of the user interface. The executable code is placed in a module called code behind file. This file contains a class that inherits from the Page class. The ASP.NET page inherits from code-behind class and the two are compiled at runtime into a single executable assembly.

The BETA 2.0 has added a number of functionalities to aid in rapid development. We will be looking at these changes in the next unit “What’s new in BETA 2.0”

Choosing a Language

An important aspect of the .NET framework is that developers can continue to use the language of their choice in application development. The cross language interoperability in .NET makes it possible to create an application in any .NET supported language as all languages will work together smoothly using the CLR which translates all languages into Intermediary language.
 

Asp.met 2.0 Fundamental

.NET framework is a Windows Component that supports the building and running of windows applications and XML Web services. The purpose of the component is to provide the user with a consistent object oriented programming environment whether the code is stored locally or remotely.

 

 

It aims to minimize software deployment and versioning conflicts and also promote safe execution of code including codes executed by trusted third parties. It is directed towards eliminating performance problems of scripted or interpreted environments. The effort is to make developer experience consistent across a variety of applications and platforms and create communication standards that help .NET framework applications integrate with all other web based applications.

The .NET framework has two major components– The Common Runtime (CLR) and the Class Library

The CLR is the foundation upon which the .NET Framework has been built. The runtime manages code at execution time and provides all the core services such as memory management, thread management and remoting. It also enforces strict type safety and ensures code accuracy in order to provide security and robustness to the applications. This capability to manage code at runtime is the distinguishing feature of the CLR. All code that is managed by the CLR is known as managed code while other codes are known as unmanaged code.

CLR Features

1. CLR manages memory, thread execution, code execution, compilation code safety verification and other system services.

2. For security reasons, managed code is assigned varying degrees of trust based on origin. This prevents or allows the managed component from performing file access operations, registry access operations or other sensitive functions even within the same active application.

3. The Runtime enforces code robustness by implementing strict type and code verification infrastructure called Common type System (CTS). The CTS ensures that all managed code is self describing and all Microsoft or third party language compiler generated codes conform to CTS. This enables the managed code to consume other managed types and enforce strict type fidelity and type safety.

4. CLR eliminates many common software issues like handling of object layout, references to objects and garbage clearance. This type of memory management prevents memory leaks and invalid memory references.

5. The CLR also accelerates developer productivity. The programmer is free to choose the language of the application without worrying about compatibility and integration issues. He is also enabled to take advantage of the runtime and the class library of the .NET Framework and also harvest components from other applications written in different languages by different developers. This implicitly eases the process of migration.

6. Though CLR aims to be futuristic software, it lends support to existing applications. The interoperability between the managed and unmanaged codes makes this process extremely simple.
7. The design of the CLR is geared towards enhancing performance. The Just-in-time (JIT) compiling enables managed code to run in the native machine language of the system executing it. During the process the memory manager removes the possibilities of fragmented memory and increases memory locality-of-reference to enhance performance.

8. Finally, server side applications can host runtime. High performance servers like Microsoft SQL Server and Internet Information Services can host this CLR and the infrastructure so provided can be used to write business logic while enjoying the best benefits of enterprise server support.

The Class Library is an object oriented collection of reusable types. It is comprehensive and the types can be used to develop command line applications or GUI applications such as Web forms or XML Web services. Unmanaged components that load CLR into their processes can be hosted by the .NET Framework to initiate the execution of managed code. This creates a software environment that exploits both the managed and unmanaged codes. The.NET Framework also provides a number of runtime hosts and supports third party runtime hosts

Uploading a Filein .net

File Upload has always been a tedious task in ASP. This is due to the encryption type of the form used to submit the file from the clientÂ’s browser. It was a complex task to receive such files on the server side using ASP. Data had to be retrieved as a safe byte array and decrypted before it could be used. Most of the people resorted to 3rd party DLL’s, a few wrote their own DLL’s and some even wrote purely ASP solutions to this problem using VBScript. Fortunately, .NET Framework made uploading files very easy. This can be done with a few lines of code in ASP.NET.

This short tutorial teaches how to add file upload functionality to your ASP.NET page

1. Create an ASP.NET project.

2. Add a web form to the project.

3. Go to the HTML code and change enctype attribute of the form tag to “multipart/form-data”. (We need to do this as we are using HTMLinput control to upload the file from the clients machine)

4. Create an Input box of type FILE.


5. Add a button control to the form and call btnUpload_Click method in the click event.


6. Create a method called btnUpload_Click either in the code behind or in the aspx file and include the following code.

C# code

if (txtUpload.PostedFile !=null)  {        //Get the file name from the client machine       string fileName = txtUpload.PostedFile.FileName.Substring                       (txtUpload.PostedFile.FileName.LastIndexOf("\\") + 1);          //Get the size of the file       int fileSize = txtUpload.PostedFile.ContentLength;        //Get the type of the file       string fileType = txtUpload.PostedFile.ContentType;        if (fileSize 
VB.NET Code
if not txtUpload.PostedFile =nothing then       'Get the file name from the client machine       Dim fileName as string = txtUpload.PostedFile.FileName.Substring                         (txtUpload.PostedFile.FileName.LastIndexOf("\\") + 1);       'Get the size of the file       Dim fileSize as int = txtUpload.PostedFile.ContentLength       'Get the type of the file       Dim fileType as string = txtUpload.PostedFile.ContentType       if fileSize 
7. The above code is pretty much self-explanatory but do remember to set write permissions on the upload folder.

8. Here is the C# source code for this article.
     void btnUpload_Click(object sender,EventArgs e)     {           if (txtUpload.PostedFile !=null)           {                 string FileName = txtUpload.PostedFile.FileName.Substring                              (txtUpload.PostedFile.FileName.LastIndexOf("\\") + 1); 	        int FileSize = txtUpload.PostedFile.ContentLength; 	        string FileType = txtUpload.PostedFile.ContentType; 	        if (FileSize Upload failed "); 	        else 	        { 	              txtUpload.PostedFile.SaveAs(Server.MapPath(".\\" + FileName)); 	              Response.Write("File uploaded successfully"); 	              Response.Write("
Details"); 	              Response.Write("
File Name: " + FileName); 	              Response.Write("
File Type: " + FileType); 	              Response.Write("
File Size: " + FileSize.ToString()"); 	        }           }     }                         Upload example                                 
File upload
 
//part twoooooooooooooooooooooooooooooooooooooooooooooooooooo
 
In Part I, we learned how to upload a single file using ASP.NET. In this part, we are going to learn about how to upload multiple files. Instead of using txtUpload.PostedFile.SaveAs just like we did in the previous article, we loop through the Request.Files collection to save one file at a time.

Here are the steps:

1. Create as many input fields of type “FILE” as you want.
Select files to upload:

2. Create a method called UploadFiles_Click and add the following code.

C#

void UploadFiles_Click(Object sender, EventArgs e) {    String result = "";    String fileName;    HttpPostedFile file;    int i = 0;     //Loop Through the Files    for(i = 0; i = 1)       {          //Get the name of the file		          fileName = file.FileName.Substring(file.FileName.LastIndexOf("\\") + 1); 			 	 //Save each uploaded file to the folder where the aspx file exists 	 file.SaveAs(Server.MapPath(".\\" + fileName)); 	 	 result += Server.MapPath(".\\" + fileName) + "Uploaded File: " +               file.FileName + " of type " + file.ContentType + "
";        }    }     if(result == "")    {       result = "Please select atleast one file";    }     //Hide the Panel    PanelUploadMultipleFiles.Visible = false;    Message.Visible = true;    Message.Text = result; }

VB.NET

Sub UploadFiles_Click(ByVal sender as Object, ByVal e as EventArgs)    Dim result as String    Dim filename as String    Dim file as HttpPostedFile    Dim I as Integer = 0     ‘Loop Through the Files    For i = 0 to Request.Files.Count - 1       ‘Get the HttpPostedFile	       file = Request.Files(I)        ‘Check that the File exists has a name and is not empty			       If not (file is nothing or file.FileName = "" or file.ContentLength