text:
#include "../lib/libcompat.h"

#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <signal.h>

#include "check.h"
#include "check_error.h"
#include "check_list.h"
#include "check_impl.h"
#include "check_msg.h"
#include "check_log.h"

enum rinfo {
  CK_R_SIG,
  CK_R_PASS,
  CK_R_EXIT,
  CK_R_FAIL_TEST,
  CK_R_FAIL_FIXTURE
};

enum tf_type {
  CK_FORK_TEST,
  CK_NOFORK_TEST,
  CK_NOFORK_FIXTURE
};

/* all functions are defined in the same order they are declared.
   functions that depend on forking are gathered all together.
   non-static functions are at the end of the file. */
static void srunner_run_init (SRunner *sr, enum print_output print_mode);
static void srunner_run_end (SRunner *sr, enum print_output print_mode);
static void srunner_iterate_suites (SRunner *sr,
				    enum print_output print_mode);
static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc);
static void srunner_add_failure (SRunner *sr, TestResult *tf);
static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc);
static TestResult * tcase_run_checked_setup (SRunner *sr, TCase *tc);
static void srunner_run_teardown (List *l);
static void srunner_run_unchecked_teardown (TCase *tc);
static void tcase_run_checked_teardown (TCase *tc);
static void srunner_run_tcase (SRunner *sr, TCase *tc);
static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tf, int i);
static TestResult *receive_result_info_nofork (const char *tcname,
                                               const char *tname,
                                               int iter);
static void set_nofork_info (TestResult *tr);
static char *pass_msg (void);

#ifdef _POSIX_VERSION
static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tf, int i);
static TestResult *receive_result_info_fork (const char *tcname,
                                             const char *tname,
                                             int iter,
					     int status, int expected_signal,
					     unsigned char allowed_exit_value);
static void set_fork_info (TestResult *tr, int status, int expected_signal,
			   unsigned char allowed_exit_value);
static char *signal_msg (int sig);
static char *signal_error_msg (int signal_received, int signal_expected);
static char *exit_msg (int exitstatus);
static int waserror (int status, int expected_signal);

static int alarm_received;
static pid_t group_pid;

static void CK_ATTRIBUTE_UNUSED sig_handler(int sig_nr)
{
  switch (sig_nr) {
   case SIGALRM:
    alarm_received = 1;
    killpg(group_pid, SIGKILL);
    break;
   default:
    eprintf("Unhandled signal: %d", __FILE__, __LINE__, sig_nr);
    break;
  }
}
#endif /* _POSIX_VERSION */

#define MSG_LEN 100

static void srunner_run_init (SRunner *sr, enum print_output print_mode)
{
  set_fork_status(srunner_fork_status(sr));
  setup_messaging();
  srunner_init_logging (sr, print_mode);
  log_srunner_start (sr);
}

static void srunner_run_end (SRunner *sr, enum print_output CK_ATTRIBUTE_UNUSED print_mode)
{
  log_srunner_end (sr);
  srunner_end_logging (sr);
  teardown_messaging();
  set_fork_status(CK_FORK);
}

static void srunner_iterate_suites (SRunner *sr,
				    enum print_output CK_ATTRIBUTE_UNUSED print_mode)

{
  List *slst;
  List *tcl;
  TCase *tc;

  slst = sr->slst;

  for (list_front(slst); !list_at_end(slst); list_advance(slst)) {
    Suite *s = list_val(slst);

    log_suite_start (sr, s);

    tcl = s->tclst;

    for (list_front(tcl);!list_at_end (tcl); list_advance (tcl)) {
      tc = list_val (tcl);
      srunner_run_tcase (sr, tc);
    }

    log_suite_end (sr, s);
  }
}

static void srunner_iterate_tcase_tfuns (SRunner *sr, TCase *tc)
{
  List *tfl;
  TF *tfun;
  TestResult *tr = NULL;

  tfl = tc->tflst;

  for (list_front(tfl); !list_at_end (tfl); list_advance (tfl)) {
    int i;
    tfun = list_val (tfl);

    for (i = tfun->loop_start; i < tfun->loop_end; i++)
    {
      log_test_start (sr, tc, tfun);
      switch (srunner_fork_status(sr)) {
      case CK_FORK:
#ifdef _POSIX_VERSION
        tr = tcase_run_tfun_fork (sr, tc, tfun, i);
#else /* _POSIX_VERSION */
        eprintf("This version does not support fork", __FILE__, __LINE__);
#endif /* _POSIX_VERSION */
        break;
      case CK_NOFORK:
        tr = tcase_run_tfun_nofork (sr, tc, tfun, i);
        break;
      default:
        eprintf("Bad fork status in SRunner", __FILE__, __LINE__);
      }
      srunner_add_failure (sr, tr);
      log_test_end(sr, tr);
    }
  }
}

static void srunner_add_failure (SRunner *sr, TestResult *tr)
{
  list_add_end (sr->resultlst, tr);
  sr->stats->n_checked++; /* count checks during setup, test, and teardown */
  if (tr->rtype == CK_FAILURE)
    sr->stats->n_failed++;
  else if (tr->rtype == CK_ERROR)
    sr->stats->n_errors++;

}

static int srunner_run_unchecked_setup (SRunner *sr, TCase *tc)
{
  TestResult *tr;
  List *l;
  Fixture *f;
  int rval = 1;

  set_fork_status(CK_NOFORK);

  l = tc->unch_sflst;

  for (list_front(l); !list_at_end(l); list_advance(l)) {
    send_ctx_info(CK_CTX_SETUP);
    f = list_val(l);
    f->fun();

    tr = receive_result_info_nofork (tc->name, "unchecked_setup", 0);

    if (tr->rtype != CK_PASS) {
      srunner_add_failure(sr, tr);
      rval = 0;
      break;
    }
    free(tr->file);
    free(tr->msg);
    free(tr);
  }

  set_fork_status(srunner_fork_status(sr));
  return rval;
}

static TestResult * tcase_run_checked_setup (SRunner *sr, TCase *tc)
{
  TestResult *tr = NULL;
  List *l;
  Fixture *f;
  enum fork_status fstat = srunner_fork_status(sr);

  l = tc->ch_sflst;
  if (fstat == CK_FORK) {
    send_ctx_info(CK_CTX_SETUP);
  }

  for (list_front(l); !list_at_end(l); list_advance(l)) {
    if (fstat == CK_NOFORK) {
      send_ctx_info(CK_CTX_SETUP);
    }
    f = list_val(l);
    f->fun();

    /* Stop the setup and return the failure if nofork mode. */
    if (fstat == CK_NOFORK) {
      tr = receive_result_info_nofork (tc->name, "checked_setup", 0);
      if (tr->rtype != CK_PASS) {
        break;
      }

      free(tr->file);
      free(tr->msg);
      free(tr);
      tr = NULL;
    }
  }

  return tr;
}

static void srunner_run_teardown (List *l)
{
  Fixture *f;

  for (list_front(l); !list_at_end(l); list_advance(l)) {
    f = list_val(l);
    send_ctx_info(CK_CTX_TEARDOWN);
    f->fun ();
  }
}

static void srunner_run_unchecked_teardown (TCase *tc)
{
  srunner_run_teardown(tc->unch_tflst);
}

static void tcase_run_checked_teardown (TCase *tc)
{
  srunner_run_teardown(tc->ch_tflst);
}

static void srunner_run_tcase (SRunner *sr, TCase *tc)
{
  if (srunner_run_unchecked_setup(sr,tc)) {
    srunner_iterate_tcase_tfuns(sr,tc);
    srunner_run_unchecked_teardown(tc);
  }
}

static TestResult *tcase_run_tfun_nofork (SRunner *sr, TCase *tc, TF *tfun, int i)
{
  TestResult *tr;

  tr = tcase_run_checked_setup(sr, tc);
  if (tr == NULL) {
    tfun->fn(i);
    tcase_run_checked_teardown(tc);
    return receive_result_info_nofork(tc->name, tfun->name, i);
  }

  return tr;
}

static TestResult *receive_result_info_nofork (const char *tcname,
                                               const char *tname,
                                               int iter)
{
  TestResult *tr;

  tr = receive_test_result(0);
  if (tr == NULL)
    eprintf("Failed to receive test result", __FILE__, __LINE__);
  tr->tcname = tcname;
  tr->tname = tname;
  tr->iter = iter;
  set_nofork_info(tr);

  return tr;
}

static void set_nofork_info (TestResult *tr)
{
  if (tr->msg == NULL) {
    tr->rtype = CK_PASS;
    tr->msg = pass_msg();
  } else {
    tr->rtype = CK_FAILURE;
  }
}

static char *pass_msg (void)
{
  char *msg = emalloc(sizeof("Passed"));
  strcpy (msg, "Passed");
  return msg;
}

#ifdef _POSIX_VERSION
static TestResult *tcase_run_tfun_fork (SRunner *sr, TCase *tc, TF *tfun, int i)
{
  pid_t pid_w;
  pid_t pid;
  int status = 0;

  pid = fork();
  if (pid == -1)
    eprintf("Error in call to fork:", __FILE__, __LINE__ - 2);
  if (pid == 0) {
    setpgid(0, 0);
    group_pid = getpgrp();
    tcase_run_checked_setup(sr, tc);
    tfun->fn(i);
    tcase_run_checked_teardown(tc);
    exit(EXIT_SUCCESS);
  } else {
    group_pid = pid;
  }

  alarm_received = 0;
  alarm(tc->timeout);
  do {
    pid_w = waitpid(pid, &status, 0);
  } while (pid_w == -1);

  killpg(pid, SIGKILL); /* Kill remaining processes. */

  return receive_result_info_fork(tc->name, tfun->name, i, status, tfun->signal,  tfun->allowed_exit_value);
}

static TestResult *receive_result_info_fork (const char *tcname,
                                             const char *tname,
                                             int iter,
					     int status, int expected_signal,
                                             unsigned char allowed_exit_value)
{
  TestResult *tr;

  tr = receive_test_result(waserror(status, expected_signal));
  if (tr == NULL)
    eprintf("Failed to receive test result", __FILE__, __LINE__);
  tr->tcname = tcname;
  tr->tname = tname;
  tr->iter = iter;
  set_fork_info(tr, status, expected_signal, allowed_exit_value);

  return tr;
}

static void set_fork_info (TestResult *tr, int status, int signal_expected, unsigned char allowed_exit_value)
{
  int was_sig = WIFSIGNALED(status);
  int was_exit = WIFEXITED(status);
  int exit_status = WEXITSTATUS(status);
  int signal_received = WTERMSIG(status);

  if (was_sig) {
    if (signal_expected == signal_received) {
      if (alarm_received) {
        /* Got alarm instead of signal */
        tr->rtype = CK_ERROR;
        tr->msg = signal_error_msg(signal_received, signal_expected);
      } else {
        tr->rtype = CK_PASS;
        tr->msg = pass_msg();
      }
    } else if (signal_expected != 0) {
      /* signal received, but not the expected one */
      tr->rtype = CK_ERROR;
      tr->msg = signal_error_msg(signal_received, signal_expected);
    } else {
      /* signal received and none expected */
      tr->rtype = CK_ERROR;
      tr->msg = signal_msg(signal_received);
    }
  } else if (signal_expected == 0) {
    if (was_exit && exit_status == allowed_exit_value) {
      tr->rtype = CK_PASS;
      tr->msg = pass_msg();
    } else if (was_exit && exit_status != allowed_exit_value) {
      if (tr->msg == NULL) { /* early exit */
        tr->rtype = CK_ERROR;
        tr->msg = exit_msg(exit_status);
      } else {
        tr->rtype = CK_FAILURE;
      }
    }
  } else { /* a signal was expected and none raised */
    if (was_exit) {
      tr->msg = exit_msg(exit_status);
      if (exit_status == allowed_exit_value)
	tr->rtype = CK_FAILURE; /* normal exit status */
      else
	tr->rtype = CK_FAILURE; /* early exit */
    }
  }
}

