text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
<title>CT | Where is High-Energy Physics Funding Spent?</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="CT" />
<meta name="author" content="Michael Baumer" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Project Homepage" />
<meta property="og:description" content="Project Homepage" />
<link rel="canonical" href="http://localhost:4000/us_hep_funding/states/CT/" />
<meta property="og:url" content="http://localhost:4000/us_hep_funding/states/CT/" />
<meta property="og:site_name" content="Where is High-Energy Physics Funding Spent?" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-03-20T14:59:36-05:00" />

<link rel="stylesheet" href="/us_hep_funding/assets/main.css"><link type="application/atom+xml" rel="alternate" href="http://localhost:4000/us_hep_funding/feed.xml" title="Where is High-Energy Physics Funding Spent?" />

Project Homepage

CT-01  CT-02  CT-03  CT-04  CT-05

CT – Sen. Richard Blumenthal (D) and  Sen. Christopher Murphy (D)

Committees

Richard Blumenthal is the #3 Democrat on the Senate Committee on Commerce, Science, and Transportation

Committees

Christopher Murphy is the #13 Democrat on the Senate Committee on Appropriations

HEP Grants

In the past 9 years, this state has received:
54 HEP grants, totalling  $24,159,000

  Year  Institution                  Amount ($)
------  -------------------------  ------------
  2019  Yale University               3,366,000
  2019  University of Connecticut       273,000
  2018  Yale University               2,697,000
  2018  University of Connecticut             0
  2017  Yale University               2,439,000
  2017  University of Connecticut             0
  2016  University of Connecticut       750,000
  2016  Yale University               2,955,000
  2015  Yale University               2,620,000
  2015  University of Connecticut       242,000
  2014  Yale University               3,251,000
  2014  University of Connecticut       247,000
  2013  Yale University               2,331,000
  2013  University of Connecticut             0
  2013  Fairfield University                  0
  2012  University of Connecticut       265,000
  2012  Yale University               2,692,000
  2012  Fairfield University             31,000

SC Contracts

In the past 9 years, this state has received:
1 Office of Science contracts, totalling  $123,259

  Year  Vendor                            Amount ($)  Item
------  ------------------------------  ------------  ----------------------------------------
  2019  Regan Technologies Corporation       123,259  Support- Management: Contract/Procuremen

NSF MPS Grants

In the past 9 years, this state has received:
550 NSF MPS grants, totalling  $114,919,060

Institution                                    Amount ($)
-------------------------------------------  ------------
Yale University                                77,136,168
University Of Connecticut                      26,075,011
Wesleyan University                             3,445,923
Fairfield University                            1,679,457
Multiple Recipients                             1,573,000
Connecticut State University System             1,052,560
Univ Of Connecticut                               833,323
John B. Pierce Laboratory                         747,336
Trinity College                                   694,848
University Of Conn Health Center                  374,980
Connecticut State University F                    300,000
Connecticut Agricultural Experiment Station       292,391
University Of New Haven Incorporated              269,463
Redacted Due To Pii                               250,000
Pii Redacted                                      150,000
Assn For Symbolic Logic                            44,600

SULI/CCI Interns

From 2014-2018, this state had 46 SULI/CCI interns

  # Interns  Program    College
-----------  ---------  ------------------------------------
         13  SULI       University of Connecticut
         13  SULI       Yale University
          4  SULI       Wesleyan University
          3  CCI        Three Rivers Community College
          3  SULI       Connecticut College
          2  SULI       University of New Haven
          1  SULI       Central Connecticut State University
          1  SULI       Eastern Connecticut State University
          1  SULI       Fairfield University
          1  SULI       Manchester Community College
          1  SULI       Quinnipiac College
          1  SULI       Sacred Heart University
          1  SULI       Trinity College
          1  SULI       University of Hartford

46
—
—

Back to top

CT-01 – Rep. John B. Larson (D) – Wikipedia

HEP Grants

This district received no SC HEP grants from 2012-2020

SC Contracts

This district received no SC contracts from 2012-2020

NSF MPS Grants

In the past 9 years, this district has received: $694,848 in NSF MPS grants.

  Year  Institution        Amount ($)
------  ---------------  ------------
  2020  Trinity College        25,000
  2019  Trinity College       100,000
  2017  Trinity College       229,120
  2015  Trinity College       234,956
  2014  Trinity College       105,772

SULI/CCI Interns

From 2014-2018, this district had 3 SULI/CCI interns

Term         Name                   College                       Host Lab                              Program
-----------  ---------------------  ----------------------------  ------------------------------------  ---------
Summer 2016  Erin Elizabeth Wenger  University of Hartford        National Renewable Energy Laboratory  SULI
Summer 2014  Anne Do                Trinity College               Brookhaven National Laboratory        SULI
Spring 2017  Melinda Jesse St.Onge  Manchester Community College  National Renewable Energy Laboratory  SULI

Back to top

CT-02 – Rep. Joe Courtney (D) – Wikipedia

Committees

Joe Courtney is the #3 Democrat on the House Subcommittee on Higher Education and Workforce Development

HEP Grants

In the past 9 years, this district has received: $1,777,000 in SC HEP grants.

Institution                  Amount ($)    Start    End  Principal Investigator    Project Title
-------------------------  ------------  -------  -----  ------------------------  --------------------------------------------
University of Connecticut     1,512,000     2014   2020  Dunne, Gerald             Theoretical High Energy and Particle Physics
University of Connecticut             0     2013   2014  Dunne                     Theoretical High Energy and Particle Physics
University of Connecticut       265,000     2012   2014  Dunne                     Investigations in Particle and Field Theory

SC Contracts

This district received no SC contracts from 2012-2020

NSF MPS Grants

In the past 9 years, this district has received: $27,037,934 in NSF MPS grants.

  Year  Institution                  Amount ($)
------  -------------------------  ------------
  2020  Assn For Symbolic Logic          44,600
  2020  University Of Connecticut       562,939
  2019  Redacted Due To Pii             100,000
  2019  University Of Connecticut     3,741,264
  2018  University Of Connecticut     4,244,038
  2017  University Of Connecticut     4,656,852
  2016  University Of Connecticut     2,133,945
  2015  Univ Of Connecticut             833,323
  2015  University Of Connecticut     2,953,891
  2014  University Of Connecticut     2,140,917
  2013  University Of Connecticut     2,711,482
  2012  University Of Connecticut     2,914,683

SULI/CCI Interns

From 2014-2018, this district had 20 SULI/CCI interns

Term         Name                     College                               Host Lab                                Program
-----------  -----------------------  ------------------------------------  --------------------------------------  ---------
Summer 2018  Alexandra Oliveira       University of Connecticut             Argonne National Laboratory             SULI
Summer 2018  Ryan Tomastik            University of Connecticut             Brookhaven National Laboratory          SULI
Summer 2018  Reid William Wilson      University of Connecticut             Brookhaven National Laboratory          SULI
Summer 2018  Masashi Azuma            University of Connecticut             Argonne National Laboratory             SULI
Summer 2018  Nora Chov                University of Connecticut             Argonne National Laboratory             SULI
Summer 2018  Andrew Michael Boudreau  University of Connecticut             Brookhaven National Laboratory          SULI
Summer 2017  Sarah Ashley Pfennig     Connecticut College                   Brookhaven National Laboratory          SULI
Summer 2017  Lauren Sullivan          Connecticut College                   National Renewable Energy Laboratory    SULI
Summer 2017  Doug J Fitzgerald        Connecticut College                   Argonne National Laboratory             SULI
Summer 2017  Pierre Dens Fils         University of Connecticut             Oak Ridge National Laboratory           SULI
Summer 2016  Madison Caballero        University of Connecticut             Pacific Northwest National Laboratory   SULI
Summer 2016  Kaitlin Ruth Dennison    University of Connecticut             Lawrence Livermore National Laboratory  SULI
Summer 2015  Kaitlin Ruth Dennison    University of Connecticut             Lawrence Livermore National Laboratory  SULI
Summer 2015  Andrew Smith             University of Connecticut             Ames National Laboratory                SULI
Summer 2015  Lee R. Combs             Three Rivers Community College        Brookhaven National Laboratory          CCI
Summer 2015  Keith Combs              Three Rivers Community College        Brookhaven National Laboratory          CCI
Summer 2014  Nicholas Denegre         Eastern Connecticut State University  National Renewable Energy Laboratory    SULI
Summer 2014  Lee R. Combs             Three Rivers Community College        Brookhaven National Laboratory          CCI
Summer 2014  Brittany Antonucci       University of Connecticut             Brookhaven National Laboratory          SULI
Spring 2015  Robin Marcelle Cywar     University of Connecticut             National Renewable Energy Laboratory    SULI

Back to top

CT-03 – Rep. Rosa L. DeLauro (D) – Wikipedia

Committees

Rosa L. DeLauro is the #5 Democrat on the House Committee on Appropriations

HEP Grants

In the past 9 years, this district has received: $22,351,000 in SC HEP grants.

Institution        Amount ($)    Start  End      Principal Investigator      Project Title
---------------  ------------  -------  -------  --------------------------  ---------------------------------------------------------------------------------------
Yale University       180,000     2019  2020     Baker, Keith                Quantum Information Science in High Energy Physics at the Large Hadron Collider
Yale University       125,000     2019  2020     Poland, David               New Approaches to Strong Dynamics
Yale University        49,000     2018  2020     Fleming, George             Quantum Finite Elements for Nonperturbative Quantum Field Theory on Curved Manifolds
Yale University     5,773,000     2017  2020     Fleming, Bonnie             High Energy Physics
Yale University       110,000     2016  2017     Demers Konezny, Sarah       Taus at ATLAS
Yale University       270,000     2016  Ongoing  Fleming, Bonnie             Next Generation Noble Liquid Detectors
Yale University     2,270,000     2016  2020     Heeger, Karsten             PROSPECT: A Precision Reactor Oscillation and Spectrum Experiment
Yale University     1,110,000     2014  Ongoing  Hirshfield, Jay             Advanced Accelerator Physics Studies
Yale University       300,000     2014  2016     Demers, Sarah               Taus and the Trigger for Discovery at ATLAS
Yale University     6,516,000     2014  2017     Fleming, Bonnie             Yale High Energy Physics Research
Yale University       450,000     2014  2017     Padmanabhan, Nikhil         A Ruler to Measure the Universe: Probing Dark Energy with Baryon Acoustic Oscillations
Yale University       175,000     2014  2015     Heeger, Karsten             Yale High Energy Physical Research:  Intensity Frontier, Task L - Daya Bay
Yale University     1,801,000     2013  2014     Fleming, Tipton, Sandweiss  High Energy Physics Research, Tasks A, B, C, D, F, G, K and J
Yale University       150,000     2013  2014     Hirshfield                  Advanced Accelerator Physics Studies
Yale University       300,000     2012  2014     Padmanabhan                 A Ruler to Measure the Universe:  Probing Dark Energy with Baryon Acoustic Oscillations
Yale University       153,000     2012  2014     Golling                     Search for New Phenomena in tt Events with Large Missing Transverse Momentum
Yale University       309,000     2012  2013     Hirshfield                  Ka-Band Test Facility for High-Gradient Accelerator R&D
Yale University       300,000     2012  2014     Demers                      Taus and the Trigger for Discovery at ATLAS
Yale University        35,000     2012  2013     Demers                      Conference for Undergraduate Women in Physics, January 13-15, 2012
Yale University     1,975,000     2012  2013     Tipton, Sandweiss           High Energy Physics Research, Tasks A, B, C, D, F, G, K and J

SC Contracts

This district received no SC contracts from 2012-2020

NSF MPS Grants

In the past 9 years, this district has received: $85,066,861 in NSF MPS grants.

  Year  Institution                                    Amount ($)
------  -------------------------------------------  ------------
  2020  Yale University                                   124,430
  2019  Yale University                                 9,968,315
  2019  Wesleyan University                                48,628
  2019  Redacted Due To Pii                               150,000
  2019  Connecticut State University System               618,741
  2018  Yale University                                 6,917,781
  2018  Wesleyan University                               149,992
  2018  University Of New Haven Incorporated              269,463
  2017  Yale University                                 9,075,592
  2017  Wesleyan University                               631,083
  2017  Pii Redacted                                      150,000
  2017  John B. Pierce Laboratory                          90,000
  2017  Connecticut State University System               114,976
  2017  Connecticut Agricultural Experiment Station       292,391
  2016  Yale University                                 7,284,321
  2016  Wesleyan University                               603,654
  2016  John B. Pierce Laboratory                         284,575
  2016  Connecticut State University System               160,590
  2015  Yale University                                11,616,893
  2015  Wesleyan University                               345,689
  2015  John B. Pierce Laboratory                         372,761
  2015  Connecticut State University System               108,273
  2014  Yale University                                11,115,456
  2014  Wesleyan University                             1,064,631
  2014  Connecticut State University F                    300,000
  2013  Yale University                                12,676,224
  2013  Wesleyan University                               384,848
  2013  Multiple Recipients                               613,000
  2012  Wesleyan University                               217,398
  2012  Yale University                                 8,357,156
  2012  Multiple Recipients                               960,000

SULI/CCI Interns

From 2014-2018, this district had 20 SULI/CCI interns

Term         Name                         College                  Host Lab                               Program
-----------  ---------------------------  -----------------------  -------------------------------------  ---------
Summer 2018  Zahir Safie                  University of New Haven  Brookhaven National Laboratory         SULI
Summer 2018  Clara Tianqi Ma              Yale University          Argonne National Laboratory            SULI
Summer 2018  Jack Roth                    Yale University          SLAC National Accelerator Laboratory   SULI
Summer 2018  Nathaniel Barbour            Yale University          Princeton Plasma Physics Laboratory    SULI
Summer 2018  Cameron Weber                Quinnipiac College       Brookhaven National Laboratory         SULI
Summer 2018  Alexandra Goriounova         University of New Haven  Savannah River National Laboratory     SULI
Summer 2017  Genevieve Sertic             Yale University          Argonne National Laboratory            SULI
Summer 2017  Nathaniel Barbour            Yale University          Princeton Plasma Physics Laboratory    SULI
Summer 2017  Josh Swerdlow                Yale University          Princeton Plasma Physics Laboratory    SULI
Summer 2016  Saisneha Koppaka             Yale University          Argonne National Laboratory            SULI
Summer 2015  Aleksandra Zakrzewska        Yale University          Oak Ridge National Laboratory          SULI
Summer 2015  Douglas Kim-Tak Wong         Yale University          Los Alamos National Laboratory         SULI
Summer 2014  Carlos del-Castillo-Negrete  Yale University          Oak Ridge National Laboratory          SULI
Summer 2014  Eli J Halperin               Wesleyan University      Lawrence Berkeley National Laboratory  SULI
Summer 2014  Lori Kaufman                 Yale University          Argonne National Laboratory            SULI
Summer 2014  Jacob Albert Lashner         Wesleyan University      SLAC National Accelerator Laboratory   SULI
Spring 2018  Julia Indivero               Wesleyan University      Pacific Northwest National Laboratory  SULI
Spring 2014  Sagar Setru                  Yale University          Argonne National Laboratory            SULI
Fall 2017    Julia Indivero               Wesleyan University      Pacific Northwest National Laboratory  SULI
Fall 2014    David Gabriel Rissman        Yale University          Princeton Plasma Physics Laboratory    SULI

Back to top

CT-04 – Rep. James A. Himes (D) – Wikipedia

HEP Grants

In the past 9 years, this district has received: $31,000 in SC HEP grants.

Institution             Amount ($)    Start    End  Principal Investigator    Project Title
--------------------  ------------  -------  -----  ------------------------  ----------------------------------------------------------
Fairfield University         31000     2012   2014  Winn                      Secondary Emission Sampling Calorimetry Sensor Development

SC Contracts

This district received no SC contracts from 2012-2020

NSF MPS Grants

In the past 9 years, this district has received: $1,679,457 in NSF MPS grants.

  Year  Institution             Amount ($)
------  --------------------  ------------
  2019  Fairfield University        49,460
  2018  Fairfield University       600,761
  2017  Fairfield University       238,749
  2016  Fairfield University       271,407
  2014  Fairfield University       428,500
  2012  Fairfield University        90,580

SULI/CCI Interns

From 2014-2018, this district had 2 SULI/CCI interns

Term         Name                College                  Host Lab                        Program
-----------  ------------------  -----------------------  ------------------------------  ---------
Summer 2018  John Leary Delaney  Fairfield University     Brookhaven National Laboratory  SULI
Summer 2018  Kelly Scanlon       Sacred Heart University  Brookhaven National Laboratory  SULI

Back to top

CT-05 – Rep. Jahana Hayes (D) – Wikipedia

Committees

Jahana Hayes is the #3 Democrat on the House Subcommittee on Early Childhood, Elementary, and Secondary Education

HEP Grants

This district received no SC HEP grants from 2012-2020

SC Contracts

In the past 9 years, this district has received:
1 Office of Science contracts, totalling  $123,259

  Year  Vendor                            Amount ($)  Item
------  ------------------------------  ------------  ----------------------------------------
  2019  Regan Technologies Corporation       123,259  Support- Management: Contract/Procuremen

NSF MPS Grants

In the past 9 years, this district has received: $439,960 in NSF MPS grants.

  Year  Institution                            Amount ($)
------  -----------------------------------  ------------
  2015  University Of Conn Health Center          374,980
  2015  University Of Connecticut                  15,000
  2013  Connecticut State University System        49,980

SULI/CCI Interns

From 2014-2018, this district had 1 SULI/CCI intern

Term         Name               College                               Host Lab                             Program
-----------  -----------------  ------------------------------------  -----------------------------------  ---------
Summer 2018  Jalal-Ud-Din Butt  Central Connecticut State University  Princeton Plasma Physics Laboratory  SULI


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.jvnet.hudson.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>1.374</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <scm>
    <connection>scm:git:git://github.com/dblock/jenkins-ansicolor-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:dblock/jenkins-ansicolor-plugin.git</developerConnection>
    <url>http://github.com/dblock/jenkins-ansicolor-plugin</url>
  </scm>

  <distributionManagement>
    <repository>
      <id>maven.jenkins-ci.org</id>
      <url>http://maven.jenkins-ci.org:8081/content/repositories/releases/</url>
    </repository>
  </distributionManagement>

  <build>
    <plugins>
      <!-- Enforce Java 5.0 compatibility. -->
      <plugin>
        <groupId>org.jvnet</groupId>
        <artifactId>animal-sniffer</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>animal-sniffer</id>
            <phase>compile</phase>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <signature>
                <groupId>org.jvnet.animal-sniffer</groupId>
                <artifactId>java1.5</artifactId>
                <version>1.0</version>
              </signature>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Needed to build against Jenkins/Hudson 1.387 or earlier. -->
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <goals>deploy</goals>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <artifactId>ansicolor</artifactId>
  <packaging>hpi</packaging>
  <version>0.2.2-SNAPSHOT</version>
  <name>AnsiColor</name>
  <description>Adds ANSI coloring to the Console Output</description>
  <url>http://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin</url>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.fusesource.jansi</groupId>
      <artifactId>jansi</artifactId>
      <version>1.7</version>
    </dependency>
  </dependencies>

  <developers>
    <developer>
      <id>dblock</id>
      <name>Daniel Doubrovkine</name>
      <email>dblock@dblock.org</email>
    </developer>
  </developers>
</project>

redpajama_set_name: RedPajamaGithub


text:
Imports System
Imports System.Data
Imports System.Collections
Imports System.Web.UI
Imports Telerik.Web.UI
Imports SistFoncreagro.BussinessEntities
Imports SistFoncreagro.BussinesLogic
Public Class FrmSemovientes
    Inherits System.Web.UI.Page
    Dim _Semovientes As New Semovientes
    Dim Semovientes As Semovientes
    Dim SemovientesBL As New SemovientesBL
    Dim IdSemoviente As String
    Dim _ubigeo As UbigeoDatos
    Dim ubigeoBL As New UbigeoDatosBL
    Dim _Ubicacion As New UbicacionSemovientes
    Dim UbicacionBL As New UbicacionSemovientesBL
    Dim _Propiedad As New PropiedadSemovientes
    Dim PropiedadBL As New PropiedadSemovientesBL
    Dim _Adjuntos As New AdjuntoSemovientes
    Dim AdjuntoBL As New AdjuntoSemovientesBL
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        IdSemoviente = Request.QueryString("IdSemoviente")
        Me.RadComboBox1.Filter = 1
        Me.RadComboBox2.Filter = 1
        Me.RadComboBox3.Filter = 1
        Me.RadComboBox4.Filter = 1
        Me.RadComboBox5.Filter = 1
        Me.RadComboBox6.Filter = 1

        If Page.IsPostBack = False Then
            If IdSemoviente > 0 Then
                'para recuperar datos
                Semovientes = SemovientesBL.GetSEMOVIENTESById(IdSemoviente)

                Me.RadComboBox1.SelectedValue = Semovientes.IdProyecto
                Me.RadComboBox2.SelectedValue = Semovientes.IdProyectoCPD
                Me.TextBox1.Text = Semovientes.Nombre
                Me.TextBox2.Text = Semovientes.Color
                Me.TextBox3.Text = Semovientes.AreteMicrochip
                Me.TextBox4.Text = Semovientes.AreteEstablo
                Me.txtDate.Text = Semovientes.FechaNacimiento
                Me.RadNumericTextBox1.Text = Semovientes.EdadMeses
                Me.DropDownList1.SelectedValue = Semovientes.idEspecie
                Me.DropDownList2.SelectedValue = Semovientes.IdRaza
                Me.RadioButtonList1.SelectedValue = Semovientes.Sexo
                Me.TextBox5.Text = Semovientes.DescSemoviente
                Me.RadioButtonList2.SelectedValue = Semovientes.TipoIngreso

                If Semovientes.IdOrigenSemoviente <> "" Then
                    _ubigeo = ubigeoBL.GetUbigeoDatosByIdUbigeoDatos(Semovientes.IdOrigenSemoviente)
                    Me.RadComboBox5.DataSourceID = "OdsUbigeo"
                    Me.OdsUbigeo.SelectParameters("texto").DefaultValue = _ubigeo.Nombre
                    Me.RadComboBox5.DataBind()
                    Me.RadComboBox5.SelectedValue = Semovientes.IdOrigenSemoviente
                End If

                If Semovientes.IdSemovientePadre > 0 Then
                    Me.RadComboBox3.SelectedValue = Semovientes.IdSemovientePadre
                End If

                If Semovientes.IdSemovienteMadre > 0 Then
                    Me.RadComboBox4.SelectedValue = Semovientes.IdSemovienteMadre
                End If

                If Semovientes.IdPlan > 0 Then
                    Me.RadComboBox6.SelectedValue = Semovientes.IdPlan
                End If

            End If

        End If
    End Sub

    Protected Sub txtDate_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles txtDate.TextChanged
        Me.RadNumericTextBox1.Text = DateDiff(DateInterval.Month, Date.Parse(Me.txtDate.Text), Now)
    End Sub

    Protected Sub RadComboBox5_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles RadComboBox5.ItemDataBound
        e.Item.Text = (DirectCast(e.Item.DataItem, SistFoncreagro.BussinessEntities.UbigeoDatos)).Departamento.ToString() + " - " + (DirectCast(e.Item.DataItem, SistFoncreagro.BussinessEntities.UbigeoDatos)).Provincia.ToString() + " - " + (DirectCast(e.Item.DataItem, SistFoncreagro.BussinessEntities.UbigeoDatos)).Distrito.ToString() + " - " + (DirectCast(e.Item.DataItem, SistFoncreagro.BussinessEntities.UbigeoDatos)).Nombre.ToString() + " (" + (DirectCast(e.Item.DataItem, SistFoncreagro.BussinessEntities.UbigeoDatos)).Nivel.ToString() + ")"
        e.Item.Value = (DirectCast(e.Item.DataItem, SistFoncreagro.BussinessEntities.UbigeoDatos)).CUBIGEO.ToString()
    End Sub

    Protected Sub RadComboBox5_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles RadComboBox5.ItemsRequested
        If e.Text.Length > 2 Then
            Me.RadComboBox5.DataSourceID = "OdsUbigeo"
            Me.OdsUbigeo.SelectParameters("texto").DefaultValue = e.Text.ToString
            Me.RadComboBox5.DataBind()
        End If
    End Sub

    Protected Sub ImageButton4_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton4.Click
        Response.Redirect("FrmSemovientes.aspx?IdSemoviente=0")
    End Sub

    Protected Sub ImageButton3_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton3.Click
        _Semovientes.AreteEstablo = Me.TextBox4.Text
        _Semovientes.AreteMicrochip = Me.TextBox3.Text
        _Semovientes.Color = Me.TextBox2.Text
        _Semovientes.DescSemoviente = Me.TextBox5.Text
        _Semovientes.EdadMeses = Me.RadNumericTextBox1.Text
        _Semovientes.FechaNacimiento = Me.txtDate.Text
        _Semovientes.FechaRegistro = Date.Now
        If Me.RadComboBox5.SelectedValue.Length > 0 Then
            _Semovientes.IdOrigenSemoviente = Me.RadComboBox5.SelectedValue
        End If

        _Semovientes.IdPlan = Me.RadComboBox6.SelectedValue
        _Semovientes.IdProyecto = Me.RadComboBox1.SelectedValue
        _Semovientes.IdProyectoCPD = Me.RadComboBox2.SelectedValue
        _Semovientes.IdRaza = Me.DropDownList2.SelectedValue
        _Semovientes.IdSemoviente = IdSemoviente
        If Me.RadComboBox4.SelectedValue.Length > 0 Then
            _Semovientes.IdSemovienteMadre = Me.RadComboBox4.SelectedValue
        Else
            _Semovientes.IdSemovienteMadre.Equals(DBNull.Value)
        End If

        If Me.RadComboBox3.SelectedValue.Length > 0 Then
            _Semovientes.IdSemovientePadre = Me.RadComboBox3.SelectedValue
        Else
            _Semovientes.IdSemovientePadre.Equals(DBNull.Value)
        End If

        _Semovientes.Nombre = Me.TextBox1.Text
        _Semovientes.Sexo = Me.RadioButtonList1.SelectedValue
        _Semovientes.TipoIngreso = Me.RadioButtonList2.SelectedValue

        If IdSemoviente > 0 Then
            SemovientesBL.SaveSEMOVIENTES(_Semovientes)
        Else
            IdSemoviente = SemovientesBL.SaveSEMOVIENTES(_Semovientes)
        End If

        Response.Redirect("FrmSemovientes.aspx?IdSemoviente=" + IdSemoviente.ToString)

    End Sub

    Protected Sub RadioButtonList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButtonList2.SelectedIndexChanged
        If Me.RadioButtonList2.SelectedValue = 2 Then
            Me.RadComboBox5.Enabled = True
            Me.RadComboBox3.Enabled = False
            Me.RadComboBox4.Enabled = False
        Else
            Me.RadComboBox5.Enabled = False
            Me.RadComboBox3.Enabled = True
            Me.RadComboBox4.Enabled = True
        End If
    End Sub

    Protected Sub RadioButtonList2_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButtonList2.TextChanged
        If Me.RadioButtonList2.SelectedValue = 2 Then
            Me.RadComboBox5.Enabled = True
            Me.RadComboBox3.Enabled = False
            Me.RadComboBox4.Enabled = False
        Else
            Me.RadComboBox5.Enabled = False
            Me.RadComboBox3.Enabled = True
            Me.RadComboBox4.Enabled = True
        End If
    End Sub

    Protected Sub RadGrid2_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid2.InsertCommand
        Dim userControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)

        _Ubicacion.FechaFin.Equals(DBNull.Value)
        _Ubicacion.FechaInicio = CType(userControl.FindControl("txtDate1"), TextBox).Text
        _Ubicacion.IdProyecto = CType(userControl.FindControl("RadComboBox1"), RadComboBox).SelectedValue
        _Ubicacion.Observacion = CType(userControl.FindControl("TextBox1"), TextBox).Text
        _Ubicacion.IdSemoviente = IdSemoviente

        UbicacionBL.SaveUBICACIONSEMOVIENTES(_Ubicacion)
    End Sub

    Protected Sub RadGrid2_DeleteCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid2.DeleteCommand
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim id As Int32
        id = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("IdUbicacionSemoviente")
        UbicacionBL.DeleteUBICACIONSEMOVIENTES(id)
    End Sub

    Protected Sub RadGrid2_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid2.UpdateCommand
        Dim userControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)

        _Ubicacion.IdUbicacionSemoviente = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("IdUbicacionSemoviente")
        _Ubicacion.FechaInicio = CType(userControl.FindControl("txtDate1"), TextBox).Text
        _Ubicacion.IdProyecto = CType(userControl.FindControl("RadComboBox1"), RadComboBox).SelectedValue
        _Ubicacion.Observacion = CType(userControl.FindControl("TextBox1"), TextBox).Text
        _Ubicacion.IdSemoviente = IdSemoviente

        UbicacionBL.SaveUBICACIONSEMOVIENTES(_Ubicacion)
    End Sub

    Protected Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand
        Dim userControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)

        _Propiedad.FechaFin.Equals(DBNull.Value)
        _Propiedad.FechaInicio = CType(userControl.FindControl("txtDate1"), TextBox).Text
        _Propiedad.IdCategoriaAnimal = CType(userControl.FindControl("DropDownList1"), DropDownList).SelectedValue
        _Propiedad.IdEstadoSemoviente = CType(userControl.FindControl("DropDownList2"), DropDownList).SelectedValue
        _Propiedad.Peso = CType(userControl.FindControl("RadNumericTextBox1"), RadNumericTextBox).Text
        _Propiedad.Valor = CType(userControl.FindControl("RadNumericTextBox2"), RadNumericTextBox).Text
        _Propiedad.IdSemoviente = IdSemoviente

        PropiedadBL.SavePROPIEDADSEMOVIENTES(_Propiedad)
    End Sub

    Protected Sub RadGrid1_DeleteCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.DeleteCommand
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim id As Int32
        id = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("IdPropiedadSemoviente")
        PropiedadBL.DeletePROPIEDADSEMOVIENTES(id)
    End Sub

    Protected Sub RadGrid1_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
        Dim userControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)

        _Propiedad.IdPropiedadSemoviente = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("IdPropiedadSemoviente")
        _Propiedad.FechaInicio = CType(userControl.FindControl("txtDate1"), TextBox).Text
        _Propiedad.IdCategoriaAnimal = CType(userControl.FindControl("DropDownList1"), DropDownList).SelectedValue
        _Propiedad.IdEstadoSemoviente = CType(userControl.FindControl("DropDownList2"), DropDownList).SelectedValue
        _Propiedad.Peso = CType(userControl.FindControl("RadNumericTextBox1"), RadNumericTextBox).Text
        _Propiedad.Valor = CType(userControl.FindControl("RadNumericTextBox2"), RadNumericTextBox).Text
        _Propiedad.IdSemoviente = IdSemoviente

        PropiedadBL.SavePROPIEDADSEMOVIENTES(_Propiedad)
    End Sub

    Protected Sub RadGrid3_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid3.InsertCommand
        Dim userControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)

        _Adjuntos.Archivo = CType(userControl.FindControl("TextBox3"), TextBox).Text
        _Adjuntos.Fecha = CType(userControl.FindControl("txtDate1"), TextBox).Text
        _Adjuntos.Nombre = CType(userControl.FindControl("TextBox1"), TextBox).Text
        _Adjuntos.IdSemoviente = IdSemoviente

        AdjuntoBL.SaveADJUNTOSEMOVIENTES(_Adjuntos)
    End Sub

    Protected Sub RadGrid3_DeleteCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid3.DeleteCommand
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim id As Int32
        id = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("IdAdjuntoSemoviente")
        AdjuntoBL.DeleteADJUNTOSEMOVIENTES(id)
    End Sub

    Protected Sub RadGrid3_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid3.UpdateCommand
        Dim userControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)

        _Adjuntos.IdAdjuntoSemoviente = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("IdAdjuntoSemoviente")
         _Adjuntos.Archivo = CType(userControl.FindControl("TextBox3"), TextBox).Text
        _Adjuntos.Fecha = CType(userControl.FindControl("txtDate1"), TextBox).Text
        _Adjuntos.Nombre = CType(userControl.FindControl("TextBox1"), TextBox).Text
        _Adjuntos.IdSemoviente = IdSemoviente

        AdjuntoBL.SaveADJUNTOSEMOVIENTES(_Adjuntos)
    End Sub
End Class


text:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <asm/uaccess.h>
#include <linux/fb.h>
#include <linux/init.h>

#if defined(CONFIG_M68VZ328)
#include <asm/MC68VZ328.h>
#elif defined(CONFIG_M68EZ328)
#include <asm/MC68EZ328.h>
#elif defined(CONFIG_M68328)
#include <asm/MC68328.h>
#else
#error wrong architecture for the MC68x328 frame buffer device
#endif

#if defined(CONFIG_FB_68328_INVERT)
#define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO01
#else
#define MC68X328FB_MONO_VISUAL FB_VISUAL_MONO10
#endif

static u_long videomemory;
static u_long videomemorysize;

static struct fb_info fb_info;
static u32 mc68x328fb_pseudo_palette[16];

static struct fb_var_screeninfo mc68x328fb_default __initdata = {
	.red =		{ 0, 8, 0 },
      	.green =	{ 0, 8, 0 },
      	.blue =		{ 0, 8, 0 },
      	.activate =	FB_ACTIVATE_TEST,
      	.height =	-1,
      	.width =	-1,
      	.pixclock =	20000,
      	.left_margin =	64,
      	.right_margin =	64,
      	.upper_margin =	32,
      	.lower_margin =	32,
      	.hsync_len =	64,
      	.vsync_len =	2,
      	.vmode =	FB_VMODE_NONINTERLACED,
};

