Search This Blog

Monday, October 8, 2012

IndexOf c#

C# > String > IndexOf

Reports the zero-based index of the first occurrence of the specified string in another string.

Index numbering starts from zero.

The zero-based index position of value if that string is found, or -1 if it is not.

This method performs a word (case-sensitive and culture-sensitive) search using the current culture. The search begins at the first character position of this instance and continues until the last character position.

Example:

string ast_name = valuePath;
int poz = ast_name.IndexOf("http");
if (poz >-1) // found "http"
   ast_name = ast_name.Substring(poz,ast_name.Length-poz);





Friday, October 5, 2012

Changing the size of Telerik RadComboBox DropDown

Telerik > RadComboBox > ComboBoxElement > DropDownWidth 


this.radComboBox1.ComboBoxElement.DropDownWidth = 200;
this.radComboBox1.ComboBoxElement.DropDownHeight = 600;





Thursday, October 4, 2012

Browse all rows and values RadGridView - Win Forms

Telerik > RadGridView > Browse all rows and values

Example:

C# Code
            for (i = 0; i <= RadGridView1.Rows.Count; i++)
            {
                for (j = 0; j <= RadGridView1.Columns.Count; j++)
                {
                    dynamic di = RadGridView1.Rows(i).Cells(j).Value;
                }
            }
            //or
             foreach (GridViewRowInfo _row in RadGridView1.Rows)
            {
                foreach (GridViewColumn _column in RadGridView1.Columns)
                {
                    dynamic di = _row.Cells(_column.Name).Value;
                }
            }

VB.NET Code

For i = 0 To RadGridView1.Rows.Count
  For j = 0 To RadGridView1.Columns.Count
   Dim di = RadGridView1.Rows(i).Cells(j).Value
  Next
Next
'or
For Each _row As GridViewRowInfo In RadGridView1.Rows
  For Each _column As GridViewColumn In RadGridView1.Columns
    Dim di = _row.Cells(_column.Name).Value
  Next
Next






How to set time to RadTimePicker Programmatically (ASP.NET)

Telerik > RadTimePicker > Set time

StartTime represents the starting time of the clock
EndTime represents  the time of the last clock item

Example : Set time  to RadTimePicker  code behind


RadTimePicker1.SelectedDate = DateTime.ParseExact("12:00", RadTimePicker1.TimeView.TimeFormat, null); // set default time

RadTimePicker1.TimeView.StartTime  = new TimeSpan(8, 60, 0); //start time
RadTimePicker1.TimeView.EndTime =  new TimeSpan(17,60, 0); // end time





OLAP

Database > OLAP





Short for Online Analytical Processing, a category of software tools that provides analysis of data stored in a database. OLAP tools enable users to analyze different dimensions of multidimensional data. For example, it provides time series and trend analysis views. OLAP often is used in data mining.

The chief component of OLAP is the OLAP server, which sits between a client and a database management systems (DBMS). The OLAP server understands how data is organized in the database and has special functions for analyzing the data. There are OLAP servers available for nearly all the major database systems.

Microsoft SQL Server Analysis Services is part of Microsoft SQL Server, a database management system. Microsoft has included a number of services in SQL Server related to business intelligence and data warehousing. These services include Integration Services and Analysis Services. Analysis Services includes a group of OLAP and data mining capabilities.

Oracle Essbase is the industry-leading multi-dimensional online analytical processing (OLAP) server, providing a rich environment for effectively developing custom analytic and enterprise performance management applications. By leveraging its self-managed, rapid application development capabilities, business users can quickly model complex business scenarios. For example, line-of-business personnel can simply and rapidly develop and manage analytic applications that can forecast likely business performance levels and deliver "what-if" analyses for varying conditions. Oracle Essbase supports extremely fast query response times for vast numbers of users, large data sets, and complex business models.

Analysis Services tutorial. Creating OLAP cube. Introduction to data warehouse


Monday, September 17, 2012

WITH (SQL Server)

SQL Server > DML > WITH

Specifies a temporary named result set, known as a common table expression (CTE). This is derived from a simple query and defined within the execution scope of a single SELECT, INSERT, UPDATE, or DELETE statement.
This clause can also be used in a CREATE VIEW statement as part of its defining SELECT statement.
A common table expression can include references to itself. This is referred to as a recursive common table expression.






Examples:

1. Creating a simple common table expression

-- Define the CTE expression name and column list.

WITH Person_CTE (PersonID, PersonName, PersonSalary)
AS
-- Define the CTE query.
(
Select
 PersonID, PersonName, PersonSalary
FROM
 Person
)

-- Define the outer query referencing the CTE name.
SELECT
 *
FROM
 Person_CTE
ORDER BY
 PersonID;

2. Using a recursive common table expression to display multiple levels of recursion


WITH Emp(superiorid, id, username) AS
(
SELECT superiorid, id, username
FROM User
WHERE superiorid IS NULL


UNION ALL
SELECT e.superiorid, e.id, e.username
FROM User AS e
INNER JOIN IS_User AS e1
ON e.superiorid = e1.id
)


SELECT superiorid, id , username
FROM Emp
ORDER BY superiorid;


3. Get all children of parent

Friday, September 14, 2012

REPLACE (Transact-SQL)

SQL Server > Built-in Functions > REPLACE

Replaces a specified string value with another string value.

REPLACE ( expression , pattern , replacement )
Example

SELECT REPLACE('sample','ple','');
GO 
Result:sam