static char *signal_msg (int signal)
{
  char *msg = emalloc(MSG_LEN); /* free'd by caller */
  if (alarm_received) {
    snprintf(msg, MSG_LEN, "Test timeout expired");
  } else {
    snprintf(msg, MSG_LEN, "Received signal %d (%s)",
             signal, strsignal(signal));
  }
  return msg;
}

static char *signal_error_msg (int signal_received, int signal_expected)
{
  char *sig_r_str;
  char *sig_e_str;
  char *msg = emalloc (MSG_LEN); /* free'd by caller */
  sig_r_str = strdup(strsignal(signal_received));
  sig_e_str = strdup(strsignal(signal_expected));
  if (alarm_received) {
    snprintf (msg, MSG_LEN, "Test timeout expired, expected signal %d (%s)",
              signal_expected, sig_e_str);
  } else {
    snprintf (msg, MSG_LEN, "Received signal %d (%s), expected %d (%s)",
              signal_received, sig_r_str, signal_expected, sig_e_str);
  }
  free(sig_r_str);
  free(sig_e_str);
  return msg;
}

static char *exit_msg (int exitval)
{
  char *msg = emalloc(MSG_LEN); /* free'd by caller */
  snprintf (msg, MSG_LEN,
            "Early exit with return value %d", exitval);
  return msg;
}

static int waserror (int status, int signal_expected)
{
  int was_sig = WIFSIGNALED (status);
  int was_exit = WIFEXITED (status);
  int exit_status = WEXITSTATUS (status);
  int signal_received = WTERMSIG (status);

  return ((was_sig && (signal_received != signal_expected)) ||
          (was_exit && exit_status != 0));
}
#endif /* _POSIX_VERSION */

enum fork_status srunner_fork_status (SRunner *sr)
{
  if (sr->fstat == CK_FORK_GETENV) {
    char *env = getenv ("CK_FORK");
    if (env == NULL)
      return CK_FORK;
    if (strcmp (env,"no") == 0)
      return CK_NOFORK;
    else {
#ifdef _POSIX_VERSION
      return CK_FORK;
#else /* _POSIX_VERSION */
      eprintf("This version does not support fork", __FILE__, __LINE__);
      return CK_NOFORK;
#endif /* _POSIX_VERSION */
    }
  } else
    return sr->fstat;
}

void srunner_set_fork_status (SRunner *sr, enum fork_status fstat)
{
  sr->fstat = fstat;
}

void srunner_run_all (SRunner *sr, enum print_output print_mode)
{
#ifdef _POSIX_VERSION
  struct sigaction old_action;
  struct sigaction new_action;
#endif /* _POSIX_VERSION */

  if (sr == NULL)
    return;
  if (print_mode >= CK_LAST)
    {
      eprintf ("Bad print_mode argument to srunner_run_all: %d",
	      __FILE__, __LINE__, print_mode);
    }
#ifdef _POSIX_VERSION
  memset(&new_action, 0, sizeof new_action);
  new_action.sa_handler = sig_handler;
  sigaction(SIGALRM, &new_action, &old_action);
#endif /* _POSIX_VERSION */
  srunner_run_init (sr, print_mode);
  srunner_iterate_suites (sr, print_mode);
  srunner_run_end (sr, print_mode);
#ifdef _POSIX_VERSION
  sigaction(SIGALRM, &old_action, NULL);
#endif /* _POSIX_VERSION */
}

pid_t check_fork (void)
{
#ifdef _POSIX_VERSION
  pid_t pid = fork();
  /* Set the process to a process group to be able to kill it easily. */
  setpgid(pid, group_pid);
  return pid;
#else /* _POSIX_VERSION */
  eprintf("This version does not support fork", __FILE__, __LINE__);
  return 0;
#endif /* _POSIX_VERSION */
}

