text:
package it.eng.liferay.cas.integration;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;

import javax.validation.constraints.NotNull;

import org.jasig.cas.adaptors.jdbc.AbstractJdbcUsernamePasswordAuthenticationHandler;
import org.jasig.cas.authentication.handler.AuthenticationException;
import org.jasig.cas.authentication.handler.AuthenticationHandler;
import org.jasig.cas.authentication.principal.Credentials;
import org.jasig.cas.authentication.principal.CredentialsToPrincipalResolver;
import org.jasig.cas.authentication.principal.Principal;
import org.jasig.cas.authentication.principal.SimplePrincipal;
import org.jasig.cas.authentication.principal.UsernamePasswordCredentials;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.jdbc.core.RowMapper;

public class LiferayAuthenticationHandler extends AbstractJdbcUsernamePasswordAuthenticationHandler implements AuthenticationHandler,
		CredentialsToPrincipalResolver {

	@NotNull
	private String sql;
	private LiferayPasswordEncoder passwordEncoder;

	public static final ThreadLocal<Principal> principalThreadLocal = new ThreadLocal<Principal>();

	@SuppressWarnings({ "unchecked", "deprecation", "rawtypes" })
	protected final boolean authenticateUsernamePasswordInternal(final UsernamePasswordCredentials credentials) throws AuthenticationException {
		final String username = getPrincipalNameTransformer().transform(credentials.getUsername());
		try {
			Collection users = getJdbcTemplate().query(this.sql, new RowMapper() {
				public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
					LiferayUser user = new LiferayUser();
					user.setEmailAddress(rs.getString("emailAddress"));
					user.setPassword(rs.getString("password_"));
					user.setFirstName(rs.getString("firstName"));
					user.setMiddleName(rs.getString("middleName"));
					user.setLastName(rs.getString("lastName"));
					user.setScreenName(rs.getString("screenName"));
					do {
						if (user.getRoles() == null)
							user.setRoles(new ArrayList<LiferayRole>());
						if (user.getOrganizations() == null)
							user.setOrganizations(new ArrayList<LiferayOrganization>());
						LiferayOrganization org = new LiferayOrganization();
						org.setId(rs.getLong("organizationId"));
						org.setName(rs.getString("organization"));
						LiferayRole role = new LiferayRole();
						role.setId(rs.getLong("roleId"));
						role.setName(rs.getString("role"));
						if (!user.getOrganizations().contains(org) && org.getId() != null && !org.getId().equals(""))
							user.getOrganizations().add(org);
						if (!user.getRoles().contains(role) && role.getId() != null && !role.getId().equals(""))
							user.getRoles().add(role);
					} while (rs.next());

					return user;
				}
			}, username);

			if (users.size() != 1)
				return false;
			LiferayUser usr = (LiferayUser) users.toArray()[0];
			// This control checks if the password is correct
			if (!passwordEncoder.encode(credentials.getPassword()).equalsIgnoreCase(usr.getPassword()))
				return false;
			// Here we prepare the principal object
			principalThreadLocal.set(new SimplePrincipal(username, extractData(usr)));
			return true;
		} catch (final IncorrectResultSizeDataAccessException e) {
			// this means the username was not found.
			return false;
		}
	}

	/**
	 * @param sql
	 *            The sql to set.
	 */
	public void setSql(final String sql) {
		this.sql = sql;
	}

	public Principal resolvePrincipal(Credentials arg0) {
		Principal principal = principalThreadLocal.get();
		principalThreadLocal.remove();
		return principal;

	}
	public static Principal getPrincipal() {
		Principal principal = principalThreadLocal.get();
		principalThreadLocal.remove();
		return principal;

	}

	private HashMap<String, Object> extractData(LiferayUser usr) {
		if(usr == null) return null;
		HashMap<String, Object> map = new HashMap<String, Object>();
		String name = usr.getFirstName() == null || usr.getFirstName().equals("")?"":usr.getFirstName();
		String surname = usr.getLastName() == null || usr.getLastName().equals("")?"":usr.getLastName();
		String nm = name+" "+surname;
		if(!nm.trim().equals(""))
			map.put(AttributeNames.NAME, nm.trim());
		String email = usr.getEmailAddress() == null?"":usr.getEmailAddress();
		if(email != null && !email.equals(""))
			map.put(AttributeNames.EMAIL, email.trim());
		if (usr.getOrganizations() != null)
			map.put(AttributeNames.ROLE, usr.getRoles());
		if(usr.getRoles() !=null)
			map.put(AttributeNames.ORGANIZATION, usr.getOrganizations());
		return map;
	}

	public void setPasswordEncoder(LiferayPasswordEncoder passwordEncoder) {
		this.passwordEncoder = passwordEncoder;
	}

}


text:
'use strict';