static struct fb_fix_screeninfo mc68x328fb_fix __initdata = {
	.id =		"68328fb",
	.type =		FB_TYPE_PACKED_PIXELS,
	.xpanstep =	1,
	.ypanstep =	1,
	.ywrapstep =	1,
	.accel =	FB_ACCEL_NONE,
};

    /*
     *  Interface used by the world
     */
int mc68x328fb_init(void);
int mc68x328fb_setup(char *);

static int mc68x328fb_check_var(struct fb_var_screeninfo *var,
			 struct fb_info *info);
static int mc68x328fb_set_par(struct fb_info *info);
static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
			 u_int transp, struct fb_info *info);
static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
			   struct fb_info *info);
static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma);

static struct fb_ops mc68x328fb_ops = {
	.fb_check_var	= mc68x328fb_check_var,
	.fb_set_par	= mc68x328fb_set_par,
	.fb_setcolreg	= mc68x328fb_setcolreg,
	.fb_pan_display	= mc68x328fb_pan_display,
	.fb_fillrect	= cfb_fillrect,
	.fb_copyarea	= cfb_copyarea,
	.fb_imageblit	= cfb_imageblit,
	.fb_mmap	= mc68x328fb_mmap,
};

    /*
     *  Internal routines
     */

static u_long get_line_length(int xres_virtual, int bpp)
{
	u_long length;

	length = xres_virtual * bpp;
	length = (length + 31) & ~31;
	length >>= 3;
	return (length);
}

    /*
     *  Setting the video mode has been split into two parts.
     *  First part, xxxfb_check_var, must not write anything
     *  to hardware, it should only verify and adjust var.
     *  This means it doesn't alter par but it does use hardware
     *  data from it to check this var.
     */

static int mc68x328fb_check_var(struct fb_var_screeninfo *var,
			 struct fb_info *info)
{
	u_long line_length;

	/*
	 *  FB_VMODE_CONUPDATE and FB_VMODE_SMOOTH_XPAN are equal!
	 *  as FB_VMODE_SMOOTH_XPAN is only used internally
	 */

	if (var->vmode & FB_VMODE_CONUPDATE) {
		var->vmode |= FB_VMODE_YWRAP;
		var->xoffset = info->var.xoffset;
		var->yoffset = info->var.yoffset;
	}

	/*
	 *  Some very basic checks
	 */
	if (!var->xres)
		var->xres = 1;
	if (!var->yres)
		var->yres = 1;
	if (var->xres > var->xres_virtual)
		var->xres_virtual = var->xres;
	if (var->yres > var->yres_virtual)
		var->yres_virtual = var->yres;
	if (var->bits_per_pixel <= 1)
		var->bits_per_pixel = 1;
	else if (var->bits_per_pixel <= 8)
		var->bits_per_pixel = 8;
	else if (var->bits_per_pixel <= 16)
		var->bits_per_pixel = 16;
	else if (var->bits_per_pixel <= 24)
		var->bits_per_pixel = 24;
	else if (var->bits_per_pixel <= 32)
		var->bits_per_pixel = 32;
	else
		return -EINVAL;

	if (var->xres_virtual < var->xoffset + var->xres)
		var->xres_virtual = var->xoffset + var->xres;
	if (var->yres_virtual < var->yoffset + var->yres)
		var->yres_virtual = var->yoffset + var->yres;

	/*
	 *  Memory limit
	 */
	line_length =
	    get_line_length(var->xres_virtual, var->bits_per_pixel);
	if (line_length * var->yres_virtual > videomemorysize)
		return -ENOMEM;

	/*
	 * Now that we checked it we alter var. The reason being is that the video
	 * mode passed in might not work but slight changes to it might make it
	 * work. This way we let the user know what is acceptable.
	 */
	switch (var->bits_per_pixel) {
	case 1:
		var->red.offset = 0;
		var->red.length = 1;
		var->green.offset = 0;
		var->green.length = 1;
		var->blue.offset = 0;
		var->blue.length = 1;
		var->transp.offset = 0;
		var->transp.length = 0;
		break;
	case 8:
		var->red.offset = 0;
		var->red.length = 8;
		var->green.offset = 0;
		var->green.length = 8;
		var->blue.offset = 0;
		var->blue.length = 8;
		var->transp.offset = 0;
		var->transp.length = 0;
		break;
	case 16:		/* RGBA 5551 */
		if (var->transp.length) {
			var->red.offset = 0;
			var->red.length = 5;
			var->green.offset = 5;
			var->green.length = 5;
			var->blue.offset = 10;
			var->blue.length = 5;
			var->transp.offset = 15;
			var->transp.length = 1;
		} else {	/* RGB 565 */
			var->red.offset = 0;
			var->red.length = 5;
			var->green.offset = 5;
			var->green.length = 6;
			var->blue.offset = 11;
			var->blue.length = 5;
			var->transp.offset = 0;
			var->transp.length = 0;
		}
		break;
	case 24:		/* RGB 888 */
		var->red.offset = 0;
		var->red.length = 8;
		var->green.offset = 8;
		var->green.length = 8;
		var->blue.offset = 16;
		var->blue.length = 8;
		var->transp.offset = 0;
		var->transp.length = 0;
		break;
	case 32:		/* RGBA 8888 */
		var->red.offset = 0;
		var->red.length = 8;
		var->green.offset = 8;
		var->green.length = 8;
		var->blue.offset = 16;
		var->blue.length = 8;
		var->transp.offset = 24;
		var->transp.length = 8;
		break;
	}
	var->red.msb_right = 0;
	var->green.msb_right = 0;
	var->blue.msb_right = 0;
	var->transp.msb_right = 0;

	return 0;
}

/* This routine actually sets the video mode. It's in here where we
 * the hardware state info->par and fix which can be affected by the
 * change in par. For this driver it doesn't do much.
 */
static int mc68x328fb_set_par(struct fb_info *info)
{
	info->fix.line_length = get_line_length(info->var.xres_virtual,
						info->var.bits_per_pixel);
	return 0;
}

    /*
     *  Set a single color register. The values supplied are already
     *  rounded down to the hardware's capabilities (according to the
     *  entries in the var structure). Return != 0 for invalid regno.
     */

static int mc68x328fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
			 u_int transp, struct fb_info *info)
{
	if (regno >= 256)	/* no. of hw registers */
		return 1;
	/*
	 * Program hardware... do anything you want with transp
	 */

	/* grayscale works only partially under directcolor */
	if (info->var.grayscale) {
		/* grayscale = 0.30*R + 0.59*G + 0.11*B */
		red = green = blue =
		    (red * 77 + green * 151 + blue * 28) >> 8;
	}

	/* Directcolor:
	 *   var->{color}.offset contains start of bitfield
	 *   var->{color}.length contains length of bitfield
	 *   {hardwarespecific} contains width of RAMDAC
	 *   cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset)
	 *   RAMDAC[X] is programmed to (red, green, blue)
	 *
	 * Pseudocolor:
	 *    uses offset = 0 && length = RAMDAC register width.
	 *    var->{color}.offset is 0
	 *    var->{color}.length contains widht of DAC
	 *    cmap is not used
	 *    RAMDAC[X] is programmed to (red, green, blue)
	 * Truecolor:
	 *    does not use DAC. Usually 3 are present.
	 *    var->{color}.offset contains start of bitfield
	 *    var->{color}.length contains length of bitfield
	 *    cmap is programmed to (red << red.offset) | (green << green.offset) |
	 *                      (blue << blue.offset) | (transp << transp.offset)
	 *    RAMDAC does not exist
	 */
#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
	switch (info->fix.visual) {
	case FB_VISUAL_TRUECOLOR:
	case FB_VISUAL_PSEUDOCOLOR:
		red = CNVT_TOHW(red, info->var.red.length);
		green = CNVT_TOHW(green, info->var.green.length);
		blue = CNVT_TOHW(blue, info->var.blue.length);
		transp = CNVT_TOHW(transp, info->var.transp.length);
		break;
	case FB_VISUAL_DIRECTCOLOR:
		red = CNVT_TOHW(red, 8);	/* expect 8 bit DAC */
		green = CNVT_TOHW(green, 8);
		blue = CNVT_TOHW(blue, 8);
		/* hey, there is bug in transp handling... */
		transp = CNVT_TOHW(transp, 8);
		break;
	}
#undef CNVT_TOHW
	/* Truecolor has hardware independent palette */
	if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
		u32 v;

		if (regno >= 16)
			return 1;

		v = (red << info->var.red.offset) |
		    (green << info->var.green.offset) |
		    (blue << info->var.blue.offset) |
		    (transp << info->var.transp.offset);
		switch (info->var.bits_per_pixel) {
		case 8:
			break;
		case 16:
			((u32 *) (info->pseudo_palette))[regno] = v;
			break;
		case 24:
		case 32:
			((u32 *) (info->pseudo_palette))[regno] = v;
			break;
		}
		return 0;
	}
	return 0;
}

    /*
     *  Pan or Wrap the Display
     *
     *  This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
     */

static int mc68x328fb_pan_display(struct fb_var_screeninfo *var,
			   struct fb_info *info)
{
	if (var->vmode & FB_VMODE_YWRAP) {
		if (var->yoffset < 0
		    || var->yoffset >= info->var.yres_virtual
		    || var->xoffset)
			return -EINVAL;
	} else {
		if (var->xoffset + var->xres > info->var.xres_virtual ||
		    var->yoffset + var->yres > info->var.yres_virtual)
			return -EINVAL;
	}
	info->var.xoffset = var->xoffset;
	info->var.yoffset = var->yoffset;
	if (var->vmode & FB_VMODE_YWRAP)
		info->var.vmode |= FB_VMODE_YWRAP;
	else
		info->var.vmode &= ~FB_VMODE_YWRAP;
	return 0;
}

    /*
     *  Most drivers don't need their own mmap function
     */

static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
#ifndef MMU
	/* this is uClinux (no MMU) specific code */

	vma->vm_flags |= VM_RESERVED;
	vma->vm_start = videomemory;

	return 0;
#else
	return -EINVAL;
#endif
}

int __init mc68x328fb_setup(char *options)
{
#if 0
	char *this_opt;
#endif

	if (!options || !*options)
		return 1;
#if 0
	while ((this_opt = strsep(&options, ",")) != NULL) {
		if (!*this_opt)
			continue;
		if (!strncmp(this_opt, "disable", 7))
			mc68x328fb_enable = 0;
	}
#endif
	return 1;
}

    /*
     *  Initialisation
     */

int __init mc68x328fb_init(void)
{
#ifndef MODULE
	char *option = NULL;

	if (fb_get_options("68328fb", &option))
		return -ENODEV;
	mc68x328fb_setup(option);
#endif
	/*
	 *  initialize the default mode from the LCD controller registers
	 */
	mc68x328fb_default.xres = LXMAX;
	mc68x328fb_default.yres = LYMAX+1;
	mc68x328fb_default.xres_virtual = mc68x328fb_default.xres;
	mc68x328fb_default.yres_virtual = mc68x328fb_default.yres;
	mc68x328fb_default.bits_per_pixel = 1 + (LPICF & 0x01);
	videomemory = LSSA;
	videomemorysize = (mc68x328fb_default.xres_virtual+7) / 8 *
		mc68x328fb_default.yres_virtual * mc68x328fb_default.bits_per_pixel;

	fb_info.screen_base = (void *)videomemory;
	fb_info.fbops = &mc68x328fb_ops;
	fb_info.var = mc68x328fb_default;
	fb_info.fix = mc68x328fb_fix;
	fb_info.fix.smem_start = videomemory;
	fb_info.fix.smem_len = videomemorysize;
	fb_info.fix.line_length =
		get_line_length(mc68x328fb_default.xres_virtual, mc68x328fb_default.bits_per_pixel);
	fb_info.fix.visual = (mc68x328fb_default.bits_per_pixel) == 1 ?
		MC68X328FB_MONO_VISUAL : FB_VISUAL_PSEUDOCOLOR;
	if (fb_info.var.bits_per_pixel == 1) {
		fb_info.var.red.length = fb_info.var.green.length = fb_info.var.blue.length = 1;
		fb_info.var.red.offset = fb_info.var.green.offset = fb_info.var.blue.offset = 0;
	}
	fb_info.pseudo_palette = &mc68x328fb_pseudo_palette;
	fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;

	if (fb_alloc_cmap(&fb_info.cmap, 256, 0))
		return -ENOMEM;

	if (register_framebuffer(&fb_info) < 0) {
		fb_dealloc_cmap(&fb_info.cmap);
		return -EINVAL;
	}

	printk(KERN_INFO
		"fb%d: %s frame buffer device\n", fb_info.node,	fb_info.fix.id);
	printk(KERN_INFO
		"fb%d: %dx%dx%d at 0x%08lx\n", fb_info.node,
		mc68x328fb_default.xres_virtual, mc68x328fb_default.yres_virtual,
		1 << mc68x328fb_default.bits_per_pixel, videomemory);

	return 0;
}

module_init(mc68x328fb_init);

#ifdef MODULE

static void __exit mc68x328fb_cleanup(void)
{
	unregister_framebuffer(&fb_info);
	fb_dealloc_cmap(&fb_info.cmap);
}

module_exit(mc68x328fb_cleanup);

MODULE_LICENSE("GPL");
#endif				/* MODULE */


text:
#ifndef __itkAvantsMutualInformationRegistrationFunction_h
#define __itkAvantsMutualInformationRegistrationFunction_h
#include <vcl_compiler.h>
#include <iostream>
#include "cmath"
#include "itkImageFileWriter.h"
#include "itkImageToImageMetric.h"
#include "itkAvantsPDEDeformableRegistrationFunction.h"
#include "itkCovariantVector.h"
#include "itkPoint.h"
#include "itkIndex.h"
#include "itkBSplineKernelFunction.h"
#include "itkBSplineDerivativeKernelFunction.h"
#include "itkCentralDifferenceImageFunction.h"
#include "itkBSplineInterpolateImageFunction.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkTranslationTransform.h"
#include "itkArray2D.h"
#include "itkImageBase.h"
#include "itkTransform.h"
#include "itkInterpolateImageFunction.h"
#include "itkSingleValuedCostFunction.h"
#include "itkMacro.h"
#include "itkGradientRecursiveGaussianImageFilter.h"
#include "itkSpatialObject.h"
#include "itkConstNeighborhoodIterator.h"