void check_waitpid_and_exit (pid_t pid CK_ATTRIBUTE_UNUSED)
{
#ifdef _POSIX_VERSION
  pid_t pid_w;
  int status;

  if (pid > 0) {
    do {
      pid_w = waitpid(pid, &status, 0);
    } while (pid_w == -1);
    if (waserror(status, 0)) {
      exit(EXIT_FAILURE);
    }
  }
  exit(EXIT_SUCCESS);
#else /* _POSIX_VERSION */
  eprintf("This version does not support fork", __FILE__, __LINE__);
#endif /* _POSIX_VERSION */
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta charset="UTF-8" />
		<title>Breitbandausbau Berlin</title>

		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link rel="stylesheet" href="css/leaflet.css" />
		<link rel="stylesheet" href="css/main.css" type="text/css" />
		<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />

				Breitbandausbau Berlin

Das Berliner Breitbandnetz

Breitband ist das Rückgrat der digitalen Gesellschaft. Bis 2018 soll in Deutschland eine flächendeckende Netzinfrastruktur mit Geschwindigkeiten von mindestens 50 MBit/s entstehen. Wo steht die Hauptstadt Berlin? Ein Überblick in interaktiven Visualisierungen.

          Messen Sie Ihre Internetgeschwindigkeit »

Entwicklung des Breitbandausbaus

Seit fünf Jahren erhebt die Berliner Senatsverwaltung Daten zum Breitbandausbau auf Ortsteilebene. Die Daten zeigen, dass Teile Ostberlins noch 2011 massiv unterversorgt waren. Inzwischen holt der Osten auf, der Bezirk Pankow bleibt aber Schlusslicht.

									2011 - 2015

Für normales Surfen im Internet und die meisten anderen webbasierten Anwendungen sind 16 Mbit/s-Anbindungen ausreichend.

50 Mbit/s Anbindungen erlauben darüber hinaus das nutzen von neuen HD-Streaming Diensten und professionellen Anwendungen.

16Mbit/s

50Mbit/s

							<svg id="minimap-legend" height="50" width="240"></svg>

							Prozentuale Verfügbarkeit

								Bezirke im Detail

Klicken Sie auf einen der Bezirke für eine detailliertere Übersicht der einzelnen Ortsteile.

Aktueller Stand

								Der Großteil Berlins ist heute mit schnellem Internet erschlossen. In dieser zoombaren Karte lassen sich die Anschlüsse bis auf Ebene der einzelnen Häuserblocks nachverfolgen.

								Viele der Berliner Wissenschafts- und Kultureinrichtungen sind durch das Berliner Wissenschaftsnetz BRAIN an das landeseigene Glasfasernetz angeschlossen. Hier können sogar Geschwindigkeiten bis zu 10 Gbit/s erreicht werden.

10 Gbit/s Highspeed
Wissenschaftsnetzwerk

Landeseigenes Glasfasernetz

Wissenschafts-
standorte/Behörden

Anteil der Haushalte mit 50Mbit/s Breitband

≥95%

>75 - 95%

>50 - 75%

>10 - 50%

0 - 10%

Keine Daten

							Stand: Mitte 2015

Messen Sie Ihre Internetgeschwindigkeit

              und sehen Sie, wie diese im Vergleich mit anderen Berliner Nutzer*innen ist. Zugleich werden Ihre Daten zu Forschungszwecken verwendet, um ein genaueres Bild des Internetverkehrs zu erhalten. Die Geschwindigkeit variiert im Tagesverlauf, d.h. ein genaueres Bild ergibt sich, wenn Sie zu unterschiedlichen Zeiten messen.

              Für den Test werden anonymisierte Daten zu Forschungszwecken an das Measurement Lab gesendet, dort ausgewertet und als Open Data bereitgestellt. Weitere Informationen zu den AGB und zum Datenschutz hier.

              Mit Klick auf "Test starten" beginnen Sie die Kommunikation mit dem externen Server und stimmen der Weiterverwendung Ihrer Messdaten zu.

            Test starten

Upload-Geschwindigkeit

% der Berliner Speedtest Teilnehmer*innen

Download-Geschwindigkeit

% der Berliner Speedtest Teilnehmer*innen

Verfügbare und tatsächliche Internet-Geschwindigkeit

							Die vom TÜV Rheinland ermittelten Werte erlauben einen Einblick in verfügbare Breitbandvolumen in den Berliner Stadtteilen. Die tatsächliche Geschwindigkeit für die einzelnen Haushalte hängt von der genutzten Technologie, aber auch von vielen weiteren Punkten ab.

							Störfaktoren

Erfahren Sie mehr über mögliche Gründe für zu langsames Internet in der interaktiven Grafik.

Puls der Stadt

								In Berlin pulsiert das digitale Leben. Die Visualisierung zeigt die Social Media-Nutzung der letzten 24 Stunden und den Datenverkehr am Berliner Internetknoten BCIX. In den Abendstunden steigt der Traffic durch die Nutzung datenintensiver Angebote wie etwa Videostreaming.

								24h Berlin

In der Karte und der kreisförmigen Zeitleiste sehen Sie Twitter und Instagram-Aktivitäten der letzten 24h.

 Twitter Aktivität

 Instagram Aktivität

 Aktivität am Internetknoten BCIX-Berlin

Quelle: BCIX, Twitter, Instagram, TÜV, BMVI
Erfahren Sie mehr über die Daten hinter der Visualisierung »

Anteil der Haushalte
mit 50Mbit/s Breitband

 ≥95%

 >75 - 95%

 >50 - 75%

 >10 - 50%

 0 - 10%

 Keine Daten

Verfügbare Technologien

DSL Netzwerk

DSL stellt zur Zeit die weit verbreitetste Technologie dar. Die Geschwindigkeit, mit der DSL in Berliner Haushalten zur Verfügung steht, variiert zwischen 1 und 50 MBit/s. Die mögliche und tatsächliche Geschwindigkeit ist dabei abhängig von diversen Faktoren, wie beispielsweise Anbieter, Verkabelung, etc.

Kabel Netzwerk (CATV)

Neben den traditionellen Telefonleitungen, nutzen viele Nutzerinnen und Nutzer mittlerweile das Netzwerk des Kabelfernsehens, um ins Internet zu gelangen. Diese Technologie ist in vielen Berliner Wohnungen verfügbar und erreicht Geschwindigkeiten von bis zu 400 Mbit/s.

Highspeednetz (FTTX)

Die neuen Glasfasertechnologien werden unter FTTX zusammengefasst (X steht dabei als Platzhalter für verschiedene Glasfasertypen). Über die neuen Glasfaserkabel können Geschwindigkeiten von bis zu 1 GBit erreicht werden.

HSDPA Netzwerk

HSDPA ist Teil des Mobilfunkstandards UMTS. Die Technologie ist in Deutschland speziell im urbanen Raum weit verbreitet. Auch wenn die Technologie selbst Geschwindigkeiten von bis zu 14 Mbit/s zulässt, liegen die tatsächlich gemessenen Geschwindigkeiten darunter.

LTE Netzwerk

LTE ist mit Downloadraten von bis zu 300 Mbit/s der UMTS Nachfolger. Neben urbanen Ballungsgebieten wurden im Rahmen des LTE Ausbaus auch speziell ländliche Regionen mit dem LTE Standard versorgt.

5G Netzwerk

Berlin soll Vorzeigestandort für den LTE-Nachfolger 5G werden. Bei dem neuen Mobilfunkstandard, der als Schlüsseltechnologie für ein Internet der Dinge gilt, werden Geschwindigkeiten bis zu 1.000Mbit/s erreicht.

								Previous

								Next

Prozentuale Verteilung der in Berlin verfügbaren Breitband-Technologien, abhängig von der maximal zur Verfügung stehenden Geschwindigkeit.

Datenquelle:BMVI

Obgleich in der Region Berlin der Großteil der deutschen Glasfaserkabel verlegt wurden, gibt es immer noch einige unterversorgte Bereiche.

Provider in Berlin

Nach der Liberalisierung des Telekommunikationsmarktes haben sich in Berlin verschiedene Provider etabliert, die auf unterschiedliche Weise den Internetzugang ermöglichen.

								Wer stellt welche Technologie zur Verfügung?

Finden Sie heraus welcher Anbieter für welche Technologie zuständig ist. Fahren Sie einfach mit der Maus über die interaktive Grafik, um mehr zu erfahren.

Satelliten-Internet

Neben kabelgebundenen und mobilen Breitbandanbindungen gibt es mittlerweile auch eine Reihe von Anbietern, die satellitengestütztes Internet in Berliner Haushalte bringen.

								Wer stellt welche Technologie zur Verfügung?

Finden Sie heraus welcher Anbieter für welche Technologie zuständig ist. Fahren Sie mit der Maus über die Logos und Technologien in der interaktiven Grafik, um mehr zu erfahren »

						Es tut uns leid.

Aber es scheint so, als ob Ihr Browser kein WebGL unterstützt. Bitte aktualisieren Sie Ihren Browser.

Leider wird diese Technologie nicht von Ihrem Gerät unterstützt. Sollten Sie ein Smartphone nutzen probieren Sie unsere Standalone Version »

								Ein Projekt der Technologiestiftung Berlin

								Kontakt

									Die Technologiestiftung Berlin unterstützt anwendungsorientierte Forschung und engagiert sich dafür, dass die neuen Ideen und Projekte aus der vielfältigen Wissenslandschaft in Berlin in die Anwendung kommen.

									info@technologiestiftung-berlin.de

								Design & Produktion

								Sebastian Meier — VISLAB.io

								Christopher Pietsch

Daten & Entwicklung

								Im folgenden geben wir Einblicke in die Entwicklung der Visualisierungen und der zugrundeliegenden Daten.

Datenquellen

								Ausgangspunkt des Projekts war die Veröffentlichung einer Detailauswertung zum Breitbandausbau der Berliner Senatsverwaltung für Wirtschaft, Technologie und Forschung. Die Datengrundlage bildet der Breitbandatlas, der im Auftrag des Bundesministeriums für Verkehr und digitale Infrastruktur vom TÜV Rheinland erstellt wurde. Die Daten zum Berliner Gebäudebestand stammen aus dem FIS-Broker. Da die von der Senatsverwaltung veröffentlichten PDF-Dokumente nicht maschinenlesbar waren, haben wir sie entsprechend überarbeitet. Die aufbereiteten Daten stellen wir über ein Github-Repo zur Verfügung.

Breitbandatlas »

TÜV Rheinland »

FIS-Broker »

Brain Netzwerk

								Das Berliner Wissenschaftsnetz BRAIN verbindet Wissenschafts-, Kultur- und Bildungseinrichtungen über ein landeseigenes Hochgeschwindigkeitsnetz. Neben Echtzeitinformationen zum Status des Netzwerks stellt BRAIN auch einen groben Netzwerkplan der angeschlossenen Institutionen zur Verfügung. Im Rahmen des Projektes haben wir diesen Plan georeferenziert. Diese aufbereiteten Daten sind ebenfalls im Github-Repo enthalten.

BRAIN-Kernnetz »

Social Media

								Zur Darstellung der Social Media-Nutzung in Berlin nutzen wir die frei zugänglichen APIs von Twitter und Instagram. Da über die APIs nur relative Werte ermittelt werden können, geben wir keine genauen Zahlen der Tweets und Bilder an, sondern lediglich Trends. Aus Datenschutzgründen speichern wir keine detaillierten Informationen, sondern generieren nur ein grobes Mapping der geteilten Tweets und Bilder. Aufgrund der Nutzungsbestimmungen der Unternehmen können wir die Rohdaten hier nicht veröffentlichen. Als weitere Referenz für den Nutzungstrend errechneten wir die durchschnittliche Nutzung des Internetknotenpunktes BCIX. BCIX stellt sowohl Echtzeit- als auch historische Daten für den Standort Berlin zur Verfügung.

Twitter API »

Instagram API »

BCIX »

Open Data & Open Source

								Die Technologiestiftung Berlin setzt sich für Open Data und Open Source ein. Dahinter steht der Gedanke, durch das Bereitstellen von Daten oder Software Innovationen zu fördern. Mit den Visualisierungen auf dieser Seite wollen wir zeigen, dass aus offenen Daten spannende Projekte und neue Einsichten entstehen können. In diesem Sinne stellen wir nicht nur die von uns genutzten Datensätze (soweit möglich), sondern auch den Code der hinter den Visualisierungen steckt, zur freien Weiternutzung zur Verfügung. Fühlen Sie sich inspiriert, ein eigenes Projekt damit zu entwickeln!

TSB Github Repo »

Open Data Berlin »

Artikel: Open Data in der Praxis »

© Technologiestiftung Berlin 2016

Kontakt | Impressum | Datenschutz

						Gefördert aus Mitteln des Landes Berlin und der Investitionsbank Berlin, kofinanziert von der Europäischen Union - Europäischer Fonds für Regionale Entwicklung. Investition in Ihre Zukunft.

				Menü

Entwicklung des Breitbandausbaus

Bezirke im Detail

Aktueller Stand

Puls der Stadt

Verfügbare Technologien

Provider in Berlin

Perspektivwechsel

Kontakt

Daten & Entwicklung


text:
require 'redmine'

Redmine::Plugin.register :redmine_pdf_macro do
  name 'Redmine PDF Macro'
  author 'Jorge Rodriguez <Jorge.rodriguez@forgeservicelab.fi>'
  description 'Allows a pdf file to be embeded'
  version '0.0.1'

  Redmine::WikiFormatting::Macros.register do
    desc "Embed a PDF file"
    macro :pdf do |obj, args|
      content = %Q{<object data="#{args[0]}" type="application/pdf" width="100%"
 height="100%">

It appears you don't have a PDF plugin for this browser.
  No biggie... you can click here to download the PDF file.

</object>}

      return "#{ CGI::unescapeHTML(content) }".html_safe
    end

  end
end


text:
using UnityEngine;
using Fineness.Framework.Interfaces;
using System;

///
///
/// UI元素基类
///
/// 方便UI逻辑管理,统一兼容各种UI库
///
/// add by Minghua.ji
///
///
public class UIElement : IUIElement
{

    #region 私有属性
    private bool mIsInited;
    private UIRootType mRootType = UIRootType.UI3D;
    private NoticeManager mNoticeManager;
    private ObjectPoolManager mPoolManager;
    #endregion

    #region 受保护的属性
    protected UIPrefabComponent mUIComponent;
    protected UIManager mUIManager;
    protected object mUIParam;
    protected bool mIsShow;
    #endregion

    #region 构造函数
    public UIElement(UIPrefabComponent UIComponent)
    {
        mUIComponent = UIComponent;
        mUIManager = UIManager.Instance;
        mNoticeManager = NoticeManager.Instance;
        mPoolManager = ObjectPoolManager.Instance;
    }
    #endregion

    #region 销毁
    /// 彻底销毁
    public virtual void Dispose()
    {
        Purge();
    }

    /// 回收方式销毁,覆盖此方法,添加对象池相关的回收操作
    protected virtual void Purge()
    {
        if(mUIComponent != null)
            mUIComponent.transform.SetParent(null);
        mUIComponent = null;
        mNoticeManager = null;
        mPoolManager = null;
        mIsInited = false;
    }
    #endregion

    #region UI激活、关闭相关
    public void OpenUI(object param = null)
    {
        if (mUIComponent == null)
            return;

        if (!mIsShow)
        {
            ActiveUI(ref param);
            mIsShow = true;
            OnShowed();
        }
        else if(param != null)
        {
            mUIParam = param;
            RefreshUI();
        }
    }

    protected virtual void ActiveUI(ref object param)
    {
        Transform UIRoot = default(Transform);
        if ((mRootType == UIRootType.UI2D) && (UIManagerIns.UIRoot2D != null))
            UIRoot = UIManagerIns.UIRoot2D.transform;
        else if((mRootType == UIRootType.UI3D) && (UIManagerIns.UIRoot3D != null))
            UIRoot = UIManagerIns.UIRoot3D.transform;

        mUIComponent.transform.SetParent(UIRoot);
        mIsInited = true;
        mUIParam = param;
    }

    public void CloseUI(object param = null)
    {
        mIsShow = false;
        OnHided();
    }

    protected virtual void OnShowed()
    {
        mUIComponent.gameObject.SetActive(true);
        mUIComponent.transform.localScale = Vector3.one;

    }
    protected virtual void OnHided()
    {
        if(mUIComponent != null)
        {
            if(mUIComponent.transform.parent != null)
                mUIComponent.transform.SetParent(null);
            mUIComponent.gameObject.SetActive(false);
        }
    }

    public virtual void RefreshUI()
    {

    }
    #endregion

    #region 对象池支持
    public virtual void Reinit(ObjectArray param = null, int ctorIndex = 0)
    {
        mUIComponent = (UIPrefabComponent)param[0];
        mUIManager = UIManager.Instance;
        mNoticeManager = NoticeManager.Instance;
        mPoolManager = ObjectPoolManager.Instance;
    }

    public virtual void Reset()
    {
        Purge();
    }

    protected T FromPool<T>(ObjectArray args = null, int ctorIndex = 0)
    {
        if (mPoolManager == null)
            mPoolManager = ObjectPoolManager.Instance;
        return mPoolManager.FromPool<T>(args, ctorIndex);
    }

    protected void ToPool(object target)
    {
        if (mPoolManager == null)
            mPoolManager = ObjectPoolManager.Instance;
        mPoolManager.ToPool(target);
    }
    #endregion

    #region 刷帧函数
    /// 开始刷帧
    public virtual void AddUpdate()
    {

    }

    /// 结束刷帧
    public virtual void RemoveUpdate()
    {

    }

    /// 帧更新
    public virtual void OnUpdate(int dTime)
    {

    }

    /// 帧后更新
    public virtual void OnLateUpdate()
    {

    }

    /// 固定更新
    public virtual void OnFixedUpdate(int dTime)
    {

    }

    /// 是否每帧更新
    public virtual bool IsUpdate
    {
        get
        {
            return true;
        }
    }

    /// 是否固定时间更新
    public virtual bool IsFixedUpdate
    {
        get
        {
            return true;
        }
    }

    /// 是否刷帧后更新
    public virtual bool IsLateUpdate
    {
        get
        {
            return true;
        }
    }
    #endregion

    #region 消息机制

    /// 注册消息
    public void AddNotice(string name, ObjectDelegate handler)
    {
        if (mNoticeManager != null)
            mNoticeManager.Register(name, handler);
    }

    public void AddNotice
(string name, Func
 handler)
    {
        if (mNoticeManager != null)
            mNoticeManager.Register
(name, handler);
    }

    public void AddNotice<M, P, R>(string name, Func
 handler) where M : IDelegateMessage
    {
        if (mNoticeManager != null)
            mNoticeManager.Register<M, P, R>(name, handler);
    }

    /// 移除消息
    public void RemoveNotice(string name, ObjectDelegate handler)
    {
        if (mNoticeManager != null)
            mNoticeManager.Unregister(name, handler);
    }

    public void RemoveNotice
(string name, Func
 handler)
    {
        if (mNoticeManager != null)
            mNoticeManager.Unregister(name, handler);
    }

    public void SendNotice(string name, object param = null)
    {
        if (mNoticeManager != null)
            mNoticeManager.SendNotice(name, param);
    }

    public void SendNotice(INotice notice)
    {
        if (mNoticeManager != null)
            mNoticeManager.SendNotice(notice);
    }

    public R SendNotice
(string name, P param = default(P))
    {
        var result = default(R);
        if (mNoticeManager != null)
            result = mNoticeManager.SendNotice
(name, param);
        return result;
    }
    #endregion

    #region 命令机制
    public object SendCommand(string controllerName, string subCommandName, object param = null)
    {
        if (mNoticeManager == null)
            return null;
        return mNoticeManager.SendCommand(controllerName, subCommandName, param);
    }
    #endregion

    #region 观察者
    public virtual void Notify(object body = null)
    {

    }
    #endregion

    #region 属性
    public NGUIComponent NGUIComponent
    {
        get
        {
            return (NGUIComponent)mUIComponent;
        }
    }

    public UGUIComponent UGUIComponent
    {
        get
        {
            return (UGUIComponent)mUIComponent;
        }
    }

    public UIPrefabComponent UIPrefabComponent
    {
        get
        {
            return mUIComponent;
        }
    }

    public UIRootType RootType
    {
        get
        {
            return mRootType;
        }

        set
        {
            mRootType = value;
        }
    }

    public UIManager UIManagerIns
    {
        get
        {
            return UIManager.Instance;
        }
    }

    protected bool IsInited
    {
        get
        {
            return mIsInited;
        }
    }

    /// 是否加入了刷帧队列
    private bool mIsFrameUpdate = false;
    public bool IsFrameUpdate
    {
        set
        {
            mIsFrameUpdate = value;

            if (mIsFrameUpdate)
                SendNotice<IUpdate, object>(FConsts.FNOTICE_ADD_UPDATE, this);
            else
                SendNotice<IUpdate, object>(FConsts.FNOTICE_REMOVE_UPDATE, this);
        }
        get
        {
            return mIsFrameUpdate;
        }
    }

    public bool IsActived
    {
        get
        {
            return mIsShow;
        }
    }

    public string UIName
    {
        get
        {
            return (mUIComponent != null) ? mUIComponent.UIName : string.Empty;
        }
    }
    #endregion
}


text:
#include <iostream>
#include <map>
using namespace std;

struct CacheEntry {
        string obj;
        struct CacheEntry *prev, *next;
};

CacheEntry head;
map<int, CacheEntry> Cache;

string /*obj*/
get(int key) {
        if (Cache.count(key) == 0)
                throw "No Key Exception";

        CacheEntry& entry = Cache[key];
        /* unlink entry */
        entry.prev->next = entry.next;
        entry.next->prev = entry.prev;

        /* link entry */
        entry.next = head.next;
        entry.prev = head.prev;

        // add to the beginning...
        head.next = &entry;
        if (head.prev == &head)
                head.prev = &entry;

        return entry.obj;

}

void put(int key, string obj) {
        CacheEntry entry;
        entry.obj = obj;

        /* link entry */
        entry.next = head.next;
        entry.prev = &head;

        // add object to map
        Cache[key] = entry;

        // put on front of the DLL.
        head.next = &Cache[key];
        if (head.prev == &head)
                head.prev = &Cache[key];
}

void init_map() {
        head.next = head.prev = &head;
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;

namespace Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryDiscardDesignation
{
    /// <summary>
    /// Supports code like <c>o switch { int _ => ... }</c> to just <c>o switch { int => ... }</c> in C# 9 and above.
    /// </summary>
    [DiagnosticAnalyzer(LanguageNames.CSharp)]
    internal sealed class CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer
        : AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer
    {
        public CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer()
            : base(IDEDiagnosticIds.RemoveUnnecessaryDiscardDesignationDiagnosticId,
                   EnforceOnBuildValues.RemoveUnnecessaryDiscardDesignation,
                   option: null,
                   fadingOption: null,
                   new LocalizableResourceString(nameof(CSharpAnalyzersResources.Remove_unnessary_discard), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)),
                   new LocalizableResourceString(nameof(CSharpAnalyzersResources.Discard_can_be_removed), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)))
        {
        }

        public override DiagnosticAnalyzerCategory GetAnalyzerCategory()
            => DiagnosticAnalyzerCategory.SemanticSpanAnalysis;

        protected override void InitializeWorker(AnalysisContext context)
        {
            context.RegisterCompilationStartAction(context =>
            {
                if (context.Compilation.LanguageVersion() < LanguageVersion.CSharp9)
                    return;

                context.RegisterSyntaxNodeAction(AnalyzeDiscardDesignation, SyntaxKind.DiscardDesignation);
            });
        }

        private void AnalyzeDiscardDesignation(SyntaxNodeAnalysisContext context)
        {
            var discard = (DiscardDesignationSyntax)context.Node;
            if (discard.Parent is DeclarationPatternSyntax)
            {
                Report(discard);
            }
            else if (discard.Parent is RecursivePatternSyntax recursivePattern)
            {
                // can't remove from `(int i) _` as `(int i)` is not a legal pattern itself.
                if (recursivePattern.PositionalPatternClause != null &&
                    recursivePattern.PositionalPatternClause.Subpatterns.Count == 1)
                {
                    return;
                }

                Report(discard);
            }

            return;

            void Report(DiscardDesignationSyntax discard)
            {
                context.ReportDiagnostic(Diagnostic.Create(
                    this.Descriptor,
                    discard.GetLocation()));
            }
        }
    }
}