angular.module('tokyoAmeApp')
  .controller('RecordCtrl', function ($scope, $interval, $filter, Amesh, Options) {

    var rangeMilliseconds = 120 * 60 * 1000; // 120 min
    var stepPrevButton = angular.element('#stepPrevButton');
    var stepNextButton = angular.element('#stepNextButton');
    var goToLatestButton = angular.element('#goToLatestButton');

    // http://api.jqueryui.com/slider/
    // https://github.com/seiyria/bootstrap-slider
    // http://seiyria.github.io/bootstrap-slider/
    var recorderSlider = angular.element('#recorderSlider').bootstrapSlider({
      max: 0,
      min: -(rangeMilliseconds),
      step: Amesh.stepMilliseconds,
      formatter: function (value) {
        var latestRecordedDate = Amesh.getLatestMeasurementDateTime();
        var now = new Date();
        var date = new Date(latestRecordedDate.getTime() + value);
        //var ago = Math.abs(value / (60 * 1000));
        var ago = Math.floor((now - date) / (60 * 1000));
        return $filter('date')(date, 'HH:mm', 'JST') + ' (' + ago + '分前' + ')';
      }
    });

    function stepPrev() {
      var latestRecordedDate = Amesh.getLatestMeasurementDateTime();
      var date = Amesh.fixedMeasurementDateTime(
        new Date($scope.$parent.recordedDate.getTime() - Amesh.stepMilliseconds / 2)
      );
      if (date.getTime() >= latestRecordedDate.getTime() - rangeMilliseconds) {
        $scope.$parent.recordedDate = date;
      }
    }

    function stepNext() {
      var latestRecordedDate = Amesh.getLatestMeasurementDateTime();
      var date = Amesh.fixedMeasurementDateTime(
        new Date($scope.$parent.recordedDate.getTime() + Amesh.stepMilliseconds * 1.5)
      );
      if (date <= latestRecordedDate) {
        $scope.$parent.recordedDate = date;
      }
    }

    function goToLatest() {
      updateRecordedDateByTimeSpan(0);
    }

    var playIntervalId;
    function play() {
      if (angular.isDefined(playIntervalId)) {
        return;
      }
      $scope.isPlaying = true;
      recorderSlider.bootstrapSlider('disable');
      if (isMaxSliderPosition()) {
        recorderSlider.bootstrapSlider('setValue', -rangeMilliseconds, true);
      }
      stepPrevButton.addClass('disabled');
      stepNextButton.addClass('disabled');
      goToLatestButton.addClass('disabled');
      playIntervalId = $interval(function () {
        stepNext();
        if (isMaxSliderPosition()) {
          stop();
        }
      }, 750);
    }

    function stop() {
      if (angular.isDefined(playIntervalId)) {
        $interval.cancel(playIntervalId);
        playIntervalId = undefined;
      }
      $scope.isPlaying = false;
      recorderSlider.bootstrapSlider('enable');
      //recorderSlider.bootstrapSlider('setValue', 0, true);
      onSliderValueChanged();
    }

    function toggleScale() {
      if ($scope.$parent.scale === Amesh.scales.tokyo) {
        $scope.$parent.scale = Amesh.scales.whole;
      } else {
        $scope.$parent.scale = Amesh.scales.tokyo;
      }
      Options.setMapScale($scope.$parent.scale);
    }

    function refreshSlider() {
      // refresh position from recordedDate
      var latestRecordedDate = Amesh.getLatestMeasurementDateTime();
      var sliderValue = latestRecordedDate.getTime() - $scope.$parent.recordedDate.getTime();
      recorderSlider.bootstrapSlider('setValue', -sliderValue, false);
      onSliderValueChanged();
    }

    function isMaxSliderPosition() {
      return 0 === recorderSlider.bootstrapSlider('getValue');
    }

    function onSliderValueChanged() {
      var value = recorderSlider.bootstrapSlider('getValue');
      //console.log('onSliderValueChanged', value);
      if (value === 0) {
        goToLatestButton.addClass('disabled');
        stepNextButton.addClass('disabled');
      } else if (!$scope.isPlaying) {
        goToLatestButton.removeClass('disabled');
        stepNextButton.removeClass('disabled');
      }
      if (value === -rangeMilliseconds) {
        stepPrevButton.addClass('disabled');
      } else if (!$scope.isPlaying) {
        stepPrevButton.removeClass('disabled');
      }
    }

    function updateRecordedDateByTimeSpan(newValue) {
      console.log('updateRecordedDateBySlider', newValue);
      var latestRecordedDate = Amesh.getLatestMeasurementDateTime();
      var value = angular.isUndefined(newValue) ? recorderSlider.bootstrapSlider('getValue') : newValue;
      onSliderValueChanged();
      $scope.$parent.recordedDate = new Date(latestRecordedDate.getTime() + value);
      //$scope.$parent.$apply();
    }

    var isSliderDragging = false;
    recorderSlider.on('slide', function (e) {
      if (!isSliderDragging) {
        updateRecordedDateByTimeSpan(e.value);
      }
    });
    recorderSlider.on('slideStart', function (/*e*/) {
      isSliderDragging = true;
    });
    recorderSlider.on('slideStop', function (e) {
      isSliderDragging = false;
      updateRecordedDateByTimeSpan(e.value);
      $scope.$parent.$apply();
    });

    $scope.$parent.$watch('recordedDate', function (/*newValue, oldValue, scope*/) {
      refreshSlider();
    });

    // update check via 1 min
    $interval(function () {
      console.log('RecordCtrl.interval to refresh map');
      // do nothing if playing
      if ($scope.isPlaying) {
        return;
      }
      var now = new Date();
      var latestRecordedDate = Amesh.fixedMeasurementDateTime(now);
      var uptoRecordedDate;
      if (isMaxSliderPosition()) {
        uptoRecordedDate = latestRecordedDate;
      } else {
        var minRecordedDate = Amesh.fixedMeasurementDateTime(new Date(now - rangeMilliseconds));
        if (latestRecordedDate.getTime() < minRecordedDate.getTime()) {
          uptoRecordedDate = minRecordedDate;
        }
      }
      $scope.$parent.updatedDate = latestRecordedDate;
      if (uptoRecordedDate) {
        $scope.$parent.recordedDate = uptoRecordedDate;
      } else {
        refreshSlider();
      }
    }, 60 * 1000);

    $scope.init = function () {
      console.log('RecordCtrl.init');
      $scope.isPlaying = false;
      $scope.wholeScale = Amesh.scales.whole;
      $scope.tokyoScale = Amesh.scales.tokyo;
      $scope.stepPrev = stepPrev;
      $scope.stepNext = stepNext;
      $scope.goToLatest = goToLatest;
      $scope.play = play;
      $scope.stop = stop;
      $scope.toggleScale = toggleScale;
      onSliderValueChanged();
    };
  });

redpajama_set_name: RedPajamaGithub


text:
{% from "macros/_form.html" import render_form %}

{% set page_title = "Sign up" %}

{% extends "layouts/base.html" %}

{% block body_classes %}{% endblock %}

{% block body %}

Sign up for Elective

        {{ render_form(url_for('users.create'), form)}}

{% endblock %}

{% block css_style %}
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
{% endblock %}

{% block extra_js %}

{% endblock %}


text:
import sys, os
sys.path.append(os.path.abspath('..'))

import setup as setup_script

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['rst.linker']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.txt'

# The encoding of source files.
#source_encoding = 'utf-8'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'Setuptools'
copyright = '2009-2014, The fellowship of the packaging'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = setup_script.setup_params['version']
# The full version, including alpha/beta/rc tags.
release = setup_script.setup_params['version']

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of documents that shouldn't be included in the build.
#unused_docs = []

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = []

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None

# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True

# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True

# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []

# -- Options for HTML output ---------------------------------------------------

# The theme to use for HTML and HTML Help pages.  Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
html_theme = 'nature'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = ['_theme']

