Posts

cliping array from a array

import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         int arr[][] = new int[6][6];         int sum[] = new int[16];         int doSum = 0;         int k =0;         int index = 0;                 for(int arr_i=0; arr_i < 6; arr_i++){             for(int arr_j=0; arr_j < 6; arr_j++){                 arr[arr_i][arr_j] = in.nextInt();           ...

Chapter 4 -- problem 1 Solution -- Clifford A. Shaffer

--class Link----- package ch1_prob1; public class Link {     E element;     Link next;         Link(E item, Link nextVal){element = item; next = nextVal;}     Link(E item){element = item;}         E element(){return element;}     E setElement(E it){return element = it;}         Link next(){return next;}     Link setNext(Link nextVal){return next = nextVal;} } --interface List-------- package ch1_prob1; public interface List {     public void clear();     public void insert(E item);     public void append(E item);         public void moveToStart();     public void moveToEnd();     public void moveToPos(int pos);         public void next();     public void prev(); ...

outputType in c#

        public class ReturnType         {             public object Data;             public string OutputType;         } return new ReturnType() { Data = Result, OutputType = this.outputType }; public PivotTable.ReturnType get_report(string type, string perOAbso, string slatype, DataGrid datagrid, string tableId) { }

Move DataRow c#

        public void MoveDataRowTo(DataRow dataRow, int destination)         {             DataTable parentTable = dataRow.Table;             int rowIndex = parentTable.Rows.IndexOf(dataRow);             if (rowIndex > 0)             {                 DataRow newDataRow = parentTable.NewRow();                 for (int index = 0; index < dataRow.ItemArray.Length; index++)                     newDataRow[index] = dataRow[index];                 parentTable.Rows.Remove(dataRow);                 parentTable.Rows.InsertAt(newDataRow, destination);                 dataRo...

add list item into foreach loop

 Dictionary colsetup = new Dictionary (); foreach(System.Data.DataColumn colname in this.pivotData.Columns) {   list.Add(new Dictionary (colsetup));  }

Create Grid from database and databable ext.net

Databse Function:: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.SqlClient; using System.Configuration; using System.Data; using System.Diagnostics; namespace iterna {     public static class Utils     {         public static void Log(string text)         {             System.Diagnostics.Debug.WriteLine(" " + text);         }     }     public class DbCon     {         private SqlConnection con = null;         private string sqlConnStr = "";         private ConnectionState connectionState = ConnectionState.Closed;         ///         ///          ///         public DbCon()         {     ...

date Format check c#

string [] format = new string []{ "yyyy-MM-dd HH:mm:ss" }; string value = "2011-09-02 15:30:20" ; DateTime datetime ; if ( DateTime . TryParseExact ( value , format , System . Globalization . CultureInfo . InvariantCulture , System . Globalization . DateTimeStyles . NoCurrentDateDefault , out datetime )) Console . WriteLine ( "Valid : " + datetime ); else Console . WriteLine ( "Invalid" );