text:
package org.apache.hadoop.hbase.io.hfile.bucket;

import static org.junit.Assert.assertTrue;

import java.nio.ByteBuffer;

import org.apache.hadoop.hbase.SmallTests;
import org.junit.Test;
import org.junit.experimental.categories.Category;

/**
 * Basic test for {@link ByteBufferIOEngine}
 */
@Category(SmallTests.class)
public class TestByteBufferIOEngine {

  @Test
  public void testByteBufferIOEngine() throws Exception {
    int capacity = 32 * 1024 * 1024; // 32 MB
    int testNum = 100;
    int maxBlockSize = 64 * 1024;
    ByteBufferIOEngine ioEngine = new ByteBufferIOEngine(capacity, false);
    int testOffsetAtStartNum = testNum / 10;
    int testOffsetAtEndNum = testNum / 10;
    for (int i = 0; i < testNum; i++) {
      byte val = (byte) (Math.random() * 255);
      int blockSize = (int) (Math.random() * maxBlockSize);
      if (blockSize == 0) {
        blockSize = 1;
      }
      byte[] byteArray = new byte[blockSize];
      for (int j = 0; j < byteArray.length; ++j) {
        byteArray[j] = val;
      }
      ByteBuffer srcBuffer = ByteBuffer.wrap(byteArray);
      int offset = 0;
      if (testOffsetAtStartNum > 0) {
        testOffsetAtStartNum--;
        offset = 0;
      } else if (testOffsetAtEndNum > 0) {
        testOffsetAtEndNum--;
        offset = capacity - blockSize;
      } else {
        offset = (int) (Math.random() * (capacity - maxBlockSize));
      }
      ioEngine.write(srcBuffer, offset);
      ByteBuffer dstBuffer = ByteBuffer.allocate(blockSize);
      ioEngine.read(dstBuffer, offset);
      byte[] byteArray2 = dstBuffer.array();
      for (int j = 0; j < byteArray.length; ++j) {
        assertTrue(byteArray[j] == byteArray2[j]);
      }
    }
    assert testOffsetAtStartNum == 0;
    assert testOffsetAtEndNum == 0;
  }
}


text:
package funtl.microservice.train.spring.boot.ch3.aware;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AwareConfig.class);

        AwareService awareService = context.getBean(AwareService.class);
        awareService.outputResult();

        context.close();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
    <folder name="Actions">
        <folder name="File">
            <file name="org-jojo-JOpen.instance">
                <attr name="delegate" newvalue="org.jojo.JOpen"/>
                <attr name="displayName" bundlevalue="org.jojo.Bundle#CTL_jopen"/>
                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
                <attr name="noIconInMenu" boolvalue="false"/>
            </file>
        </folder>
    </folder>
    <folder name="Menu">
        <folder name="GoTo">
            <file name="org-jojo-jopen.shadow">
                <attr name="originalFile" stringvalue="Actions/File/org-jojo-JOpen.instance"/>
                <attr name="position" intvalue="0"/>
            </file>
        </folder>
    </folder>
</filesystem>


text:
FROM registry.cn-beijing.aliyuncs.com/kk/kk-logic:latest

COPY ./web/job /web/job
COPY ./view/job /view/job
COPY ./static/job /static/job
COPY ./config/env.ini /config/env.ini


text:
title: Capacity Building Programme - Teaching science in St. Columbus School, Faridabad
layout: gallery
galleryid: 2018-st-columbus-school-faridabad
---


text:
var expect = require('salinity').expect;

var statusManager = require('../../lib/statusManager.js');

describe('statusManager.js', () => {

  var manager;
  var config = {};

  beforeEach(() => {
    manager = statusManager(config);
  });

  describe('progressForStep', () => {
    test('exists', () => {
      expect(manager).itself.to.respondTo('progressForStep');
    });
  });

});


text:
require "pinker/print/print_support"