# The name for this set of Sphinx documents.  If None, it defaults to
# "<project> v<release> documentation".
html_title = "Setuptools documentation"

# A shorter title for the navigation bar.  Default is the same as html_title.
html_short_title = "Setuptools"

# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None

# The name of an image file (within the static path) to use as favicon of the
# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'

# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
html_sidebars = {'index': 'indexsidebar.html'}

# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}

# If false, no module index is generated.
html_use_modindex = False

# If false, no index is generated.
html_use_index = False

# If true, the index is split into individual pages for each letter.
#html_split_index = False

# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True

# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it.  The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''

# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = ''

# Output file base name for HTML help builder.
htmlhelp_basename = 'Setuptoolsdoc'

# -- Options for LaTeX output --------------------------------------------------

# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'

# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
  ('index', 'Setuptools.tex', 'Setuptools Documentation',
   'The fellowship of the packaging', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False

# Additional stuff for the LaTeX preamble.
#latex_preamble = ''

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
#latex_use_modindex = True

link_files = {
	'CHANGES.rst': dict(
		using=dict(
			BB='https://bitbucket.org',
			GH='https://github.com',
		),
		replace=[
			dict(
				pattern=r"(Issue )?#(?P<issue>\d+)",
				url='{GH}/pypa/setuptools/issues/{issue}',
			),
			dict(
				pattern=r"BB Pull Request ?#(?P<bb_pull_request>\d+)",
				url='{BB}/pypa/setuptools/pull-request/{bb_pull_request}',
			),
			dict(
				pattern=r"Distribute #(?P<distribute>\d+)",
				url='{BB}/tarek/distribute/issue/{distribute}',
			),
			dict(
				pattern=r"Buildout #(?P<buildout>\d+)",
				url='{GH}/buildout/buildout/issues/{buildout}',
			),
			dict(
				pattern=r"Old Setuptools #(?P<old_setuptools>\d+)",
				url='http://bugs.python.org/setuptools/issue{old_setuptools}',
			),
			dict(
				pattern=r"Jython #(?P<jython>\d+)",
				url='http://bugs.jython.org/issue{jython}',
			),
			dict(
				pattern=r"Python #(?P<python>\d+)",
				url='http://bugs.python.org/issue{python}',
			),
			dict(
				pattern=r"Interop #(?P<interop>\d+)",
				url='{GH}/pypa/interoperability-peps/issues/{interop}',
			),
			dict(
				pattern=r"Pip #(?P<pip>\d+)",
				url='{GH}/pypa/pip/issues/{pip}',
			),
			dict(
				pattern=r"Packaging #(?P<packaging>\d+)",
				url='{GH}/pypa/packaging/issues/{packaging}',
			),
			dict(
				pattern=r"[Pp]ackaging (?P<packaging_ver>\d+(\.\d+)+)",
				url='{GH}/pypa/packaging/blob/{packaging_ver}/CHANGELOG.rst',
			),
			dict(
				pattern=r"PEP[- ](?P<pep_number>\d+)",
				url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
			),
			dict(
				pattern=r"^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n",
				with_scm="{text}\n{rev[timestamp]:%d %b %Y}\n",
			),
		],
	),
}


text:
/* jshint -W097 */
"use strict";

import * as d3 from "d3";

import {Controller}   from "./controller";
import {ActivityNode} from "./history-data";
import {Source, Method, StackFrame, SourceCoordinate, StackTraceResponse,
  TaggedSourceCoordinate, Scope, getSectionId, Variable, Activity, ActivityType,
  SymbolMessage, ServerCapabilities, BreakpointType, SteppingType,
  EntityType } from "./messages";
import {Breakpoint, SectionBreakpoint, LineBreakpoint} from "./breakpoints";
import {SystemVisualization} from "./visualizations";

declare var ctrl: Controller;
declare var zenscroll: any;

const ACT_ID_PREFIX   = "a";
const ACT_RECT_PREFIX = "RA";

const ACT_GROUP_ID_PREFIX   = "ag";
const ACT_GROUP_RECT_PREFIX = "RAG";

const CH_ID_PREFIX  = "c";
const CH_VIZ_PREFIX = "VC";

export function getActivityId(id: number): string {
  return ACT_ID_PREFIX + id;
}

export function getActivityRectId(id: number): string {
  return ACT_RECT_PREFIX + id;
}

export function getActivityGroupId(id: number): string {
  return ACT_GROUP_ID_PREFIX + id;
}

export function getActivityGroupRectId(id: number): string {
  return ACT_GROUP_RECT_PREFIX + id;
}

export function getChannelId(id: number): string {
  return CH_ID_PREFIX + id;
}

export function getChannelVizId(id: number): string {
  return CH_VIZ_PREFIX + id;
}

export function getLineId(line: number, sourceId: string) {
  return sourceId + "ln" + line;
}

function getSectionIdForActivity(ssId: string, activityId: number) {
  return getActivityId(activityId) + ssId;
}

function getSourceIdForActivity(sId: string, activityId: number) {
  return getActivityId(activityId) + sId;
}

export function getSourceIdFrom(actAndSourceId: string) {
  const i = actAndSourceId.indexOf("s");
  console.assert(i > 0);
  console.assert(actAndSourceId.indexOf(":") === -1);
  return actAndSourceId.substr(i);
}

export function getSectionIdFrom(actAndSourceId: string) {
  const i = actAndSourceId.indexOf("s");
  console.assert(i > 0);
  return actAndSourceId.substr(i);
}

export function getSourceIdFromSection(sectionId: string) {
  const i = sectionId.indexOf(":");
  console.assert(i > 1);
  return sectionId.substr(0, i);
}

export function getActivityIdFromView(actId: string) {
  return parseInt(actId.substr(ACT_ID_PREFIX.length));
}

function splitAndKeepNewlineAsEmptyString(str) {
  let result = new Array();
  let line = new Array();

  for (let i = 0; i < str.length; i++) {
    line.push(str[i]);
    if (str[i] === "\n") {
      line.pop();
      line.push("");
      result.push(line);
      line = new Array();
    }
  }
  return result;
}

function sourceToArray(source: string): string[][] {
  let lines = splitAndKeepNewlineAsEmptyString(source);
  let arr = new Array(lines.length + 1);  // +1 is to work around files not ending in newline

  for (let i in lines) {
    let line = lines[i];
    arr[i] = new Array(line.length);
    for (let j = 0; j < line.length; j += 1) {
      arr[i][j] = line[j];
    }
  }
  arr[lines.length] = [""]; // make sure the +1 line has an array with an empty string
  return arr;
}

function methodDeclIdToString(sectionId: string, idx: number, activityId: number) {
  return getActivityId(activityId) + "m-" + sectionId + "-" + idx;
}

function methodDeclIdToObj(id: string) {
  console.assert(id.indexOf("-") !== -1);
  const idComponents = id.split("-");
  let arr = idComponents[1].split(":");
  return {
    sourceId:    arr[0],
    startLine:   parseInt(arr[1]),
    startColumn: parseInt(arr[2]),
    charLength:  parseInt(arr[3]),
    idx:         parseInt(idComponents[2])
  };
}

abstract class SectionMarker {
  public type: any;

  constructor(type: any) {
    this.type = type;
  }

  public abstract length(): number;
}

class Begin extends SectionMarker {
  private section: TaggedSourceCoordinate;
  private sectionId: string;
  private activityId: number;

  constructor(section: TaggedSourceCoordinate, sectionId: string,
      activityId: number) {
    super(Begin);
    this.sectionId  = sectionId;
    this.activityId = activityId;
    this.section = section;
    this.type    = Begin;
  }

  public toString() {
    return '';
  }

  public length() {
    return this.section.charLength;
  }
}

class BeginMethodDef extends SectionMarker {
  private method:   Method;
  private sourceId: string;
  private activityId: number;
  private i:        number;
  private defPart:  SourceCoordinate;

  constructor(method: Method, sourceId: string, i: number, activityId: number,
      defPart: SourceCoordinate) {
    super(Begin);
    this.method   = method;
    this.sourceId = sourceId;
    this.i        = i;
    this.defPart  = defPart;
    this.activityId = activityId;
  }

  public length() {
    return this.defPart.charLength;
  }

  public toString() {
    const tags = "MethodDeclaration",
      sectionId = getSectionId(this.sourceId, this.method.sourceSection),
      id = methodDeclIdToString(sectionId, this.i, this.activityId);
    return '';
  }
}

class End extends SectionMarker {
  private section: SourceCoordinate;
  private len:     number;

constructor(section: SourceCoordinate, length: number) {
    super(End);
    this.section = section;
    this.len     = length;
  }

  public toString() {
    return "";
  }

  public length() {
    return this.len;
  }
}

class Annotation {
  private char: string;
  private before: SectionMarker[];
  private after:  SectionMarker[];

  constructor(char: string) {
    this.char   = char;
    this.before = [];
    this.after  = [];
  }

  public toString() {
    this.before.sort(function (a, b) {
      if (a.type !== b.type) {
        if (a.type === Begin) {
          return -1;
        } else {
          return 1;
        }
      }

      if (a.length() === b.length()) {
        return 0;
      }

      if (a.length() < b.length()) {
        return (a.type === Begin) ? 1 : -1;
      } else {
        return (a.type === Begin) ? -1 : 1;
      }
    });

    let result = this.before.join("");
    result += this.char;
    result += this.after.join("");
    return result;
  }
}

function arrayToString(arr: any[][]) {
  let result = "";

  for (let line of arr) {
    for (let c of line) {
      result += c.toString();
    }
    result += "\n";
  }
  return result;
}

function nodeFromTemplate(tplId: string) {
  const tpl = document.getElementById(tplId);
  console.assert(tpl, "nodeFromTemplate failed for: " + tplId);
  const result = <Element> tpl.cloneNode(true);
  result.removeAttribute("id");
  return result;
}

function createLineNumbers(cnt: number, sourceId: string) {
  let result = "1";
  for (let i = 2; i <= cnt; i += 1) {
    result = result + "\n" + i + "";
  }
  return result;
}

/**
 * Arguments and results are 1-based.
 * Computation is zero-based.
 */
function ensureItIsAnnotation(arr: any[][], line: number, column: number) {
  let l = line - 1,
    c = column - 1;

  if (!(arr[l][c] instanceof Annotation)) {
    console.assert(typeof arr[l][c] === "string");
    arr[l][c] = new Annotation(arr[l][c]);
  }
  return arr[l][c];
}

/**
 * Determine line and column for `length` elements from given start location.
 *
 * Arguments and results are 1-based.
 * Computation is zero-based.
 */
function getCoord(arr: any[][], startLine: number, startColumn: number, length: number) {
  let remaining = length,
    line   = startLine - 1,
    column = startColumn - 1;

  while (remaining > 0) {
    while (column < arr[line].length && remaining > 0) {
      column    += 1;
      remaining -= 1;
    }
    if (column === arr[line].length) {
      line      += 1;
      column    =  0;
      remaining -= 1; // the newline character
    }
  }
  return {line: line + 1, column: column + 1};
}

function annotateArray(arr: any[][], sourceId: string, activityId: number,
    sections: TaggedSourceCoordinate[], methods: Method[]) {
  for (let s of sections) {
    let start = ensureItIsAnnotation(arr, s.startLine, s.startColumn),
        coord = getCoord(arr, s.startLine, s.startColumn, s.charLength),
          end = ensureItIsAnnotation(arr, coord.line, coord.column),
    sectionId = getSectionId(sourceId, s);

    start.before.push(new Begin(s, sectionId, activityId));
    end.before.push(new End(s, s.charLength));
  }

  // adding method definitions
  for (let meth of methods) {
    for (let i in meth.definition) {
      let defPart = meth.definition[i],
        start = ensureItIsAnnotation(arr, defPart.startLine, defPart.startColumn),
        coord = getCoord(arr, defPart.startLine, defPart.startColumn, defPart.charLength),
        end   = ensureItIsAnnotation(arr, coord.line, coord.column);

      start.before.push(new BeginMethodDef(meth, sourceId, parseInt(i),
                                           activityId, defPart));
      end.before.push(new End(meth.sourceSection, defPart.charLength));
    }
  }
}

/**
 * The HTML View, which realizes all access to the DOM for displaying
 * data and reacting to events.
 */
export class View {
  private systemViz: SystemVisualization;
  private serverCapabilities?: ServerCapabilities;

  constructor() {
    this.systemViz = new SystemVisualization();
  }

  public setCapabilities(capabilities: ServerCapabilities) {
    this.serverCapabilities = capabilities;
    this.systemViz.setCapabilities(capabilities);
  }

  public displaySystemView() {
    this.systemViz.display();
  }

  public updateStringData(msg: SymbolMessage) {
    this.systemViz.updateStringData(msg);
  }

  public updateTraceData(data: DataView): Activity[] {
    return this.systemViz.updateData(data);
  }

  public onConnect() {
    $("#dbg-connect-btn").html("Connected");
  }

  public onClose() {
    $("#dbg-connect-btn").html("Reconnect");
  }

  private getCodePaneExpander(actId: string) {
    return $("#" + actId + " .activity-fold button");
  }

  private getCodePane(actId: string) {
    return $("#" + actId + " .activity-source");
  }

  public isCodePaneExpanded(actId: string) {
    const btn = this.getCodePaneExpander(actId);
    return btn.hasClass("pane-opened");
  }

  public markCodePaneClosed(actId: string) {
    const btn = this.getCodePaneExpander(actId);
    const pane = this.getCodePane(actId);
    const isClosed = btn.hasClass("pane-closed");
    if (!isClosed) {
      btn.addClass("pane-closed");
      btn.removeClass("pane-opened");
      pane.addClass("pane-closed");
    }
  }

  private markCodePaneExpanded(actId: string) {
    const btn = this.getCodePaneExpander(actId);
    const pane = this.getCodePane(actId);
    const isClosed = btn.hasClass("pane-closed");
    if (isClosed) {
      btn.removeClass("pane-closed");
      btn.addClass("pane-opened");
      pane.removeClass("pane-closed");
    }
  }

  public overActivity(act: ActivityNode, rect: SVGRectElement) {
    let strokeWidth = $(rect).attr("data-stw");
    if (strokeWidth === undefined) {
      strokeWidth = d3.select(rect).style("stroke-width");
      $(rect).attr("data-stw", strokeWidth);
    }
    d3.select(rect).style("stroke-width", (parseInt(strokeWidth) * 2) + "px");

    $(act.getQueryForCodePane()).addClass("activity-highlight");
  }

  public outActivity(act: ActivityNode, rect: SVGRectElement) {
    let strokeWidth = $(rect).attr("data-stw");
    if (strokeWidth !== undefined) {
      d3.select(rect).style("stroke-width", strokeWidth);
    }
    $(act.getQueryForCodePane()).removeClass("activity-highlight");
  }

  /**
   * @returns true, if new source is displayed
   */
  public displaySource(activity: Activity, source: Source, sourceId: string): boolean {
    const actId = getActivityId(activity.id);
    this.markCodePaneExpanded(actId);

    const container = $("#" + actId + " .activity-sources-list");

    // we mark the tab header as well as the tab content with a class
    // that contains the source id
    let sourceElem = container.find("li." + sourceId);

    if (sourceElem.length !== 0) {
      const existingAElem = sourceElem.find("a");
      // we got already something with the source id
      // does it have the same name?
      if (existingAElem.get(0).innerHTML !== source.name) {
        // clear and remove tab header and tab content
        sourceElem.html("");
        sourceElem.remove();
      } else {
        return false; // source is already there, so, I think, we don't need to update it
      }
    }

    // show the source
    const annotationArray = sourceToArray(source.sourceText);

    // TODO: think this still need to be updated for multiple activities
    annotateArray(annotationArray, sourceId, activity.id, source.sections,
      source.methods);

    const tabListEntry = nodeFromTemplate("tab-list-entry");
    $(tabListEntry).addClass(sourceId);

    // create the tab "header/handle"
    const aElem = $(tabListEntry).find("a");
    const sourcePaneId = getSourceIdForActivity(sourceId, activity.id);
    aElem.attr("href", "#" + sourcePaneId);
    aElem.text(source.name);
    container.append(tabListEntry);

    // create tab pane
    const newFileElement = nodeFromTemplate("file");
    newFileElement.setAttribute("id", sourcePaneId);
    newFileElement.getElementsByClassName("line-numbers")[0].innerHTML = createLineNumbers(annotationArray.length, sourceId);
    const fileNode = newFileElement.getElementsByClassName("source-file")[0];
    $(fileNode).addClass(sourceId);
    fileNode.innerHTML = arrayToString(annotationArray);

    this.enableBreakpointMenuItems($(fileNode));

    const sourceContainer = $("#" + actId + " .activity-source");
    sourceContainer.append(newFileElement);

    aElem.tab("show");
    return true;
  }

  private getBreakpointTypesPerTag(breakpointTypes: BreakpointType[]) {
    const result = {};
    for (const bpT of breakpointTypes) {
      for (const tag of bpT.applicableTo) {
        if (!result.hasOwnProperty(tag)) {
          result[tag] = [];
        }
        result[tag].push(bpT);
      }
    }
    return result;
  }

  private enableBreakpointMenuItems(fileNode) {
    console.assert(this.serverCapabilities, "connection should be properly initialized");
    const typesPerTag = this.getBreakpointTypesPerTag(this.serverCapabilities.breakpointTypes);

    for (const tag in typesPerTag) {
      const menu    = nodeFromTemplate("bp-menu");
      const bpTypes = typesPerTag[tag];

      for (const bpT of <BreakpointType[]> bpTypes) {
        // assemble menu
        const bpBtn = nodeFromTemplate("bp-menu-btn");
        $(bpBtn).addClass(bpT.name);
        $(bpBtn).attr("data-bp-type", bpT.name);
        $(bpBtn).text(bpT.label);

        menu.appendChild(bpBtn);
      }

      this.enableBreakpointMenu(fileNode, tag, menu);
    }
    this.enableBreakpointMenuButtons();
  }

  private enableBreakpointMenuButtons() {
    $(document).on("click", ".bp-btn", function (e) {
      e.stopImmediatePropagation();
      ctrl.onToggleSectionBreakpoint(e.currentTarget.attributes["data-ss-id"].value,
        e.currentTarget.attributes["data-bp-type"].value);
    });
  }

  private enableBreakpointMenu(fileNode, tag: string, menu: Element) {
    const sourceSection = fileNode.find("." + tag);
    sourceSection.attr({
      "data-toggle"    : "popover",
      "data-trigger"   : "click hover",
      "title"          : "Breakpoints",
      "data-html"      : "true",
      "data-animation" : "false",
      "data-placement" : "top"
    });

    let getId;
    // NOTE: For MethodDeclaration breakpoints, we have special handling,
    // but that's arguably a structural thing, and not really a concurrency issue
    // so, the debugger having the notion of a MethodDeclaration seems to be ok
    if (tag === "MethodDeclaration") {
      getId = function(that) {
        const idObj = methodDeclIdToObj(that.id);
        return getSectionId(idObj.sourceId, idObj);
      };
    } else {
      getId = function (that) {
        return getSectionIdFrom(that.id);
      };
    }

    sourceSection.attr("data-content", function() {
      const content = $(menu).clone(true);
      // capture the source section id, and store it on the buttons
      $(content).find("button").attr("data-ss-id", getId(this));
      return $(content).html();
    });
    sourceSection.popover();
  }

  private createSteppingButtons(actId: string, stepBtns: JQuery) {
    let group = "";
    let groupElem = null;

    for (const step of this.serverCapabilities.steppingTypes) {
      if (group !== step.group) {
        group = step.group;
        groupElem = nodeFromTemplate("debugger-step-btn-group");
        groupElem.setAttribute("aria-label", group);
        stepBtns.append(groupElem);
      }

      const stepElem = nodeFromTemplate("debugger-step-btn");
      $(stepElem).empty();
      stepElem.setAttribute("title", step.label);
      stepElem.setAttribute("data-actid", actId);
      stepElem.setAttribute("data-step", step.name);
      stepElem.appendChild(nodeFromTemplate("icon-" + step.icon));
      groupElem.appendChild(stepElem);
    }
  }

  private displayActivity(activity: Activity) {
    const act = nodeFromTemplate("activity-tpl");
    $(act).find(".activity-name").html(activity.name);

    const actId = getActivityId(activity.id);
    act.id = actId;
    this.createSteppingButtons(actId, $(act).find(".debugger-button-groups"));
    $(act).find("button.pane-closed").attr("data-actid", actId);

    const codeView = document.getElementById("code-views");
    codeView.appendChild(act);
  }

  public reset() {
    this.resetActivities();
    this.systemViz.reset();
  }

  private resetActivities() {
    $(document.getElementById("code-views")).empty();
  }

  public addActivities(activities: Activity[]) {
    for (const act of activities) {
      this.displayActivity(act);
    }
  }

  public displayProgramArguments(args: String[]) {
    $("#program-args").text(args.join(" "));
  }

  private getScopeId(varRef: number) {
    return "scope-" + varRef;
  }

  public displayScope(varRef: number, s: Scope) {
    const list = $("#" + this.getScopeId(varRef)).find("tbody");
    const entry = nodeFromTemplate("scope-head-tpl");
    entry.id = this.getScopeId(s.variablesReference);
    let t = $(entry).find("th");
    t.html(s.name);
    list.append(entry);
  }

  private createVarElement(name: string, value: string, varRef: number): Element {
    const entry = nodeFromTemplate("frame-state-tpl");
    entry.id = this.getScopeId(varRef);
    let t = $(entry).find("td");
    t.get(0).innerHTML = name;
    t = $(entry).find("td");
    t.get(1).innerHTML = value;
    return entry;
  }

  public displayVariables(varRef: number, vars: Variable[]) {
    const scopeEntry = document.getElementById(this.getScopeId(varRef));

    for (const v of vars) {
      scopeEntry.insertAdjacentElement(
        "afterend",
        this.createVarElement(v.name, v.value, v.variablesReference));
    }
  }

  private getFrameId(frameId: number) {
    return "frame-" + frameId;
  }

  private showFrame(frame: StackFrame, active: boolean, list: JQuery) {
    let location;
    if (frame.sourceUri) {
      const fileNameStart = frame.sourceUri.lastIndexOf("/") + 1;
      const fileName = frame.sourceUri.substr(fileNameStart);
      location = fileName + ":" + frame.line + ":" + frame.column;
    } else {
      location = "vmMirror";
    }

    const entry = nodeFromTemplate("stack-trace-elem-tpl");
    entry.id = this.getFrameId(frame.id);

    if (active) {
      $(entry).addClass("active");
    }

    const name = $(entry).find(".trace-method-name");
    name.html(frame.name);
    const loc = $(entry).find(".trace-location");
    loc.html(location);

    list.append(entry);
  }

  public displayStackTrace(sourceId: string, data: StackTraceResponse,
      requestedId: number, activity: Activity, ssId: string,
      section: TaggedSourceCoordinate) {
    const act = $("#" + getActivityId(data.activityId));
    const list = act.find(".activity-stack");
    list.html(""); // rest view

    for (let i = 0; i < data.stackFrames.length; i++) {
      this.showFrame(data.stackFrames[i],
        data.stackFrames[i].id === requestedId, list);
      console.assert(data.stackFrames[i].id !== requestedId || i === 0, "We expect that the first frame is displayed.");
    }
    const scopes = act.find(".activity-scopes");
    scopes.attr("id", this.getScopeId(requestedId));
    scopes.find("tbody").html(""); // rest view

    this.highlightProgramPosition(sourceId, activity, ssId);
    this.adjustSteppingButtons(act, section, activity.type, data.concurrentEntityScopes);
  }

  private hasCommonElements(a: string[], b: string[]) {
    if (!Array.isArray(a) || !Array.isArray(b)) {
      return false;
    }
    for (const s of a) {
      for (const t of b) {
        if (s === t) {
          return true;
        }
      }
    }
    return false;
  }

  private isSteppingApplicable(section: TaggedSourceCoordinate,
      step: SteppingType, activityType: ActivityType,
      concurrentEntityScopes: EntityType[]) {
    if (step.inScope) {
      if (!concurrentEntityScopes) {
        return false;
      }

      let matches = false;
      for (const entT of step.inScope) {
        if (concurrentEntityScopes.indexOf(entT) > -1) {
          matches = true;
          break;
        }
      }

      // if the stepping is not supported for this activity, just return
      if (!matches) { return false; }
    }

    if (step.forActivities) {
      let matches = false;
      for (const actT of step.forActivities) {
        if (actT === activityType) {
          matches = true;
          break;
        }
      }

      // if the stepping is not supported for this activity, just return
      if (!matches) { return false; }
    }

    if (step.applicableTo) {
      // there can be cases where we don't actually have source section. TODO: fix this
      const tags = section ? section.tags : [];
      return this.hasCommonElements(tags, step.applicableTo);
    } else {
      return true;
    }
  }

  private adjustSteppingButtons(act: JQuery, section: TaggedSourceCoordinate,
      activityType: ActivityType, concurrentEntityScopes: EntityType[]) {
    for (const step of this.serverCapabilities.steppingTypes) {
      const enabled = this.isSteppingApplicable(
        section, step, activityType, concurrentEntityScopes);
      act.find("button[data-step=" + step.name + " ]").prop("disabled", !enabled);
    }
  }

  private highlightProgramPosition(sourceId: string, activity: Activity,
      ssId: string) {

    this.showSourceById(sourceId, activity);

    const ss = document.getElementById(
                        getSectionIdForActivity(ssId, activity.id));
    if (ss) { // there can be cases where we don't actually have source section. TODO: fix this
      $(ss).addClass("DbgCurrentNode");

      const sourcePaneId = getSectionIdForActivity(sourceId, activity.id);
      const sourcePaneElem = document.getElementById(sourcePaneId);

      const defaultDuration = 100;
      const edgeOffset      = 30;

      const scroller = zenscroll.createScroller(sourcePaneElem, defaultDuration, edgeOffset);
      scroller.center(ss);
    }
  }

  private showSourceById(sourceId: string, activity: Activity) {
    if (this.getActiveSourceId(activity) !== sourceId) {
      const actId = getActivityId(activity.id);
      $("#" + actId + " .activity-sources-list li." + sourceId + " a").tab("show");
    }
  }

  private getActiveSourceId(activity: Activity): string {
    const actId = getActivityId(activity.id);
    const actAndSourceId = $("#" + actId + " .tab-pane.active").attr("id");
    return getSourceIdFrom(actAndSourceId);
  }

  private ensureBreakpointListEntry(breakpoint: Breakpoint) {
    if (breakpoint.checkbox !== null) {
      return;
    }

    let bpId = breakpoint.getListEntryId();
    let entry = nodeFromTemplate("breakpoint-tpl");
    entry.setAttribute("id", bpId);

    let tds = $(entry).find("td");
    tds[0].innerHTML = breakpoint.source.name;
    tds[1].innerHTML = breakpoint.getListEntryId();

    breakpoint.checkbox = $(entry).find("input");
    breakpoint.checkbox.attr("id", bpId + "chk");

    const list = document.getElementById("breakpoint-list");
    list.appendChild(entry);
  }

  private updateBreakpoint(breakpoint: Breakpoint, highlightClass: string) {
    this.ensureBreakpointListEntry(breakpoint);
    const enabled = breakpoint.isEnabled();

    breakpoint.checkbox.prop("checked", enabled);
    const highlightElems = $(document.getElementsByClassName(
      breakpoint.getSourceElementClass()));
    if (enabled) {
      highlightElems.addClass(highlightClass);
    } else {
      highlightElems.removeClass(highlightClass);
    }
  }

  public updateLineBreakpoint(bp: LineBreakpoint) {
    this.updateBreakpoint(bp, "breakpoint-active");
  }

  public updateSectionBreakpoint(bp: SectionBreakpoint) {
    this.updateBreakpoint(bp, "section-breakpoint-active");
  }

  public switchActivityDebuggerToSuspendedState(act: Activity) {
    // mark paused in system view
    const markedNode = $(
      "#" + getActivityRectId(act.id) + " " + "text.activity-pause");
    markedNode.removeClass("running");
  }

  private switchActivityDebuggerToResumedState(act: Activity) {
    // mark resume in system view
    const markedNode = $(
      "#" + getActivityRectId(act.id) + " " + "text.activity-pause");
    markedNode.addClass("running");

    // TODO: at some point, we might want to reconsider enabling the pause button
    const id = getActivityId(act.id);
    const actE = $("#" + id);
    actE.find("button[data-step]").prop("disabled", true);
  }

  public onContinueExecution(act: Activity) {
    this.switchActivityDebuggerToResumedState(act);

    const id = getActivityId(act.id);
    const highlightedNode = $("#" + id + " .DbgCurrentNode");
    highlightedNode.removeClass("DbgCurrentNode");
  }
}


text:
package org.geometerplus.zlibrary.text.view;

import java.lang.ref.WeakReference;
import java.util.HashMap;

import org.geometerplus.zlibrary.text.model.ZLTextModel;

class ZLTextParagraphCursorCache {
	private final static class Key {
		private final ZLTextModel myModel;
		private final int myIndex;

		public Key(ZLTextModel model, int index) {
			myModel = model;
			myIndex = index;
		}

		public boolean equals(Object o) {
			Key k = (Key)o;
			return (myModel == k.myModel) && (myIndex == k.myIndex);
		}

		public int hashCode() {
			return myModel.hashCode() + myIndex;
		}
	}

	private static final HashMap<Key,WeakReference<ZLTextParagraphCursor>> ourMap = new HashMap<Key,WeakReference<ZLTextParagraphCursor>>();

	public static void put(ZLTextModel model, int index, ZLTextParagraphCursor cursor) {
		ourMap.put(new Key(model, index), new WeakReference<ZLTextParagraphCursor>(cursor));
	}

	public static ZLTextParagraphCursor get(ZLTextModel model, int index) {
		WeakReference<ZLTextParagraphCursor> ref = ourMap.get(new Key(model, index));
		return (ref != null) ? ref.get() : null;
	}

	public static void clear() {
		ourMap.clear();
	}
}


text:
from sparts.tests.base import BaseSpartsTestCase
from sparts.timer import Timer, run_until_true

class TimerTests(BaseSpartsTestCase):
    def testInstance(self):
        t = Timer()

        # Mock the timestamp to some fixed value
        t._time = self.mock.Mock()
        t._time.return_value = 100.0

        # Start the timer.  Elapsed should remain 0.0 before and after start
        self.assertEqual(t.elapsed, 0.0)
        t.start()
        self.assertEqual(t.elapsed, 0.0)

        # Make sure running time is 5s
        t._time.return_value = 105.0
        self.assertEqual(t.elapsed, 5.0)

        # Stop and make sure elapsed time is 5s as well
        t.stop()
        self.assertEqual(t.elapsed, 5.0)

        # Bump time by 5s, but make sure elapsed stays the same
        t._time.return_value = 110.0
        self.assertEqual(t.elapsed, 5.0)

        # Re-stop the timer, which should update stop_time and elapsed to 10s
        t.stop()
        self.assertEqual(t.elapsed, 10.0)

    def testContext(self):
        with Timer() as t:
            # Mock the timestamp to some fixed value
            t._time = self.mock.Mock()
            t._time.return_value = 100.0

            # Context manager should have started the timer, so elapsed
            # should be some big negative number
            self.assertLess(t.elapsed, 0)

            # Restart the timer, so we get good data
            t.start()

            # Start the timer.  Elapsed should remain 0.0 before and after start
            t.start()
            self.assertEqual(t.elapsed, 0.0)

            # Make sure running time is 3s
            t._time.return_value = 103.0
            self.assertEqual(t.elapsed, 3.0)

            # Bump time again, before exiting
            t._time.return_value = 105.0

        # Stop (via exit) and make sure elapsed time is 5s as well
        self.assertEqual(t.elapsed, 5.0)

        # Bump time by 5s, but make sure elapsed stays the same
        t._time.return_value = 110.0
        self.assertEqual(t.elapsed, 5.0)

        # Re-stop the timer, which should update stop_time and  elapsed to 10s
        t.stop()
        self.assertEqual(t.elapsed, 10.0)

class RunUntilTrueTests(BaseSpartsTestCase):
    def testTrue(self):
        run_until_true(lambda: True, timeout=5.0)
        self.assertTrue(True)

    def testTimeout(self):
        with self.assertRaises(Exception):
            run_until_true(lambda: False, timeout=0.1)
        self.assertTrue(True)


text:
{{ routine.name }}

{{ routine.total_time }}

    Add new routine

        ×
        Error! {{ list.error }}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>SDV.Util.String Tests (library object utils tests)</title>
    <link rel="stylesheet" href="../../scripts/vendor/unitTests/mocha/mocha.css" />
    <link rel="stylesheet" href="../../scripts/vendor/unitTests/mocha/additionalMocha.css" />

Index


text:
/*
 * Adapter that scales the referenced images and
 * displays the image plus the image name
 */

package com.piechecker;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ImageListAdapter extends BaseAdapter {
	Context context;
	public ImageListAdapter(Context context){
		this.context = context;
	}
	@Override
	public int getCount() {
		return mThumbIds.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		 LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         convertView = inflater.inflate(R.layout.home_list_items_layout, null);

         ImageView imageView = (ImageView)convertView.findViewById(R.id.home_image);

         imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
         TextView tvBottom = (TextView)convertView.findViewById(R.id.home_list_secondLine);
         tvBottom.setText(mThumbIds[position]);
         imageView.setImageResource(mThumbIds[position]);
		return convertView;
	}
	 private Integer[] mThumbIds = {
	    		R.drawable.pie1, R.drawable.pie2,
	            R.drawable.pie3, R.drawable.pie4,
	            R.drawable.pie5, R.drawable.pie6,
	            R.drawable.pie7, R.drawable.pie8,
	            R.drawable.pie9, R.drawable.pie10,
	            R.drawable.pie11, R.drawable.pie12,
	            R.drawable.pie13, R.drawable.pie14,
	            R.drawable.pie15, R.drawable.pie16,
	            R.drawable.pie17, R.drawable.pie18,
	            R.drawable.pie19, R.drawable.pie20,
	            R.drawable.pie21, R.drawable.pie22,
	            R.drawable.pie23, R.drawable.pie24,
	            R.drawable.pie25

	    };

}


text:
module Data.Function.Instances.Algebra.Monoid where

import Data.Function.Instances.Algebra.Internal
import Algebra.Monoid as M

instance C a => C (k -> a) where
  idt = const M.idt
  (<*>) = zipFn (M.<*>)
  cumulate fs = \x -> M.cumulate $ map ($ x) fs


text:
@class NSArray, NSImage, NSString, NSView;

@protocol IDEDebugGaugeReportTopSectionContentDelegate <NSObject>
- (NSString *)topSectionTitle;

@optional
- (NSArray *)topSectionComponentEntries;
- (NSArray *)topSectionSubDescriptionViews;
- (NSView *)topSectionAccessoryView;
- (NSView *)topSectionDescription;
- (NSArray *)topSectionDescriptionEntries;
- (NSView *)topSectionShortDescription;
- (NSView *)topSectionCenterTitleAccessoryView;
- (NSView *)topSectionTitleAccessoryView;
- (NSString *)topSectionShortDescriptionTitle;
- (NSImage *)topSectionImage;
@end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
Uses of Class gov.nasa.worldwind.render.Polyline (NASA World Wind)
</TITLE>

<META NAME="date" CONTENT="2010-01-14">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Index
      Help

NASA World Wind

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
gov.nasa.worldwind.render.Polyline

Packages that use Polyline

gov.nasa.worldwind.examples

gov.nasa.worldwind.layers

gov.nasa.worldwind.util.measure

Uses of Polyline in gov.nasa.worldwind.examples

Methods in gov.nasa.worldwind.examples that return Polyline

 Polyline
LineBuilder.getLine()

          Returns the layer currently used to display the polyline.

Constructors in gov.nasa.worldwind.examples with parameters of type Polyline

LineBuilder(WorldWindow wwd,
            RenderableLayer lineLayer,
            Polyline polyline)

          Construct a new line builder using the specified polyline and layer and drawing events from the specified world
 window.

Uses of Polyline in gov.nasa.worldwind.layers

Methods in gov.nasa.worldwind.layers that return Polyline

 Polyline
TerrainProfileLayer.getPickedLine()

          Get the Polyline used to render the picked position on the terrain.

 Polyline
TerrainProfileLayer.getProfileLine()

          Get the Polyline used to render the profile line on the ground.

Uses of Polyline in gov.nasa.worldwind.util.measure

Fields in gov.nasa.worldwind.util.measure declared as Polyline

protected  Polyline
MeasureTool.line

Methods in gov.nasa.worldwind.util.measure that return Polyline

 Polyline
MeasureTool.getLine()

          Returns the polyline currently used to display lines and path.

Methods in gov.nasa.worldwind.util.measure with parameters of type Polyline

 void
MeasureTool.setMeasureShape(Polyline line)

          Set the measure shape to an existing Polyline.

      Overview
      Package
      Class
    Use
      Tree
      Index
      Help

NASA World Wind

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes