Search This Blog

Wednesday, July 21, 2010

Indian Rupee Font

Finally Indian Rupee got a symbol on July 15 2010 and it is approved by the Indian government. The next step is to get approval from Unicode consortium which will take about 18 to 24 months. Once it is approve by Unicode then everyone will can include in their software.

The design of the new symbol is by Udaya Kumar, a student of the Industrial Design Centre (IDC) at the Indian Institute of Technology Bombay (IITB). It is from Devanagri 'Ra' which represents rupaiah, to appeal to international and Indian audiences. The design is based on the tricolour of the Indian Flag, with two lines at the top and white space in between.

Mangalore-based Foradian Technologies Pvt Ltd has created a font called Rupee_Foradian. It can be downloaded from the company’s blogsite — http://blog.foradian.com — and used for free. Within the hour, the trial version of the font was downloaded 1,100 times. When downloads crossed the 5,000 mark, the company worked on the full version, which it has also made available for free on the site.

How to use the Indian Rupee Symbol Font
1. Download the font which is in the ttf format (Rupee_Foradian.ttf)
2. Install the font or simply copy and paste into the font folder. Windows Vista and Windows 7 users can right click and install the font.


Once installed you can using it by selecting the font to Rupee and use the ~ key to get the symbol on the page.

Sunday, June 20, 2010

Early Binding Vs Late Binding


Early and Late binding