module Pinker

  class Rule
    def inspect(indent="")
      str = ArrayPrintSupport.inspect_array(@parts, indent, "Rule(#{@rule_key.inspect})")
      str << "\n" if indent.empty?
      str
    end

    def to_s
      "Rule(#{@rule_key.inspect})#{ArrayPrintSupport.to_s_array(@parts)}"
    end
  end

  class Declaration
    include PrintSupport

    def to_s
      msg = @failure_message ? "'" + @failure_message + "'" : "<no message>"
      "declare:#{msg}"
    end
  end

  class RuleDeclaration
    include PrintSupport

    def to_s
      "with_rule:#{rule_key.to_s}"
    end
  end

  class Remembering
    include PrintSupport

    def to_s
      "remember"
    end
  end

  class Problem
    def inspect(indent="")
      indent + "'" + (@declaration.respond_to?(:failure_message) && @declaration.failure_message || "") + "'" + "\n" +
      indent + "  ==> " + @actual_object.inspect
    end

    def to_s
      "'" + @declaration.failure_message + "'" + ":" + @actual_object.inspect
    end
  end

end


text:
package com.silence.commons.tools;

import org.apache.commons.lang3.StringUtils;

public class TelephoneTool {

	public static String formatNumber(String phoneNumber) {
		if (StringUtils.isNotEmpty(phoneNumber)) {
			String after = phoneNumber.replaceAll("86-", "");
			after = after.replaceAll("[\\s|\\+|-]+", "");

			return after;
		}
		return "";
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/rootLayout"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:background="@color/primary"
    android:orientation="vertical"
    android:clickable="true"
    android:padding="@dimen/activity_horizontal_margin">

  <ImageView
      android:id="@+id/logo"
      android:layout_width="@dimen/pin_logo_width"
      android:layout_height="@dimen/pin_logo_height"
      android:src="@drawable/ic_lock"
      android:layout_gravity="center_horizontal"
      android:layout_marginTop="20dp"
      />

  <include layout="@layout/merge_fragment_lock" />

</LinearLayout>


text:
namespace download {

// The type of completion when the download entry transits to complete state.
// TODO(xingliu): Implement timeout and unknown failure types.
enum class CompletionType {
  // The download is successfully finished.
  SUCCEED = 0,
  // The download is interrupted and failed.
  FAIL = 1,
  // The download is aborted by the client.
  ABORT = 2,
  // The download is timed out and the connection is closed.
  TIMEOUT = 3,
  // The download is failed for unknown reasons.
  UNKNOWN = 4,
  // The download is cancelled by the client.
  CANCEL = 5,
  // The download expended it's number of expensive retries.
  OUT_OF_RETRIES = 6,
  // The download expended it's number of 'free' retries.
  OUT_OF_RESUMPTIONS = 7,
  // The upload was timed out due to unresponsive client.
  UPLOAD_TIMEOUT = 8,
  // The count of entries for the enum.
  COUNT = 9,
};

}  // namespace download

#endif  // COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_CONSTANTS_H_


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>LO21 | Pistache: Class Members - Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

LO21 | Pistache

Projet de LO21 de Loïc Deryckère et Mewen Michel

Main Page

Namespaces

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

All

Functions

Variables

Related Functions

a

c

d

e

f

g

h

i

l

m

n

o

p

r

s

t

u

~

- e -

Editeur()
: Editeur

EditeurPrecedence()
: EditeurPrecedence

EditeurProjet()
: EditeurProjet

EditeurTache()
: EditeurTache

EditeurTC()
: EditeurTC

EditeurTU()
: EditeurTU

editionPrecedenceEnd()
: EditeurPrecedence

empty()
: EditeurPrecedence

estComposante()
: Projet

Evenement()
: Evenement

EventWidget()
: EventWidget

<address class="footer">
Generated on Sun Jun 14 2015 20:59:16 for LO21 | Pistache by

 1.8.9.1
</address>


text:
{% load partialdate_tags %}
{% load fb_versions %}

.. role:: underline
    :class: underline

{% if latexmode %}.. _{{ object.handle }}:{% endif %}

{% firstof itemtitle object.get_full_name %}
==============================================================================================================================================================

{% if object.portrait.image %}
{% if latexmode %}
{% if current_site in object.portrait.sites.all %}
.. raw:: latex

    \begin{minipage}[t]{11cm}\vspace{0pt}
{% endif %}
{% else %}
{% if request.site in object.portrait.sites.all %}
.. image:: {% version object.portrait.image 'small' %}
    :class: pull-right
{% endif %}
{% endif %}
{% endif %}

{% if object.datebirth or object.placebirth %}geboren {{ object.datebirth|partial_date:"j.n.Y" }}{% if object.placebirth %} in `{{ object.placebirth }} <{% url "place-detail" object.placebirth.id %}>`__ {% endif %}{% if object.datedeath or object.placedeath %} - {% endif %}{% endif %}{% if object.datedeath or object.placedeath %}gestorben {{ object.datedeath|partial_date:"j.n.Y" }}{% if object.placedeath %} in `{{ object.placedeath }} <{% url "place-detail" object.placedeath.id %}>`__ {% endif %}{% endif %}

{% include "genealogio/person_snippet_full.rst" with person=object.get_father label="**Vater:** " %}

{% include "genealogio/person_snippet_full.rst" with person=object.get_mother label="**Mutter:** " %}

{% with allchildren=object.get_children %}
{% for partner, children, family in allchildren %}

{{ family.get_relation_text }} {% include "genealogio/person_snippet.rst" with person=partner %}{% if latexmode %}. :ref:`Familie {% firstof family.name family %} <{{family.handle}}>`{% else %}— `Familie {% firstof family.name family.father.last_name person.last_name %} <{{ family.get_absolute_url }}>`__{% endif %}

{% if children %}
.. container:: marginleft30

    **Kinder:**

{% for child in children %}
    * {% include "genealogio/person_snippet_full.rst" with person=child %}
{% endfor %}
{% endif %}
{% endfor %}
{% endwith %}

{% if latexmode and object.portrait.image %}
{% if current_site in object.portrait.sites.all %}
.. raw:: latex

    \end{minipage}\hfill
    \begin{minipage}[t]{4cm}\vspace{0pt}

.. image:: /../../../..{% version object.portrait.image 'medium' %}
    :width: 4cm

.. raw:: latex

    \end{minipage}
{% endif %}
{% endif %}

{{ object.comments|safe }}

{% include "genealogio/events.rst" %}

{% if object.personplace_set.count and not hide_places %}

Orte
----

{% for pl in object.personplace_set.all %}
* {% if pl.start and pl.start != pl.end %}{{ pl.start|partial_date:"j.n.Y" }}{% endif %}{% if pl.start and pl.end and pl.start != pl.end %} - {% endif %}{{ pl.end|partial_date:"j.n.Y" }}{% if pl.start or pl.end %}: {% endif %} `{{ pl.place }} <{{ pl.place.get_absolute_url }}>`__ ({{ pl.get_typ_display }})
{% endfor %}
{% endif %}

{% include "genealogio/notes.rst" %}

{% include "notaro/sources.rst" with all_sources=object.personsource_set.all %}


text:
package com.nec.congenio.value.xml;

import java.io.File;
import java.io.InputStream;
import java.io.Writer;
import java.net.URL;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import com.nec.congenio.ConfigValue;
import com.nec.congenio.ValueFormat;
import com.nec.congenio.xml.Xml;

public class XmlValueFormat implements ValueFormat {

    @Override
    public ConfigValue parse(String data) {
        return create(Xml.parse(data));
    }

    @Override
    public ConfigValue parse(URL url) {
        return create(Xml.parse(url));
    }

    @Override
    public ConfigValue parse(File file) {
        return create(Xml.parse(file));
    }

    @Override
    public ConfigValue parse(InputStream instr) {
        return create(Xml.parse(instr));
    }

    private ConfigValue create(Document doc) {
        return XmlValue.create(doc.getDocumentElement());
    }

    @Override
    public void write(ConfigValue conf, Writer writer, boolean indent) {
        if (conf instanceof XmlValue) {
            Element elem = ((XmlValue) conf).toXml();
            Xml.write(elem, writer, false, indent);
        } else {
            Element elem = conf.toXml(conf.getName());
            Xml.write(elem, writer, false, indent);
        }
    }

    /**
     * Generates a path expression that refers to
     * the given element.
     * @param elem the element for which a path is
     *        generated.
     * @return a path from the root to the given element.
     */
    public static String path(Element elem) {
        String path = "/" + name(elem);
        Node currentNode = elem;
        while ((currentNode = currentNode.getParentNode()) != null) {
            if (currentNode instanceof Element) {
                path = "/" + name((Element) currentNode) + path;
            } else {
                break;
            }
        }
        return path;
    }

    private static String name(Element elem) {
        String name = elem.getAttribute("name");
        if (!name.isEmpty()) {
            return elem.getTagName() + "[" + name + "]";
        } else {
            return elem.getTagName();
        }
    }
}


text:
import express from 'express'
import session from 'express-session'
import connectRedis from 'connect-redis'
import mongoose from 'mongoose'
import cookieParser from 'cookie-parser'
import bodyParser from 'body-parser'
import favicon from 'serve-favicon'
import logger from 'morgan'
import path from 'path'
import WebpackDevServer from 'webpack-dev-server'
import webpack from 'webpack'
import config from './config/config'

const app = express()

// view engine setup
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'pug')

app.use(favicon(path.join(__dirname, '../public/img', 'favicon.ico')))
app.use(logger('dev'))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use(cookieParser(config.sessionOptions.secret))
app.use(express.static(path.join(__dirname, '../public')))

// start mongodb
const mongodb = mongoose.connection
mongodb.on('error', console.error)
mongodb.once('open', () => {
  console.log('Connected to mongodb server')
})
mongoose.connect(config.mongoParams.url)

// store sessions to redis
const RedisStore = connectRedis(session)
const sessionOptions = config.sessionOptions
sessionOptions.store = new RedisStore(config.redisParams)
app.use(session(sessionOptions))

// add routers
import routes from './routes'
app.use('/api', routes)
app.get('*', (req, res) => {
  res.sendFile(path.resolve(__dirname, '../public/index.html'))
})

// catch 404 and forward to error handler
app.use((req, res, next) => {
  let err = new Error('Not Found')
  err.status = 404
  next(err)
})

// production error handler no stacktraces leaked to user
app.use((err, req, res, next) => {
  res.status(err.status || 500)
  res.render('error', {
    message: err.message,
    error: app.get('env') === 'development' ? err : {}
  })
})

// Normalize a port into a number, string, or false.
const normalizePort = (val) => {
  let port = parseInt(val, 10)
  if (isNaN(port)) return val
  if (port >= 0) return port
  return false
}

// server setting
const port = normalizePort(process.env.PORT || '3000')
const devPort = normalizePort(process.env.PORT || '3001')

if (process.env.NODE_ENV === 'development') {
  console.log('Server is running on development mode')
  const config = require('../webpack.dev.config')
  let compiler = webpack(config)
  let devServer = new WebpackDevServer(compiler, config.devServer)
  devServer.listen(devPort, () => {
    console.log('webpack-dev-server is listening on port', devPort)
  })
}

// listen
const server = app.listen(port, () => {
  console.log('Express listening on port', port)
})


text:
package com.lechucksoftware.proxy.proxysettings.excluded;

/**
 * Created by Marco on 06/08/13.
 */
public class ActionManager
{
    private static ActionManager instance;