namespace itk
{
/** \class AvantsMutualInformationRegistrationFunction
 * \brief Computes the mutual information between two images to be
 * registered using the method of Avants et al.
 *
 * AvantsMutualInformationRegistrationFunction computes the mutual
 * information between a fixed and moving image to be registered.
 *
 * This class is templated over the FixedImage type and the MovingImage
 * type.
 *
 * The fixed and moving images are set via methods SetFixedImage() and
 * SetMovingImage(). This metric makes use of user specified Transform and
 * Interpolator. The Transform is used to map points from the fixed image to
 * the moving image domain. The Interpolator is used to evaluate the image
 * intensity at user specified geometric points in the moving image.
 * The Transform and Interpolator are set via methods SetTransform() and
 * SetInterpolator().
 *
 * If a BSplineInterpolationFunction is used, this class obtain
 * image derivatives from the BSpline interpolator. Otherwise,
 * image derivatives are computed using central differencing.
 *
 * \warning This metric assumes that the moving image has already been
 * connected to the interpolator outside of this class.
 *
 * The method GetValue() computes of the mutual information
 * while method GetValueAndDerivative() computes
 * both the mutual information and its derivatives with respect to the
 * transform parameters.
 *
 * The calculations are based on the method of Avants et al [1,2]
 * where the probability density distribution are estimated using
 * Parzen histograms. Since the fixed image PDF does not contribute
 * to the derivatives, it does not need to be smooth. Hence,
 * a zero order (box car) BSpline kernel is used
 * for the fixed image intensity PDF. On the other hand, to ensure
 * smoothness a third order BSpline kernel is used for the
 * moving image intensity PDF.
 *
 * On Initialize(), the FixedImage is uniformly sampled within
 * the FixedImageRegion. The number of samples used can be set
 * via SetNumberOfSpatialSamples(). Typically, the number of
 * spatial samples used should increase with the image size.
 *
 * During each call of GetValue(), GetDerivatives(),
 * GetValueAndDerivatives(), marginal and joint intensity PDF's
 * values are estimated at discrete position or bins.
 * The number of bins used can be set via SetNumberOfHistogramBins().
 * To handle data with arbitray magnitude and dynamic range,
 * the image intensity is scale such that any contribution to the
 * histogram will fall into a valid bin.
 *
 * One the PDF's have been contructed, the mutual information
 * is obtained by doubling summing over the discrete PDF values.
 *
 *
 * Notes:
 * 1. This class returns the negative mutual information value.
 * 2. This class in not thread safe due the private data structures
 *     used to the store the sampled points and the marginal and joint pdfs.
 *
 * References:
 * [1] "Nonrigid multimodality image registration"
 *      D. Avants, D. R. Haynor, H. Vesselle, T. Lewellen and W. Eubank
 *      Medical Imaging 2001: Image Processing, 2001, pp. 1609-1620.
 * [2] "PET-CT Image Registration in the Chest Using Free-form Deformations"
 *      D. Avants, D. R. Haynor, H. Vesselle, T. Lewellen and W. Eubank
 *      IEEE Transactions in Medical Imaging. Vol.22, No.1,
        January 2003. pp.120-128.
 * [3] "Optimization of Mutual Information for MultiResolution Image
 *      Registration"
 *      P. Thevenaz and M. Unser
 *      IEEE Transactions in Image Processing, 9(12) December 2000.
 *
 * \ingroup RegistrationMetrics
 * \ingroup ThreadUnSafe
 */
template <typename TFixedImage, typename TMovingImage, typename TDisplacementField>
class AvantsMutualInformationRegistrationFunction final
  : public AvantsPDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
{
public:
  /** Standard class typedefs. */
  typedef AvantsMutualInformationRegistrationFunction                                            Self;
  typedef AvantsPDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField> Superclass;
  typedef SmartPointer<Self>                                                                     Pointer;
  typedef SmartPointer<const Self>                                                               ConstPointer;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(AvantsMutualInformationRegistrationFunction, AvantsPDEDeformableRegistrationFunction);

  /** MovingImage image type. */
  typedef typename Superclass::MovingImageType    MovingImageType;
  typedef typename Superclass::MovingImagePointer MovingImagePointer;

  /** FixedImage image type. */
  typedef typename Superclass::FixedImageType    FixedImageType;
  typedef typename Superclass::FixedImagePointer FixedImagePointer;
  typedef typename FixedImageType::IndexType     IndexType;
  typedef typename FixedImageType::SizeType      SizeType;
  typedef typename FixedImageType::SpacingType   SpacingType;

  /** Deformation field type. */
  typedef typename Superclass::VectorType                   VectorType;
  typedef typename Superclass::DisplacementFieldType        DisplacementFieldType;
  typedef typename Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer;

  /** Inherit some enums from the superclass. */
  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;

  /** Inherit some enums from the superclass. */
  typedef typename Superclass::PixelType        PixelType;
  typedef typename Superclass::RadiusType       RadiusType;
  typedef typename Superclass::NeighborhoodType NeighborhoodType;
  typedef typename Superclass::FloatOffsetType  FloatOffsetType;
  typedef typename Superclass::TimeStepType     TimeStepType;

  /** Interpolator type. */
  typedef double CoordRepType;
  typedef //       //    LinearInterpolateImageFunction<MovingImageType,CoordRepType>
    BSplineInterpolateImageFunction<MovingImageType, CoordRepType>
                                               InterpolatorType;
  typedef typename InterpolatorType::Pointer   InterpolatorPointer;
  typedef typename InterpolatorType::PointType PointType;
  typedef InterpolatorType                     DefaultInterpolatorType;
  //  typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
  // DefaultInterpolatorType;

  /** Covariant vector type. */
  typedef CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;

  /** Gradient calculator type. */
  typedef CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
  typedef typename GradientCalculatorType::Pointer       GradientCalculatorPointer;

  /** Set the moving image interpolator. */
  void
  SetMovingImageInterpolator(InterpolatorType * ptr)
  {
    m_MovingImageInterpolator = ptr;
  }

  /** Get the moving image interpolator. */
  InterpolatorType *
  GetMovingImageInterpolator(void)
  {
    return m_MovingImageInterpolator;
  }

  /** This class uses a constant timestep of 1. */
  TimeStepType
  ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const override
  {
    return 1;
  }

  /** Return a pointer to a global data structure that is passed to
   * this object from the solver at each calculation.  */
  void *
  GetGlobalDataPointer() const override
  {
    GlobalDataStruct * global = new GlobalDataStruct();

    //    global->m_SumOfSquaredDifference  = 0.0;
    // / global->m_NumberOfPixelsProcessed = 0L;
    // global->m_SumOfSquaredChange      = 0;
    return global;
  }

  /** Release memory for global data structure. */
  void
  ReleaseGlobalDataPointer(void * GlobalData) const override
  {
    delete (GlobalDataStruct *)GlobalData;
  }

  /** Set the object's state before each iteration. */
  void
  InitializeIteration() override;

  typedef double CoordinateRepresentationType;

  /** Types inherited from Superclass. */
  typedef TranslationTransform<CoordinateRepresentationType,
                               //                    itkGetStaticConstMacro(ImageDimension),
                               itkGetStaticConstMacro(ImageDimension)>
    TransformType;

  typedef ImageToImageMetric<TFixedImage, TMovingImage> Metricclass;

  typedef typename TransformType::Pointer             TransformPointer;
  typedef typename Metricclass::TransformJacobianType TransformJacobianType;
  //  typedef typename Metricclass::InterpolatorType         InterpolatorType;
  typedef typename Metricclass::MeasureType             MeasureType;
  typedef typename Metricclass::DerivativeType          DerivativeType;
  typedef typename TransformType::ParametersType        ParametersType;
  typedef typename Metricclass::FixedImageConstPointer  FixedImageConstPointer;
  typedef typename Metricclass::MovingImageConstPointer MovingImageCosntPointer;
  // typedef typename TransformType::CoordinateRepresentationType  CoordinateRepresentationType;

  /** Index and Point typedef support. */
  typedef typename FixedImageType::IndexType           FixedImageIndexType;
  typedef typename FixedImageIndexType::IndexValueType FixedImageIndexValueType;
  typedef typename MovingImageType::IndexType          MovingImageIndexType;
  typedef typename TransformType::InputPointType       FixedImagePointType;
  typedef typename TransformType::OutputPointType      MovingImagePointType;

  /** The marginal PDFs are stored as std::vector. */
  typedef float PDFValueType;
  //  typedef std::vector<PDFValueType> MarginalPDFType;
  typedef Image<PDFValueType, 1>              MarginalPDFType;
  typedef typename MarginalPDFType::IndexType MarginalPDFIndexType;
  /** Typedef for the joint PDF and PDF derivatives are stored as ITK Images. */
  typedef Image<PDFValueType, 2>              JointPDFType;
  typedef Image<PDFValueType, 3>              JointPDFDerivativesType;
  typedef JointPDFType::IndexType             JointPDFIndexType;
  typedef JointPDFType::PixelType             JointPDFValueType;
  typedef JointPDFType::RegionType            JointPDFRegionType;
  typedef JointPDFType::SizeType              JointPDFSizeType;
  typedef JointPDFDerivativesType::IndexType  JointPDFDerivativesIndexType;
  typedef JointPDFDerivativesType::PixelType  JointPDFDerivativesValueType;
  typedef JointPDFDerivativesType::RegionType JointPDFDerivativesRegionType;
  typedef JointPDFDerivativesType::SizeType   JointPDFDerivativesSizeType;
  typedef typename MarginalPDFType::PointType MarginalPDFPointType;
  typedef typename JointPDFType::PointType    JointPDFPointType;
  typedef typename JointPDFType::SpacingType  JointPDFSpacingType;

  /**  Get the value and derivatives for single valued optimizers. */
  double
  GetValueAndDerivative(IndexType        index,
                        MeasureType &    Value,
                        DerivativeType & Derivative1,
                        DerivativeType & Derivative2);

  /**  Get the value and derivatives for single valued optimizers. */
  double
  GetValueAndDerivativeInv(IndexType        index,
                           MeasureType &    Value,
                           DerivativeType & Derivative1,
                           DerivativeType & Derivative2);

  /** Number of spatial samples to used to compute metric */
  //  itkSetClampMacro( NumberOfSpatialSamples, unsigned long,
  //                1, NumericTraits<unsigned long>::max() );
  // itkGetConstReferenceMacro( NumberOfSpatialSamples, unsigned long);

  /** Number of bins to used in the histogram. Typical value is 50. */
  //  itkSetClampMacro( NumberOfHistogramBins, unsigned long,
  //                1, NumericTraits<unsigned long>::max() );
  // itkGetConstReferenceMacro( NumberOfHistogramBins, unsigned long);
  void
  SetNumberOfHistogramBins(unsigned long nhb)
  {
    m_NumberOfHistogramBins = nhb + 2 * this->m_Padding;
  }

  unsigned long
  GetNumberOfHistogramBins()
  {
    return m_NumberOfHistogramBins;
  }

  void
  SetTransform(TransformPointer t)
  {
    m_Transform = t;
  }

  TransformPointer
  GetTransform()
  {
    return m_Transform;
  }

  void
  SetInterpolator(InterpolatorPointer t)
  {
    m_Interpolator = t;
  }

  InterpolatorPointer
  GetInterpolator()
  {
    return m_Interpolator;
  }

  void
  GetProbabilities();

  void
  ComputeJointPDFPoint(double fixedImageValue, double movingImageValue, JointPDFPointType & jointPDFpoint)
  {
    double a = (fixedImageValue - this->m_FixedImageTrueMin) / (this->m_FixedImageTrueMax - this->m_FixedImageTrueMin);
    double b =
      (movingImageValue - this->m_MovingImageTrueMin) / (this->m_MovingImageTrueMax - this->m_MovingImageTrueMin);

    jointPDFpoint[0] = a;
    jointPDFpoint[1] = b;
  }

  inline double
  ComputeFixedImageMarginalPDFDerivative(MarginalPDFPointType margPDFpoint, unsigned int /* threadID */)
  {
    double offset = 0.25 * this->m_JointPDFSpacing[0], eps = this->m_JointPDFSpacing[0]; // offset in
                                                                                // voxels
    MarginalPDFPointType leftpoint = margPDFpoint;

    leftpoint[0] -= offset;
    MarginalPDFPointType rightpoint = margPDFpoint;
    rightpoint[0] += offset;
    if (leftpoint[0] < eps)
    {
      leftpoint[0] = eps;
    }
    if (rightpoint[0] < eps)
    {
      rightpoint[0] = eps;
    }
    //    if (leftpoint[0] > 1-eps ) leftpoint[0]=1-eps;
    //    if (rightpoint[0] > 1-eps ) rightpoint[0]=1-eps;
    double delta = rightpoint[0] - leftpoint[0];
    if (delta > 0)
    {
      double deriv = pdfinterpolator2->Evaluate(rightpoint) - pdfinterpolator2->Evaluate(leftpoint);
      return deriv;
    }
    else
    {
      return 0;
    }
  }

  inline double
  ComputeMovingImageMarginalPDFDerivative(MarginalPDFPointType margPDFpoint, unsigned int /* threadID */)
  {
    double               offset = 0.5 * this->m_JointPDFSpacing[0];
    double               eps = this->m_JointPDFSpacing[0]; // offset in voxels
    MarginalPDFPointType leftpoint = margPDFpoint;

    leftpoint[0] -= offset;
    MarginalPDFPointType rightpoint = margPDFpoint;
    rightpoint[0] += offset;
    if (leftpoint[0] < eps)
    {
      leftpoint[0] = eps;
    }
    if (rightpoint[0] < eps)
    {
      rightpoint[0] = eps;
    }
    if (leftpoint[0] > 1)
    {
      leftpoint[0] = 1;
    }
    if (rightpoint[0] > 1)
    {
      rightpoint[0] = 1;
    }
    double delta = rightpoint[0] - leftpoint[0];
    if (delta > 0)
    {
      double deriv = pdfinterpolator3->Evaluate(rightpoint) - pdfinterpolator3->Evaluate(leftpoint);
      return deriv / delta;
    }
    else
    {
      return 0;
    }
  }

  inline double
  ComputeJointPDFDerivative(JointPDFPointType jointPDFpoint, unsigned int /* threadID */, unsigned int ind)
  {
    double            offset = 0.5 * this->m_JointPDFSpacing[ind];
    double            eps = this->m_JointPDFSpacing[ind]; // offset in voxels
    JointPDFPointType leftpoint = jointPDFpoint;

    leftpoint[ind] -= offset;
    JointPDFPointType rightpoint = jointPDFpoint;
    rightpoint[ind] += offset;
    if (leftpoint[ind] < eps)
    {
      leftpoint[ind] = eps;
    }
    if (rightpoint[ind] < eps)
    {
      rightpoint[ind] = eps;
    }
    if (leftpoint[ind] > 1)
    {
      leftpoint[ind] = 1;
    }
    if (rightpoint[ind] > 1)
    {
      rightpoint[ind] = 1;
    }
    double delta = rightpoint[ind] - leftpoint[ind];
    double deriv = 0;
    if (delta > 0)
    {
      deriv = pdfinterpolator->Evaluate(rightpoint) - pdfinterpolator->Evaluate(leftpoint);
      return deriv / delta;
    }
    else
    {
      return deriv;
    }
  }

  double
  ComputeMutualInformation()
  {
    /** Ray Razlighi changes : May 3, 2010: improves convergence.
1- The padding is lowered to 2.
2- The MI energy is changed to actual MI, please note the value of this MI is in the range of [0  min(H(x),H(y))]. in
case you need it to be normalized. 3- The Natural logarithm is changed to log2. 4- In the ComputeMutualInformation() the
iterator range has been changed to cover the entire PDF. 5- In the FitIndexInBins() the truncation by floor has been
modified to round. 6- The normalization is done based on NomberOfHistogramBins-1 instead of NomberOfHistogramBins. */
    float         px, py, pxy;
    double        mival = 0;
    double        mi;
    unsigned long ct = 0;

    typename JointPDFType::IndexType index;
    for (unsigned int ii = 0; ii < m_NumberOfHistogramBins; ii++)
    {
      MarginalPDFIndexType mind;
      mind[0] = ii;
      px = m_FixedImageMarginalPDF->GetPixel(mind);
      for (unsigned int jj = 0; jj < m_NumberOfHistogramBins; jj++)
      {
        mind[0] = jj;
        py = m_MovingImageMarginalPDF->GetPixel(mind);
        float denom = px * py;
        index[0] = ii;
        index[1] = jj;
        // pxy=m_JointPDF->GetPixel(index);

        JointPDFValueType * pdfPtr = m_JointPDF->GetBufferPointer() + (ii * m_NumberOfHistogramBins);
        // Move the pointer to the first affected bin
        int pdfMovingIndex = static_cast<int>(jj);
        pdfPtr += pdfMovingIndex;
        pxy = *(pdfPtr);

        mi = 0;
        if (fabs(denom) > 0)
        {
          if (pxy / denom > 0)
          {
            // true mi
            mi = pxy * std::log(pxy / denom);
            // test mi
            // mi = 1.0 + log(pxy/denom);
            ct++;
          }
        }

        mival += mi;
      }
      //      std::cout << " II " << ii << " JJ " << ii << " pxy " << pxy << " px " << px << std::endl;
    }
    // GS: temp edit to make sure if this is decreasing (should be )
    // this->m_Energy = -1.0*mival/std::log((double)2.0);
    this->m_Energy = -1.0 * mival / std::log((double)2.0);
    return this->m_Energy;
  }

  VectorType
  ComputeUpdateInv(const NeighborhoodType & neighborhood,
                   void * /* globalData */,
                   const FloatOffsetType & /* offset */ = FloatOffsetType(0.0)) override
  {
    VectorType update;

    update.Fill(0.0);
    IndexType oindex = neighborhood.GetIndex();

    FixedImageType * img = const_cast<FixedImageType *>(this->Superclass::m_FixedImage.GetPointer());
    if (!img)
    {
      return update;
    }
    typename FixedImageType::SpacingType spacing = img->GetSpacing();
    typename FixedImageType::SizeType    imagesize = img->GetLargestPossibleRegion().GetSize();
    for (unsigned int dd = 0; dd < ImageDimension; dd++)
    {
      if (oindex[dd] < 1 || oindex[dd] >= static_cast<typename IndexType::IndexValueType>(imagesize[dd] - 1))
      {
        return update;
      }
    }

    CovariantVectorType fixedGradient;
    ParametersType      fdvec1(ImageDimension);
    ParametersType      fdvec2(ImageDimension);
    fdvec1.Fill(0);
    fdvec2.Fill(0);
    fixedGradient = m_FixedImageGradientCalculator->EvaluateAtIndex(oindex);
    double       nccm1 = 0;
    const double loce = this->GetValueAndDerivative(oindex, nccm1, fdvec1, fdvec2);
    //    if ( loce > 1.5 ) std::cout << " loce " << loce << " ind " << oindex << std::endl;
    for (unsigned int imd = 0; imd < ImageDimension; imd++)
    {
      update[imd] = loce * fixedGradient[imd] * spacing[imd] * (1);
    }
    // if (this->m_MetricImage) this->m_MetricImage->SetPixel(oindex,loce);
    return update;
  }

  /*   Normalizing the image to the range of [0 1] */
  double
  GetMovingParzenTerm(double intensity)
  {
    return intensity;
    /*
    double windowTerm = static_cast<double>( intensity ) -  this->m_MovingImageTrueMin;
    windowTerm = windowTerm / ( this->m_MovingImageTrueMax - this->m_MovingImageTrueMin   );
    return windowTerm;
    */
  }

  double
  GetFixedParzenTerm(double intensity)
  {
    return intensity;
    /*
    double windowTerm = static_cast<double>( intensity ) -  this->m_FixedImageTrueMin;
    windowTerm = windowTerm / ( this->m_FixedImageTrueMax - this->m_FixedImageTrueMin   );
    return windowTerm;
    */
  }

  /* find the image index in the number of histogram bins */
  unsigned int
  FitIndexInBins(double windowTerm)
  {
    unsigned int movingImageParzenWindowIndex = static_cast<unsigned int>(
      this->m_Padding +
      static_cast<unsigned int>(static_cast<float>(windowTerm) *
                                  static_cast<float>(this->m_NumberOfHistogramBins - 1 - this->m_Padding) +
                                0.5f));

    // Make sure the extreme values are in valid bins
    if (movingImageParzenWindowIndex < this->m_Padding)
    {
      movingImageParzenWindowIndex = this->m_Padding - 1;
    }
    else if (movingImageParzenWindowIndex > (m_NumberOfHistogramBins - this->m_Padding))
    {
      movingImageParzenWindowIndex = m_NumberOfHistogramBins - this->m_Padding - 1;
    }

    return movingImageParzenWindowIndex;
  }

  double
  FitContIndexInBins(double windowTerm)
  {
    return static_cast<double>(this->m_Padding) +
           windowTerm * static_cast<double>(this->m_NumberOfHistogramBins - this->m_Padding);
  }

  VectorType
  ComputeUpdate(const NeighborhoodType & neighborhood,
                void * /* globalData */,
                const FloatOffsetType & /* offset */ = FloatOffsetType(0.0)) override
  {
    VectorType update;

    update.Fill(0.0);
    IndexType oindex = neighborhood.GetIndex();

    FixedImageType * img = const_cast<FixedImageType *>(this->Superclass::m_MovingImage.GetPointer());
    if (!img)
    {
      return update;
    }
    typename FixedImageType::SpacingType spacing = img->GetSpacing();
    typename FixedImageType::SizeType    imagesize = img->GetLargestPossibleRegion().GetSize();
    for (unsigned int dd = 0; dd < ImageDimension; dd++)
    {
      if (oindex[dd] < 1 || oindex[dd] >= static_cast<typename IndexType::IndexValueType>(imagesize[dd] - 1))
      {
        return update;
      }
    }

    CovariantVectorType movingGradient;
    ParametersType      fdvec1(ImageDimension);
    ParametersType      fdvec2(ImageDimension);
    fdvec1.Fill(0);
    fdvec2.Fill(0);
    movingGradient = m_MovingImageGradientCalculator->EvaluateAtIndex(oindex);

    double       nccm1 = 0;
    const double loce = this->GetValueAndDerivativeInv(oindex, nccm1, fdvec1, fdvec2);
    for (unsigned int imd = 0; imd < ImageDimension; imd++)
    {
      update[imd] = loce * movingGradient[imd] * spacing[imd] * (1);
    }
    //    if( oindex[1] == 250 && oindex[0] == 250  ) WriteImages();
    return update;
  }

  void
  WriteImages()
  {
    if (this->m_MetricImage)
    {
      typedef ImageFileWriter<FixedImageType> writertype;
      typename writertype::Pointer            w = writertype::New();
      w->SetInput(this->m_MetricImage);
      w->SetFileName("ZZmetric.nii.gz");
      w->Write();
    }
  }

  void
  SetOpticalFlow(bool b)
  {
    m_OpticalFlow = b;
  }

  typename JointPDFType::Pointer
  GetJointPDF()
  {
    return m_JointPDF;
  }

  void
  SetFixedImageMask(FixedImageType * img)
  {
    m_FixedImageMask = img;
  }

  /** FixedImage image neighborhood iterator type. */
  typedef ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;

  /** A global data type for this class of equation. Used to store
   * iterators for the fixed image. */
  struct GlobalDataStruct
  {
    FixedImageNeighborhoodIteratorType m_FixedImageIterator;
  };

  /** The fixed image marginal PDF. */
  mutable MarginalPDFType::Pointer m_FixedImageMarginalPDF;

  /** The moving image marginal PDF. */
  mutable MarginalPDFType::Pointer m_MovingImageMarginalPDF;

  /** The joint PDF and PDF derivatives. */
  typename JointPDFType::Pointer m_JointPDF;

  unsigned long m_NumberOfSpatialSamples;
  unsigned long m_NumberOfParameters;

  /** Variables to define the marginal and joint histograms. */
  unsigned long m_NumberOfHistogramBins;
  double        m_MovingImageNormalizedMin;
  double        m_FixedImageNormalizedMin;
  double        m_MovingImageTrueMin;
  double        m_MovingImageTrueMax;
  double        m_FixedImageTrueMin;
  double        m_FixedImageTrueMax;
  double        m_FixedImageBinSize;
  double        m_MovingImageBinSize;

protected:
  AvantsMutualInformationRegistrationFunction();
  ~AvantsMutualInformationRegistrationFunction() override = default;
  void
  PrintSelf(std::ostream & os, Indent indent) const override;

private:
  AvantsMutualInformationRegistrationFunction(const Self &) = delete;
  void
  operator=(const Self &) = delete;

  typename JointPDFDerivativesType::Pointer m_JointPDFDerivatives;

  /** Typedefs for BSpline kernel and derivative functions. */
  typedef BSplineKernelFunction<3>           CubicBSplineFunctionType;
  typedef BSplineDerivativeKernelFunction<3> CubicBSplineDerivativeFunctionType;

  /** Cubic BSpline kernel for computing Parzen histograms. */
  typename CubicBSplineFunctionType::Pointer           m_CubicBSplineKernel;
  typename CubicBSplineDerivativeFunctionType::Pointer m_CubicBSplineDerivativeKernel;

  /**
   * Types and variables related to image derivative calculations.
   * If a BSplineInterpolationFunction is used, this class obtain
   * image derivatives from the BSpline interpolator. Otherwise,
   * image derivatives are computed using central differencing.
   */
  typedef CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> ImageDerivativesType;

  /** Boolean to indicate if the interpolator BSpline. */
  bool m_InterpolatorIsBSpline;

  // boolean to determine if we use mono-modality assumption
  bool m_OpticalFlow;

  /** Typedefs for using BSpline interpolator. */
  typedef BSplineInterpolateImageFunction<MovingImageType, CoordinateRepresentationType> BSplineInterpolatorType;

  /** Pointer to BSplineInterpolator. */
  typename BSplineInterpolatorType::Pointer m_BSplineInterpolator;

  /** Typedefs for using central difference calculator. */
  typedef CentralDifferenceImageFunction<MovingImageType, CoordinateRepresentationType> DerivativeFunctionType;

  /** Pointer to central difference calculator. */
  typename DerivativeFunctionType::Pointer m_DerivativeCalculator;

  /**
   * Types and variables related to BSpline deformable transforms.
   * If the transform is of type third order BSplineTransform,
   * then we can speed up the metric derivative calculation by
   * only inspecting the parameters within the support region
   * of a mapped point.
   */

  /** Boolean to indicate if the transform is BSpline deformable. */

  /**
   * Enum of the deformabtion field spline order.
   */
  enum
  {
    DeformationSplineOrder = 3
  };

  typename TFixedImage::SpacingType m_FixedImageSpacing;
  typename TFixedImage::PointType   m_FixedImageOrigin;

  typedef FixedArray<unsigned long, FixedImageType::ImageDimension> ParametersOffsetType;
  ParametersOffsetType                                              m_ParametersOffset;

  mutable TransformPointer m_Transform;
  InterpolatorPointer      m_Interpolator;
  InterpolatorPointer      m_FixedImageInterpolator;
  InterpolatorPointer      m_MovingImageInterpolator;

  GradientCalculatorPointer m_FixedImageGradientCalculator;
  GradientCalculatorPointer m_MovingImageGradientCalculator;

  FixedImagePointer  m_FixedImageMask;
  MovingImagePointer m_MovingImageMask;

  double m_NormalizeMetric;
  float  m_Normalizer;

  typedef LinearInterpolateImageFunction<JointPDFType, double> pdfintType;
  typename pdfintType::Pointer                                 pdfinterpolator;

  typedef LinearInterpolateImageFunction<JointPDFDerivativesType, double> dpdfintType;
  typename dpdfintType::Pointer                                           dpdfinterpolator;

  typedef BSplineInterpolateImageFunction<MarginalPDFType, double> pdfintType2;
  typename pdfintType2::Pointer                                    pdfinterpolator2;
  typename pdfintType2::Pointer                                    pdfinterpolator3;

  unsigned int        m_Padding;
  JointPDFSpacingType m_JointPDFSpacing;
};
} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#  include "itkAvantsMutualInformationRegistrationFunction.cxx"
#endif

#endif


text:
import { Routes, RouterModule }  from '@angular/router';

import { UpgradeComponent } from './upgrade.component';
import { ModuleWithProviders } from '@angular/core';

// noinspection TypeScriptValidateTypes
export const routes: Routes = [
  {
    path: '',
    component: UpgradeComponent,
    children: [
      //{ path: 'treeview', component: TreeViewComponent }
    ]
  }
];

export const routing: ModuleWithProviders = RouterModule.forChild(routes);


text:
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.shortcuts import redirect, render
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.http import HttpResponseBadRequest
from django.utils.translation import ugettext_lazy as _
from django.utils.module_loading import import_string

from lazysignup.decorators import allow_lazy_user
from lazysignup.exceptions import NotLazyError
from lazysignup.models import LazyUser
from lazysignup.forms import UserCreationForm
from lazysignup import constants

@allow_lazy_user
def convert(request, form_class=None,
            redirect_field_name='redirect_to',
            anonymous_redirect=settings.LOGIN_URL,
            template_name='lazysignup/convert.html',
            ajax_template_name='lazysignup/convert_ajax.html'):
    """ Convert a temporary user to a real one. Reject users who don't
    appear to be temporary users (ie. they have a usable password)
    """
    redirect_to = 'lazysignup_convert_done'

    if form_class is None:
        if constants.LAZYSIGNUP_CUSTOM_USER_CREATION_FORM is not None:
            form_class = import_string(constants.LAZYSIGNUP_CUSTOM_USER_CREATION_FORM)
        else:
            form_class = UserCreationForm

    # If we've got an anonymous user, redirect to login
    if request.user.is_anonymous:
        return HttpResponseRedirect(anonymous_redirect)

    if request.method == 'POST':
        redirect_to = request.POST.get(redirect_field_name) or redirect_to
        form = form_class(request.POST, instance=request.user)
        if form.is_valid():
            try:
                LazyUser.objects.convert(form)
            except NotLazyError:
                # If the user already has a usable password, return a Bad
                # Request to an Ajax client, or just redirect back for a
                # regular client.
                if request.is_ajax():
                    return HttpResponseBadRequest(
                        content=_(u"Already converted."))
                else:
                    return redirect(redirect_to)

            # Re-log the user in, as they'll now not be authenticatable with
            # the Lazy backend
            login(request, authenticate(**form.get_credentials()))

            # If we're being called via AJAX, then we just return a 200
            # directly to the client. If not, then we redirect to a
            # confirmation page or to redirect_to, if it's set.
            if request.is_ajax():
                return HttpResponse()
            else:
                return redirect(redirect_to)

        # Invalid form, now check to see if is an ajax call
        if request.is_ajax():
            return HttpResponseBadRequest(content=str(form.errors))
    else:
        form = form_class()

    # If this is an ajax request, prepend the ajax template to the list of
    # templates to be searched.
    if request.is_ajax():
        template_name = [ajax_template_name, template_name]
    return render(
        request,
        template_name,
        {
            'form': form,
            'redirect_to': redirect_to
        },
    )


