Saturday, October 22, 2011

How to learn?


Learning mainly depends upon Environment. In which environment you are leaving, that totally tell about effectiveness of Learning. If you are leaving between good students, good teachers, good parents, good social people then you must be also good.
                                         Whats the definition of Good? You don't Know. You know, ask yourself

Good Students Behavior:


Good Teacher Behavior:


There are no good environment then how to create?
These are the brief:
1) Open an institution where you teach the people, take work from people, prepare for coming challenges and so on.

Open an restaurant, where you provide good food with same prices as ordinary restaurant. Mainly aim to open this restaurant to teach people how to behave.


Monday, October 17, 2011

Accessing Server Controls Using JavaScript

Suppose you have a Web server control called TextBox in your Web page:

<asp:TextBox id="Test" Text="Sample" runat="server">
You can access this value in a couple ways using JavaScript:
  1. 
    document.getElementById('<%=Test.ClientID%>').value;
    
    ClientID - server control identifier generated by ASP.NET
    
  2. 
    document.forms[0]['Test'].value;
     
     
    Note: Copy - Paste from this site http://www.devx.com/tips/Tip/28332
    

Saturday, October 15, 2011

Friday, October 14, 2011

Find IP Address Location

Get information from this site
http://whatismyipaddress.com/ip-lookup  : Give IP address and click on Lookup IP Address button. You will get IP information like ISP, Service Type, Country, State, City etc.

You can also visit this site http://whois.arin.net . In this site, after giving IP address, you will find 'organization name' who provides ip for ISP in Aisa. And you can get further details that organization website.

Also read these articles
http://whatismyipaddress.com/geolocation-accuracy  
http://whatismyipaddress.com/geolocation-providers

Send Mail with attachment in ASP.Net

Use below code for sending mail with attachment:

            SmtpClient smtpClient = new SmtpClient();
            NetworkCredential basicCredential = new NetworkCredential("UserName", "Password");
            smtpClient.Host = "SMTP Server";
            smtpClient.Port = 25;
            smtpClient.UseDefaultCredentials = false;
            smtpClient.Credentials = basicCredential;

            MailMessage message = new MailMessage();
            message.From = new MailAddress("Sender mail address");

            String[] ToAddress = TextBox1.Text.Split(','); //TextBox1 contains Receiver Mail addresses separated by comma
            for (int i = 0; i < ToAddress.Length;i++)
                message.To.Add(new MailAddress(ToAddress[i]));
          
            message.Subject = TextBox3.Text;
            message.IsBodyHtml = true;
            message.Body = TextBox2.Value;

            //----------------------------1 (Attachment: Data Text File where Data Fetching From database)
            //Get some binary data
            //byte[] data = GetDatabaseData();//User Defined Function
            ////save the data to a memory stream
            //System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
            ////create the attachment from a stream. Be sure to name the data with a file and
            ////media type that is respective of the data
            //message.Attachments.Add(new Attachment(ms, "example.txt", "text/plain"));
            //Should be Dispose/close MemoryStream 'ms' after sending the mail


            //----------------------------2 (Attachment: Excel File Which is already exist in the server)
            // Specify the file to be attached and sent. This example assumes that a file named Data.xls exists in the current working directory.
            //string file = "data.xls";
            //// Create  the file attachment for this e-mail message.
            //Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
            //// Add time stamp information for the file.
            //ContentDisposition disposition = data.ContentDisposition;
            //disposition.CreationDate = System.IO.File.GetCreationTime(file);
            //disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
            //disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
            //// Add the file attachment to this e-mail message.
            //message.Attachments.Add(data);
            //Should be Dispose 'data' file after sending the mail


            //---------------------------3 (Attachment: Client attached the file)
            // Check to see if file was attached
            if (File1.PostedFile != null)
            {
                // Get a reference to PostedFile object
                HttpPostedFile myFile = File1.PostedFile;
                // Get size of uploaded file
                int nFileLen = myFile.ContentLength;
                // make sure the size of the file is > 0
                // Allocate a buffer for reading of the file
                byte[] myData = new byte[nFileLen];
                // Read uploaded file from the Stream
                myFile.InputStream.Read(myData, 0, nFileLen);
                //save the data to a memory stream
                System.IO.MemoryStream ms = new System.IO.MemoryStream(myData);
                //create the attachment from a stream. Be sure to name the data with a file and
                //media type that is respective of the data
                String extension = System.IO.Path.GetExtension(myFile.FileName);
                if (extension == ".exe")
                {
                    Label1.Text = "Execution File Not Allowed";
                    return;
                }
                else if (extension == ".pdf")
                    message.Attachments.Add(new Attachment(ms, myFile.FileName,               System.Net.Mime.MediaTypeNames.Application.Pdf));
                else if (extension == ".zip")
                    message.Attachments.Add(new Attachment(ms, myFile.FileName, System.Net.Mime.MediaTypeNames.Application.Zip));
                else
                    message.Attachments.Add(new Attachment(ms, myFile.FileName, System.Net.Mime.MediaTypeNames.Application.Octet));
            }

            try
            {
                smtpClient.Send(message);
                Label1.Text = "Successfully Sent";
            }
            catch (Exception ex)
            {
                //Error, could not send the message
                Label1.Text = ex.Message;
            }

Free SMS API

Go to this Site http://www.freesmsapi.com/users/registration?ref=rdenterprisespl.co.in 
 Register yourself. You will get the connection string, from which you will able to send SMS.

Note: You should have registered domain.

Wednesday, October 12, 2011

Need to Change

Here we mention some points which i want to change in the society:-