    /**
     * Create a new instance of ActionManager
     */
    public static ActionManager getInstance()
    {
        if (instance == null)
            instance = new ActionManager();

        return instance;
    }

    public void setStatus(StatusFragmentStates status)
    {
        StatusFragment.getInstance().setStatus(status);
    }

    public void setStatus(StatusFragmentStates status, String message)
    {
        StatusFragment.getInstance().setStatus(status, message);
    }

    public void setStatus(StatusFragmentStates status, String message, Boolean isInProgress)
    {
        StatusFragment.getInstance().setStatus(status, message, isInProgress);
    }

    public void hide()
    {
        StatusFragment.getInstance().hide();
    }
}


text:
/**
 * Module dependencies.
 */
const request = require('request');
const readline = require('readline');
const fs = require('fs');

const CSV = 'mapping-query.txt';

var pooledRequest = request.defaults({pool: {maxSockets: 100}});

var lineReader = require('readline').createInterface({
 input: fs.createReadStream(CSV)
});
var i = 0;
lineReader.on('line', function (line) {

  var jsonLine = JSON.parse(line);

  pooledRequest.post(
    'https://api.openfigi.com/v1/mapping',
    { json: jsonLine, headers: { 'X-OPENFIGI-APIKEY': '8083cda3-d0a6-4ecb-97d6-cf14efb4a6fc' } },
      function (error, response, body) {

          if (!error) {
            for(var j = 0; j < body.length; j++) {
              if(body[j] && body[j].data && body[j].data.length) {
                fs.appendFile('mapping-response.txt', jsonLine[j].idValue + '===' + body[j].data[0].ticker + '\n', function (err) {});

              }
            }

          } else {
            console.log('error: ', error);
          }
      }
  );

});


text:
var Lab = require('lab');
var Code = require('code');
var Config = require('../../../config');
var Hapi = require('hapi');
var MailerPlugin = require('../../../server/mailer');
var ContactPlugin = require('../../../server/api/contact');

var lab = exports.lab = Lab.script();
var request, server;

lab.beforeEach(function (done) {

    var plugins = [MailerPlugin, ContactPlugin];
    server = new Hapi.Server();
    server.connection({ port: Config.get('/port/web') });
    server.register(plugins, function (err) {

        if (err) {
            return done(err);
        }

        done();
    });
});

lab.experiment('Contact Plugin', function () {

    lab.beforeEach(function (done) {

        request = {
            method: 'POST',
            url: '/contact',
            payload: {
                name: 'Toast Man',
                email: 'mr@toast.show',
                message: 'I love you man.'
            }
        };

        done();
    });

    lab.test('it returns an error when send email fails', function (done) {

        var realSendEmail = server.plugins.mailer.sendEmail;
        server.plugins.mailer.sendEmail = function (options, template, context, callback) {

            callback(Error('send email failed'));
        };

        server.inject(request, function (response) {

            Code.expect(response.statusCode).to.equal(500);

            server.plugins.mailer.sendEmail = realSendEmail;

            done();
        });
    });

    lab.test('it returns success after sending an email', function (done) {

        var realSendEmail = server.plugins.mailer.sendEmail;
        server.plugins.mailer.sendEmail = function (options, template, context, callback) {

            callback(null, {});
        };

        server.inject(request, function (response) {

            Code.expect(response.statusCode).to.equal(200);

            server.plugins.mailer.sendEmail = realSendEmail;

            done();
        });
    });
});


text:
class DdaExpenditure < ActiveRecord::Base
before_save :trunc_fund

scope :current_month, lambda { where("paid_date >= ? AND paid_date <= ?",
                                           Time.zone.now.beginning_of_month, Time.zone.now.end_of_month) }

  def trunc_fund
    self.fund = self.fund[1..-1]
  end