text:
<?xml version="1.0" encoding="UTF-8"?>
<mapping xmlns="http://docs.rackspace.com/identity/api/ext/MappingRules"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         version="RAX-1">
   <rules>
      <rule>
        <local>
            <user>
                <name value="{D}"/>
                <email value="{D}"/>
                <expire value="{D}"/>
                <domain value="{D}"/>
                <roles value="{D}"/>
                <!--
                    foo is not a standard role, the attribute will still be captured,
                    The attribute name will be user/foo Because it's the attribute foo
                    in the user group!

                    It is an error to use {D} on an extended attribute, because it has no default!
                    You can, however, do something like {D(name)} which gets the default for a standard
                    attribute.

                    The default is to have a type of xs:string and to not be multi-valued.
                -->
                <foo value="{0}2H" xsi:type="LocalAttribute" type="xs:dateTime"/>
            </user>
            <!--
                faws is an extended attribute group

                Extended groups are there for organizational purposes. They hold
                extended attributes like foo above.
            -->

            <faws xsi:type="LocalAttributeGroup">
                <policy value="{1}" xsi:type="LocalAttribute"/>
            </faws>
        </local>
        <remote>
            <attribute path="'PT'"/>
            <attribute path="()"/>
        </remote>
      </rule>
      <rule>
        <local>
            <user/>
            <faws xsi:type="LocalAttributeGroup">
                <policy value="AWSPolicy2" xsi:type="LocalAttribute"/>
            </faws>
        </local>
      </rule>
   </rules>
</mapping>


text:
import tapeCss_ from './module';

const test = require('tape-catch');
const clone = require('clone');
const {freeze} = Object;
const {jsdom} = require('jsdom');

const tape = require('tape');

test('Doesn't modify the `tape` instance', (is) => {
  const tapeClone = clone(tape);
  freeze(tapeClone.Test);
  freeze(tapeClone);

  is.doesNotThrow(
    () => tapeCss_(tapeClone),
    'doesn't attempt to change any property'
  );

  is.end();
});

test('Doesn't change the `tape` API', (is) => {
  const localTape = tape.createHarness({exit: false});
  const localTapeCss = tapeCss_(localTape);

  const tapStream = localTape.createStream({objectMode: true});

  is.plan(13);

  localTapeCss('1', (localIs) => {
    is.fail('`tape.only` works as before');
    localIs.end();
  });

  localTapeCss.only('2', (localIs) => {
    localIs.pass();
    localIs.ok(true);
    localIs.notOk(false);
    localIs.equal(1, 1);
    localIs.deepEqual([1], [1]);
    localIs.throws(() => { throw new Error('whatever'); });

    localIs.comment('Yeeaah!');
    localIs.skip('Whooah!');

    localIs.fail();
    localIs.ok(false);
    localIs.deepEqual([1], [2]);

    localIs.end();
  });

  const registerStreams = [
    ({type}) => is.equal(
      type, 'test',
      '`tape` works as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['pass', true],
      '`t.pass` succeeds as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['ok', true],
      '`t.ok` succeeds as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['notOk', true],
      '`t.notOk` succeeds as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['equal', true],
      '`t.equal` succeeds as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['deepEqual', true],
      '`t.deepEqual` succeeds as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['throws', true],
      '`t.throws` succeeds as before'
    ),

    (data) => is.equal(
      data,
      'Yeeaah!',
      '`t.comment` outputs as before'
    ),

    ({operator, skip}) => is.deepEqual(
      [operator, skip],
      ['skip', true],
      '`t.skip` skips as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['fail', false],
      '`t.fail` fails as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['ok', false],
      '`t.ok` fails as before'
    ),

    ({operator, ok}) => is.deepEqual(
      [operator, ok],
      ['deepEqual', false],
      '`t.deepEqual` fails as before'
    ),

    ({type}) => is.deepEqual(
      type,
      'end',
      '`t.end` ends as before'
    ),
  ].reduceRight(
    (callback, assertion) => () => tapStream.once('data', (data) => {
      assertion(data);
      callback();
    }),
    () => {}
  );

  registerStreams();
});

const doc = (typeof window !== 'undefined' && window.window === window ?
  window.document :
  jsdom('<!DOCTYPE html>').defaultView.document
);

test('Adds and removes DOM', (is) => {
  const blindTape = tape.createHarness({exit: false});
  const tapeCss = tapeCss_(blindTape);
  blindTape.createStream({objectMode: true});
    // No need to test the output of `tapeCss` unless our tests fail.

  is.plan(7);

  const span = doc.createElement('span');

  tapeCss('Whatever', {
    dom: span,
    document: doc,
  }, (localIs) => {
    is.equal(
      span.parentNode,
      doc.body,
      'inserts a single element to the <body>'
    );

    localIs.end();

    is.notOk(
      doc.body.contains(span),
      'removes the single element from the <body>'
    );
  });

  const tree = doc.createDocumentFragment();
  const button = doc.createElement('button');
  const p = doc.createElement('p');
  const div = doc.createElement('div');

  tree.appendChild(button);
  p.appendChild(div);
  tree.appendChild(p);

  tapeCss('Whatever', {
    dom: tree,
    document: doc,
  }, (localIs) => {
    is.ok(
      doc.body.contains(button) &&
      doc.body.contains(p) &&
      doc.body.contains(div),
      'inserts a whole DOM tree to the <body>'
    );

    is.equal(
      button.parentNode,
      doc.body,
      'puts every element of the tree directly in the <body>'
    );

    is.equal(
      div.parentNode,
      p,
      'keeps the internal DOM structure'
    );

    localIs.end();

    is.notOk(
      doc.body.contains(button) ||
      doc.body.contains(p) ||
      doc.body.contains(div),
      'removes the whole tree from the <body> after the test'
    );

    is.equal(
      div.parentNode,
      p,
      'doesn't screw up the DOM structure while at it'
    );
  });
});

test('Adds and removes styles', (is) => {
  const blindTape = tape.createHarness({exit: false});
  const tapeCss = tapeCss_(blindTape);
  blindTape.createStream({objectMode: true});
    // No need to test the output of `tapeCss` unless our tests fail.

  is.plan(2);

  const styles = 'span {font-size: 99px}';

  tapeCss('Whatever', {
    styles,
    document: doc,
  }, (localIs) => {
    const styleElements = doc.head.getElementsByTagName('style');
    const styleElement = styleElements[styleElements.length - 1];

    is.equal(
      styleElement && styleElement.textContent,
      styles,
      'inserts our styles into the <head>'
    );

    localIs.end();

    is.notOk(
      doc.head.contains(styleElement),
      'removes them after the test'
    );
  });
});

test('`test.only` works as they say in the ads', (is) => {
  const blindTape = tape.createHarness({exit: false});
  const tapeCss = tapeCss_(blindTape);
  blindTape.createStream({objectMode: true});
    // No need to test the output of `tapeCss` unless our tests fail.

  is.plan(4);

  const styles = 'span {font-size: 73px}';
  const span = doc.createElement('span');

  tapeCss('Shouldn't run', () => {
    is.fail(
      'test before `test.only` doesn't run'
    );
  });

  tapeCss.only('Whatever', {
    styles,
    dom: span,
    document: doc,
  }, (localIs) => {
    const styleElements = doc.head.getElementsByTagName('style');
    const styleElement = styleElements[styleElements.length - 1];

    is.equal(
      styleElement && styleElement.textContent,
      styles,
      'inserts our styles into the <head>'
    );

    is.equal(
      span.parentNode,
      doc.body,
      'inserts our DOM to the <body>'
    );

    localIs.end();

    is.ok(
      doc.head.contains(styleElement),
      'doesn't remove styles after the test'
    );

    is.ok(
      doc.body.contains(span),
      'doesn't remove the DOM after the test'
    );

    is.end();
  });

  tapeCss('Shouldn't run', () => {
    is.fail(
      'test after `test.only` doesn't run'
    );
  });
});


text:
import Worker from 'web.worker';

/**
 * Provide steps with specific logic.
 * @class Utils
 */
class Utils {
    /**
     * constructor - Setting global vars
     * @constructor
     */
    constructor() {
        this.button = document.querySelector('.button');
        this.currentProgress = 0;
    }

    /**
     * convertMillisecondsToHHMMSS - simple conversion from seconds to
     *  human readable format
     *
     * @param  {type} milliseconds description
     * @return {string} Time string in format mm:ss.sss
     */
    convertMillisecondsToHHMMSS(milliseconds) {
        return new Date(milliseconds).toISOString().substr(-10, 9);
    }

    /**
     * startTimer - start interval function which counts and writes on screen
     *  passed time
     *
     */
    startTimer() {
        this.startTime = Date.now();
        this.timer = document.querySelector('#timer');

        this.interval = setInterval(() => {
            let elapsedTime = Date.now() - this.startTime;

            this.timer.innerHTML = this.convertMillisecondsToHHMMSS(elapsedTime);
        }, 100);
    }

    /**
     * finish - stop timer, update screen with more precise data
     *  resolve passed into promise by file
     *
     * @param  {File} file    processed file blob object
     * @param  {Promise} resolve resolve promise
     */
    finish(file, resolve) {
        let elapsedTime = Date.now() - this.startTime;

        clearInterval(this.interval);
        this.timer.innerHTML = this.convertMillisecondsToHHMMSS(elapsedTime);
        resolve(file);
    }

    /**
     * showProgress - description
     *
     * @param  {number} actualProgress update progress on screen by changin class
     * @return {number} currently displayed progress
     */
    showProgress(actualProgress) {
        if (this.currentProgress < actualProgress) {
            this.button.classList.add(`progress-${this.currentProgress + 5}`);
            if (this.button.classList.contains(`progress-${this.currentProgress}`)) {
                this.button.classList.remove();
            }
            this.currentProgress += 5;

            return this.currentProgress;
        }
    }

    /**
     * clearProgress - clear currentProgress global var
     *
     */
    clearProgress() {
        this.currentProgress = 0;
    }

    /**
     * convertStringToDataArray - convert input string, recieved from *.csv file,
     *  to js Array, convert all string values into numbers
     *
     * @param  {string} string stringyfied input array
     * @return {number[]}        converted from string number array
     */
    convertStringToDataArray(string) {
        let array = string.split('\n');

        while (array[array.length - 1] === '') {
            array.pop();
        }

        return array.map(value => +value);
    }

    /**
     * startWorker - description
     *
     * @param  {number[]} inputDataArray recieved from *.csv file array
     * @param  {number} frameSize size of sliding window
     * @param  {Function} resolve   resolve Promise function
     * @param  {Function} reject    reject Promise function
     */
    startWorker(inputDataArray, frameSize, resolve, reject) {
        let worker = new Worker();

        worker.postMessage([frameSize, inputDataArray]);

        worker.onmessage = (event) => {
            if (event.data.progress) {
                this.showProgress(event.data.progress);
            } else if (event.data.error) {
                reject(event.data.error);
            } else {
                this.finish(event.data.file, resolve);
            }
        };
    }

    /**
     * detectFrameSize - detect sliding window frame size (Sf)
     *  by input array length (Si)
     *  formula: Si > 2 ? Sf = 10e( Math.floor( Math.log10( Si ) ) - 3 ) : 3
     *
     * @param  {number} size description
     * @return {type}      description
     */
    detectFrameSize(size) {
        let numberLength = size.toString().length;

        return numberLength > 2
            ? +`10e${numberLength - 3}`
            : 3;
    }

}

export default new Utils();