1) From childhood, we are competitive with other child. Its good but not all the time. It means When you play against a team then competition is good. But When you play in a team, then competition with another member of team that's not good. Because if you take the nature of competition with own team member then might be happen you will not share good things to team member which will help them to improve. Which will effect the team output. Lets take another example: Go to your childhood, Think about your study procedures and attitude. We competitive with class fellow i.e, we doesn't share the things at exam time which will make benefit to him. We don't do group study. We don't discuss to any study related topics. We don't short out the study problem with the help of others. Because this is not teach by our teachers to us. I think there's need to change the procedures of teaching. These steps should be take up:

i) Should be create an environment and develop attitude in child that they study together, put the view on topic, discuss on topic,  solve the problem with the help of each other, also arrange the classes where they take the classes of junior student, and also take the involvement in checking the exam paper of junior students.You need to make responsible child, confident child i.e, he can able to carry any challenge whenever comes. Firstly your motive should be clear that grooming the child personality, not only study. And in the study, should have develop the tendency that he can learn himself. (Because every thing is written in the book, Video tutorial. He need to just follow that.)
                                          Specially I will mention Teacher should do the work on Student's math and make it strong because that increase lots of confidence in student. You will see which students are good in math, they are good in other subjects also why? I don't know. Therefore I am saying from the childhood, we need to focus on child's math.

Saturday, October 8, 2011

Kruti Dev Hindi Font to Unicode

Go to this Site:

http://www.infowebservices.in/hindi/

From this site, you can also convert Kruti Dev to English , English to Hindi unicode

There is missing English to Kruti Dev in above site.

You can find out Unicode to Kruti Dev in below site:

http://rajbhasha.net/drupal514/UniKrutidev+Converter


In below site, you can convert English to Hindi in same texbox

http://www.tamilcube.com/translate/hindi.aspx

In above site, you can also find the links of different converters which convert English to other languages.

List of Hindi Unicode like &#2309; -> अ --> a

http://wjsn.home.xs4all.nl/hindi.htm


When you write in english for converting Hindi-Unicode, you can also see the unicode syntax from this site:
http://vikku.info/indian-language-unicode-converter/hindi-unicode-converter.html 


a website named as http://uh.learnpunjabi.org/ this web facilated to convert Hindi language to Urdu and also convert Urdu to Hindi Language.

Monday, October 3, 2011

Find out sheet name from Excel in c#

JavaScript Calender Control

 Follow this link:

https://engineering.purdue.edu/ECN/Support/KB/Docs/JavascriptCalendar

Above calender format is mm-dd-yyyy. If you want format dd-mm-yyyy then you need to do little bit following changes in javascipt file:

1) In function setDate(year, month, day),

Replace 
      var dateString = month+"-"+day+"-"+year;
with
     var dateString = day+"-"+month+"-"+year;

2) In function show(field)

Replace
        selectedMonth = parseInt(dateParts[0],10);
        selectedDay = parseInt(dateParts[1],10);
 with
        selectedDay = parseInt(dateParts[0],10);
        selectedMonth = parseInt(dateParts[1],10);

Excel reading through Microsoft Excel 11.0 Object Library in c#

Use Below Code:

using Microsoft.Office.Interop.Excel;

string Path = @"c:\test.xls";
         // initialize the Excel Application class
            Microsoft.Office.Interop.Excel.ApplicationClass app = new ApplicationClass();


        // create the workbook object by opening the excel file.
            Microsoft.Office.Interop.Excel.Workbook workBook = app.Workbooks.Open(Path,
                                                      0,
                                                      true,
                                                      5,
                                                      "",
                                                      "",
                                                      true,
                                                      Microsoft.Office.Interop.Excel.XlPlatform.xlWindows,
                                                      "\t",
                                                      false,
                                                      false,
                                                      0,
                                                      true,
                                                      1,
                                                      0);
         // get the active worksheet using sheet name or active sheet
            Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)workBook.ActiveSheet;


         int index = 0;


         // This row,column index should be changed as per your need.
         // i.e. which cell in the excel you are interesting to read.
         object rowIndex = 2;
         object colIndex1 = 1;
         object colIndex2 = 2;


         try
         {


             while (((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2 != null)
            {
               rowIndex = 2+index;
               string firstName = ((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, colIndex1]).Value2.ToString();
               string lastName = ((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, colIndex2]).Value2.ToString();
               MessageBox.Show(firstName+"    "+lastName);


              index++;


           }
         }
         catch(Exception ex)
         {
            app.Quit();
            Console.WriteLine(ex.Message);
         }

Copy from this  http://www.codeproject.com/KB/cs/Excel_Application_in_C_.aspx

File Upload with ASP.Net


Follow this link you get the answer:
http://www.codeproject.com/KB/aspnet/fileupload.aspx#security

I did little correction in the downloaded code to execute in VS 2005:

1) In deault.aspx.cs:

Replace
namespace FileUpload
{
     public class WebForm1 : System.Web.UI.Page

with

    public partial class _Default : System.Web.UI.Page
   
2) In default.aspx source code:

Replace first line with
<%@ Page language="c#" AutoEventWireUp="true" CodeFile="default.aspx.cs" Inherits="_Default" %>

Sunday, October 2, 2011

Start CSS layout


This site very useful to learn: how to design page with CSS layout

http://css-discuss.incutio.com/?page=CssLayouts

District Post


1) DM or Collector : Head of all departments in district

2) D.D.C :  Come under DM. Take care of  Development parts like PHED. Watch the work of B.D.O, C.O
                   Mukhiya work.

3) Executive Engineer: Come under Collector and some cases under D.D.C also. Head of single deparment i.e,
                                   PHED.