Latest Entries »

Real Numbers


Real numbers include:

  1. Rational Numbers
  2. Irrational Numbers

Rational Numbers include:

  1. Integers
  2. Whole Numbers
  3. Natural Numbers (a.k.a. counting numbers}

Integers include:

  1. Whole Numbers {0, 1, 2, 3, …}
  2. Natural Numbers (a.k.a. Counting Numbers) {1, 2, 3, …}

Whole Numbers include:

  1. Natural Numbers (a.k.a. Counting Numbers) {1, 2, 3, …}

Irrational Numbers include squareroots (√) and pi (ϖ).

Signature of a Method – C#


A signature of a method consists of:

  1. The name of the method (e.g. Main(), ComputeCost(), OtherUserDefinedMethodName())
  2. Modifiers (public, public static, private, private static, etc…)
  3. Types of its formal parameters

The formal parameters are inside the method parenthesis.  Examples include:

  • int numStudents
  • decimal cashBalance
  • double arg1
  • string arg2

Unlike delegates in C#, the return type IS NOT part of a method’s signature.  Return types include void or one type of data object such as int, string, array and so on.

If the return type is not void, the method must include the return keyword followed by a value that is of the data object declared as the return type.

Example:

private double MileageCost(int miles, double rate)

{

       return miles * rate;

}

 

Using @OFFSET in SPSS Clementine


@OFFSET in SPSS Clementine Explained:

 
A few years back I asked Satheesh from Elite Analytics what the @OFFSET function in SPSS Clementine was for. He provided the following explanation (paraphrased):
 
@OFFSET basically allows you to access the value of any record other than the current one. 
 
Code:
 
@OFFSET(X, 1) – points to the value of the previous record
@OFFSET(X, 2) – points to the value of the record prior to the previous record
@OFFSET(X, -1) – points to the value of the next record
 
Example: (click images to enlarge)
 
Original Data Set
 
Offset used in derive node
 
@OFFSET Results
 
In the resulting data set after @OFFSET is applied, note how the value on the Monday row for the OFFSET_FUNC is null. That is because in the table, there is no other value before the values for Monday.
 
You can also download the stream and data file testing on your local environment.

This example will illustrate how to write one event handler to multiple objects.  This example utilizes the checkbox objects.  In the app, the user has an option to check up to four checkboxes.  Each time he checks one, the total dollar value for each item the user is checking is displayed on a label. 

An alternative would have been to place the code inside a button object.  This would also provide the total in dollars for the checkboxes checked but not until the button was pressed.  This application illustrates running totals based on check box clicks.

 

Two files are attached.  A flash movie file illustrating the steps and a zip file containing the code.  I recommend you oOpen the .swf file in a new window.

Repeating items in an ASP.NET page using the repeater web control


This code here demonstrates the 4 things, populating an array.  Assigning the values of the array to a data source and binding the array.  Lastly displaying the results on a web page.  You can copy and paste the code to test it out.

<%@ Page Language="C#" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<script runat="server">

      

   

    protected void Page_Load(object sender, EventArgs e)

    {

        ArrayList arList = new ArrayList();

        for(int k=0; k < 5; k++)

        {

            arList.Add("<br />Item " + k + " ");

        }

 

        arValList.DataSource = arList;

        arValList.DataBind();

    }

</script>

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>Repeating Items in ASP.NET</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    <asp:Repeater ID="arValList" runat="server">

    <HeaderTemplate>

    <strong>This is a list of the array values.</strong>

    </HeaderTemplate>  

    <ItemTemplate>

    <%# Container.DataItem %>

    </ItemTemplate>

    </asp:Repeater>

   

    </div>

    </form>

</body>

</html>