  searchable do
    text :fund, :paid, :paid_date
    string :fund
    string :paid
    string :paid_date
  end

end


text:
#include "cache.h"
#include "diff.h"
#include "commit.h"
#include "revision.h"
#include "builtin.h"
#include "submodule.h"

static const char diff_cache_usage[] =
"git diff-index [-m] [--cached] "
"[<common diff options>] <tree-ish> [<path>...]"
COMMON_DIFF_OPTIONS_HELP;

int cmd_diff_index(int argc, const char **argv, const char *prefix)
{
	struct rev_info rev;
	int cached = 0;
	int i;
	int result;

	init_revisions(&rev, prefix);
	gitmodules_config();
	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
	rev.abbrev = 0;

	argc = setup_revisions(argc, argv, &rev, NULL);
	for (i = 1; i < argc; i++) {
		const char *arg = argv[i];

		if (!strcmp(arg, "--cached"))
			cached = 1;
		else
			usage(diff_cache_usage);
	}
	if (!rev.diffopt.output_format)
		rev.diffopt.output_format = DIFF_FORMAT_RAW;

	/*
	 * Make sure there is one revision (i.e. pending object),
	 * and there is no revision filtering parameters.
	 */
	if (rev.pending.nr != 1 ||
	    rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
		usage(diff_cache_usage);
	if (!cached) {
		setup_work_tree();
		if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
			perror("read_cache_preload");
			return -1;
		}
	} else if (read_cache() < 0) {
		perror("read_cache");
		return -1;
	}
	result = run_diff_index(&rev, cached);
	return diff_result_code(&rev.diffopt, result);
}


text:
layout: example.html
title: Magnify
shortdesc: Show a magnified version of imager under the pointer
docs: >

This example makes use of the postcompose event listener to
  oversample imagery in a circle around the pointer location.  Listeners for this event have access to the Canvas context and can manipulate image data.

Move around the map to see the effect.  Use the ↑ up and ↓ down arrow keys to adjust the magnified circle size.

tags: "magnify, image manipulation"
cloak:
  - key: As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5
    value: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---


text:
// vars
var data = {},
    unicoreData = [],
    order = [],
    lca = "",
    pans = [],
    cores = [],
    unicores = [],
    unicorePresent = false,
    rank = 0,
    matrix;

// Add an event handler to the worker
self.addEventListener('message', function (e) {
    var data = e.data;
    switch (data.cmd) {
    case 'log':
        sendToHost("log", data.msg);
        break;
    case 'loadData':
        loadData(data.msg.id, data.msg.name);
        break;
    case 'loadUserData':
        loadUserData(data.msg.id, data.msg.name, data.msg.ids);
        break;
    case 'removeData':
        removeData(data.msg.id, data.msg.order, data.msg.start);
        break;
    case 'clearAllData':
        clearAllData();
        break;
    case 'recalculatePanCore':
        recalculatePanCore(data.msg.order, data.msg.start, data.msg.stop);
        break;
    case 'getUniqueSequences':
        getUniqueSequences(data.msg.order, data.msg.force);
        break;
    case 'autoSort':
        autoSort(data.msg.type);
        break;
    case "getSequences":
        getSequences(data.msg.type, data.msg.id);
        break;
    case "calculateSimilarity":
        matrix.calculateSimilarity();
        break;
    case "clusterMatrix":
        matrix.clusterMatrix(data.msg.similarity);
        break;
    case "getMatrix":
        matrix.sendToHost();
        break;
    default:
        error(data.msg);
    }
}, false);

/* Write a small class to contain all the variables for the matrix */
var matrixBackend = function matrixBackend(data) {
    var idsToCalculate = [],
        matrixOrder  = [],
        matrixObject = {};

    // variable to keep track of dirty state
    var dirty = false;

    var that = {};

    /**************************** Private methods *****************************/

    /**
     * Converts the object representation of the matrix to a normal array
     */
    function matrixObjectToArray(similarity) {
        var returnMatrix = [],
            i,
            j;
        for (i = 0; i < matrixOrder.length; i++) {
            returnMatrix[i] = [];
            for (j = 0; j < matrixOrder.length; j++) {
                returnMatrix[i][j] = matrixObject[matrixOrder[i]][matrixOrder[j]][similarity];
            }
        }
        return returnMatrix;
    }

    /**
     * Searches in tree for an occurance of x to replace that occurance by the
     * triplet [x, y, val]
     *
     * @param <Array> tree A hierarchical array representing the tree
     * @param <Number> x The first value
     * @param <Number> y The second value
     * @param <Number> val The similarity between x and y
     */
    function findAndReplace(tree, x, y, val) {
        var index;
        if (tree instanceof Array) {
            index = tree.indexOf(x);
            if (index === -1 || index === 2) {
                findAndReplace(tree[0], x, y, val);
                findAndReplace(tree[1], x, y, val);
            } else {
                tree[index] = [x, y, val];
            }
        }
    }

    /**
     * Flattens a hierarchical array based on the first 2 elements. Always
     * removes the last element. Converts the id's to proteome id's.
     *
     * @param <Array> array The array to flatten
     */
    function treeToOrder(array) {
        var result = [],
            i;
        for (i = 0; i < array.length - 1; i++) {
            if (array[i] instanceof Array) {
                result = result.concat(treeToOrder(array[i]));
            } else {
                result.push(matrixOrder[array[i]]);
            }
        }
        return result;
    }

    /**
     * Recursively converts the clustered similarities to a valid newick string
     *
     * @param <Array> array The clustered similarities
     * @param <Number> prevDist The previous distance
     */
    function arrayToNewick(array, prevDist) {
        // default to zero
        if (prevDist === undefined) {
            prevDist = 0;
        }

        var string = "(",
            distance = array[array.length - 1],
            i;

        for (i = 0; i < array.length - 1; i++) {
            if (array[i] instanceof Array) {
                string += arrayToNewick(array[i], distance);
            } else {
                string += generateNewickName(data[matrixOrder[array[i]]]) + ":" + (1 - distance);
            }
            if (i !== array.length - 2) {
                string += ", ";
            }
        }
        string += "):" + (distance - prevDist);
        return string;
    }

    /***************************** Public methods *****************************/

    /**
     * Adds a genome to the matrix object
     *
     * @param <Number> genomeId The id of the genome to add
     */
    that.addGenome = function addGenome(genomeId) {
        var id;
        dirty = true;
        matrixOrder.push(genomeId);
        idsToCalculate.push(genomeId);

        matrixObject[genomeId] = {};
    };

    /**
     * Removes a genome from the matrix object
     *
     * @param <Number> genomeId The id of the genome to remove
     */
    that.removeGenome = function removeGenome(genomeId) {
        var x;

        matrixOrder.splice(matrixOrder.indexOf(genomeId), 1);
        x = idsToCalculate.indexOf(genomeId);
        if (x !== -1) {
            idsToCalculate.splice(x, 1);
        }
        delete matrixObject[genomeId];
        for (x in matrixObject) {
            delete matrixObject[x][genomeId];
        }
    };

    /**
     * Calculates all uncalculated cells in the similarity matrix
     */
    that.calculateSimilarity = function calculateSimilarity() {
        var sendFullMatrix = true,
            dataQueue = {},
            x,
            id,
            peptides,
            id2,
            similarity,
            finalBatch;

        // Be a bit clever with sending data
        if (idsToCalculate.length > 3) {
            sendFullMatrix = false;
        }

        for (x = 0; x < idsToCalculate.length; x++) {
            id = idsToCalculate[x];
            peptides = data[id].peptide_list;

            for (id2 in matrixObject) {
                if (matrixObject[id][id2] === undefined) {
                    if ("" + id === "" + id2) {
                        similarity = {
                            intersection : peptides.length,
                            union        : peptides.length,
                            min          : peptides.length,
                            max          : peptides.length,
                            avg          : peptides.length,
                            simUnion     : 1,
                            simMin       : 1,
                            simMax       : 1,
                            simAvg       : 1,
                            simOchiai    : 1
                        };
                    } else {
                        similarity = genomeSimilarity(peptides, data[id2].peptide_list);
                    }

                    matrixObject[id][id2] = similarity;
                    matrixObject[id2][id] = similarity;
                }
            }

            if (!sendFullMatrix) {
                dataQueue[id] = matrixObject[id];
                finalBatch = (x === idsToCalculate.length - 1);
                if (x % 3 === 2 || finalBatch) {
                    that.sendRows(dataQueue, finalBatch);
                    dataQueue = {};
                }
            }
        }

        if (sendFullMatrix) {
            that.sendMatrix(matrixObject);
        }

        dirty = false;
        idsToCalculate = [];
    };

    /**
     * Sends the full similarity matrix to the client
     *
     * @param <SimObject> m The full similarity matrix to send
     */
    that.sendMatrix = function sendMatrix(m) {
        sendToHost('processSimilarityData', {
            'fullMatrix' : true,
            'data': m,
            'final' : true
        });
    };

    /**
     * Sends a single row of similarities to the client
     *
     * @param <Map> dataQueue The list of id to data mappings
     * @param <Boolean> final The final batch?
     */
    that.sendRows = function sendRows(dataQueue, final) {
        sendToHost('processSimilarityData', {
            'fullMatrix' : false,
            'data' : dataQueue,
            'final' : final
        });
    };

    /**
     * Calculates the order of the clustered matrix
     */
    that.getClusteredOrder = function getClusteredOrder() {
        return treeToOrder(that.calculateTree());
    };

    /**
     * Clusters the genomes based on similarity
     */
    that.clusterMatrix = function clusterMatrix(similarity) {
        if (matrixOrder.length === 0) {
            return;
        }
        matrixOrder.sort();
        var tree = that.calculateTree(similarity);
        sendToHost('processClusteredMatrix', {
            order : treeToOrder(tree),
            newick : arrayToNewick(tree) + ";"
        });
    };

    /**
     * Clusters the matrix and returns a tree of the clustering
     */
    that.calculateTree = function calculateTree(similarity) {
        var sizes,
            i,
            matrixArray,
            result,
            resultOrder,
            first,
            tree,
            next;

        if (dirty) {
            that.calculateSimilarity();
        }

        // Create an array representation of the similarities object
        matrixArray = matrixObjectToArray(similarity);

        sizes = [];
        for (i = 0; i < matrixArray.length; i++) {
            sizes[i] = 1;
        }

        // Cluster the matrix
        result = clusterMatrixRecursively(matrixArray, sizes, {}, []);
        resultOrder = result.order;

        // Start building the tree
        first = resultOrder.splice(-1, 1)[0];
        tree = [first.x, first.y, first.value];
        for (i = resultOrder.length - 1; i >= 0; i--) {
            next = resultOrder[i];
            // Find next.x recursively
            findAndReplace(tree, next.x, next.y, next.value);
        }

        return tree;
    };

    /**
     * Clusters the matrix recursively
     *
     * @param <Array> matrix The array representation of the similarities
     * @param <Array> sizes The size of the clusters corresponding with the rows
     * @param <Map> cluster A mapping of which rows were combined in previous
     *      steps
     * @param <Array> order A list of objects containing the combined rows and
     *      their similarities
     */
    function clusterMatrixRecursively(matrix, sizes, cluster, order) {
        var x = 0,
            y = 0,
            largest = -1,
            i,
            j,
            temp;

        // Are we done?
        if (order.length === matrix.length - 1) {
            return {'order': order, 'cluster': cluster};
        }

        // find highest similarity
        for (i = 0; i < matrix.length; i++) {
            for (j = 0; j < matrix[i].length; j++) {
                if (matrix[i][j] > largest && i !== j) {
                    x = i;
                    y = j;
                    largest = matrix[i][j];
                }
            }
        }

        if (!cluster[x]) {
            cluster[x] = [];
        }
        cluster[x].push(y);

        order.push({'x': x, 'y': y, 'value': largest});

        // Update sim matrix with average values
        for (j = 0; j < matrix.length; j++) {
            if (j !== y && j !== x) {
                temp = (sizes[x] * matrix[x][j] + sizes[y] * matrix[y][j]) / (sizes[x] + sizes[y]);
                matrix[x][j] = temp;
                matrix[j][x] = temp;
            }
        }

        // Set the value of comparison with y to zero
        for (j = 0; j < matrix.length; j++) {
            matrix[y][j] = -1;
            matrix[j][y] = -1;
        }

        sizes[x] = sizes[x] + sizes[y];
        sizes[y] = 0;

        return clusterMatrixRecursively(matrix, sizes, cluster, order);
    }

    return that;
};
matrix = matrixBackend(data);

/**
 * Sends a response type and message to the host
 *
 * @param <String> type The type of the message
 * @param <String> message A string or Object in JSON
 */
function sendToHost(type, message) {
    self.postMessage({'type': type, 'msg': message});
}

/**
 * Requests the sequence id's for a given proteome id. Calls the addData
 * function when done.
 *
 * @param <Number> id The id of the proteome of sequences we want
 * @param <String> name The name of the organism
 */
function loadData(id, name) {
    var requestRank = rank;
    getJSON("/peptidome/sequences/" + id + ".json", function (json_data) {
        addData(id, name, deltaDecodeInPlace(json_data), requestRank);
    });
}

/**
 * Integrates a user-uploaded genome into the visualisation
 *
 * @params <Number> id An id
 * @params <String> name The name of the genome
 * @params <Array> ids A list of internal peptide id's
 */
function loadUserData(id, name, ids) {
    addData(id, name, ids, rank);
}

/**
 * Processes a list of sequence_id's, received from the webserver and adds it
 * to the data array.
 *
 * @param <Number> id The proteome id of the organism
 * @param <String> name The name of the organism
 * @param <Array> set The ordered array of sequence_id, contains no duplicates
 * @param <Number> request_rank The rank of the request. Used to discard old
 *      requests
 */
function addData(id, name, set, request_rank) {
    var core,
        pan,
        unicore,
        temp;

    // Discard old data
    if (request_rank !== rank) return;

    // Store data for later use
    data[id] = {};
    data[id].id = id;
    data[id].name = name;
    data[id].peptide_list = set;
    data[id].peptides = set.length;

    // Calculate pan and core
    core = cores.length === 0 ? set : intersection(cores[cores.length - 1], set);
    pan = pans.length === 0 ? set : union(pans[pans.length - 1], set);
    pans.push(pan);
    cores.push(core);
    if (unicorePresent) {
        unicore = intersection(unicores[unicores.length - 1], set);
        unicores.push(unicore);
    }

    matrix.addGenome(id);

    // Return the results to the host
    temp = {};
    temp.id = id;
    temp.pan = pan.length;
    temp.peptide_list = set;
    temp.name = name;
    temp.core = core.length;
    temp.name = name;
    temp.peptides = set.length;
    if (unicorePresent) {
        temp.unicore = unicore.length;
    }
    sendToHost("processLoadedGenome", {data: temp, rank: request_rank});
}

/**
 * Removes a genome from the data
 *
 * @param <Number> id The id of the genome to remove
 * @param <Array> newOrder The new order of the genomes
 * @param <Number start The id where the change of order starts
 */
function removeData(id, newOrder, start) {
    // Remove stuff
    var l = pans.length;
    delete data[id];
    pans.splice(l - 1, 1);
    cores.splice(l - 1, 1);
    unicores.splice(l - 1, 1);
    unicorePresent = false;
    unicores = [];

    // Recalculate stuff
    recalculatePanCore(newOrder, start, l - 2);
    getUniqueSequences(newOrder, false);
    matrix.removeGenome(id);
}

// Recalculates the pan and core data based on a
// given order, from start till stop
function recalculatePanCore(newOrder, start, stop) {
    var i = 0,
        set,
        temp,
        response = [];
    order = newOrder;
    if (start === 0) {
        unicorePresent = false;
        unicores = [];
        getUniqueSequences(order);
    }
    for (i = start; i <= stop; i++) {
        set = data[order[i]].peptide_list;
        if (i === 0) {
            cores[i] = set;
            pans[i] = set;
        } else {
            cores[i] = intersection(cores[i - 1], set);
            pans[i] = union(pans[i - 1], set);
            if (unicorePresent) {
                unicores[i] = intersection(unicores[i - 1], set);
            }
        }
    }
    for (i = 0; i < order.length; i++) {
        temp = {};
        temp.id = order[i];
        temp.pan = pans[i].length;
        temp.core = cores[i].length;
        temp.peptides = data[order[i]].peptides;
        if (unicorePresent) {
            temp.unicore = unicores[i].length;
        }
        response.push(temp);
    }

    sendToHost("processPancoreData", {data : response, lca : lca, rank : rank});
}

// Sorts the genomes in a given order
function autoSort(type) {
    if (order.length === 0) {
        return;
    }

    var i,
        sortFunction,
        tempPan,
        tempCore,
        optId,
        optVal,
        temp,
        easySort = true,
        clustered = false,
        sortableArray = [],
        tempOrder = [],
        newOrder = [],
        start;
    // Set up sort function based on type
    switch (type) {
        case 'name':
            sortFunction = function (a, b) {
                if (a.name < b.name) {
                    return -1;
                }
                if (b.name < a.name) {
                    return 1;
                }
                return 0;
            };
            break;
        case 'size':
            sortFunction = function (a, b) {
                return b.size - a.size;
            };
            break;
        case 'clustered':
            clustered = true;
            break;
        default:
            easySort = false;
    }
    if (clustered) {
        newOrder = matrix.getClusteredOrder();
    } else {
        // Prepare the array to sort
        for (i in data) {
            sortableArray.push({id : data[i].id, name : data[i].name, size : data[i].peptides});
        }
        // Do the actual sorting
        if (easySort) {
            sortableArray.sort(sortFunction);
        } else {
            tempPan = data[order[0]].peptide_list;
            tempCore = data[order[0]].peptide_list;
            for (i = 0; i < sortableArray.length; i++) {
                if (sortableArray[i].id === order[0]) {
                    tempOrder.push(sortableArray[i]);
                    delete sortableArray[i];
                    break;
                }
            }
            while (tempOrder.length < sortableArray.length) {
                optId = -1;
                optVal = 0;
                for (i = 0; i < sortableArray.length; i++) {
                    if (sortableArray[i] !== undefined) {
                        if (type === "minpan") {
                            temp = union(tempPan, data[sortableArray[i].id].peptide_list);
                            if (optId === -1 || temp.length < optVal) {
                                optId = i;
                                optVal = temp.length;
                            }
                        } else if (type === "maxcore") {
                            temp = intersection(tempCore, data[sortableArray[i].id].peptide_list);
                            if (optId === -1 || temp.length > optVal) {
                                optId = i;
                                optVal = temp.length;
                            }
                        } else if (type === "optimal") {
                            temp = union(tempPan, data[sortableArray[i].id].peptide_list).length - intersection(tempCore, data[sortableArray[i].id].peptide_list).length;
                            if (optId === -1 || temp < optVal) {
                                optId = i;
                                optVal = temp;
                            }
                        }
                    }
                }
                if (type === "minpan") {
                    tempPan = union(tempPan, data[sortableArray[optId].id].peptide_list);
                } else if (type === "maxcore") {
                    tempCore = intersection(tempCore, data[sortableArray[optId].id].peptide_list);
                } else if (type === "optimal") {
                    tempPan = union(tempPan, data[sortableArray[optId].id].peptide_list);
                    tempCore = intersection(tempCore, data[sortableArray[optId].id].peptide_list);
                }
                tempOrder.push(sortableArray[optId]);
                delete sortableArray[optId];
            }
            sortableArray = tempOrder;
        }
        // Prepare to return the result
        for (i = 0; i < sortableArray.length; i++) {
            newOrder.push(sortableArray[i].id);
        }
    }
    start = newOrder[0] === order[0] ? 1 : 0;
    sendToHost('autoSorted', {order: newOrder, start: start, stop: newOrder.length - 1 });
}

// Retrieves the unique sequences
function getUniqueSequences(newOrder, force) {
    force = typeof force !== 'undefined' ? force : true;
    order = newOrder;
    if (order.length > 0) {
        if (force) {
            reallyGetUniqueSequences(order[0]);
        } else {
            getJSONByPost("/peptidome/get_lca/", "ids=" + filterIds(order), function (d) {
                // only fetch sequences when there's a new lca
                if (lca !== d.name) {
                    reallyGetUniqueSequences(order[0]);
                } else {
                    calculateUnicore(unicoreData);
                }
            });
        }
    }
}

// fetch the sequences
function reallyGetUniqueSequences(id) {
    var variables = "ids=" + filterIds(order);
    if (isLocalProteome(id)) {
        variables += "&sequences=[" + deltaEncode(data[id].peptide_list) + "]";
    } else {
        variables += "&proteome_id=" + id;
    }
    getJSONByPost("/peptidome/unique_sequences/", variables, function (d) {
        lca = d[0];
        calculateUnicore(deltaDecodeInPlace(d[1]));
    });
}

// Calculates the unique peptides data
function calculateUnicore(ud) {
    var i;
    unicorePresent = true;
    unicoreData = ud;
    unicores[0] = unicoreData;
    for (i = 1; i < order.length; i++) {
        unicores[i] = intersection(unicores[i - 1], data[order[i]].peptide_list);
    }
    recalculatePanCore(order, 1, -1);
}

// Resets the data vars
function clearAllData() {
    unicorePresent = false;
    data = {};
    unicoreData = [];
    order = [];
    lca = "";
    pans = [];
    cores = [];
    unicores = [];
    rank++;
    matrix = matrixBackend(data);
}

// Sends a list sequences to the client
function getSequences(type, id) {
    var ids,
        ord = getOrderById(id),
        action = "full_sequences";
    switch (type) {
    case 'all':
        ids = data[id].peptide_list;
        break;
    case 'pan':
        ids = pans[ord];
        break;
    case 'core':
        ids = cores[ord];
        break;
    case 'unique':
        ids = unicores[ord];
        break;
    case 'unique_proteins':
        ids = unicores[ord];
        break;
    default:
        error("Unknown type: " + type);
    }
    if (type === "unique_proteins") {
        action = "full_proteins";
    }
    getJSONByPost("/peptidome/" + action + "/", "sequence_ids=[" + deltaEncode(ids) + "]", function (d) {
        sendToHost("processDownloadedSequences", {sequences : d, type : type, id : id});
    });
}

/************ These functions are not accessible from the host ****************/

// Returns the rank of a given proteome id for the current order
function getOrderById(id) {
    var i;
    for (i = 0; i < order.length; i++) {
        if (order[i] == id) {
            return i;
        }
    }
    error("unknown id: " + id);
    return 0;
}

// Provide an error function with the same signature as in the host
function error(err, message) {
    sendToHost("error", {"error" : err, "msg" : message});
}

// Wrapper around xhr json request
function getJSON(url, callback) {
    var req = new XMLHttpRequest();
    req.open('GET', url, true);
    req.onreadystatechange = function () {
        if (req.readyState === 4) {
            if (req.status === 200) {
                var data = JSON.parse(req.responseText);
                callback(data);
            } else {
                error("request error for " + url, "It seems like something went wrong while we loaded the data. Are you still conected to the internet? You might want to reload this page.");
            }
        }
    };
    req.send(null);
}

// Wrapper around xhr json request
function getJSONByPost(url, data, callback) {
    var req = new XMLHttpRequest();
    req.open('POST', url, true);
    req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    req.onreadystatechange = function () {
        if (req.readyState === 4) {
            if (req.status === 200) {
                var data = JSON.parse(req.responseText);
                callback(data);
            } else {
                error("request error for " + url, "It seems like something went wrong while we loaded the data. Are you still conected to the internet? You might want to reload this page.");
            }
        }
    };
    req.send(data);
}

function genomeSimilarity(peptideList1, peptideList2) {
    var intersect = intersectionSize(peptideList1, peptideList2),
        union = peptideList1.length + peptideList2.length - intersect,
        min = Math.min(peptideList1.length, peptideList2.length),
        max = Math.max(peptideList1.length, peptideList2.length),
        avg = (peptideList1.length + peptideList2.length) / 2,
        ochiai = Math.sqrt(peptideList1.length * peptideList2.length);
    return {
        intersection : intersect,
        union        : union,
        min          : min,
        max          : max,
        avg          : avg,
        simUnion     : intersect / union,
        simMin       : intersect / min,
        simMax       : intersect / max,
        simAvg       : intersect / avg,
        simOchiai    : intersect / ochiai
    };
}

/**
 * Removes [,;:] from a string and replaces spaces by underscores. Also adds
 * the proteome id.
 *
 * @param <Genome> genome The genome we want to convert
 */
function generateNewickName(genome) {
    return genome.name.replace(/ /g, "_").replace(/[,;:-]/g, "_") + "-" + genome.id;
}

/**
 * Returns a new array containing only real proteome ids
 *
 * @param <Array> a A list of ids.
 */
function filterIds(a) {
    var r = [],
        i;
    for (i = 0; i < a.length; i++) {
        if (!isLocalProteome(a[i])) {
            r.push(a[i]);
        }
    }
    return r;
}

/**
 * Returns wether the given id comes from a local Proteome
 */
function isLocalProteome(id) {
    return isNaN(+id);
}

// union and intersection for sorted arrays
function unionIntersection(a, b) {
    var intersection = [],
        union = [],
        i = 0,
        j = 0;
        while (i < a.length && j < b.length) {
            if (a[i] < b[j]) {
                union.push(a[i]);
                i++;
            } else if (a[i] > b[j]) {
                union.push(b[j]);
                j++;
            } else {
                union.push(a[i]);
                intersection.push(a[i]);
                i++;
                j++;
            }
        }
        while (i < a.length) {
            union.push(a[i]);
            i++;
        }
        while (j < b.length) {
            union.push(b[j]);
            j++;
        }
        return {
            union : union,
            intersection : intersection
        };
}
function union(a, b) {
    var r = [],
        i = 0,
        j = 0;
    while (i < a.length && j < b.length) {
        if (a[i] < b[j]) {
            r.push(a[i]);
            i++;
        } else if (a[i] > b[j]) {
            r.push(b[j]);
            j++;
        } else {
            r.push(a[i]);
            i++;
            j++;
        }
    }
    while (i < a.length) {
        r.push(a[i]);
        i++;
    }
    while (j < b.length) {
        r.push(b[j]);
        j++;
    }
    return r;
}
function intersection(a, b) {
    var r = [],
        i = 0,
        j = 0;
    while (i < a.length && j < b.length) {
        if (a[i] < b[j]) {
            i++;
        } else if (a[i] > b[j]) {
            j++;
        } else {
            r.push(a[i]);
            i++;
            j++;
        }
    }
    return r;
}
function intersectionSize(a, b) {
    var size = 0,
        i = 0,
        j = 0;
    while (i < a.length && j < b.length) {
        if (a[i] < b[j]) {
            i++;
        } else if (a[i] > b[j]) {
            j++;
        } else {
            size++;
            i++;
            j++;
        }
    }
    return size;
}

/**
 * Delta decodes an array of integers IN PLACE
 *
 * @param <Array> data An array of integers
 */
function deltaDecodeInPlace(data) {
    var old = 0,
        len = data.length,
        i;
    for (i = 0; i < len; i++) {
        old += data[i];
        data[i] = old;
    }
    return data;
}

/**
 * Delta encodes an array of integers
 *
 * @param <Array> data An array of integers
 */
function deltaEncode(data) {
    var prev = 0,
        len = data.length,
        output = new Array(len),
        i;
    for (i = 0; i < len; i++) {
        output[i] = data[i] - prev;
        prev = data[i];
    }
    return output;
}


text:
import unittest

from test_dympy import *

if __name__ == '__main__':
    unittest.main()


text:
void PrettyPrint_NFA(NFA* nfa);

#endif //C_INTERPRETER_PRETTYPRINTER_H


text:
<?xml version='1.0' encoding='UTF-8'?>
<Document>
  <Header>
    <SchemaName>Location</SchemaName>
    <Identifier>location_geonames_2749067</Identifier>
    <DocumentState>public</DocumentState>
    <TimeStamp>1390753463406</TimeStamp>
    <SummaryFields>
      <Title>NL > North Brabant > Oude Maasje</Title>
    </SummaryFields>
  </Header>
  <Body>
    <Location>
      <GeopoliticalHierarchy>NL,North Brabant,Oude Maasje</GeopoliticalHierarchy>
      <LocationName>
        <Appelation>Oude Maasje</Appelation>
        <LocationNameType>canalized stream</LocationNameType>
        <Comments>Oude Maasje</Comments>
      </LocationName>
      <Coordinates>
        <Longitude>5.0122800000000005</Longitude>
        <Latitude>51.71498</Latitude>
      </Coordinates>
      <GeonamesURI>http://www.geonames.org/2749067</GeonamesURI>
      <WikipediaLink/>
      <DbpediaLink/>
    </Location>
  </Body>
</Document>


text:
© <a href="<?php echo $this->config->item('company_url'); ?>"
															   target="_blank"><?php echo $this->config->item('company'); ?> <?php echo date("Y"); ?>
				, Created with GisPortal!


text:
int (^block)(void) = ^ {
	static int test=0;
	return test;
};
// CHECK: @block1_block_invoke_2.test = internal global i32
void (^block1)(void) = ^ {
	static int test = 2;
	return;
};
// CHECK: @block2_block_invoke_3.test = internal global i32
int (^block2)(void) = ^ {
	static int test = 5;
	return test;
};