Tuesday, July 17, 2012

Hide/Show Div With Smooth Effect.

Hi  i am  giving you  one example to show  and hide  div with smooth effect .

My html Code:

<div id="done" style="display:none;">
write content here
</div>
My Java Script Code
<script>

 $('#done').fadeIn('slow');

                setTimeout(function () {
                    $('#done').fadeOut('slow');
                }, 2000);
</script>








Happy  Coding

Wednesday, July 11, 2012

How to Define action Link Using Areas In MVC

Hi..

I  am  giving  one example to  define Action Link Url Using Multiple Areas..

I am  using two areas with Name
a) Control
b) System
.

 
  • @Html.ActionLink("Main Home", "Index", "Home", new { Area = "" }, null)

  •  
  • @Html.ActionLink(" Control Home", "Index", "ControlHome", new { Area = "Control" }, null)

  •  
  • @Html.ActionLink(" System Home", "Index", "SystemHome", new { Area = "System" }, null)





  • Happy  Coding

    Monday, July 9, 2012

    Import Excell,csv file into Linq

    I  have csv file with name infocontext,  having two fileds

    1.Alies
    2. ShortDesc

    Now i  am  importing My Excel data from csv file to database using Linq  (Entity Framework in MVC3)

    I  have table Infocontext

    1. Create properties of class for Table

    --->
     public class InfoContext
        {
                         public string Tag { get; set; }
                         public string Alias { get; set; }
         }

    2.  Now Write this Method

     public ActionResult ImportCSV()
            {
              // Object of My Class
     InfoContext Dtinfo = new InfoContext();


               // Import  data  from csv file
     var dataImport = System.IO.File.ReadAllLines(Server.MapPath("~/Areas/Cataloging/infocontext.csv"));
                
                for(int i=0;i<=dataImport.Length;i++)
                {

                 // Split data from Excel by  column
                    string[] word = dataImport[i].Split(',');
                    for(int k=0;k<=word.Length-1;i++)
                    {


                        Dtinfo.Alias = word[0];
                        Dtinfo.ShortDesc = word[1];
                         db.InfoContext.Add(Dtinfo);  // Saving data  by  code  first tech. you can write your own method to save data

                        db.SaveChanges();
                    }
                }

                return View();


            }


    Data  is   Saved..

    Happy Programing

    Saturday, June 9, 2012

    Google Map in 3d

    Now  explore   your  Maps View  in 3d  with  New  Google 3d Map 6.0.

    Features
    • Tilt
    • Rotate
    • Compass Mode
    • Smooth Zooming
    • Offline Reliability 
    • Offline Building  and Rerouting
    Source :  Google.com

    Friday, June 8, 2012

    Write a program to list files in the current working directory depending upon a given pattern.?


    ♣♣♣ WRITE A PROGRAM TO LIST FILES IN THE CURRENT WORKING DIRECTORY DEPENDING UPON A GIVEN PATTERN. ♣♣♣


      import java.lang.*;
      import java.io.*;

      class pro15
    {
      public static void main(String ar[]) throws IOException
            {
                                        InputStreamReader a=new InputStreamReader(System.in);
                                        BufferedReader b=new BufferedReader(a);
                                        System.out.print("\n\tEnter the Directory Name : ");
                String s=b.readLine();
                File f=new File(s);
                if(f.exists())
                {
                            if(f.isDirectory())
                            {
                            String []f1=f.list();
                            int i;
                                        for(i=0;i
                                        {
                                        String tp=f1[i];
                                        if(tp.endsWith("java"))
                                        System.out.println("\n\t\t"+tp);
                                        if(tp.endsWith("class"))
                                        System.out.println("\n\t\t"+tp);
                                        }
                            }
                 }
            }
    }


    OUTPUT :-
                                       
                            Enter The Directory Name : d:\

                                        Test.java
                                        Test.class
                                        Abc.java
                                        Abc.class
                                        Applet2.java

    Write a program to get a file name at run time and display number of lines and words in that file.?


    ♣♣♣ WRITE A PROGRAM TO GET A FILE NAME AT RUN TIME AND DISPLAY NUMBER OF LINES AND WORDS IN THAT FILE. ♣♣♣


    import java.lang.*;
    import java.io.*;

    class pro14
    {
            public static void main(String ar[]) throws IOException
            {
            InputStreamReader a=new InputStreamReader(System.in);
            BufferedReader b=new BufferedReader(a);
            int lines=0,words=0;
            System.out.print("\n\tEnter The File Name : ");
            String s=b.readLine();
            File f=new File(s);
            InputStreamReader in=new InputStreamReader(new FileInputStream(f));
                            StreamTokenizer st=new StreamTokenizer(in);
                                                                            st.wordChars(0,255);
                                            st.whitespaceChars(0,' ');
                                            st.eolIsSignificant(true);
                                            while(st.nextToken()!= st.TT_EOF)
                                            {
                                                    if(st.ttype==st.TT_EOL)
                                                                lines++;
                                                    if(st.ttype==st.TT_WORD)
                                                        words++;
                                            }
                 System.out.println("\n\tNumber of Lines : "+lines+"\n\t Number of words : "+words);

            }
    }


    OUTPUT :-
                                       
                            Enter The File Name : c:\test.txt
                           
                            Number of Lines : 0
                            Number of Words : 2

                            Enter The File Name : c:\hook.log
                           
                            Number of Lines : 238
                            Number of Words : 357

    Write a program to copy a file to another file using java.io package classes. Get the file names at run time and if the target file existed then ask confirmation to overwrite and take necessary actions.?


    ♣♣♣ WRITE A PROGRAM TO COPY A FILE TO ANOTHER FILE USING JAVA.IO PACKAGE CLASSES. GET THE FILE NAMES AT RUN TIME AND IF THE TARGET FILE EXISTED THEN ASK CONFIRMATION TO OVERWRITE AND TAKE NECESSARY ACTIONS. ♣♣♣

    import java.lang.*;
    import java.io.*;

    class pro13
    {
            public static void main(String ar[]) throws IOException
            {
                   InputStreamReader a =new InputStreamReader(System.in);
                   BufferedReader b=new BufferedReader(a);
                    int i;
                    FileInputStream fin=null;
                    FileOutputStream fout=null;
                    String filename=null;
                    try
                    {
                            System.out.print("\n\tEnter the file name to copy to another file : ");
                            filename=b.readLine();
                            try
                            {
                                    fin=new FileInputStream(filename);
                            }
                            catch(Exception e)
                            {
                                    System.out.println("\n\tFile Not Found");
                                    return;
                            }
                            try
                            {
                                    System.out.print("\n\tEnter the file name to copy : ");
                                    filename=b.readLine();
                                    fout=new FileOutputStream(filename);
                            }
                            catch(Exception e)
                            {}
                    }
                    catch(Exception e)
                    {}
                    try
                    {
                            do
                            {
                                    i=fin.read();
                                    if(i!=-1)
                                    fout.write(i);
                            }while(i!=-1);
                           
    System.out.println("\n\tFile copied to "+filename+" Sucessfully");
                    }
                    catch(IOException e)
                    {
                            System.out.println("\n\tFile Error");
                    }
                    fin.close();
                    fout.close();
            }
    }


    OUTPUT :-
                                       
                            Enter the file name to copy to another file : c:\test.txt
                           
                            Enter the file name to copy : c:\hello.txt

                            File copied to c:\hello.txt successfully

                           
                            Enter the file name to copy to another file : c:\tests.txt
                            File Not Found