"An object is early bound when it is assigned to a variable declared to be of a specific object type." (Copied from Microsoft's MSDN page):

“Early” binding was when the assignment of memory locations to variables was done by the compiler.

“Late” binding was when the memory location associated with a variable was not determined until the execution time of the program.
An object is early bound when it is assigned to a variable declared to be of a specific object type. Early bound objects allow the compiler to allocate memory and perform other optimizations before an application executes.


For Ex:
Dim Objunknowvar as Object



The above variable is said to be "late bound" because the software doesn't really know what kind value will be store in that object variable until runtime when it's actually used for something.



Dim strMyname as string



The above variable is said to be "Early bound". The variable type is know by the compiler and the memory is allocated for the string.

  • The compiler can find errors that might otherwise cause a runtime Application crash.

  • It makes the application to execute faster since code to type conversion from unknown type to the actual type isn't necessary.

  • Intellisense code completion and Dynamic Help only works with early bound variables.


  • Sometimes we need use late binding. When we use COM object (Excel object model) we need to do the late binding and option strict should be off for the late binding. Early binding will increase the application performance. So better to use the really binding later than late binding. Use late binding wherever necessary.

    Create Setup for windows Application in .net


    How to create Setup for windows Application in .net

    Application once created will have number of associated dll and exe and other project related files and that has to be bundled in single file as MSI file. For that visual studio offers a setup project to do it.
    Assume that we had created application and then we need to add a setup project from the visual studio.

    Here is the first setup to add the setup project to the solution.


    Step 1




    Right click the solution Add New project in the pop window click the other project types and add the Setup Project as show below and rename the name of the setup project and click ok button and it will added in you solution


    Setp2




    Once the Setup project is added to you project. Automatically it will have the application folder, user’s Desktop, User’s Program Menu. We need to add the project output in the application folder. On right click of the application folder and we can add the project output and project will be added to the application folder.

    Right Click the project output and create a short cut and we can add it in User’s Desktop folder and User’s Program menu. So that in program menu after installation the application shortcuts will be shown. If we used any other files apart from the project output right click and browse and add the needed files.


    Step3





    Right click the setup project file and build the setup and it will have the output MSI files in release folder of the Setup.



    Step4





    In VS 2005 it creates "advertised shortcuts" automatically. Shortcut launch the Windows Installer to check whether components are installed before cal ling the shortcut and it will install the components again when the application is installed by a user and opened from other user login. It will be disabled automatically.
    To enable this we need to edit the MSI tables using ORCA tool. ORCA tool is used to edit database. This will be downloaded from Microsoft site from the below location.
    http://msdn.microsoft.com/en-us/library/aa370557.aspx

    We can to this in number of ways



    First method





    While installing the MSI file We need to tell the windows installer to not disable advertised shortcuts. This will cause it to create regular shortcuts instead

    Open the command line

    Run the setup.exe with the below command it will enable

    "setup.exe DISABLEADVTSHORTCUTS"

    Or create a batch file and add this lines in that batch file and on double click of the batch file

    Path of the EXE and DISABLEADVTSHORTCUTS

    Ex:

    C:\justtotest\setup.exe DISABLEADVTSHORTCUTS



    Second method





    Install the ORCA.MSI.

    Orca will show the List of the Tables of MSI file and Click the property table and it will show the property and value in right side window.

    In Right window Right click the last row and click add new row?in property add DISABLEADVTSHORTCUTS in property and add 1 in value

    How to check whether it is correct?

    Click the start button?program files?go the installed application ?right click the application and go to properties and Target text box will be enabled now. Check this before and after this modification.

    Web Service

    Web service




    What is a Web service?

    Web service is to expose the functionality to any other application which is needed independent of language and plat form. Client application can use the service of the web service functionality. Client application may be of any language asp, dot net (windows or web application), java. The only thing is client application has support for SOAP (Simple Object Access Protocol). Soap is to transfer the Data from client to server and return the result to client in XML format. Any platform or language can understand the XML format.

    How to create a web service in .NET

    We can create Web service in windows or in web application. You need to add the web service. .asmx is the extension of the web service.


    The accessibility to provide the features across different platforms that are developed using different languages, and can be used by any remote application, over the internet, etc.., makes the web service more useful at times by means of providing the user only the specific and relevant information, avoiding the accessibility to resources that have to be securely maintained.

    Web Services comprises of the following main aspects that are included,

    1.XML Web Services: The communication between the service and the application is through a standard format called XML (eXtensible Markup Language) which is universal and is accepted on any platform across the distributed network.

    2.WSDL (Web Service Description Language): It consists of the description about the web service, which is basically a file with .wsdl extension that you can find in your application folder. It includes the information about the namespace of the xml file which is the tag . it also holds the description of the elements that the service consists of and also the information relevant to the parameters supplied.

    3.SOAP (Simple Object Access Protocol): SOAP is a protocol that by means of which Web Services is enabled; it is the format that is acclaimed universally due to its nature of standardization and rules that it implements. The inter-communication in web services uses SOAP for the efficient communication.

    4.UDDI (Universal Discription, Discovery and Integration): UDDI is specifically a governing body that monitors the publication and discovery of the web services implementation with respect to message communication between the application and also at the enterprise level.

    5.IIS(Internet Information Server for MicroSoft Visual Studio .Net) : It is the core aspect in web technology which deals with the Client/Server model, as the web service is a module available throughout the web for usage. Whenever a client sends the request to find the web service to the UDDI , the UDDI in turn contacts the web server IIS(for Dot Net) and the discovery, description of the web service is returned after which the client sends a request to consume the web service.

    A simple Example to create a Web Service:

    Service Application

    From the Visual Studio .net IDE select the file--> new --> project, select Visual C# projects from the Project Types and Select an ASP.NET Web Service from the templates available and name it as addnumservice. The extension of web service is of type .asmx file, change the name of the service.asmx page as ‘testservice.asmx’ or as per the naming convention that you are accustomed to but do adopt to a format.

    Now your service application is ready to be coded for depending on your requirements. Now in the window pane select the ‘click here to switch to code view’ and you are taken to the code-behind file where you can write your code.

    In the attribute [WebMethod] you can see a default simple method that is used to display a simple text “Hello World” , using the [WebMethod] attribute the code for your service is included,

    Write the function for the above discussed web service method that is shown as below. In the Web method code include the following content,




    [WebMethod]
    public int add(int a,int b)
    {
    return (a+b);
    }



    Now that, your have written your method, the project needs to be built. To do that right click on your project name and from the context menu available select the build option which will complete your service method creation.

    Client Application

    This is the application that invokes the Web Service that is defined above.

    Create a new project, select Visual C# Projects from the Project Types and select an ASP.NET Web Application from the Templates available and name it as clientusingwebservice or as per your convenience.

    Your web form should consists of two textbox controls for accepting the values from the user, two label controls for naming against the textboxes, a button control and a label control to display the message.

    Now specify the relevant control ID’s naming as per your convenience and then the most important thing, in the Solution Explorer right-click on the References folder that you can find and select the Add Web Reference option. A Dialogue box pops up where you can find the list of options related to the repository of the web services, select the option ‘Web services on the local machine’ after clicking on the link you are displayed with all the services currently available on the local machine. Select the relevant service that you want to include onto your application, in our example it being the ‘testservice’.

    Next follows the code that is included in the application that has to use the service, for this create an object of the service type and by using that object we call the method that is present in the service, as shown below;


    write this code just above the Page_Load method.



    //creating an object for the service that has to be called for


    clientusingservice.localhost.Service1 serviceobj=new clientusingservice.localhost.Service1();

    private void Page_Load(object sender, System.EventArgs e)
    {
    // Put user code to initialize the page here
    }



    And now for the Button click event from where you will perform the addition of two numbers accepted from the textboxes through the method in the service will be written, code as follows;



    private void btnadd_Click(object sender, System.EventArgs e)
    {
    int sum;
    sum=serviceobj.add(int.Parse(txtnum1.Text),int.Parse(txtnum2.Text));
    lblmsg.Text="Addition performed using service" +a;
    }



    Now you are ready to use and see the working of the web that you have created by following the procedure as mentioned above build the solution and press F5 to view the results.


    Theme and skins in asp.net





    Theme is a collection of properties of pages, CSS (cascading style sheets), Skins etc. We can define the properties of the page controls in a skin file and then we can refer the properties for the page web server controls. A theme can be used for the web server controls in order to make the consistent look and feel across your web application.



    In earlier version of the Asp.net 1.0 or 1.1 we need to create a Cascading style sheets and then refer we can refer the CSS in a page.

    A skin is file with Extension as .skin and it contains the properties for a web server control that is used in web sites.

    The advantage of using the Skin file we can define the different properties of a web server control and we can apply to all the controls in a page to give a consistent look to the pages.



    Difference between a skin and CSS

    Cascading style sheet and the skin are similar. That can be used for applying the properties to all the controls in a page that are defined in a skin or css.

    Theme can be not only used for the style attributes it can be use to define a template for a control.

    Themes include Graphics, template for controls

    Only one theme can be applied to a page. We cannot include any number for CSS file in a page.



    Steps to create and include a theme in a page

    Create a folder App_themes in your solution and then In Solution Explorer, right-click the name of your theme folder and then click add new item and then select the skin file.

    Then we can add the define the properties of the then like below
    Here the Class =”asp_label” is defined in a class file











    Now we had defined the Properties for the controls

    We need to include the theme file in the page like below




    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs"
    Theme="Mytheme" Inherits="_Default" %>




    Now all the labels and textbox in this page will have the common property which will be defined in the Skin and class file