Codes from Developers



Creates a file using fstream in c++



This example requires two ClientDataSets, two DBGrids, two DataSources, and two DBNavigators. Name the two ClientDataSets CDS and CDS2. Set the DataSet property in the first DataSource to CDS and name that DataSource DS. Set the DataSet property in the second DataSource to CDS2 and name that DataSource DS2. Set the DataSource in the first DBNavigator to DS and the DataSource in the second DBNavigator to DS2. Set the DataSource in the first DBGrid to DS and the DataSource in the second DBGrid to DS2. Right-click CDS and select the Fields Editor, then right-click the Field Editor form and create two fields by selecting "new field". In the field configuration window, set the name to HOST; the Component value will automatically be set to CDSHOST. Set the filed type to String. In the field configuration window for the second field, set the name to PORTA; the Component value will automatically be set to CDSPORTA. Set the field type to Integer. The file used to load CDS must have an attribute name of HOST with an attribute type of string and an attribute name of PORTA with an attribute type of integer. Add DB, DBCtrls, Grids, DBGrids, DBClient, and SwSystem to the uses clause. LoadFormFile to start with the file or CreateDataSet to start from scratch. You must CloseDataSet after a LoadFromFile before you can do another CreateDataSet.



linq to xml samples



The following code uses the bitmaps in an image list component to draw the contents of each cell in a draw grid. It uses a draw grid with a label above it on a form. When the user clicks a cell in the grid, the location of the cursor is displayed in the label caption. This example requires a populated image list, or can just display an empty grid.



This Code Shows How to Perform Merge Sort. A merge sort is a sorting algorithm with complexity of O(nlogn). It is used for sorting numbers, structure, files.



This code exemplifies the uses of the FindKey and FindNearest functions. This example requires a ClientDataset, a DataSource, a DBGrid, and a DBNavigator. Connect the DataSource to the DataSet and then connect the DBGrid to the DataSource. Also, the DBNavigator needs to be connected to the DataSource. Now you need to create two fields in the DataSet. Right-click the TClientDataset component, select Fields Editor, create two fields named field1 and field2. Then specify the IndexDefs property for ClientDataSet in the Object Inspector. Add two indexdefs. The first one should have the Fields property set to field1 and the Name property set to field1index while the second one should have field2 and field2index. Run the example, press the Create "DataSource" button, then add some records to the DBGrid with the aid of DBNavigator. After that, enter one of the values in any record in "field1" in the "Search for:" edit box. Press the "FindKey" button and observe the message that appears on the screen. Do the same with the "FindNearest" button.



This Code Shows How to Demonstrate Heap Sort. Here it first removes the topmost item (the largest) and replace it with the rightmost leaf. The topmost item is stored in an array and Re-establish the heap.this is done until there are no more items left in the heap.



Add, Edit & Update All in one Contact Management Form Here is a fun example on how to use functions to squeeze the most out of one page. This page lists users, adds users and edits users.

C# cshtml JavaScript


File Upload Without Page Refresh in ASP.NET MVC In this ASP.NET MVC code sample, we will see how we can upload file without page refresh. As we know, in MVC there is no server controller, this sample will be useful if we want to upload files without page refresh.



This code shows how to overloade c# operators



This code shows how to implement Custom IFormatProvider



State Pattern



Grid Layout Demo in Java



A flat file counter in PHP



This sql code will group data with grand total



This example shows how to use the TBitmapData.GetPixel and TBitmapData.SetPixel methods. This sample draws and fills the rectangle on an image, pixel by pixel. To build and test this example, create a Multi-Device Application - Delphi, then add the folowing objects to the form: A TImage to display the TBitmap. A TLabel to display the value of the TTrackBar. A TTrackBar to control the amount of Red in relation to which the transparency of certain pixels changes. Add the following code to the OnChange event handlers of the track bar.



A simple example using a virtual function in C++



Buffering servlet responses in Java



Align the form controls with table in Html



A very simple and efficient split bar the B-Z bar , for mysql and php