text:
<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

/**
 * Implements the user model.
 */
class User extends Eloquent implements UserInterface, RemindableInterface {

	use UserTrait, RemindableTrait;

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'mmm_user';

	/**
	 * Tell the ORM to use timestamp fields or not.
	 *
	 * @var boolean
	 */
	public $timestamps = false;

	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
	protected $hidden = array('password', 'remember_token');

	/**
	 * Implementation of the relation to the Comment table.
	 *
	 * @return HasMany
	 */
	public function comments() {
		return $this->hasMany('Comment');
	}

	/**
	 * Returns the last activity of the user from the session.
	 *
	 * @return int Last activity or 0 if no valid session exists.
	 */
	public static function getLastActivityFromSession() {
		$bag = Session::getMetadataBag();
		if ($bag) {
			return $bag->getLastUsed();
		}
		else {
			return 0;
		}
	}

}


text:
package org.apache.ambari.view.hive20.resources.uploads.parsers;

import java.util.HashMap;

public class ParseOptions {
  public static final String OPTIONS_CSV_DELIMITER = "OPTIONS_CSV_DELIMITER";
  public static final String OPTIONS_CSV_QUOTE = "OPTIONS_CSV_QUOTE";
  public static final String OPTIONS_HEADERS = "OPTIONS_HEADERS";
  public static final String OPTIONS_CSV_ESCAPE_CHAR = "OPTIONS_CSV_ESCAPE_CHAR";

  public enum InputFileType {
    CSV,
    JSON,
    XML
  }

  public enum HEADER {
    FIRST_RECORD,
    PROVIDED_BY_USER, // not used right now but can be used when some metadata of file provide this information
    EMBEDDED, // this one is for JSON/ XML and may be other file formats where its embedded with the data
    NONE   // if the file does not contain header information at all
  }
  final public static String OPTIONS_FILE_TYPE = "FILE_TYPE";
  final public static String OPTIONS_HEADER = "HEADER";
  final public static String OPTIONS_NUMBER_OF_PREVIEW_ROWS = "NUMBER_OF_PREVIEW_ROWS";

  private HashMap<String, Object> options = new HashMap<>();

  public void setOption(String key, Object value) {
    this.options.put(key, value);
  }

  public Object getOption(String key) {
    return this.options.get(key);
  }

  @Override
  public String toString() {
    return new StringBuilder("ParseOptions{")
      .append("options=").append(options)
      .append('}').toString();
  }
}

redpajama_set_name: RedPajamaGithub


text:
int dsp_register(int unit, int channel);
int dsp_registerrec(int unit, int channel);
int dsp_unregister(int unit, int channel);
int dsp_unregisterrec(int unit, int channel);


text:
using System;

namespace SharpVk.Interop
{
    /// <summary>
    ///
    /// </summary>
    public unsafe delegate void VkCommandBufferSetDepthBiasDelegate(SharpVk.Interop.CommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor);
}


text:
pub struct AveragedCollection {
    list: Vec<i32>,
    average: f64,
}


text:
layout: post
title: Ruby on Rails
category: rails
tags: rails
---

#### rails yükleme:

        $ sudo gem install rails -v 3.0.5
        $ sudo gem install rails -v 3.0.9

Geçici problemlerden dolayı 3.0.5 daha temiz/hatasız... Bazı paketler 3.0.9 tam
olarak gelmiyor ya da versiyon uyuşmazlıkları var. Bu yüzden 2 versiyonuda kuruyoruz.

#### rails uygulaması oluşturma:

        $ rails new my_app

#### gerekli gem paketlerinin kurulması:

        $ bundle install

#### kurulan gemlerin listesini görmek:

        $ gem list

#### veritabanı yapılandırması "database.yml":

        $ vim config/database.yml

gerekli eklemeler veya düzenelemer yapın örnek "database.yml";

	development:
	  adapter: mysql2
	  encoding: utf8
	  reconnect: false
	  database: ror-app-db
	  pool: 5
	  username: root
	  password:
	  socket: /var/run/mysqld/mysqld.sock

#### veritabanı oluşturma:

        $ rake db:create

#### veritabanına bağlanma:

        $ rails dbconsole

#### veritabanına tablo eklemek için:

        $ rails generate scaffold Post name:string title:string content:text

        invoke  active_record
        create    db/migrate/20110630132903_create_posts.rb
        create    app/models/post.rb
        route   resources :posts
        invoke  scaffold_controller
        create    app/controllers/posts_controller.rb
        invoke    erb
        create      app/views/posts
        create      app/views/posts/index.html.erb
        create      app/views/posts/edit.html.erb
        create      app/views/posts/show.html.erb
        create      app/views/posts/new.html.erb
        create      app/views/posts/_form.html.erb
        invoke  stylesheets
        create    public/stylesheets/scaffold.css

örnek Post » "posts" isminde tablonun

    name: string
    title: string
    content: text

elamanları olacak şekilde tanımlanmıştır. Burada /show, /edit, /new
özelliklerini kullanabilmektedir. Bunlarda kısıtlama olması mümkündür.Bu kontrol
yapısı her şey olabildiğinden **admin** 'e özgü tablo oluşturulmalarında
kullanılabilir.

#### tabloları oluşturmayı tetiklemek için:

        $ rake db:migrate

#### tüm tabloları tek çatı altında toplamak için:

        $ rake db:rollback

#### rails'e merhaba demek için:

        $ rails generate controller home index

        create  app/controllers/home_controller.rb
        route  get "home/index"
        invoke  erb
        create    app/views/home
        create    app/views/home/index.html.erb

#### rails route(yönlendirme) ayarları("get", "post"):

       $ vim config/routes.rb

#### rails denemeleri için web sunucusunu başlatma:

        $ rails server # veya "rails s"

#### rails denemeleri için konsolu panelini başlatma:

        $ rails console # veya "rails c"
#### rails'i sunucuda çalıştırma:

ruby web server olarak [thin](http://code.macournoyer.com/thin/)
kullanılıyor, ve ek olarak nginx ayarları gerekiyor bunun için
şu dökümanı okuyunuz : [nginx, rails ve thin](http://ecylmz.com/107/nginx-rails-ve-thin/)


text:
'use strict';

app.controller('BlocksCtrl', function($scope, $route, dataService, timerService) {
	$scope.blocks = {};
	$scope.selected = [];

	$scope.options = {
		page: 1,
		limit: 15
	}

	$scope.loadBlocks = function () {
		var params = angular.copy($scope.options);
		params.page -= 1;
		var urlParams = $.param(params)
		$scope.promise = dataService.getData("/pool/blocks?"+urlParams, function(data){
			$scope.blocks.global = data;
			updateMaturity();
		});
	};

	var updateMaturity = function () {
		var luck;
		if($scope.poolStats.global !== undefined){
			_.each($scope.blocks.global, function(block, index){
				if($scope.network !== undefined) {
					$scope.blocks.global[index].maturity = $scope.config.maturity_depth - ($scope.network.height - block.height);
				}

				// calculate luck
				luck = block.shares/block.diff*100;
				$scope.blocks.global[index].luck = (luck <= 100) ? (100-luck) : (-luck+100) ;
				$scope.blocks.global[index].icon = (block.valid) ? 'done' : 'clear';
			});
		}
	}

	$scope.$watchGroup(["blocks.global", "poolStats.global"], updateMaturity);

	// Register call with timer
	timerService.register($scope.loadBlocks, $route.current.controller);
	$scope.loadBlocks();

	$scope.$on("$routeChangeStart", function () {
		timerService.remove($route.current.controller);
	});
});


text:
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.office;
import com.wilutions.com.*;

/**
 * MsoBarRow.
 *
 */
@SuppressWarnings("all")
@CoInterface(guid="{00000000-0000-0000-0000-000000000000}")
public class MsoBarRow implements ComEnum {
  static boolean __typelib__loaded = __TypeLib.load();

  // Typed constants
  public final static MsoBarRow msoBarRowFirst = new MsoBarRow(0);
  public final static MsoBarRow msoBarRowLast = new MsoBarRow(-1);

  // Integer constants for bitsets and switch statements
  public final static int _msoBarRowFirst = 0;
  public final static int _msoBarRowLast = -1;

  // Value, readonly field.
  public final int value;

  // Private constructor, use valueOf to create an instance.
  private MsoBarRow(int value) { this.value = value; }

  // Return one of the predefined typed constants for the given value or create a new object.
  public static  MsoBarRow valueOf(int value) {
    switch(value) {
    case 0: return msoBarRowFirst;
    case -1: return msoBarRowLast;
    default: return new MsoBarRow(value);
    }
  }

  public String toString() {
    switch(value) {
    case 0: return "msoBarRowFirst";
    case -1: return "msoBarRowLast";
    default: {
      StringBuilder sbuf = new StringBuilder();
      sbuf.append("[").append(value).append("=");
      if ((value & 0) != 0) sbuf.append("|msoBarRowFirst");
      if ((value & -1) != 0) sbuf.append("|msoBarRowLast");
      return sbuf.toString();
      }
    }
  }
}


text:
title: How to write a SapphireTest

# How to write a SapphireTest

Here is an example of a test which extends [api:SapphireTest] to test the URL generation of the page. It also showcases
how you can load default records into the test database.

**mysite/tests/PageTest.php**

	:::php
	<?php

	class PageTest extends SapphireTest {

		/**
		 * Defines the fixture file to use for this test class
		 *
		 /
		protected static $fixture_file = 'SiteTreeTest.yml';

		/**
		 * Test generation of the URLSegment values.
		 *
		 * Makes sure to:
		 *  - Turn things into lowercase-hyphen-format
		 *  - Generates from Title by default, unless URLSegment is explicitly set
		 *  - Resolves duplicates by appending a number
		 */
		public function testURLGeneration() {
			$expectedURLs = array(
				'home' => 'home',
				'staff' => 'my-staff',
				'about' => 'about-us',
				'staffduplicate' => 'my-staff-2'
			);

			foreach($expectedURLs as $fixture => $urlSegment) {
				$obj = $this->objFromFixture('Page', $fixture);

				$this->assertEquals($urlSegment, $obj->URLSegment);
			}
		}
	}

Firstly we define a static `$fixture_file`, this should point to a file that represents the data we want to test,
represented as a YAML [Fixture](../fixtures). When our test is run, the data from this file will be loaded into a test
database and discarded at the end of the test.

The `fixture_file` property can be path to a file, or an array of strings pointing to many files. The path must be
absolute from your website's root folder.

The second part of our class is the `testURLGeneration` method. This method is our test. When the test is executed,
methods prefixed with the word `test` will be run.

The test database is rebuilt every time one of these methods is run.

Inside our test method is the `objFromFixture` method that will generate an object for us based on data from our fixture
file. To identify to the object, we provide a class name and an identifier. The identifier is specified in the YAML file
but not saved in the database anywhere, `objFromFixture` looks the `[api:DataObject]` up in memory rather than using the
database. This means that you can use it to test the functions responsible for looking up content in the database.

The final part of our test is an assertion command, `assertEquals`. An assertion command allows us to test for something
in our test methods (in this case we are testing if two values are equal). A test method can have more than one
assertion command, and if any one of these assertions fail, so will the test method.

For more information on PHPUnit's assertions see the [PHPUnit manual](http://www.phpunit.de/manual/current/en/api.html#api.assert).

## Related Documentation

* [Unit Testing](../unit_testing)
* [Fixtures](../fixtures)

## API Documentation

* [api:SapphireTest]
* [api:FunctionalTest]


text:
layout: doc
title: Site Data
---

# Site Data

Data relating to the current site.

## Attributes

You can render these values from the page data:

* ```favicon``` (array): Favicon uploaded by the user via the manage section within the Editor. This is an array of data with two parts; ```favicon``` and ```thumbnail```

{% highlight html %}
{% raw %}

{% if site.favicon %}
  <link rel="icon" href="{{ site.favicon['favicon'] }}" type="image/x-icon" />
  <link rel="SHORTCUT ICON" href="{{ site.favicon['thumbnail'] }}?v={{ "now"|date("U") }}" type="image/x-icon" />
{% endif %}

{% endraw %}
{% endhighlight %}

* ```primaryDomain``` (string): Will display the primary domain for this site

{% highlight django %}
{% raw %}

  {{ site.primaryDomain }}

{% endraw %}
{% endhighlight %}

* ```templateData``` (array): Data regarding the template currently being used. This is an array of data that includes keys ```name```, ```pageTypes```, ```assetDomain```, ```templateFolder```

{% highlight django %}
{% raw %}

  {{ site.templateData['name'] }}

{% endraw %}
{% endhighlight %}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Quatro</logradouro><bairro>Grajaú</bairro><cidade>Divinópolis</cidade><uf>MG</uf><cep>35502337</cep></feed>


text:
import { join, sep } from 'path'
import fs from 'mz/fs'

export default async function resolve (id) {
  const paths = getPaths(id)
  for (const p of paths) {
    if (await isFile(p)) {
      return p
    }
  }

  const err = new Error(`Cannot find module ${id}`)
  err.code = 'ENOENT'
  throw err
}

export function resolveFromList (id, files) {
  const paths = getPaths(id)
  const set = new Set(files)
  for (const p of paths) {
    if (set.has(p)) return p
  }
}

function getPaths (id) {
  const i = sep === '/' ? id : id.replace(/\//g, sep)

  if (i.slice(-3) === '.js') return [i]
  if (i[i.length - 1] === sep) return [i + 'index.js']

  return [
    i + '.js',
    join(i, 'index.js')
  ]
}

async function isFile (p) {
  let stat
  try {
    stat = await fs.stat(p)
  } catch (err) {
    if (err.code === 'ENOENT') return false
    throw err
  }
  return stat.isFile() || stat.isFIFO()
}


text:
.foo{}

body,h1,h2,h3,h4,h5,h6,address,blockquote,dd,dl,hr,form,input{margin:0;padding:0;}
body{font-family:arial, verdana, helvetica, sans-serif;font-size:12px;text-align:center;}

.nobr{white-space:nowrap!important;}
.wrap{ white-space:normal!important;}
.a-left{text-align:left!important;}
.a-center{text-align:center!important;}
.a-right{text-align:right!important;}
.title{padding:10px 10px 5px 0;font-weight:700;clear:both;}
/* data table */
.data-table{width:100%;border:1px solid;border-collapse:collapse;border-spacing:0;empty-cells:show;}
.data-table th{font-weight:bold;padding:3px 8px;white-space:nowrap;vertical-align:middle;}
.data-table td{padding:3px 8px;}
.data-table th,.data-table td{border-bottom:1px solid;border-right:1px solid;}
.data-table .odd{}
.data-table .even{background-color: #F4FAFF;}

.cart-total-left{width:100%;text-align:right;vertical-align:middle;height:21px;font-weight:700;color:#353434;}
.cart-total-left-below{width:100%;text-align:right;vertical-align:top;height:30px;}
.cart-total-right{text-align:right;vertical-align:middle;padding-left:5px;}

.order-details-page{margin-bottom:15px;padding:0;}
.order-details-page .page-body{border:1px solid #d7d7d7;padding:10px;}
.order-details-page .order-overview{text-align:left;padding-bottom:10px;}
.order-details-page .order-overview .order-total{}
.order-details-page .order-details-area{text-align:left;margin:10px;padding:10px;border:1px solid #EEE;height:auto;}
.order-details-page .order-details-area table{width:100%;border:0px;border-collapse:collapse;border-spacing:0;}
.order-details-page .order-details-area td{width:50%;vertical-align:top;}
.order-details-page .order-details-area ul{float:left;margin-right:20px;}
.order-details-page .order-details-area li{list-style:none;}
.order-details-page .order-details-area li:first-child{margin-top:0;}
.order-details-page .section{text-align:left;padding:10px;margin-bottom:20px;height:auto;}
.order-details-page .checkout-attributes{text-align:right;vertical-align:middle;padding:10px;height:auto;}
.order-details-page .cart-total-left{color:#000;}
.order-details-page .products td .td-title{display:none;}


text:
% begin text
\banner
\section{Acknowledgements}
The \MH/ system described herein is based on the original Rand \MH/ system.
It has been extensively developed (perhaps too much so) by Marshall Rose and
John Romine at the University of California, Irvine.
Einar Stefferud, Jerry Sweet, and Terry Domae provided numerous suggestions
to improve the UCI version of \MH/.

In particular, the UCI BBoards facility,
which was suggested by Einar Stefferud,
has been in place at the University of California, Irvine
(in one form or another) for the last two and one-half years.
The UCI BBoards facilities runs under both \MMDF/ and {\sf SendMail},
and, in a more restricted form, under stand-alone \MH/.

\section{Disclaimer}
The Regents of the University of California wish to make it known that:
\bigquote
Although each program has been tested by its contributor,
no warranty, express or implied,
is made by the contributor or the University of California,
as to the accuracy and functioning of the program
and related program material,
nor shall the fact of distribution constitute any such warranty,
and no responsibility is assumed by the contributor
or the University of California in connection herewith.
\endbigquote

\section{Scope}
This document explains how to use the UCI BBoards facility to a user familiar
with \MH/ and the \unix/ operating system in general.
A large degree of expertise is not assumed.
This document does not attempt to introduce \MH/ to the novice user
(for that task, consult the \MH/ tutorial known as \cite{MH.TUT}).
Additional information on the programs discussed here
(particularly \pgm{bbc\/}) is to be found in \cite{MH}.

\section{Conventions}
In this document,
certain \TeX -formatting conventions are adhered to:
\smallskip
{\advance\leftskip by\parindent
\item{1.} The names of \unix/ commands, such as \pgm{comp},
are presented in {\it text italics}.
\item{2.} Arguments to programs, such as \arg{msgs},
are presented in {\tt typewriter style} and delimited by single-quotes.
\item{3.} \unix/ pathnames and envariables,
such as \file{/usr/uci/} and \file{\$SIGNATURE},
are presented in {\sl slanted roman}.
\item{4.} Text presenting an example, such as
\example comp\ -editor\ zz\endexample
is presented in {\tt typewriter style}.
\smallskip}

\section{Introduction}
\MH/ is a very powerful message handling system that runs under the \unix/
operating system.
One of the many features which \MH/ offers is an interface to the UCI BBoards
facility.
This facility permits the efficient distribution of interest group messages
on a single host, a group of hosts under a single administration, and the
ARPA Internet community.

Described simply, a interest group is composed of a number of subscribers
with a common interest.
These subscribers post mail to a single address, known as a
{\it distribution} address.
From this distribution address, a copy of the message is sent to each
subscriber.
Each group has a {\it moderator},
which is the person that runs the the group.
This moderator can usually be reached at a special address,
known as a {\it request} address.
Usually, the responsibilities of the moderator are quite simple,
since the mail system handles the distribution to subscribers automatically.
In some cases, the interest group,
instead of being distributed directly to its subscribers,
is put into a {\it digest} format by the moderator and then sent to the
subscribers.
Although this requires more work on the part of the moderator,
such groups tend to be better organized.

Unfortunately, there are a few problems with the scheme outlined above.
First, if two users on the same host subscribe to the same interest group,
two copies of the message get delivered.
This is wasteful of both processor and disk resources.

Second,
some of these groups carry a lot of traffic.
Although subscription to an group does indicate interest on the part of a
subscriber,
it is usually not interesting to get $50$ messages or so delivered to
the user's private maildrop each day,
interspersed with {\it personal} mail,
that is likely to be of a much more important and timely nature.

Third, if a subscriber on the distribution list for a group becomes ``bad''
somehow,
the originator of the message and not the moderator of the group is notified.
It is not uncommon for a large list to have $10$ or so bogus addresses present.
This results in the originator being flooded with ``error messages'' from
mailers across the ARPA Internet stating that a given address on the list was
bad.
Needless to say,
the originator usually could not care less if the bogus addresses got a copy
of the message or not.
The originator is merely interested in posting a message to the group at large.
Furthermore, the moderator of the group does care if there are bogus
addresses on the list,
but ironically does not receive notification.

To solve all of these problems,
the UCI BBoards facility introduces a new entity into the picture:
all interest group mail is handled by a special component of the mail system.
The distribution address maps to a special {\it channel} that performs
several actions.
First, if local delivery is to be performed,
then a copy of the message is placed in a global maildrop for the interest
group with a timestamp and a unique number.
Local users can read messages posted for the interest group by reading the
file.
Second, if further distribution is to take place,
a copy of the message is sent to the distribution address in such a way that
if any of the addresses are bogus,
the failure notice is sent to the maintainer of the group and not the
originator.

This scheme has several advantages:
First, messages delivered to the host are processed and saved once
in a globally accessible area.
The UCI BBoards facility supports software which allows a user to query the
interest group for new messages and to read those messages in the \MH/-style.
Second, once a host subscribes to an interest group,
a user can add or remove him/herself from the list without contacting the
moderator.
Third, a hierarchical distribution scheme can be constructed to further
reduce the amount of message traffic.
Fourth, errors are prevented from propagating.
When an address on the distribution list goes bad,
the request address immediately responsible for the address is notified.
Usually, this is the local PostMaster and not the group moderator.

In addition to solving the problems outlined above,
the UCI BBoards facility supports several other capabilities.
BBoards may be automatically archived in order to conserve disk space and
reduce processing time when reading them.

Special alias files may be generated which allow the \MH/ user to shorten
address type-in.
For example, instead of sending to \eg{SF-Lovers@Rutgers},
a user of \MH/ usually sends to \eg{SF-Lovers} and the \MH/ aliasing
facility automatically makes the appropriate expansion in the headers of the
outgoing message.
Hence, one need only know the name of a interest group and not its address.

Finally, the UCI BBoards facility supports {\it private} interest groups
using the \unix/ group access mechanism.
This allows a group of people on the same or different machines to conduct a
private discussion.

The practical upshot of all this is that the UCI BBoards facility automates
the vast majority of BBoards handling from the point of view of both the
PostMaster and the user.

\section{BBoard Handling}
Usually the term {\it BBoard} is used interchangeably with the terms
{\it discussion group} and {\it interest group}.
This is true of the discussion that follows.

The messages for a BBoard delivered locally are kept in the same format as
a maildrop.%
\nfootnote{Actually,
your site might be running with all BBoards kept on a single host.
\MH/ supports the remote access of BBoards using a modified version of the
ARPA Post Office Protocol (POP).
This has the advantage that it saves a lot of disk space,
and incurs only a modest performance penalty.}
Unlike the user's private maildrop however,
the \pgm{inc} program is not run to incorporate new BBoard messages into
the user's \MH/ \eg{+inbox} folder.
The programs which are used will be discussed momentarily.

Each message in a BBoard maildrop has a unique number and a timestamp.
The number, called the {\it BBoard-ID}, is always ascending.
The BBoard-ID of a message should {\bf NOT} be confused with the message
number of a message, which can change as messages are removed from the BBoard.
The BBoard-ID is a value which is unique for every message delivered locally
to the BBoard.

To read BBoards, the \MH/ user invokes \pgm{bbc}.
The \pgm{bbc} program has several switches to direct it's action.
The \switch{topics} switch to \pgm{bbc} tells the \MH/ user about the
status of a BBoard.
The \switch{check} switch to \pgm{bbc} lets the \MH/ user check on the
activity of a BBoard.
The \switch{read} switch to \pgm{bbc} invokes the \pgm{msh} program on the
BBoard.
\pgm{msh} is a monolithic program which contains most of the functionality of
\MH/ in a single program.
These commands are now discussed in greater detail.

\subsection{BBoard status}
The \switch{topics} option to the \pgm{bbc} program can be used to report
information about a BBoard that does not pertain to the user's reading habits.
If the \MH/ users types \example bbc\ -topics\endexample
then \pgm{bbc} will list the following information for all BBoards received
on the host:
\smallskip
{\advance\leftskip by\parindent
\item{$\bullet$} the official name of the BBoard
\item{$\bullet$} the number of messages delivered to the BBoard
(but not necessarily present)
\item{$\bullet$} the date and time of the last message delivered to the BBoard
\medskip}
\noindent
In addition to \switch{topics},
if the \switch{verbose} option is given to \pgm{bbc},
then more information is listed:
\smallskip
{\advance\leftskip by\parindent
\item{$\bullet$} any aliases the BBoard is known as
\item{$\bullet$} the local leaders of the BBoard
\item{$\bullet$} the file that the BBoard is locally delivered to
\item{$\bullet$} the ``global'' distribution address
\item{$\bullet$} the ``global'' request address
\item{$\bullet$} the host that distributes the BBoard to the local host
\item{$\bullet$} the addresses to which this host distributes
\item{$\bullet$} miscellaneous information (presently only archiving status)
\medskip}
\noindent
Naturally, \pgm{bbc} can be invoked with the \switch{topics} option and one or
more BBoard names listed on its command line.
For example \example bbc\ -topics\ unix-wizards\endexample is completely
acceptable~---~it tells \pgm{bbc} to report the status of the BBoard
\eg{unix-wizards}.

\subsection{BBoard checking}
The \switch{check} option to the \pgm{bbc} program can be used to check for
new BBoard messages in a synchronous fashion
(i.e., when you specifically ask for it).
The \MH/ users types \example bbc\ -check\endexample and \pgm{bbc} consults
the profile entry for \eg{bboards:} in the user's \profile/ file.
For each BBoard listed,
\pgm{bbc} prints one of several messages depending on the status of both the
BBoard and the user's reading habits
(for example, in the case of the mythical BBoard \eg{foo\/}):
\smallskip
{\advance\leftskip by\parindent
\item{1.} \eg{foo -- n items unseen}\hbreak
This message indicates items in the BBoard have not been seen by the user.
When \pgm{bbc} is invoked with the \eg{quiet} switch,
this is the only informative message that \pgm{bbc} will print out.
Users of \MH/ usually put \example bbc\ -check\ -quiet\endexample
in their \file{\$HOME/.login} file.

\item{2.} \eg{foo -- empty}\hbreak
The BBoard is empty.

\item{3.} \eg{foo -- n items (none seen)}\hbreak
The BBoard has $n$ items in it, but the user hasn't seen any.

\item{4.} \eg{foo -- n items (all seen)}\hbreak
The BBoard is non-empty, and the user has seen everything in it.

\item{5.} \eg{foo -- n items seen out of m}\hbreak
The BBoard has at most $m-n$ items that the user has not seen.
\medskip}
\noindent
It is important to note that \pgm{bbc} performs its calculations on
BBoard-ID:s and not the messages actually present in a BBoard.
This means that the numbers given by \pgm{bbc} are maximal end-points.
When \pgm{bbc} says $n$, \pgm{bbc} means ``at most $n$''.

Naturally, \pgm{bbc} can be invoked with the \switch{check} option and one or
more BBoards listed on its command line.
For example \example bbc\ -check\ info-c\ poli-sci\endexample is completely
acceptable~---~it tells \pgm{bbc} to check on the BBoards \eg{info-c} and
\eg{poli-sci} only.

There are two ways to check for new BBoard messages in an asynchronous fashion:
using the \pgm{CShell} variable \file{\$mail} and running the \pgm{useto}
program.

\subsubsection{Asynchronous Checking with the CShell}
The \pgm{CShell} has a variable called \file{\$mail}.
This variable can contain one or more words.
Each word should be a filename where the shell should check for new mail.
The check is performed after a specified time interval has elapsed just
before the shell would prompt the user.

If the first word of \file{\$mail} is a number,
then this number specifies a different checking interval, in seconds,
than the default, which is 10 minutes.

Whenever the time interval elapses and the shell is ready to prompt the user,
the shell looks at the file and decides if new messages have arrived.
If so, it says \example You have new mail.\endexample
if only one file is present in \file{\$mail}.
Otherwise,
if more than one file is present in \file{\$mail},
then the shell says \example New mail in foo.\endexample whenever there is new
mail in the file called \eg{foo}.

To find out what file is associated with a BBoard, say \eg{info-unix},
the \MH/ user types \example bbc\ -topics\ -verbose\ info-unix\endexample
Usually the local file for a BBoard has an extension of \file{.mbox}.

\subsubsection{Asynchronous Checking with Useto}
In contrast to using the \file{\$mail} variable in the \pgm{CShell},
the \MH/ user might employ \pgm{useto} instead.%
\nfootnote{Not all sites have \pgm{useto};
contact the same people who supplied \MH/ to get a copy.}
The \pgm{useto} program is a continuous update display that prints information
on the status line of your terminal.
Needless to say,
your terminal must support a status line in order to run \pgm{useto}.
Not all terminals have this capability,
but for those that do it's usually well worth the effort to run \pgm{useto}.

For example, users of \MH/  could put
\example
    useto\ -bepf\ \'tcp-ip\ sftp\'\ %
	\'\%D\ \%M\ \%d\ \%h:\%m\%z\%b\ \%n.tty\%t:\%l1\'%
\endexample
in their \file{\$HOME/.login} file.
This command line to \pgm{useto} says to inform the user of
\smallskip
{\advance\leftskip by\parindent
\item{$\bullet$} the current date and time
\item{$\bullet$} new mail for the user
\item{$\bullet$} new messages for the BBoards \eg{tcp-ip} and \eg{sftp}
\item{$\bullet$} the name of the host and tty that the user is logged in on
\item{$\bullet$} the 5--minute load average of that host
\smallskip}

The \pgm{useto} program is really quite amusing and useful.%
\nfootnote{To be honest,
the author considers computing environments without \pgm{useto}
to be less than adequate.}

\subsection{BBoard reading}
If \pgm{bbc} is not given either the \switch{check} or \switch{topics} option,
the \pgm{bbc} program reads BBoard messages.
For each BBoard listed in the \MH/ user's profile entry for \eg{bboards:},
\pgm{bbc} checks to see if there is unread mail.
If so, \pgm{bbc} starts \pgm{msh} on the BBoard,
telling \pgm{msh} which messages haven't been seen.%
\nfootnote{If the \switch{verbose} option is given to \pgm{bbc},
then \pgm{bbc} will start \pgm{msh} on the BBoard regardless of whether there
are unseen messages there.}

When \pgm{msh} starts it identifies the BBoard being read and indicates how
many messages are present and how many the user has read.
Usually, in the user's \MH/ profile,
the user has the entry \example msh:\ -scan\endexample
This says that when \pgm{msh} starts,
it should print a {\it scan listing} of the messages which the user
hasn't seen yet.

The \pgm{msh} program now prompts the user for \MH/ commands.
The user may type most of the normal \MH/ command.
The syntax and semantics of the commands typed to \pgm{msh} are identical
to their \MH/ counterparts.
For example, to reply to a message on the BBoard,
the \MH/ user types \eg{repl};
other \MH/ commands likewise may be applied to BBoard messages.
In cases where the nature of \pgm{msh} would be inconsistent
(e.g., specifying a \arg{+folder} with some commands),
\pgm{msh} will duly inform the user.
In addition to supporting most \MH/ commands,
\pgm{msh} also has a \eg{help} command which gives a brief overview.

The only command that behaves entirely differently in \pgm{msh} is the
\eg{mark} command when given no arguments.
The \pgm{msh} program maintains a special sequence, \eg{unseen},
which it uses to keep track of the messages you've seen.
If the \eg{mark} command is given without any arguments,
then \pgm{msh} will interpret it as
\example mark\ -sequence\ unseen\ -delete\ -nozero\ all\endexample
Hence, to discard all of the messages in the current BBoard being read,
the \MH/ user types \eg{mark} which says to remove all messages from sequence
called \eg{unseen}.

To leave \pgm{msh} use the \eg{quit} command.
This tells \pgm{msh} to terminate and \pgm{bbc} to go to the next BBoard.
Instead, if the user types EOT (usually CTRL-D),
then \pgm{bbc} will exit as well,
updating whatever information was appropriate.

\section{Current BBoards}
There are many, many active interest groups.
Consult the BBoard called \eg{list-of-lists} for a comprehensive description.
Here are a few of the more popular:
\smallskip
{\advance\leftskip by\parindent
\item{\tx system}
Important announcements for the local system are posted here.

\item{\tx mh-users}
A discussion group for users of \MH/.

\item{\tx arpanet-bboards}
Redistribution address for all known BBoards on the ARPAnet.

\item{\tx editor-people}
Discussion of topics related to computerized text editing, display editors,
and human factors in man/machine interaction.
The theoretical discussion is catholic,
but practical discussion focuses particularly on \tops20/ and \unix/.

\item{\tx franz-friends}
Discusses the Franz Lisp language.

\item{\tx header-people}
Interest specifically in the format of message headers and related issues
such as inter-network mail formats/standards, etc.

\item{\tx human-nets}
{\sf Human-Nets} has discussed many topics,
all of them related in some way to the theme of a world-wide computer and
telecommunications network usually called WorldNet.
The topics have ranged very widely, from something like tutorials,
to state of the art discussions,
to rampant speculation about technology and its impact.

\item{\tx info-micro}
Information/discussion list on the general interest topic of microcomputers.

\item{\tx info-unix}
{\sf Info-UNIX} is intended for question/answer discussion,
where ``novice'' system administrators can pose questions.

\item{\tx msggroup}
Interest in electronic mail, message formats, message systems, and the
sociological implications of the above.

\item{\tx poli-sci}
A permanent distributed political ``bull'' session.

\item{\tx sf-lovers}
Science Fiction lovers.
{\sf SF-Lovers} has discussed many topics,
all of them related in some way to the theme of science fiction or fantasy.

\item{\tx space}
Discussions (daily digest) on space-related topics.

\item{\tx telecom}
A broad spectrum moderated-digest-format discussion on telecommunictions
technology: the telephone system, modems, and other more technical aspects
of telecommunications systems.

\item{\tx unix-emacs}
Used for new release announcements and general discussions of Gosling's
\EMACS/.

\item{\tx unix-wizards}
Distribution list for people maintaining machines running the \unix/ operating
system.
\medskip}
\noindent
As discussed earlier,
to find out about all of the BBoards that the local host subscribes to,
the \MH/ users types \example bbc\ -topics\endexample

\section{More on BBoards}
Finally, here are a few more operational details:

\subsection{Creating a BBoard}
Contact the PostMaster at your host to have a BBoard created.
Be sure to indicate its status (public or private)
and scope (where distribution should occur).

\subsection{Subscribing to a BBoard}
If your local host already receives an interest group,
then simply add the name of the BBoard to the \eg{bboards:} entry in your
\MH/ profile.
If not, ask the PostMaster to create the BBoard and contact the global
request address for you.

\subsection{BBoard Archives}
BBoard messages are automatically archived on a weekly basis.
Usually, this results in messages older than 12 days being moved to an
{\it archive} area.
To read the archives for a BBoard, the \switch{archive} option is used.
For example, \example bbc\ -archive\ telecom\endexample
tells \pgm{bbc} to invoke \pgm{msh} on the archives for the \eg{telecom}
BBoard.

Note that the archives may not be present for all BBoards on a given host;
also note that the archives may be periodically moved to tape and expunged
from the system.
Contact your local PostMaster for the details.

\subsection{BBoard Addresses}
Each BBoard has associated with it 4 addresses
(for example, in the case of the mythical BBoard \eg{foo\/}):
\smallskip
{\advance\leftskip by\parindent
\item{\tx foo} The global distribution list\hbreak
If you post a message addressed to {\tx foo} then the message is distributed
to everyone who subscribes to \eg{foo}.

\item{\tx dist-foo} The local distribution list\hbreak
If you post a message addressed to {\tx dist-foo} then the message is
distributed to the local BBoard for \eg{foo}
and to any sites which the local system distributes to.

\item{\tx foo-request} The global moderator\hbreak
If you post a message addressed to {\tx foo-request} then the message is
sent to the moderator for the entire interest group called \eg{foo}.

\item{\tx local-foo-request} The local moderator\hbreak
If you post a message addressed to {\tx local-foo-request} then the message is
sent to the person responsible for the BBoard \eg{foo} on the local system.
\medskip}
\noindent
These addresses are defined by the \MH/ alias facility.
Users of the BBoards facility who do not use \MH/ may not be able to make use
of them.

\subsection{Leading a BBoard}
Except for special circumstances, this task is wholly automated.
For more information though,
see the manual entries for \man bbl(1) and \man bbleaders(8).

\section{Extra for Experts}
Some clever \MH/ users might ask why BBoards aren't kept as folders instead
of \pgm{pack}'d files.
This is a good question.
Perhaps some future release of \MH/ and the UCI BBoards facility will treat
BBoards as a variant of read-only folders.

The problem with \pgm{msh}, of course, is that it's a monolithic program,
and although it does support input/output redirection and a few other
primitive shell-like properties, it's still not the \pgm{CShell}.


text:
table.insert(arg, 1, ".")

local love = package.loadlib('/Applications/love.app/Contents/Frameworks/love.framework/Versions/A/love', 'luaopen_love')
package.preload.love = love

-- for k,v in pairs(love()) do
--   print(k,v)
-- end
love()
return require('love.boot')()


text:
[![Build Status](https://travis-ci.org/ChronixDB/chronix.ingester.svg?branch=master)](https://travis-ci.org/ChronixDB/chronix.ingester)

# chronix.ingester

The Chronix Ingester batches up sample data from various sources and
stores it as chunks in Chronix. Currently, only [Prometheus](https://prometheus.io/)
is supported.

## Building

Building requires [Go](https://golang.org/dl/) 1.7 or newer, as well as a
working [`GOPATH` setup](https://golang.org/doc/code.html).

To build the ingester:

```
go build
```

## Running

Example:

```
./chronix.ingester -url=http://my-solr-host:8983/solr/chronix -max-chunk-age=30m
```

To show all flags:

```
./chronix.ingester -h
Usage of chronix.ingester.exe:
  -checkpoint-file string
        The path to the checkpoint file. (default "checkpoint.db")
  -checkpoint-interval duration
        The interval between checkpoints. (default 5m0s)
  -chronix-commit-within duration
        The duration after which updates to Chronix should be committed. (default 5s)
  -create-statistics
        Whether to store some additional statistical data for each data chunk.
  -es.deleteIndexIfExists
        Deletes the index only with es.withIndex=true
  -es.sniffNodes
        Should elastic client sniff for ES nodes (only used with elastic search) (default true)
  -es.withIndex
        Creates an index (only used with elastic search (default true)
  -flush-on-shutdown
        Whether to flush all chunks to Chronix on shutdown, rather than saving them to a checkpoint. A checkpoint will still be written, but will be empty.
  -kind string
        Possible values are: 'solr' or 'elastic' (default "solr")
  -listen-addr string
        The address to listen on. (default ":8080")
  -log.format value
        Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true" (default "logger:stderr")
  -log.level value
        Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] (default "info")
  -max-chunk-age duration
        The maximum age of a chunk before it is closed and persisted. (default 1h0m0s)
  -url string
        The URL of the Chronix endpoint. (default "http://localhost:8983/solr/chronix")

```

## Run in Docker container
A docker image is provided on [Docker Hub](https://hub.docker.com/r/chronix/chronix.ingester/).
The Dockerfile defines the entrypoint to the chronix.ingester binary but no program arguments. You have to
set the commands yourself, e.g.:

`docker run --rm -it chronix/chronix.ingester -url=http://localhost:9200 -kind=elastic -es.deleteIndexIfExists=true`

## Testing

To run tests:

```
go test ./...
```

## Configuring Prometheus

Sending samples to the Chronix ingester from Prometheus requires Prometheus
version 1.2.0 or newer. To configure Prometheus to send samples to the
ingester, add the following stanza to your Prometheus configuration file:

```yml
remote_write:
  url: http://<host>:<port>/ingest
```


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18444
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Toofz.Gmail.Properties {
    using System;

    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Logging {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Logging() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Toofz.Gmail.Properties.Logging", typeof(Logging).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Adding UID {0}.
        /// </summary>
        internal static string AddingUid {
            get {
                return ResourceManager.GetString("AddingUid", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Checking mail.
        /// </summary>
        internal static string CheckingMail {
            get {
                return ResourceManager.GetString("CheckingMail", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Downloading UID {0} from server.
        /// </summary>
        internal static string DownloadingUid {
            get {
                return ResourceManager.GetString("DownloadingUid", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Loaded UID {0} from memory.
        /// </summary>
        internal static string LoadedUid {
            get {
                return ResourceManager.GetString("LoadedUid", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Removing UID {0} from memory.
        /// </summary>
        internal static string RemovingUid {
            get {
                return ResourceManager.GetString("RemovingUid", resourceCulture);
            }
        }
    }
}


text:
#region license
// Copyright (c) 2007-2010 Mauricio Scheffer
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion

using System;
using System.Linq;
using SolrNet.Exceptions;

namespace SolrNet.Impl.QuerySerializers {
    public class AggregateQuerySerializer : ISolrQuerySerializer {
        private readonly ISolrQuerySerializer[] serializers;

        public AggregateQuerySerializer(ISolrQuerySerializer[] serializers) {
            this.serializers = serializers;
        }

        public bool CanHandleType(Type t) {
            return serializers.Any(s => s.CanHandleType(t));
        }

        public string Serialize(object q) {
            if (q == null)
                return string.Empty;
            var t = q.GetType();
            foreach (var s in serializers)
                if (s.CanHandleType(t))
                    return s.Serialize(q);
            throw new SolrNetException(string.Format("Couldn't serialize query '{0}' of type '{1}'", q, t));
        }
    }
}


text:
<?php

/**
 * @file
 * Contains \Drupal\comment\Entity\CommentType.
 */

namespace Drupal\comment\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\comment\CommentTypeInterface;

/**
 * Defines the comment type entity.
 *
 * @ConfigEntityType(
 *   id = "comment_type",
 *   label = @Translation("Comment type"),
 *   handlers = {
 *     "form" = {
 *       "default" = "Drupal\comment\CommentTypeForm",
 *       "add" = "Drupal\comment\CommentTypeForm",
 *       "edit" = "Drupal\comment\CommentTypeForm",
 *       "delete" = "Drupal\comment\Form\CommentTypeDeleteForm"
 *     },
 *     "list_builder" = "Drupal\comment\CommentTypeListBuilder"
 *   },
 *   admin_permission = "administer comment types",
 *   config_prefix = "type",
 *   bundle_of = "comment",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label"
 *   },
 *   links = {
 *     "delete-form" = "/admin/structure/comment/manage/{comment_type}/delete",
 *     "edit-form" = "/admin/structure/comment/manage/{comment_type}",
 *     "add-form" = "/admin/structure/comment/types/add",
 *     "collection" = "/admin/structure/comment/types",
 *   },
 *   config_export = {
 *     "id",
 *     "label",
 *     "target_entity_type_id",
 *     "description",
 *   }
 * )
 */
class CommentType extends ConfigEntityBundleBase implements CommentTypeInterface {

  /**
   * The comment type ID.
   *
   * @var string
   */
  protected $id;

  /**
   * The comment type label.
   *
   * @var string
   */
  protected $label;

  /**
   * The description of the comment type.
   *
   * @var string
   */
  protected $description;

  /**
   * The target entity type.
   *
   * @var string
   */
  protected $target_entity_type_id;

  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    return $this->description;
  }

  /**
   * {@inheritdoc}
   */
  public function setDescription($description) {
    $this->description = $description;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getTargetEntityTypeId() {
    return $this->target_entity_type_id;
  }

}


text:
import { Injectable } from '@angular/core';
import { LanguageService } from '../language.service';

@Injectable()
export class AlertsService {

  private campaignCreatedAlert = '';
  private testEmailSentAlert = '';

  constructor(private lang: LanguageService) {}

  public setCampaignCreatedAlert(): void {
    this.campaignCreatedAlert = this.lang.getWord('CAMPAIGN_CREATED_ALERT');
  }

  public removeCampaignCreatedAlert(): void {
    this.campaignCreatedAlert = '';
  }

  public getCampaignCreatedAlert(): string {
    let temp = this.campaignCreatedAlert;
    this.removeCampaignCreatedAlert();
    return temp;
  }

  public setTestEmailSentAlert(): void {
    this.testEmailSentAlert = this.lang.getWord('TEST_EMAIL_SENT_ALERT');
  }

  public removeTestEmailSentAlert(): void {
    this.testEmailSentAlert = '';
  }

  public getTestEmailSentAlert(): string {
    let temp = this.testEmailSentAlert;
    this.removeTestEmailSentAlert();
    return temp;
  }
}


text:
<!DOCTYPE html>

          <?php
              require('side_menu.html');
          ?>

            Out Patient Record
            Cash Sheet of the Patient

 Home

Dashboard

            <?php if($stock == 0) { ?>

                <button type="button" class="btn btn-danger btn-md " >No Medical Treatment History</button>

            <?php
            }else{?>

                <button type="button" class="btn btn-success btn-md " data-toggle="modal" data-target="#myModal">View Medical Treatment History</button>

                        <button type="button" class="close" data-dismiss="modal">×</button>

Previous Medical Treatment Information

                        <?php
                            $i=0;
                            foreach ($stock as $row) {
                              ?>
                              <form action="<?php echo base_url(); ?>index.php/Add_details/update_history" method="post" name="upload_excel" enctype="multipart/form-data">
                                <a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExampless1<?php echo $i; ?>">Date:<?php echo  date("d-M-Y",strtotime($row['dt']));?>
Referred To:<?php foreach($ref_phc as $each){ ?><?php  if($row['ref']== $each->phc_code){ echo $each->phc_name;} ?>
                                 <?php } ?>
                                  <div class="collapse multi-collapse" id="multiCollapseExampless1<?php echo $i; ?>">

                                              Date
                                              <?php echo  date("d-M-Y",strtotime($row['dt'])); ?>

                                              Patient ID

                                                <input type="hidden" name="pat_id" value="<?php echo $row['pat_id']; ?>">
                                                <?php echo $row['pat_no']; ?>

                                              Patient Name
                                              <?php echo $row['pat_name']; ?>

                                            Treatment Type

<?php echo $row['visit_type']; ?>

                                            Complaints

                                              <textarea class="form-control"  name="compl" rows="3" placeholder="Enter Complaints..." ><?php echo $row['compl']; ?></textarea>

                                            Findings

                                              <textarea class="form-control"  name="find" rows="3" placeholder="Enter Findings..." ><?php echo $row['find']; ?></textarea>

                                            Diagonosis

                                                <textarea class="form-control"  name="diag" rows="3" placeholder="Enter Diagonosis..." ><?php echo $row['diag']; ?></textarea>

                                            Investigation

                                              <textarea class="form-control"  name="invest" rows="3" placeholder="Enter Investigation..." ><?php echo $row['invest']; ?></textarea>

                                            Treatment

                                                <textarea class="form-control"  name="treat" rows="3" placeholder="Enter Treatment..." ><?php echo $row['treat']; ?></textarea>

                                            Referred To

<?php foreach($ref_phc as $each){ ?>
                                                 <?php  if($row['ref']== $each->phc_code){ echo $each->phc_name;} ?>
                                             <?php } ?>

                                            Prescription
<?php echo str_replace(',',',
',$row['drug']); ?>

                                            Update

                                                      <input type="submit" value="Submit" name="submit"  class="btn btn-warning">

                              </form>

                            <?php
                            $i++;
                            }?>

                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

                <?php
                  }
                ?>
                <?php if($stockd == 0) { ?>

                    <button type="button" class="btn btn-danger btn-md " >No Dental Treatment History</button>
                  <?php
                }else{?>

                  <button type="button" class="btn btn-success btn-md " data-toggle="modal" data-target="#myModals">View Dental Treatment History</button>

                        <button type="button" class="close" data-dismiss="modal">×</button>

Previous Dental Treatment Information

                        <?php
                            $i=0;
                            foreach ($stockd as $row) {
                              ?>
                              <form action="<?php echo base_url(); ?>index.php/Add_details/update_history" method="post" name="upload_excel" enctype="multipart/form-data">
                                <a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExampless2<?php echo $i; ?>">Date:<?php echo  date("d-M-Y",strtotime($row['dt']));?>
Referred To:<?php foreach($ref_phc as $each){ ?><?php  if($row['ref']== $each->phc_code){ echo $each->phc_name;} ?>
                                 <?php } ?>
                                  <div class="collapse multi-collapse" id="multiCollapseExampless2<?php echo $i; ?>">

                                              Date
                                              <?php echo  date("d-M-Y",strtotime($row['dt'])); ?>

                                              Patient ID

                                                <input type="hidden" name="pat_id" value="<?php echo $row['pat_id']; ?>">
                                                <?php echo $row['pat_no']; ?>

                                              Patient Name
                                              <?php echo $row['pat_name']; ?>

                                            Treatment Type

<?php echo $row['visit_type']; ?>

                                            Complaints

                                              <textarea class="form-control"  name="compl" rows="3" placeholder="Enter Complaints..." ><?php echo $row['compl']; ?></textarea>

                                            Findings

                                              <textarea class="form-control"  name="find" rows="3" placeholder="Enter Findings..." ><?php echo $row['find']; ?></textarea>

                                            Diagonosis

                                                <textarea class="form-control"  name="diag" rows="3" placeholder="Enter Diagonosis..." ><?php echo $row['diag']; ?></textarea>

                                            Investigation

                                              <textarea class="form-control"  name="invest" rows="3" placeholder="Enter Investigation..." ><?php echo $row['invest']; ?></textarea>

                                            Treatment

                                                <textarea class="form-control"  name="treat" rows="3" placeholder="Enter Treatment..." ><?php echo $row['treat']; ?></textarea>

                                            Referred To

<?php foreach($ref_phc as $each){ ?>
                                                 <?php  if($row['ref']== $each->phc_code){ echo $each->phc_name;} ?>
                                             <?php } ?>

                                            Prescription
<?php echo str_replace(',',',
',$row['drug']); ?>

                                            Update

                                                      <input type="submit" value="Submit" name="submit"  class="btn btn-warning">

                              </form>

                            <?php
                            $i++;
                            }?>

                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

                <?php
                  }
                ?>

                <?php if($stockde == 0) { ?>

                      <button type="button" class="btn btn-danger btn-md " >No Psychiatric Treatment History</button>
                <?php
                  }else{?>

                      <button type="button" class="btn btn-success btn-md " data-toggle="modal" data-target="#myModalss">View Psychiatric Treatment History</button>

                                        <button type="button" class="close" data-dismiss="modal">×</button>

Previous Psychiatric Treatment Information

                                        <?php
                                        $i=0;
                                        foreach ($stockde as $row) {
                                        ?>
                                        <form action="<?php echo base_url(); ?>index.php/Add_details/update_history" method="post" name="upload_excel" enctype="multipart/form-data">
                                          <a class="btn btn-primary" data-toggle="collapse" href="#multiCollapseExampless<?php echo $i; ?>" role="button" aria-expanded="false" aria-controls="multiCollapseExample<?php echo $i; ?>">Date:<?php echo  date("d-M-Y",strtotime($row['dt']));?>
Referred To:<?php foreach($ref_phc as $each){ ?><?php  if($row['ref']== $each->phc_code){ echo $each->phc_name;} ?>
                                           <?php } ?>
                                            <div class="collapse multi-collapse" id="multiCollapseExampless<?php echo $i; ?>">

                                                        Date
                                                        <?php echo  date("d-M-Y",strtotime($row['dt'])); ?>

                                                        Patient ID

                                                          <input type="hidden" name="pat_id" value="<?php echo $row['pat_id']; ?>">
                                                          <?php echo $row['pat_no']; ?>

                                                        Patient Name
                                                        <?php echo $row['pat_name']; ?>

                                                      Treatment Type

<?php echo $row['visit_type']; ?>

                                                      Complaints

                                                        <textarea class="form-control"  name="compl" rows="3" placeholder="Enter Complaints..." ><?php echo $row['compl']; ?></textarea>

                                                      Findings

                                                        <textarea class="form-control"  name="find" rows="3" placeholder="Enter Findings..." ><?php echo $row['find']; ?></textarea>

                                                      Diagonosis

                                                          <textarea class="form-control"  name="diag" rows="3" placeholder="Enter Diagonosis..." ><?php echo $row['diag']; ?></textarea>

                                                      Investigation

                                                        <textarea class="form-control"  name="invest" rows="3" placeholder="Enter Investigation..." ><?php echo $row['invest']; ?></textarea>

                                                      Treatment

                                                          <textarea class="form-control"  name="treat" rows="3" placeholder="Enter Treatment..." ><?php echo $row['treat']; ?></textarea>

                                                      Referred To

<?php foreach($ref_phc as $each){ ?>
                                                           <?php  if($row['ref']== $each->phc_code){ echo $each->phc_name;} ?>
                                                       <?php } ?>

                                                      Prescription
<?php echo str_replace(',',',
',$row['drug']); ?>

                                                      Update

                                                                <input type="submit" value="Submit" name="submit"  class="btn btn-warning">

                                        </form>

                                          <?php

                                          $i++;
                                          }?>

                                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

                                <?php
                                  }
                                ?>

                <?php echo form_open('Outreg/Add_precord');?>

                  <input id="prh" type="text" value="<?php echo $phc_code;?>" name="prh" hidden="">
                    <?php
                      foreach ($pat_name as $row) {
                      ?>

                          Patient ID&nbsp*
                          <input readonly type="text" class="form-control" value="<?php echo $row['pat_no'];?>" name="pat_no" placeholder="Enter Patient's Name" required="">

                          Patient Name&nbsp*
                          <input readonly type="text" class="form-control" value="<?php echo $row['pat_name'];?>" name="pat_name" placeholder="Enter Patient's Name" required="">

                          Patient Age&nbsp*
                          <input type="text" class="form-control" value="<?php echo $row['age'];?>" name="pat_age" placeholder="Enter Patient's Age" required="">

                            Diagonosis
                            <textarea class="form-control"  name="diag" rows="3" placeholder="Enter Diagonosis..." ></textarea>

                            Investigation&nbsp*
                            <textarea class="form-control"  name="invest" rows="3" placeholder="Enter Investigation..." ></textarea>

                            Referred To&nbsp*

                        <select name="ref" class="form-control" required>
                          <option value="">Select PHC</option>
                            <?php foreach($ref_phc as $each){ ?>
                                 <option value="<?php echo $each->phc_code; ?>"><?php echo $each->phc_name; ?></option>
                             <?php } ?>
                        </select>

                            Treatment Type&nbsp*
                            <select name="trt_type" class="form-control" required>
                              <option value="">Treatment Type</option>
                                <option value="Psychiatric Treatment">Psychiatric Treatment</option>
                                <option value="Medical Treatment">Medical Treatment</option>
                                <option value="Dental Treatment">Dental Treatment</option>

                            </select>

                          <input  readonly type="hidden" class="form-control" value="<?php if(strtotime($row['date']) < strtotime(date("Y-m-d")))
                          { echo "0";}else{echo "1";}?>" name="patV_type" placeholder="Enter Patient's Name" required="">

                          Patient's Father Name&nbsp*
                          <input readonly type="text" class="form-control" value="<?php echo $row['pat_father'];?>" name="pat_fn" placeholder="Enter Patient's Name" required="">

                      <?php
                      }

                     ?>

                       PHC Name&nbsp*
                       <select class="form-control" name="phc">
                         <?php foreach($phc as $each){ ?>
                              <option value="<?php echo $each->phc_code; ?>"><?php echo $each->phc_name; ?></option>';
                          <?php } ?>
                       </select>

                       Patient Gender&nbsp*
                       <input readonly type="text" class="form-control" value="<?php if($row['sex']==1){print_r('Male'); }else{ print_r('Female');}  ?>" name="pat_sex" placeholder="Enter Patient's Name" required="">

                        Complaints
                        <textarea class="form-control"  name="compl" rows="3" placeholder="Enter Complaints..." ></textarea>

                        Findings
                        <textarea class="form-control"  name="Findings" rows="3" placeholder="Enter Findings..." ></textarea>

                        Treatment
                        <textarea class="form-control"  name="treat" rows="3" placeholder="Enter Treatment..." ></textarea>

                      <?php if(($row['age'] >= 18)&&($row['sex']==2)){?>

                           ×
                          Note..!&nbsp &nbsp Please confirm whether Patient is Pregnant and provide suitable medicines..

                      <?php }?>
                        Medicine Prescription
                        <input type="radio" id="chkYes" name="nrkp" value="1" class="flat-red" onclick="ShowHideDiv()" required>Yes&nbsp&nbsp&nbsp
                        <input type="radio" id="chkNo" name="nrkp"  value ="0" class="flat-red" onclick="ShowHideDiv()" required>No

                              <button type="button" id="set" class="btn btn-danger btn-lg" data-toggle="modal" data-target="#myModal1">Choose Drugs</button>

                      <input type="submit" id="sub" value="submit" name="submit"  class="btn btn-primary pull-right">

                              <button type="button" class="close" data-dismiss="modal">×</button>

Choose Drugs

                                 Drug Name
                                 Quantity

                                    <input autocomplete="off" type="text" id="id" value="" class="form-control drug_name" name="drug_name[]" placeholder="Enter Drug Name.." >

                                  &nbsp<input type="text" id="di1" name="drug_id[]" hidden="">
                                  &nbsp<input type="text" id="di2"  name="drug_qty[]" hidden="">

                                  <input autocomplete="off"  type="number" min="1" id="id1" class="form-control" name="qunt[]" placeholder="Enter Quantity..." >

                                  <button  class="btn-info btn-sm" type="button"   onclick="add_row();"  id="add">

                                  </button>

                             <button type="button" class="btn btn-default" data-dismiss="modal">Minimize</button>
                              <input type="submit" id="sub" value="submit" name="submit"  class="btn btn-primary pull-right">

            <?php  form_close(); ?>

       <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
       <link rel="stylesheet" href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" />
       <link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.3.1/css/buttons.dataTables.min.css" />


text:
title: "Tiistain tunnille"
tags: ena6 läksyt
---

Tiistain tunnille tulee olla valmiina kirjallinen tiivistelmä. Ne jotka eivät vielä ole hakeneet tiivistelmän konseptia hakekaa ehdottomasti maanantaina!


text:
import { createAction, ActionFunctionAny, Action } from 'redux-actions';
import { call, put, take } from 'redux-saga/effects';
import xFetch from './xFetch';
import { message } from 'antd';
import * as querystring from 'querystring';

interface Redirect {
  componentName: string;
  message?: string;
}

export interface ApiConfig {
  /**
   * path (also use as action name)
   */
  path: string;
  /**
   * http method (default: GET)
   */
  method?: string;
  /**
   * Determine whether show message when request success
   */
  message?: boolean | string;
  /**
   * Determine whether redirect other route when request success
   */
  redirect?: Redirect;
  /**
   * action name
   */
  actionName: string;
  /**
   * Determine whether custom saga.
   */
  customSaga?: boolean;
  /**
   * custom model name
   */
  modelName?: string;
}

export interface ApiActionNames {
  request: string;
  success: string;
  error: string;
}

export interface Api<T> {
  apiActionNames: {[key in keyof T]: ApiActionNames};
  apiActions: {[key in keyof T]: ActionFunctionAny<Action<{}>>};
  sagas: any[];
}

export function initApi<T>(basePath, configs: ApiConfig[], modelName: string): Api<T> {
  let apiActionNames = {} as any;
  let apiActions = {} as any;
  let sagas = [];

  configs.forEach(config => {
    let finalModelName = config.modelName || modelName;
    let truePath = config.actionName;
    let actionNames = makeActionNames(finalModelName, config);
    apiActionNames[truePath] = actionNames;
    apiActions[truePath] = createAction(actionNames.request);
    let request = makeRequest(basePath, config);
    let effect = makeEffect(config, request, actionNames);
    if (config.customSaga) {
      return;
    }
    if (config.message) {
      return sagas.push(showMessage(apiActionNames[truePath], effect, config.message));
    }
    if (config.redirect) {
      return sagas.push(redirect(apiActionNames[truePath], effect, config.redirect));
    }
    sagas.push(simple(apiActionNames[truePath], effect));
  });

  return {
    apiActionNames,
    apiActions,
    sagas,
  };
}

function makeRequest(basePath: string, api: ApiConfig) {
  return async(data) => {
    let opts = {};
    let uri = basePath + api.path;
    let method = 'POST';
    if (api.method) {
      method = api.method;
    }
    let upperCaseMethod = method.toUpperCase();
    if (upperCaseMethod === 'GET') {
      let query = querystring.stringify(data);
      if (query) {
        uri += '?' + query;
      }
      opts = {
        method: 'GET',
      };
    }else {
      opts = {
        method: method,
        body: JSON.stringify(data) || null,
      };
    }
    return await xFetch(uri, opts);
  };
}

function makeActionNames(modelName: string, api: ApiConfig): ApiActionNames {
  const baseActionName = `${modelName}/${api.method}_${api.path}`;
  return {
    request: `${baseActionName}_request`,
    success: `${baseActionName}_success`,
    error: `${baseActionName}_error`,
  };
}

function makeEffect(api: ApiConfig, request: any, actionNames: ApiActionNames) {
  return function*(req) {
    const { except, ...others } = req.payload;
    try {
      const response = yield call(request, others);
      yield put(createAction<any>(actionNames.success)({
        req: req.payload,
        res: response,
      }));
      return response;
    } catch (error) {
      console.error(`request /${api.path} 错误`);
      console.error(`request params`, req.payload);
      console.error(`message`, error);
      if (error.status === -101) {
        yield put(createAction<any>('loginTimeout')({}));
      }
      yield put(createAction<any>(actionNames.error)({
        req: req.payload,
        error: error,
        except: Object.assign({}, except),
      }));
    }
  };
}

function simple(actionNames: ApiActionNames, apiSaga: any) {
  return function* () {
    while (true) {
      const req = yield take(actionNames.request);
      yield call(apiSaga, req);
    }
  };
}

function showMessage(actionNames: ApiActionNames, apiSaga: any, successText: string | boolean) {
  return function* () {
    while (true) {
      const req = yield take(actionNames.request);
      const res = yield call(apiSaga, req);
      if (res) {
        let text = '操作成功';
        if (typeof successText === 'string') {
          text = successText;
        }
        message.success(text);
      }
    }
  };
}

function redirect(actionNames: ApiActionNames, apiSaga: any, redirectObj: Redirect) {
  return function* () {
    while (true) {
      const req = yield take(actionNames.request);
      const res = yield call(apiSaga, req);
      if (res) {
        message.success(redirectObj.message || '操作成功');
        yield put(createAction<any>('sidebar/updatePane')({
          componentName: redirectObj.componentName,
        }));
      }
    }
  };
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
	xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:d="urn:import:org.ovirt.engine.ui.common.widget.dialog"
	xmlns:e="urn:import:org.ovirt.engine.ui.common.widget.editor"
	xmlns:t="urn:import:org.ovirt.engine.ui.common.widget.dialog.tab">
	<ui:with field='resources'
		type='org.ovirt.engine.ui.webadmin.ApplicationResources' />
    <ui:with field='constants' type='org.ovirt.engine.ui.webadmin.ApplicationConstants'/>
	<ui:style
		type="org.ovirt.engine.ui.webadmin.section.main.view.popup.storage.backup.ImportVmPopupView.WidgetStyle">
		@external .gwt-TabLayoutPanel;
		@external .gwt-TabLayoutPanel .gwt-TabLayoutPanelTabs;
			.gwt-TabLayoutPanel .gwt-TabLayoutPanelTabs {
		background: #CCC;
		}
		@external .gwt-TabLayoutPanel .gwt-TabLayoutPanelTab;
		.gwt-TabLayoutPanel .gwt-TabLayoutPanelTab {
			background-image:
			url("images/main_tab_middle.png");
			background-repeat: repeat-x;
		}
		@external .gwt-TabLayoutPanel .gwt-TabLayoutPanelTab-selected;
		.gwt-TabLayoutPanel .gwt-TabLayoutPanelTab-selected {
			background-image: url("images/tab_middle_selected.png");
			background-repeat: repeat-x;
		}
		@external .gwt-TabLayoutPanel .gwt-TabLayoutPanelContent;
		.gwt-TabLayoutPanel .gwt-TabLayoutPanelContent {
			border-width: 0px;
			padding: 0px;
		}

		.splitLayoutPanelStyle {
			border: 1px solid #333;
			padding: 5px;
			margin: 5px;
		}

		.labelStyle {
			color: red;
			vertical-align: bottom;
			height: 45px;
			line-height: 20px;
			margin-left: 5px;
		}

		.checkboxEditor {
			width: 20px;
			padding: 0px;
		}

		.collapseEditor {
			padding: 0px;
 		}

		.imageStyle {
			vertical-align: bottom;
			height: 30px;
			line-height: 25px;
			margin-left: 10px;
		}

		.cellSelectBox {
			width: 100%;
		}

		.destStorageQuotaEditor {
			visibility: hidden;
		}
	</ui:style>
	<d:SimpleDialogPanel height="650px" width="1000px">
		<d:content>
			<g:VerticalPanel>
				<g:HorizontalPanel>
					<g:VerticalPanel>
						<g:HorizontalPanel>
							<g:VerticalPanel>
								<e:ListModelListBoxEditor ui:field="destStorageEditor" />
								<e:ListModelListBoxEditor ui:field="destClusterEditor" />
							</g:VerticalPanel>
							<g:VerticalPanel>
								<e:ListModelListBoxEditor ui:field="destStorageQuotaEditor" addStyleNames="{style.destStorageQuotaEditor}"/>
								<e:ListModelListBoxEditor ui:field="destClusterQuotaEditor" />
							</g:VerticalPanel>
						</g:HorizontalPanel>
						<g:HorizontalPanel>
							<g:Image ui:field="image" resource='{resources.alertImage}'	addStyleNames="{style.imageStyle}" />
							<e:EntityModelCheckBoxEditor ui:field="collapseSnapshotEditor" />
						</g:HorizontalPanel>
					</g:VerticalPanel>
				</g:HorizontalPanel>
				<g:Label ui:field="message" addStyleNames="{style.labelStyle}" />
				<g:SplitLayoutPanel ui:field="splitLayoutPanel"
					height="400px" addStyleNames="{style.splitLayoutPanelStyle}" />
			</g:VerticalPanel>
		</d:content>
	</d:SimpleDialogPanel>
</ui:UiBinder>


text:
;(function()
{
	// CommonJS
	SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);

	function Brush()
	{
		// Copyright 2006 Shin, YoungJin

		var datatypes =	'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
						'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
						'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
						'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
						'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
						'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
						'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
						'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
						'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
						'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
						'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
						'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
						'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
						'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
						'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
						'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
						'char char16_t char32_t bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
						'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
						'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
						'__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
						'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
						'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
						'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
						'va_list wchar_t wctrans_t wctype_t wint_t signed';

		var keywords =	'alignas alignof auto break case catch class const constexpr decltype __finally __exception __try ' +
						'const_cast continue private public protected __declspec ' +
						'default delete deprecated dllexport dllimport do dynamic_cast ' +
						'else enum explicit extern if for friend goto inline ' +
						'mutable naked namespace new noinline noreturn nothrow noexcept nullptr ' +
						'ref register reinterpret_cast return selectany ' +
						'sizeof static static_cast static_assert struct switch template this ' +
						'thread thread_local throw true false try typedef typeid typename union ' +
						'using uuid virtual void volatile whcar_t while';

		var functions =	'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' +
						'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' +
						'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' +
						'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' +
						'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' +
						'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' +
						'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' +
						'fwrite getc getchar gets perror printf putc putchar puts remove ' +
						'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' +
						'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' +
						'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' +
						'mbtowc qsort rand realloc srand strtod strtol strtoul system ' +
						'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' +
						'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' +
						'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' +
						'clock ctime difftime gmtime localtime mktime strftime time';

		this.regexList = [
			{ regex: SyntaxHighlighter.regexLib.singleLineCComments,	css: 'comments' },			// one line comments
			{ regex: SyntaxHighlighter.regexLib.multiLineCComments,		css: 'comments' },			// multiline comments
			{ regex: SyntaxHighlighter.regexLib.doubleQuotedString,		css: 'string' },			// strings
			{ regex: SyntaxHighlighter.regexLib.singleQuotedString,		css: 'string' },			// strings
			{ regex: /^ *#.*/gm,										css: 'preprocessor' },
			{ regex: new RegExp(this.getKeywords(datatypes), 'gm'),		css: 'color1 bold' },
			{ regex: new RegExp(this.getKeywords(functions), 'gm'),		css: 'functions bold' },
			{ regex: new RegExp(this.getKeywords(keywords), 'gm'),		css: 'keyword bold' }
			];
	};

	Brush.prototype	= new SyntaxHighlighter.Highlighter();
	Brush.aliases	= ['cpp', 'cc', 'c++', 'c', 'h', 'hpp', 'h++'];

	SyntaxHighlighter.brushes.Cpp = Brush;

	// CommonJS
	typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
})();


text:
/* ===== ===== =====

Theory of Programming

- N-ary tree of k-way tree data structure
Website - http://theoryofprogramming.com/2018/01/14/n-ary-tree-k-way-tree-data-structure/
Github - https://github.com/VamsiSangam/theoryofprogramming

===== ===== ===== */

import java.util.ArrayList;

public class NaryTreeNode {
    final String LABEL;
    final int N;
    private final ArrayList<NaryTreeNode> children;

    public NaryTreeNode(String LABEL, int n) {
        this.LABEL = LABEL;
        this.N = n;
        children = new ArrayList<>(n);
    }

    private boolean addChild(NaryTreeNode node) {
        if (children.size() < N) {
            return children.add(node);
        }

        return false;
    }

    public boolean addChild(String label) {
        return addChild(new NaryTreeNode(label, N));
    }

    public ArrayList<NaryTreeNode> getChildren() {
        return new ArrayList<>(children);
    }

    public NaryTreeNode getChild(int index) {
        if (index < children.size()) {
            return children.get(index);
        }

        return null;
    }

    public static void print(NaryTreeNode root) {
        printUtil(root, 0);
    }

    private static void printUtil(NaryTreeNode node, int depth) {
        for (int i = 0; i < depth; ++i) {
            System.out.print("   ");
        }

        System.out.println(node.LABEL);

        for (NaryTreeNode child : node.getChildren()) {
            printUtil(child, depth + 1);
        }
    }
}

class TestNaryTree {
    public static void main(String[] args) {
        int n = 3;
        NaryTreeNode root = new NaryTreeNode("Matter", n);

        root.addChild("Pure");
            root.getChild(0).addChild("Elements");
                root.getChild(0).getChild(0).addChild("Metals");
                root.getChild(0).getChild(0).addChild("Metalloids");
                root.getChild(0).getChild(0).addChild("Non-metals");
            root.getChild(0).addChild("Compounds");
                root.getChild(0).getChild(1).addChild("Water");
                root.getChild(0).getChild(1).addChild("Carbon dioxide");
                root.getChild(0).getChild(1).addChild("Salt");
                root.getChild(0).getChild(1).addChild("Camphor");  // won't add
        root.addChild("Mixture");
            root.getChild(1).addChild("Homogeneous");
                root.getChild(1).getChild(0).addChild("Air");
                root.getChild(1).getChild(0).addChild("Vinegar");
            root.getChild(1).addChild("Heterogeneous");
                root.getChild(1).getChild(1).addChild("Colloids");
                root.getChild(1).getChild(1).addChild("Suspensions");

        NaryTreeNode.print(root);
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.automation.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The NodeCountProperties model. */
@Fluent
public final class NodeCountProperties {
    /*
     * Gets the count for the name
     */
    @JsonProperty(value = "count")
    private Integer count;

    /**
     * Get the count property: Gets the count for the name.
     *
     * @return the count value.
     */
    public Integer count() {
        return this.count;
    }

    /**
     * Set the count property: Gets the count for the name.
     *
     * @param count the count value to set.
     * @return the NodeCountProperties object itself.
     */
    public NodeCountProperties withCount(Integer count) {
        this.count = count;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}


text:
Final assignment
================

Start your final assignment by accepting the `GitHub Classroom <https://classroom.github.com/a/CkKpFSpn>`_ for the final work.

Aim of the work
---------------

The final assignment is a project of your own where the aim is to apply the programming techniques and skills that we have learned during the course and do
something useful with them.

You have two options for the final project that you can choose from:

#. AccessViz_ which is a GIS-tool that can visualize and compare travel times by different travel modes in Helsinki Region.
#. Your-own-project_. If you have a tool, problem or analysis of your own in mind, send your idea to us by email or in Slack (before Friday 15.12.2017), and we can discuss and accept your idea if it is suitable for the final project.

Think the final project as a challenge for yourself to show and implement the programming skills that you have learned this far. You have learned a lot already!

What should be returned?
~~~~~~~~~~~~~~~~~~~~~~~~

Write your codes into a single (or multiple) Python file(s) and return the codes to your GitHub repository.
Good documentation of the code will be highly regarded and
will affect positively in the grading of the final work. You can choose yourself what tools / techniques / modules you want to use.

When is the deadline?
~~~~~~~~~~~~~~~~~~~~~

You should **return your final assignment in GitHub by 7.1.2018 at 23:59** at latest. Of course, you can return your work also before the deadline! If you are ready
before the deadline, please send us a note about it (e.g. in Slack), so that we know and can start evaluating your work.

Grading
~~~~~~~

In the evaluation of the final work different functionalities of the code are evaluated individually.
Thus, if you do not get all different parts / functionalities of the tool working that are described below, it is not the *"the end of the world"*.
The main idea in the final project is that you try to use your skills and do GIS analyses in Python **independently**.

**Good documentation of the code and your project is highly appreciated!!!** One more time: Good documentation of the code and your project is highly appreciated!

The grading is based on a typical 0-5 scale.

Best practices
--------------

There are several guidelines how to do programming "in a proper way". These best practices when doing programming are well described in `this article <http://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.1001745>`_
Wilson et al. (2014) that include aspects such as:

 1. *"Write programs for people, not computers."*

 2. *"Let the computer do the work."*

 3. *"Make incremental changes."*

 4. *"Don't repeat yourself (or others)."*

 5. *"Plan for mistakes."*

 6. *"Optimize software only after it works correctly."*

 7. *"Document design and purpose, not mechanics."*

 8. *"Collaborate."*

These kind of guidelines are extremely useful. I recommend that you take at least a short look at the article before starting your final project because it helps you to
finnish your project efficiently and in such a manner that works and makes your life (and others) easier!

For this final project, the most important aspects from the list above are numbers 1-4 and number 7 (although they are all important).
Thus, at least take a look at those aspects from the article before
starting your work.

Documenting your work
~~~~~~~~~~~~~~~~~~~~~

Good documentation is one the most important aspect when doing any programming. It allows us (and also yourself) to understand
what you have done or tried to do with the code. Thus, we cannot emphasize it more to document your codes, and the work in general, properly. Hence, use comments
in the code where you explain the purpose of different parts of the code.

In addition, **describe and explain your work also in general**, so that everyone understands:

 - What your codes should do? (a general description about the aim of the work)

 - How your code / tool(s) should be used?

    - A practical example of how the tool is used should always be included!

    - What function(s) the user can use and how? Describe.

    - What parameters your function(s) have and what are the possible input values for them. Describe.

The general description of your tool / codes / analyses and how they work should be written into the **README.md** -file that is located in the root of the
final assignment GitHub repository.

Commit your work frequently!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the previous exercises that we have done during the course, it has not maybe been that important that you commit (upload) your work frequently to GitHub because the
size and complexity of the codes have been relatively low. However, now
as you are doing a larger programming project, I really recommend that you **commit and upload your changes to GitHub frequently!** Whenever you get some functionality
working in your code, it is a good time to commit your changes. In that way, your work is saved and if something goes wrong and your code does not work anymore as planned,
you can **go back in history** and start from a state that was still working.

Hints
~~~~~

Similarly as before, we gather hints separately to `here <https://automating-gis-processes.github.io/lessons/FA/fa-hints.html>`_. However, because this is the final work, we encourage you to try hard yourself first,
find information from the internet, and ask your friends before asking help from us. However, if there is a common problem or some of the instructions needs more
explanation, we will update those into the hints page.

.. _AccessViz:

AccessViz
---------

What the tool should do?
~~~~~~~~~~~~~~~~~~~~~~~~

**AccessViz** is a set of tools that can be used for managing and helping to analyze
Helsinki Region Travel Time Matrix data (2013 / 2015) that can be downloaded from
`here <http://blogs.helsinki.fi/accessibility/helsinki-region-travel-time-matrix/>`_.
Read also the description of the dataset from the web-pages so that you get familiar with the data.

AccessViz tool package has following main functionalities (i.e. functions) that should work independently:

1. AccessViz finds from the data folder all the matrices that user has specified by assigning a list of integer values that should correspond to YKR-IDs found from the attribute table of a Shapefile called `MetropAccess_YKR_grid.shp <http://www.helsinki.fi/science/accessibility/data/MetropAccess-matka-aikamatriisi/MetropAccess_YKR_grid.zip>`_.
If the ID-number that the user has specified does not exist in the data folders, the tools should warn about this to the user but still continue running.
The tool should also inform the user about the execution process: tell the user what file is currently under process and how many files there are left
(e.g. "Processing file travel_times_to_5797076.txt.. Progress: 3/25").

2. AccessViz can create Shapefiles from the chosen Matrix text tables (e.g. *travel_times_to_5797076.txt*) by joining the Matrix file with
MetropAccess_YKR_grid Shapefile  where ``from_id`` in Matrix file corresponds to ``YKR_ID`` in the Shapefile. The tool saves the result in the output-folder
that user has defined. You should name the files in a way that it is possible to identify the ID from the name (e.g. 5797076).

3. AccessViz can visualize the travel times of selected YKR_IDs based on the travel mode that the user specifies. It can save those maps into a folder that user specifies. The output
maps can be either **static** or **interactive** and user can choose which one with a parameter. You can freely design yourself the style of the map, colors, travel time intervals (classes)
etc. Try to make the map as informative as possible!

4. AccessViz can also compare **travel times** or **travel distances** between two different travel modes (more than two travel modes are not allowed).
Thus IF the user has specified two travel modes (passed in as a list) for the AccessViz, the tool will calculate the time/distance difference of those travel modes
into a new data column that should be created in the Shapefile. The logic of the calculation is following the order of the items passed on the list where first
travel mode is always subtracted by the last one: ``travelmode1 - travelmode2``.
The tool should ensure that distances are not compared to travel times and vice versa. If the user chooses to compare travel modes to each other,
you should add the travel modes to the filename such as ``Accessibility_5797076_pt_vs_car.shp``. If the user has not specified any travel modes,
the tool should only create the Shapefile but not execute any calculations. It should be only possible to compare two travel modes between each other at the time.
Accepted travel modes are the same ones that are found in the actual TravelTimeMatrix file (pt_r_tt, car_t, etc.).
If the user specifies something else, stop the program, and give advice what are the acceptable values.

**Additionally, you should choose and implement one of the following functionalities**:

5. (option 1). Bundled with AccessViz there is also a separate interactive map that shows the YKR grid values in Helsinki region. The purpose of the map is to help
the user to choose the YKR-IDs that s/he is interested to visualize / analyze.

6. (option 2). AccessViz can also visualize the travel mode comparisons that were described in step 4. You can design the style of the map yourself, but try to make it
as informative as possible!

7. (option 3). AccessViz can also visualize shortest path routes (walking, cycling, and/or driving) using OpenStreetMap data from Helsinki Region.
The impedance value for the routes can be distance (as was shown in Lesson 7) or time (optional for the most advanced students).
This functionality can also be a separate program (it is not required to bundle include this with the rest of the AccessViz tool)

.. note::

    **NoData values**

    Notice that there are NoData values present in the data (value -1). In such cases the result cell should always end up having a value -1 when doing travel
    mode comparisons. In the visualizations, the NoData values should be removed before visualizing the map.

.. hint::

    **Modularize your code**

    One of the best practice guidelines is that you should avoid repeating yourself. Thus, we recommend to modularize different tasks in your
    code and use functions as much as possible. Use meaningful parameter and variable names when defining the functions, so that they are intuitive but short.

.. _Your-own-project:

Own project work
----------------

If you have own idea for the final project that you would be willing to do, send us a short description of your idea and
we can have a short meeting where we can chat if your project would fit the requirements for the final project.
You should send us a description of your own idea **before 15th of December** so that we can soon decide if it meets the requirements
of the final project.

Your own final project could be for example:

  - a specific tool that you would like to create for some purpose that you think would be useful

  - a GIS analysis or a set of analyses that you would be interested to conduct and write a short report about them

What is at least required from the final project, is that you have:

 - a working piece of code for your task / problem / analyses that solves it

 - a GOOD documentation explaining how your tool works

 - OR a report about your analyses and what we can learn from them

The documentation of your tool or analysis / report needs to be written in MarkDown into the same repository
where you upload your codes.


text:
longform
========

Basic boilerplate for longform template