Posts

Showing posts from February, 2014

Java Arraylist VS Vector in context of threading

Java ArrayList VS Vector ArrayList properties ArrayList is implemented using array as internal data structure. It can be dynamically resized   ArrayList increases half of its size when its size is increased ArrayList faster than Vector Vector properties Vector is synchronized (so thread safe) Vector is implemented using array as internal data structure. It can be dynamically resized. Vector doubles size of array when its size is increased. Major difference between ArrayList and Vector is that ArrayList is not synchronized and Vector is synchronized. That is why vector can be used in multi threaded and concurrent environment more appropriately and efficiently. We can use ArrayList in multi threading environment if multiple threads are only reading values from ArrayList. We can also make read only ArrayList as well. ArrayList faster than Vector as it is Asynchronous. so if we want to read only ArrayList is more efficeint and faster than Vector. By Ha...

Comparison between Static and Dynamic Polymorphism

Image
Static polymorphism is considered more efficient, and dynamic polymorphism more flexible. Statically bound methods are those methods that are bound to their calls at compile time. Dynamic function calls are bound to the functions during run-time. This involves the additional step of searching the functions during run-time. On the other hand, no run-time search is required for statically bound functions. As applications are becoming larger and more complicated, the need for flexibility is increasing rapidly. Most users have to periodically upgrade their software, and this could become a very tedious task if static polymorphism is applied. This is because any change in requirements requires a major modification in the code. In the case of dynamic binding, the function calls are resolved at run-time, thereby giving the user the flexibility to alter the call without having to modify the code. To the programmer, efficiency and performance would probably be a primary concern, but to t...

How to bind combo Box / or drop down list to the database

How to bind combo Box  or drop down list to the database: In the given example i am illustrating  binding of the sql Data (only single column named Domain) to the Drop down list. It is quite similar to bind with combobox in windows application  SqlConnection con = new SqlConnection(constring);         con.Open();         SqlCommand cmd = new SqlCommand("", con);         cmd.CommandType = System.Data.CommandType.Text;         cmd.CommandText = "SELECT DISTINCT Domain from SurveyDomainTable";         SqlDataAdapter adpt = new SqlDataAdapter(cmd);         DataSet ds = new DataSet();         adpt.SelectCommand = cmd;         adpt.Fill(ds);         // bind domain with the dropdownlist         ddlDomain.DataTextField = "Domain";         ddlDo...

How to bind data to a grid view in C#.net

How to bind data to a grid view in C#.net  When we need to show data from database we have to use a front end control to show data. connecting grid view control of web based application to the database is called binding  SqlConnection conn = new SqlConnection(constring);         string query = " Select * from table";         SqlCommand sqlCmd = new SqlCommand(query, conn);         conn.Open();         SqlDataReader reader = sqlCmd.ExecuteReader();         GridView1.DataSource = reader;         GridView1.DataBind();         conn.Close();

How to make Browser button for save file in ASP.net C# language

Image
How to make Browser button in ASP.net C# language It is very useful to save file in a specific location.It is quite easy to make browse button using C#.net. You have to follow these steps; First create your button with id=Browse   Double click on Button Event handler of that button would be created and displays in front of you paste this code in the event handler // In C#.net SaveFileDialog sd = new SaveFileDialog();             sd.ShowDialog();             txtPath.Text = sd.FileName; Save , Run and enjoy................................................................. BY Hafiz Muhammad Umar Hayat Hafizmohemmedumar@gmail.com