text:
var layout, dummy_gadget_block = 50, block_params = {
	max_width : 6,
	max_height : 6
}, MARGINS_RATIO = 0.1, COLS = block_params.max_width;

var onShowAssetLoad;
(function($) {

	var extensions = {

		resize_widget_dimensions : function(options) {
			if (options.widget_margins) {
				this.options.widget_margins = options.widget_margins;
			}

			if (options.widget_base_dimensions) {
				this.options.widget_base_dimensions = options.widget_base_dimensions;
			}

			this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
			this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];

			var serializedGrid = this.serialize();
			this.$widgets.each($.proxy(function(i, widget) {
				var $widget = $(widget);
				var data = serializedGrid[i];
				this.resize_widget($widget, data.sizex, data.sizey);
			}, this));

			this.generate_grid_and_stylesheet();
			this.get_widgets_from_DOM();
			this.set_dom_grid_height();
			return false;
		}
	};
	$.extend($.Gridster, extensions);
})(jQuery);

var newWid = 0;

$(function() {
	var $STORE_MODAL = $('#modal-add-gadget');
	var $LAYOUTS_GRID = $('#layouts_grid');
	var newDimensions = calculateNewDimensions();

	var widgetTemplate = Handlebars.compile($('#widget-template').html());
	var widgetTemplate2 = Handlebars.compile($('#widget-template2').html());
	var widgetTemplateBlank = Handlebars.compile($('#widget-template-blank').html());
	var widgetTemplateBlank2 = Handlebars.compile($('#widget-template-blank2').html());

	drawGrid(newDimensions[0][0]);
	setGridOffsetTop();

	function calculateNewDimensions() {
		var containerWidth = $('#layouts_grid').innerWidth();
		var newMargin = containerWidth * MARGINS_RATIO / (COLS * 2);
		var newSize = containerWidth * (1 - MARGINS_RATIO) / COLS;
		return [[newSize, newSize], [newMargin, newMargin]];
	}

	var timeOut;

	function resize() {
		var newDimensions = calculateNewDimensions();

		//window.setTimeout(function() {
		layout.resize_widget_dimensions({
			widget_base_dimensions : newDimensions[0],
			widget_margins : newDimensions[1]
		});
		//}, 2000);

		drawGrid(newDimensions[0][0]);

		//		refreshAllGadgets();

		clearTimeout(timeOut);
		timeOut = setTimeout(setGridOffsetTop, 500);

	}

	function drawGrid(blockSize) {
		var h = $LAYOUTS_GRID.innerWidth() / blockSize;
		var v = $LAYOUTS_GRID.innerHeight() / blockSize;

		$('#grid-guides').html('');

		for (var i = 0; i < v; i++) {
			for (var j = 0; j < h; j++) {

				var plus = '';
				$('#grid-guides').append(plus);
			}
		}
	}

	//var itemTmp = Handlebars.compile($('#item-template').html());

	$('#dummy-gadget').resizable({
		grid : dummy_gadget_block,
		containment : "#dummy-gadget-container",
		stop : function(event, ui) {
			var h = Math.round($(this).height()) / dummy_gadget_block;
			var w = Math.round($(this).width()) / dummy_gadget_block;
			var display = w + "x" + h;
			$(this).find('#dummy-size').html(display).attr({
				'data-w' : w,
				'data-h' : h
			});
		}
	});
	/*
	 var registerEventsToWidget = function(widget) {
	 var addGadgetBtn = $(widget).find('.btn-add-gadget');
	 addGadgetBtn.live('click', onGadgetSelectButton);
	 };

	 */

	$('.btn-add-gadget').live('click', onGadgetSelectButton);

	var eventRegistered = false;
	// is an event is resisted to show-asset gadget to get the selected gadget.
	function drawGadgets() {

		applyGridster();

		$.get('apis/ues/layout/', {}, function(result) {
			if (result) {

				var userWidgets = result.widgets;
				var defaultWidgets = layout.serialize();

				$.each(userWidgets, function(i, w) {
					//var _widget = {};

					if (w.wid > newWid) {

						newWid = w.wid;
					}

					//find w in defaultWidgets, if found copy attributes to _widget
					//if (isWidgetFound(w, defaultWidgets, _widget)) {
					if (isWidgetFound(w, defaultWidgets)) {

						//if (_widget) {

						//update coords in default grid for _widget

						$('.layout_block[data-wid="' + w.wid + '"]').attr({
							'data-col' : w.x,
							'data-row' : w.y,
							'data-url' : w.url,
                            'data-title' : w.title,
							'data-prefs' : w.prefs
						});

						//}
					} else {
						//add user widget to grid
						var newWidget = widgetTemplateBlank2(w);
						//$('#layouts_grid ul').append(newWidget);

						layout.add_widget(widgetTemplate2({
							wid : w.wid,
							url : w.url,
							prefs : w.prefs
						}), w.width, w.height, w.x, w.y);

					}

				});

				//applyGridster();

				//skip static widgets
				//for(var i=4; i< widgets.length; i++){
				$.each(defaultWidgets, function(i, w) {
					//var _widget = {};
					// skip static widgets
					if (w.y == 1) {
						return true;
					}

					if (w.wid > newWid) {
						newWid = w.wid;
					}

					// remove widgets in default grid but not found in user widgets
					if (!isWidgetFound(w, userWidgets)) {

						var removeWidget = $('.layouts_grid').find('.layout_block[data-wid="' + w.wid + '"]');
						layout.remove_widget($(removeWidget));
					}
				});

				$('#dashboardName').find('span').text(result.title);

			}

			var widgets = $('.layouts_grid').find('.layout_block');

			$.each(widgets, function(i, widget) {
                var $w = $(widget);
                var wid = $w.attr('data-wid');
				if (wid > newWid) {
					newWid = wid;
				}

				var url = $w.attr('data-url');
				var prefs = JSON.parse($w.attr('data-prefs').replace(/'/g, '"'));
				var gadgetArea = $w.find('.add-gadget-item');
				if (url != '') {
                    $w.find('.designer-placeholder').remove();
					insertGadget($w, url, {
						prefs : prefs
					},$w.attr('data-title'));
				}

			});

		}).error(function(error) {
			console.log(error);
		});

		//changeMode('view');

		setGridOffsetTop();

	}

	function applyGridster() {

		var widgetId = 500;
		layout = $('.layouts_grid ul').gridster({
			widget_base_dimensions : newDimensions[0],
			widget_margins : newDimensions[1],

			serialize_params : function($w, wgd) {
				//apparently $('.x').data() is not equals to $($('.x').get(0)).data() . why?
				var gadgetInfo = $($w.get(0)).data('gadgetInfo');
				var wclass = ($(wgd.el[0]).attr('class').indexOf('static') != -1) ? 'static' : '';
				var gadgetId = $w.find(".add-gadget-item > div").attr('id');
				var gadgetRenderInfo = UESContainer.getGadgetInfo(gadgetId);
				var prefs = gadgetRenderInfo && gadgetRenderInfo.opt.prefs || {};
				var currentWidgetId = $(wgd.el[0]).attr('data-wid');
				var url = $(wgd.el[0]).attr('data-url');

				return {
					wid : currentWidgetId || widgetId++,
					x : wgd.col,
					y : wgd.row,
                    title: $w.find('input').val(),
					width : wgd.size_x,
					height : wgd.size_y,
					prefs : JSON.stringify(prefs).replace(/"/g, "'"),
					wclass : wclass,
					url : gadgetInfo && gadgetInfo.attributes.overview_url || url
				};

			},
			//min_rows : block_params.max_height,
			max_cols : 6,
			max_size_x : 6
		}).data('gridster');
	}

	function isWidgetFound(w, defaultWidgets) {
		var _widget = {};
		$.each(defaultWidgets, function(i, _w) {
			if (_w.wid == w.wid) {
				//_widget = {};
				_widget.x = _w.x;
				_widget.y = _w.y;
				return false;
			}
		});

		if ( typeof _widget.x != 'undefined' || typeof _widget.y != 'undefined') {
			return true;
		}

		return false;

	}

	// check if default grid widget and user saved widget
	// have same positions. No change made if both are same
	function isWidgetMatch(w1, w2) {

		var match = ((w1.x == w2.x) && (w1.y == w2.y));

		return match;
	}

	//
	var lastClickedGadgetButton = null;
	var gadgetRendered;

	function onGadgetSelectButton() {
		lastClickedGadgetButton = $(this);
		gadgetRendered = false;

		$STORE_MODAL.modal('show');
	}

	var id = 1;

	function insertGadget(parentEl, url, pref,title) {
		id++;
		var gadgetDiv = parentEl.find('.add-gadget-item');
		var idStr = 'gadgetArea-d' + id;
		gadgetDiv.html('
');
		UESContainer.renderGadget(idStr, url, pref || {}, function(gadgetInfo) {
            var visibleTitle = title || gadgetInfo.meta.modulePrefs.title;
            parentEl.find('h3').text(visibleTitle);
            parentEl.find('input').val(visibleTitle);
		});
	}

	function refreshAllGadgets() {
		var iframes = $('iframe').not('#__gadget_gadget-content-g1');
		$.each(iframes, function(i, w) {
			//			refreshGadget(w);
		});
	}

	function refreshGadget(iframe) {
		console.log(">>>Gadget refreshed");
		var parentLi = $(iframe).closest('li');

		$(iframe).ready(function() {

			$(iframe).height(parentLi.height() - 90);
		});

		if ( typeof $(iframe).get(0) != 'undefined') {
			$(iframe).get(0).contentDocument.location.reload(true);
		}
	}

	function getLayoutFormat(layoutType) {
		var layoutFormat;
		switch (layoutType) {
			case 'rows':
				layoutFormat = [{
					"x" : 1,
					"y" : 2,
					"width" : 6,
					"height" : 2
				}, {
					"x" : 1,
					"y" : 4,
					"width" : 6,
					"height" : 2
				}, {
					"x" : 1,
					"y" : 6,
					"width" : 6,
					"height" : 2
				}];
				break;
			case 'columns':
				layoutFormat = [{
					"x" : 1,
					"y" : 2,
					"width" : 2,
					"height" : 6
				}, {
					"x" : 3,
					"y" : 2,
					"width" : 2,
					"height" : 6
				}, {
					"x" : 5,
					"y" : 2,
					"width" : 2,
					"height" : 6
				}];
				break;
			default:
			case 'grid':

				layoutFormat = [{
					"x" : 1,
					"y" : 2,
					"width" : 2,
					"height" : 2
				}, {
					"x" : 3,
					"y" : 2,
					"width" : 2,
					"height" : 2
				}, {
					"x" : 5,
					"y" : 2,
					"width" : 2,
					"height" : 2
				}, {
					"x" : 1,
					"y" : 4,
					"width" : 2,
					"height" : 2
				}, {
					"x" : 3,
					"y" : 4,
					"width" : 2,
					"height" : 2
				}, {
					"x" : 5,
					"y" : 4,
					"width" : 2,
					"height" : 2
				}];
				break;
		}
		return layoutFormat;
	}

	drawGadgets();
	changeMode('view');

	$(window).bind('resize', resize);
	//$(window).bind('load', checkMode);
	/*
	 $("#btnSetLayout").click(function() {

	 $('#modal-gadget-size').modal('show');

	 });
	 */
	/*
	 var itemTmp = '
 \

 \
	  \

 \

 \

 \

';
	 */
	$('#btn-add-dummy-gadget').click(function(e) {
		e.preventDefault();
		var $dummy = $('#dummy-size');
		var w = Number($dummy.attr('data-w'));
		var h = Number($dummy.attr('data-h'));
		var widget = layout.add_widget(widgetTemplate(), w, h, 1, 2);
		$('.dropdown.open .dropdown-toggle').dropdown('toggle');
		//registerEventsToWidget(widget);
	});

	$("#btn-exit-editor").click(function() {
		$('.sub-navbar-designer').slideUp("fast", function() {
			changeMode('view');

		});
	});

	$("#btn-exit-view").click(function() {
		$('.sub-navbar-designer-view').slideUp("fast", function() {
			changeMode('design');

		});
	});

	$('.close-widget').live('click', function(e) {
		e.preventDefault();
		var widget = $(this).closest('.gs_w');
		layout.remove_widget($(widget));
		$(widget).remove();
		$('.gs_w').show();
	});

	function changeMode(mode) {
		if (mode == 'view') {
			var title = $('#inp-designer-title').val();
			$('#dashboardName').find('span').text(title);
			$('#dashboardName').fadeIn();
			$('.sub-navbar-designer-view').fadeIn();
			layout.disable();
			$('#grid-guides').fadeOut("slow");
			$('.close-widget').hide();
			$('.show-widget-pref').hide();
			$('.layout_block .btn-add-gadget').hide();
			$('.layout_block').addClass('layout_block_view');
			$('.gadget-controls li:last-child').remove();

            $('.grid_header > input').each(function(){
                var $this = $(this);
                $this.parent().append('
'+$this.val()+'
');
                $this.remove();
            });
		} else if (mode == 'design') {
			var title = $('#dashboardName').find('span').text();
			$('#inp-designer-title').val(title);
			$('#dashboardName').hide();
			$('.sub-navbar-designer').fadeIn();
			layout.enable();
			$('#grid-guides').fadeIn("slow");
			$('.close-widget').show();
			$('.show-widget-pref').each(function(){
                var $this = $(this);
                if($this.parents('.grid_header').siblings('.designer-placeholder').length == 0){
                    $this.show();
                }
            });
            $('h3').each(function(){
                var $this = $(this);
                if($this.parents('.grid_header').siblings('.designer-placeholder').length == 0){
                    $this.parent().append('<input class="gadget-title-txt" value="' + $this.text() + '">');
                    $this.remove();
                }
            });
			$('.layout_block .btn-add-gadget').show();
			$('.layout_block').removeClass('layout_block_view');
			$('.gadget-controls').append('

');
		}
	}

	function checkMode() {
		/*
		 if (window.location.hash) {
		 var hash = window.location.hash.substr(1);
		 changeMode(hash);
		 }
		 */
		var mode = $('#inp-view-mode').val();
		changeMode(mode);
	}

	// Hides the 3 static gridster widgets placed at the top.
	// placing static widgets was a fix for gridster responsive bug
	// https://github.com/ducksboard/gridster.js/pull/77
	function setGridOffsetTop() {
		var sizey = parseInt($('.static').height());

		$('.layouts_grid').animate({
			'margin-top' : "-" + (sizey - 80) + "px"
		});

	}

	var formArrayToPref = function(a) {
		var o = {};
		$.each(a, function() {
			if (o[this.name] !== undefined) {
				if (!o[this.name].push) {
					o[this.name] = [o[this.name]];
				}
				o[this.name].push(this.value || '');
			} else {
				o[this.name] = this.value || '';
			}
		});
		return o;
	};

	$('.show-widget-pref').live('click', function(e) {
		e.preventDefault();
		var $this = $(this);
		var widget = $this.closest('.gs_w');
		var id = widget.find(".add-gadget-item > div").attr('id');
		var info = UESContainer.getGadgetInfo(id);
		if (info) {
			var prefCont = widget.find('.gadget-pref-cont');

			var hidePref = function() {
				prefCont.empty();
				prefCont.hide();
				widget.find('.grid_header_controls').removeClass('grid_header_controls-show');
				$this.attr('data-collapse', true);
			};

			var savePref = function(e) {

				e.preventDefault();
				var newPref = formArrayToPref(prefCont.find('form').serializeArray());
				UESContainer.redrawGadget(id, {
					prefs : newPref
				});
				hidePref();

			};

			if ($this.attr('data-collapse') == 'false') {
				hidePref();
				return;
			}

			var prefInfo = info.meta.userPrefs;
			var currentPref = info.opt.prefs || {};
			var html = '<form>';

			for (prefName in prefInfo) {
				var pref = prefInfo[prefName];
				var prefId = 'gadget-pref-' + id + '-' + prefName;
				html += '' + pref.displayName + '';
				html += '<input name="' + prefName + '" type="text" id="' + prefId + '" value="' + (currentPref[prefName] || pref.defaultValue ) + '">';
			}
			html += '
<button class="btn btn-cancel-pref">Cancel</button>';
			html += '<button class="btn btn-primary btn-save-pref">Save</button>';
			html += '</form>';
			prefCont.html(html);
			prefCont.find('.btn-cancel-pref').on('click', function(e) {
				e.preventDefault();
				hidePref();
			});
			prefCont.find('.btn-save-pref').on('click', savePref);
			prefCont.show();
			widget.find('.grid_header_controls').addClass('grid_header_controls-show');
			$this.attr('data-collapse', false);
		}
	});

	$('.expand-widget').live('click', function(e) {
		e.preventDefault();
		var widget = $(this).closest('.gs_w');
		widget.addClass('maximized-view');
		var widgetEl = widget.get(0);
		$('.gs_w').each(function(i, el) {
			if (el != widgetEl) {
				$(el).hide();
			}
		});
		UESContainer.maximizeGadget(widget.find(".add-gadget-item > div").attr('id'));
	});

	$('.shrink-widget').live('click', function(e) {
		e.preventDefault();
		var widget = $(this).closest('.gs_w');
		widget.removeClass('maximized-view');
		$('.gs_w').show();
		UESContainer.restoreGadget(widget.find(".add-gadget-item > div").attr('id'));
	});

	$('#btn-save').click(function(e) {
		e.preventDefault();

		var icon = $(this).find('i');
		icon.removeClass().addClass('icon-spinner icon-spin');

		var dashboard = $('#inp-dashboard').val();
		var title = $('#inp-designer-title').val();
		//var widgets = JSON.stringify(layout.serialize());
		var widgets = layout.serialize();
		widgets.splice(0, 4);

		var _layout = {
			title : title,
			widgets : widgets
		};

		$.post('apis/ues/layout/' + dashboard, {
			layout : JSON.stringify(_layout)
		}, function(result) {
			if (result) {
				setTimeout(function() {
					icon.removeClass().addClass('icon-save');
				}, 3000);
			}
		}).error(function(error) {
			console.log(error);
		});

	});

	onShowAssetLoad = function() {
		var cWindow = $('#modal-add-gadget').find('iframe').get(0).contentWindow;
		if (cWindow.addListener) {
			cWindow.addListener(function(gadgetInfo) {
				var gadgetLi = lastClickedGadgetButton.parents('li');

				gadgetLi.data('gadgetInfo', gadgetInfo);
                var h3 = gadgetLi.find('h3');
                if(h3){
                    h3.parent().append('<input class="gadget-title-txt">');
                    h3.remove()
                }
				insertGadget(gadgetLi, gadgetInfo.attributes.overview_url);
				var placeholder = lastClickedGadgetButton.siblings('.designer-placeholder');
				lastClickedGadgetButton.remove();
				placeholder.remove();
				gadgetLi.find('.show-widget-pref').show();
				$STORE_MODAL.modal('hide');
			});
		}
	};

});


text:
#ifndef __TIMER_QUEUE_H__
#define __TIMER_QUEUE_H__

#ifndef NS_NO_GLOBALS
#include "inet/routing/extras/dymo/dymoum/defs_dymo.h"
#include "inet/routing/extras/dymo/dymoum/dlist.h"

#ifndef _WIN32
#include <sys/time.h>
#endif

namespace inet {

namespace inetmanet {

typedef void (NS_CLASS*timeout_func_t) (void *);

#if defined(OMNETPP) && defined(TIMERMAPLIST)

struct timer
{
    int     used;
    struct timeval  timeout;
    timeout_func_t  handler;
    void        *data;
};

#else

struct timer
{
    dlist_head_t    list_head;
    int     used;
    struct timeval  timeout;
    timeout_func_t  handler;
    void        *data;
};

#endif

NS_STATIC NS_INLINE long timeval_diff(struct timeval *t1, struct timeval *t2)
{
    long long res;

    // Sanity check
    if (t1 && t2)
    {
        res = t1->tv_sec;
        res = ((res - t2->tv_sec) * 1000000 + t1->tv_usec - t2->tv_usec) / 1000;
        return (long) res;
    }
    return -1;
}

} // namespace inetmanet

} // namespace inet

#endif  /* NS_NO_GLOBALS */

#ifndef NS_NO_DECLARATIONS
/* This should be called for every newly allocated timer */
int timer_init(struct timer *t, timeout_func_t f, void *data);

/* Check whether a timer is queued or not */
int timer_is_queued(struct timer *t);

/* Add a new timer timer to the queue (lower to higher timeout order) */
int timer_add(struct timer *t);

/* Remove a timer from the queue */
int timer_remove(struct timer *t);

/* Set the timer to timeout msec miliseconds in the future. The timer is not
   enqueued (you must call timer_add() if you need it) */
int timer_set_timeout(struct timer *t, long msec);

/* Execute all expired timers and remove them from the queue */
void timer_timeout(struct timeval *now);

/* This function must be called by the main loop. It calls timer_timeout()
   and returns the remaining time until the next scheduled timeout in the
   queue */
struct timeval *timer_age_queue();

#endif  /* NS_NO_DECLARATIONS */

#endif  /* __TIMER_QUEUE_H__ */

redpajama_set_name: RedPajamaGithub


text:
/**
 * @license Highcharts JS v8.1.0 (2020-05-05)
 * @module highcharts/modules/variwide
 * @requires highcharts
 *
 * Highcharts variwide module
 *
 * (c) 2010-2019 Torstein Honsi
 *
 * License: www.highcharts.com/license
 */
'use strict';
import '../../modules/variwide.src.js';


text:
/**
 *
 */
package com.trendrr.strest.server.v2.models;

import com.trendrr.oss.DynMap;

/**
 * @author Dustin Norlander
 * @created Apr 26, 2012
 *
 */
public interface StrestResponse extends StrestPacketBase {

	public void setStatus(int code, String message);
	public int getStatusCode();
	public String getStatusMessage();
	public void setTxnStatus(StrestHeader.TxnStatus status);
	public StrestHeader.TxnStatus getTxnStatus();
	/**
	 * used for caching..
	 * @return
	 */
	public byte[] getContentBytes();
}


text:
use crate::posts::Post;
use serde_derive::{Deserialize, Serialize};
use std::error::Error;
use std::path::{Path, PathBuf};

static MANIFEST_FILE: &str = "blog.yml";
static POSTS_EXT: &str = "md";

#[derive(Deserialize)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub(crate) struct Manifest {
    /// Title to display in the "top row".
    pub(crate) title: String,

    /// Title to use in the html header.
    pub(crate) index_title: String,

    /// twitter handle
    pub(crate) twitter: String,

    /// Description for metadata
    pub(crate) description: String,

    /// Who maintains this blog? Appears in the rss feed.
    pub(crate) maintained_by: String,

    /// Raw html describing the blog to insert into the index page.
    pub(crate) index_html: String,

    /// If true, posts require a `team` in their metadata.
    pub(crate) requires_team: bool,

    /// What text to use when linking to this blog in the "see also"
    /// section from other blogs.
    pub(crate) link_text: String,
}

#[derive(Serialize)]
pub(crate) struct Blog {
    title: String,
    index_title: String,
    link_text: String,
    description: String,
    maintained_by: String,
    index_html: String,
    twitter: String,
    #[serde(serialize_with = "add_postfix_slash")]
    prefix: PathBuf,
    posts: Vec<Post>,
}

impl Blog {
    fn load(prefix: PathBuf, dir: &Path) -> Result<Self, Box<dyn Error>> {
        let manifest_content = std::fs::read_to_string(dir.join(MANIFEST_FILE))?;
        let manifest: Manifest = serde_yaml::from_str(&manifest_content)?;

        let mut posts = Vec::new();
        for entry in std::fs::read_dir(dir)? {
            let path = entry?.path();
            let ext = path.extension().and_then(|e| e.to_str());
            if path.metadata()?.file_type().is_file() && ext == Some(POSTS_EXT) {
                posts.push(Post::open(&path, &manifest)?);
            }
        }

        posts.sort_by_key(|post| {
            format!(
                "{}-{:02}-{:02}-{}",
                post.year, post.month, post.day, post.title
            )
        });
        posts.reverse();

        // Decide which posts should show the year in the index.
        posts[0].show_year = true;
        for i in 1..posts.len() {
            posts[i].show_year = posts[i - 1].year != posts[i].year;
        }

        // Make the updated time is unique, by incrementing seconds for duplicates
        let mut last_matching_updated = 0;
        for i in 1..posts.len() {
            if posts[i].updated == posts[last_matching_updated].updated {
                posts[i].set_updated((i - last_matching_updated) as u32);
            } else {
                last_matching_updated = i;
            }
        }

        Ok(Blog {
            title: manifest.title,
            twitter: manifest.twitter,
            index_title: manifest.index_title,
            description: manifest.description,
            maintained_by: manifest.maintained_by,
            index_html: manifest.index_html,
            link_text: manifest.link_text,
            prefix,
            posts,
        })
    }

    pub(crate) fn title(&self) -> &str {
        &self.title
    }

    pub(crate) fn link_text(&self) -> &str {
        &self.link_text
    }

    pub(crate) fn index_title(&self) -> &str {
        &self.index_title
    }

    pub(crate) fn prefix(&self) -> &Path {
        &self.prefix
    }

    pub(crate) fn posts(&self) -> &[Post] {
        &self.posts
    }
}

/// Recursively load blogs in a directory. A blog is a directory with a `blog.yml`
/// file inside it.
pub(crate) fn load(base: &Path) -> Result<Vec<Blog>, Box<dyn Error>> {
    let mut blogs = Vec::new();
    load_recursive(base, base, &mut blogs)?;
    Ok(blogs)
}

fn load_recursive(
    base: &Path,
    current: &Path,
    blogs: &mut Vec<Blog>,
) -> Result<(), Box<dyn Error>> {
    for entry in std::fs::read_dir(current)? {
        let path = entry?.path();
        let file_type = path.metadata()?.file_type();

        if file_type.is_dir() {
            load_recursive(base, &path, blogs)?;
        } else if file_type.is_file() {
            let file_name = path.file_name().and_then(|n| n.to_str());
            if let (Some(file_name), Some(parent)) = (file_name, path.parent()) {
                if file_name == MANIFEST_FILE {
                    let prefix = parent
                        .strip_prefix(base)
                        .map(|p| p.to_path_buf())
                        .unwrap_or_else(|_| PathBuf::new());
                    blogs.push(Blog::load(prefix, parent)?);
                }
            }
        }
    }
    Ok(())
}

fn add_postfix_slash<S>(path: &PathBuf, serializer: S) -> Result<S::Ok, S::Error>
where
    S: serde::Serializer,
{
    let mut str_repr = path.to_string_lossy().to_string();
    if !str_repr.is_empty() {
        str_repr.push('/');
    }
    serializer.serialize_str(&str_repr)
}


text:
package com.xxmassdeveloper.mpchartexample.realm;

import android.os.Bundle;
import android.view.WindowManager;

import com.github.mikephil.charting.animation.Easing;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.AxisBase;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.realm.implementation.RealmBarDataSet;
import com.github.mikephil.charting.data.realm.implementation.RealmLineDataSet;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.xxmassdeveloper.mpchartexample.R;

import java.util.ArrayList;

import io.realm.RealmResults;

/**
 * Created by Philipp Jahoda on 18/12/15.
 */
public class RealmWikiExample extends RealmBaseActivity {

    private LineChart lineChart;
    private BarChart barChart;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_realm_wiki);

        lineChart = (LineChart) findViewById(R.id.lineChart);
        barChart = (BarChart) findViewById(R.id.barChart);
        setup(lineChart);
        setup(barChart);

        lineChart.setExtraBottomOffset(5f);
        barChart.setExtraBottomOffset(5f);

        lineChart.getAxisLeft().setDrawGridLines(false);
        lineChart.getXAxis().setDrawGridLines(false);
        lineChart.getXAxis().setLabelCount(5);
        lineChart.getXAxis().setGranularity(1f);
        barChart.getAxisLeft().setDrawGridLines(false);
        barChart.getXAxis().setDrawGridLines(false);
        barChart.getXAxis().setLabelCount(5);
        barChart.getXAxis().setGranularity(1f);
    }

    @Override
    protected void onResume() {
        super.onResume(); // setup realm

        mRealm.beginTransaction();

        // write some demo-data into the realm.io database
        Score score1 = new Score(100f, 0f, "Peter");
        mRealm.copyToRealm(score1);
        Score score2 = new Score(110f, 1f, "Lisa");
        mRealm.copyToRealm(score2);
        Score score3 = new Score(130f, 2f, "Dennis");
        mRealm.copyToRealm(score3);
        Score score4 = new Score(70f, 3f, "Luke");
        mRealm.copyToRealm(score4);
        Score score5 = new Score(80f, 4f, "Sarah");
        mRealm.copyToRealm(score5);

        mRealm.commitTransaction();

        // add data to the chart
        setData();
    }

    private void setData() {

        // LINE-CHART
        final RealmResults<Score> results = mRealm.where(Score.class).findAll();

        IAxisValueFormatter formatter = new IAxisValueFormatter() {
            @Override
            public String getFormattedValue(float value, AxisBase axis) {
                return results.get((int) value).getPlayerName();
            }

            @Override
            public int getDecimalDigits() {
                return 0;
            }
        };

        lineChart.getXAxis().setValueFormatter(formatter);
        barChart.getXAxis().setValueFormatter(formatter);

        RealmLineDataSet<Score> lineDataSet = new RealmLineDataSet<Score>(results, "scoreNr", "totalScore");
        lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
        lineDataSet.setLabel("Result Scores");
        lineDataSet.setDrawCircleHole(false);
        lineDataSet.setColor(ColorTemplate.rgb("#FF5722"));
        lineDataSet.setCircleColor(ColorTemplate.rgb("#FF5722"));
        lineDataSet.setLineWidth(1.8f);
        lineDataSet.setCircleRadius(3.6f);

        ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>();
        dataSets.add(lineDataSet);

        LineData lineData = new LineData(dataSets);
        styleData(lineData);

        // set data
        lineChart.setData(lineData);
        lineChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);

        // BAR-CHART
        RealmBarDataSet<Score> barDataSet = new RealmBarDataSet<Score>(results, "scoreNr", "totalScore");
        barDataSet.setColors(new int[]{ColorTemplate.rgb("#FF5722"), ColorTemplate.rgb("#03A9F4")});
        barDataSet.setLabel("Realm BarDataSet");

        ArrayList<IBarDataSet> barDataSets = new ArrayList<IBarDataSet>();
        barDataSets.add(barDataSet);

        BarData barData = new BarData(barDataSets);
        styleData(barData);

        barChart.setData(barData);
        barChart.setFitBars(true);
        barChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
    }
}


text:
namespace ThesesSystem.Web.Areas.Administration.ViewModels.Specialties
{
    using System.ComponentModel.DataAnnotations;
    using ThesesSystem.Models;
    using ThesesSystem.Web.Infrastructure.Mapping;

    public class SpecialtyCreateViewModel : IMapFrom<Specialty>
    {
        [Display(Name = "Заглавие")]
        public string Title { get; set; }

        [Display(Name = "Факултет")]
        public int FacultyId { get; set; }
    }
}


text:
import * as livedoc from "livedoc-mocha/model";
import * as vscode from "vscode";
import * as path from 'path';

import { ScenarioStatus } from "./ScenarioStatus";
import { FeatureGroup } from "./ExecutionResultOutlineProvider";
import { TestSuite } from "../../node_modules/livedoc-mocha/model/config";

export abstract class ExecutionResultTreeViewItem extends vscode.TreeItem {
    private icons = {
        unknown: "passed.svg",
        pass: "passed.svg",
        fail: "failed.svg",
        pending: "pending.svg",
        passPending: "pending-autorun-light.svg",
        failPending: "failed-faint-autorun-light.svg",
        passFailPending: "failed-faint-autorun-light.svg"
    };

    constructor(public title: string, public readonly collapsibleState: vscode.TreeItemCollapsibleState, protected readonly extensionPath: string, public readonly command?: vscode.Command) {
        super(title, collapsibleState);
    }
    protected annotateNode(status: ScenarioStatus) {
        // TODO: This needs fixing as there are bugs in the way status is calculated
        try {
            const icon = this.icons[ScenarioStatus[status]];
            this.iconPath = path.join(this.extensionPath + "/images/icons/", icon);
        } catch (e) {
            this.iconPath = path.join(this.extensionPath + "/images/icons/", this.icons.unknown);
        }
    }

    protected getStatus(suite: livedoc.SuiteBase<any>): ScenarioStatus {
        let status = ScenarioStatus.unknown;
        const stats = suite.statistics;
        // These status' are export binary
        if (stats.failedCount > 0) {
            status = ScenarioStatus.fail;
        }
        else if (stats.passCount > 0) {
            status = ScenarioStatus.pass;
        }
        // These status' are additive
        if (stats.pendingCount > 0) {
            status |= ScenarioStatus.pending;
        }
        // warnings have been ignored for now.
        return status;
    }
}

export class ExecutionConfigTreeViewItem extends vscode.TreeItem {
    constructor(public readonly title: string, public readonly key: string, public readonly collapsibleState: vscode.TreeItemCollapsibleState, public readonly command?: vscode.Command) {
        super(title, collapsibleState);
    }
}

/**
 * This tree view item is used to support the virtual tree based on the Feature.path property
 *
 * @export
 * @class ExecutionFolderTreeViewItem
 * @extends ExecutionResultTreeViewItem
 */
export class ExecutionFolderTreeViewItem extends ExecutionResultTreeViewItem {
    constructor(public readonly tesSuite: TestSuite, public readonly group: FeatureGroup, public readonly collapsibleState: vscode.TreeItemCollapsibleState, protected readonly extensionPath: string, public readonly command?: vscode.Command) {
        super(group.title, collapsibleState, extensionPath);
        this.annotateNode(group.status);
    }
}

/**
 * This tree view item is used to support Features
 *
 * @export
 * @class FeatureTreeViewItem
 * @extends ExecutionResultTreeViewItem
 */
export class FeatureTreeViewItem extends ExecutionResultTreeViewItem {
    constructor(public readonly tesSuite: TestSuite, public readonly feature: livedoc.Feature, public readonly collapsibleState: vscode.TreeItemCollapsibleState, protected readonly extensionPath: string, public readonly command?: vscode.Command) {
        super("Feature: " + feature.title, collapsibleState, extensionPath);
        this.annotateNode(this.getStatus(feature));
    }
}

/**
 * This tree view item is used to support Features
 *
 * @export
 * @class ScenarioTreeViewItem
 * @extends ExecutionResultTreeViewItem
 */
export class ScenarioTreeViewItem extends ExecutionResultTreeViewItem {
    constructor(public readonly tesSuite: TestSuite, public readonly scenario: livedoc.Scenario, public readonly collapsibleState: vscode.TreeItemCollapsibleState, protected readonly extensionPath: string, public readonly command?: vscode.Command) {
        super("Scenario: " + scenario.title, collapsibleState, extensionPath, command);
        this.annotateNode(this.getStatus(scenario));
    }
}

/**
 * This tree view item is used to support Features
 *
 * @export
 * @class StepTreeViewItem
 * @extends ExecutionResultTreeViewItem
 */
export class StepTreeViewItem extends ExecutionResultTreeViewItem {
    constructor(public readonly step: livedoc.StepDefinition, public readonly collapsibleState: vscode.TreeItemCollapsibleState, protected readonly extensionPath: string, public readonly command?: vscode.Command) {
        super(step.displayTitle, collapsibleState, extensionPath, command);
        const stepStatus = step.status as string;
        const scenarioStatus = ScenarioStatus[stepStatus];
        this.annotateNode(scenarioStatus);
    }
}

/**
 * This tree view item is used to support Feature Backgrounds
 *
 * @export
 * @class StepTreeViewItem
 * @extends ExecutionResultTreeViewItem
 */
export class BackgroundTreeViewItem extends ExecutionResultTreeViewItem {
    constructor(public readonly tesSuite: TestSuite, public readonly background: livedoc.Background, public readonly collapsibleState: vscode.TreeItemCollapsibleState, protected readonly extensionPath: string, public readonly command?: vscode.Command) {
        super("Background: " + background.title, collapsibleState, extensionPath, command);
        this.annotateNode(this.getStatus(background));
    }
}


text:
<?php
/**
  * OAuth controller for API endpoints.
  *
  * @author Jaisen Mathai <jaisen@jmathai.com>
 */
class ApiOAuthController extends ApiBaseController
{
  /**
    * Call the parent constructor
    *
    * @return void
    */
  public function __construct()
  {
    parent::__construct();
  }

  public function delete($id)
  {
    getAuthentication()->requireAuthentication();
    $res = getDb()->deleteCredential($id);
    if($res)
      return $this->noContent('Oauth credential deleted', true);
    else
      return $this->error('Could not delete credential', false);
  }

  public function view($id)
  {
    getAuthentication()->requireAuthentication();
    $res = getDb()->getCredential($id);
    if($res !== false)
      return $this->success('Oauth Credential', $res);
    else
      return $this->error('Could not retrieve credential', false);
  }

  public function list_()
  {
    getAuthentication()->requireAuthentication();
    $res = getDb()->getCredentials();
    if($res !== false)
      return $this->success('Oauth Credentials', $res);
    else
      return $this->error('Could not retrieve credentials', false);
  }
}


text:
      {{ site.name|split:' '|first }}
      {{ site.name|split:' '|last }}

about

posts


text:
/**
 *
 * @author Sarah's Laptop
 */
// Import required java libraries
import com.google.gson.Gson;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.*;
import javax.servlet.http.*;
import static spark.Spark.post;

// Extend HttpServlet class
public class AddUser extends HttpServlet {

  // Method to handle GET method request.
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
            throws ServletException, IOException
  {
      post("/newuser", (req, res) -> {

                String username = req.queryParams("username");
            	String name = req.queryParams("name");
                String email  = req.queryParams("email");
                String bizname = req.queryParams("bizname");
                String website = req.queryParams("website");
                String craft = req.queryParams("craft");
                String about = req.queryParams("about");
            	String id = UUID.randomUUID().toString();

                Map<String, Object> userData = new HashMap<>();
                userData.put("id", id);
                userData.put("username", username);
                userData.put("name", name);
                userData.put("email", email);
                userData.put("bizname", bizname);
                userData.put("website", website);
                userData.put("craft", craft);
                userData.put("about", about);

                Gson gson = new Gson();
                res.redirect("/signup.html");
                return gson.toJson(userData);

            });

  }
  // Method to handle POST method request.
  public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
      throws ServletException, IOException {
     doGet(request, response);
  }
}


text:
package org.camunda.bpm.spring.boot.starter;

import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.impl.jobexecutor.JobExecutor;
import org.camunda.bpm.spring.boot.starter.actuator.JobExecutorHealthIndicator;
import org.camunda.bpm.spring.boot.starter.actuator.ProcessEngineHealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

@Configuration
@ConditionalOnProperty(prefix = "management.health.camunda", name = "enabled", matchIfMissing = true)
@ConditionalOnClass(HealthIndicator.class)
@DependsOn("runtimeService")
public class CamundaBpmActuatorConfiguration {

  @Bean
  @ConditionalOnBean(name = "jobExecutor")
  @ConditionalOnMissingBean(name = "jobExecutorHealthIndicator")
  public HealthIndicator jobExecutorHealthIndicator(JobExecutor jobExecutor) {
    return new JobExecutorHealthIndicator(jobExecutor);
  }

  @Bean
  @ConditionalOnMissingBean(name = "processEngineHealthIndicator")
  public HealthIndicator processEngineHealthIndicator(ProcessEngine processEngine) {
    return new ProcessEngineHealthIndicator(processEngine);
  }
}


text:
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'CandidateList'
        db.create_table('polyorg_candidatelist', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=80)),
            ('ballot', self.gf('django.db.models.fields.CharField')(max_length=4)),
            ('number_of_seats', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
            ('surplus_partner', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['polyorg.CandidateList'], null=True, blank=True)),
            ('mpg_html_report', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
        ))
        db.send_create_signal('polyorg', ['CandidateList'])

        # Adding model 'Party'
        db.create_table('polyorg_party', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=64)),
            ('number_of_seats', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
        ))
        db.send_create_signal('polyorg', ['Party'])

        # Adding model 'Candidate'
        db.create_table('polyorg_candidate', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('candidates_list', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['polyorg.CandidateList'])),
            ('person', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['persons.Person'])),
            ('ordinal', self.gf('django.db.models.fields.IntegerField')()),
            ('party', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['polyorg.Party'], null=True, blank=True)),
            ('votes', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
        ))
        db.send_create_signal('polyorg', ['Candidate'])

    def backwards(self, orm):
        # Deleting model 'CandidateList'
        db.delete_table('polyorg_candidatelist')

        # Deleting model 'Party'
        db.delete_table('polyorg_party')

        # Deleting model 'Candidate'
        db.delete_table('polyorg_candidate')

    models = {
        'auth.group': {
            'Meta': {'object_name': 'Group'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
        },
        'auth.permission': {
            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
        },
        'auth.user': {
            'Meta': {'object_name': 'User'},
            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
        },
        'contenttypes.contenttype': {
            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'mks.member': {
            'Meta': {'ordering': "['name']", 'object_name': 'Member'},
            'area_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'average_monthly_committee_presence': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
            'average_weekly_presence_hours': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
            'backlinks_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'bills_stats_approved': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'bills_stats_first': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'bills_stats_pre': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'bills_stats_proposed': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'blog': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['planet.Blog']", 'unique': 'True', 'null': 'True', 'blank': 'True'}),
            'current_party': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'members'", 'null': 'True', 'to': "orm['mks.Party']"}),
            'current_role_descriptions': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'null': 'True', 'blank': 'True'}),
            'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'date_of_death': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'family_status': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
            'fax': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
            'gender': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'img_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
            'is_current': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
            'number_of_children': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'parties': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'all_members'", 'symmetrical': 'False', 'through': "orm['mks.Membership']", 'to': "orm['mks.Party']"}),
            'phone': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
            'place_of_birth': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'place_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'place_of_residence_lat': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'place_of_residence_lon': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'residence_centrality': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'residence_economy': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
            'website': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
            'year_of_aliyah': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
        },
        'mks.membership': {
            'Meta': {'object_name': 'Membership'},
            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'member': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mks.Member']"}),
            'party': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['mks.Party']"}),
            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'})
        },
        'mks.party': {
            'Meta': {'ordering': "('-number_of_seats',)", 'object_name': 'Party'},
            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'is_coalition': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
            'number_of_members': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'number_of_seats': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'})
        },
        'persons.person': {
            'Meta': {'ordering': "('name',)", 'object_name': 'Person'},
            'area_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'date_of_birth': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'date_of_death': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
            'family_status': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
            'fax': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
            'gender': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'img_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
            'mk': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'person'", 'null': 'True', 'to': "orm['mks.Member']"}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
            'number_of_children': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'phone': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
            'place_of_birth': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'place_of_residence': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'place_of_residence_lat': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'place_of_residence_lon': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
            'residence_centrality': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'residence_economy': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'titles': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'persons'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['persons.Title']"}),
            'year_of_aliyah': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
        },
        'persons.title': {
            'Meta': {'object_name': 'Title'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '64'})
        },
        'planet.blog': {
            'Meta': {'ordering': "('title', 'url')", 'object_name': 'Blog'},
            'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
            'url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '1024', 'db_index': 'True'})
        },
        'polyorg.candidate': {
            'Meta': {'object_name': 'Candidate'},
            'candidates_list': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['polyorg.CandidateList']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'ordinal': ('django.db.models.fields.IntegerField', [], {}),
            'party': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['polyorg.Party']", 'null': 'True', 'blank': 'True'}),
            'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['persons.Person']"}),
            'votes': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
        },
        'polyorg.candidatelist': {
            'Meta': {'object_name': 'CandidateList'},
            'ballot': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
            'candidates': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['persons.Person']", 'null': 'True', 'through': "orm['polyorg.Candidate']", 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'mpg_html_report': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
            'number_of_seats': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
            'surplus_partner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['polyorg.CandidateList']", 'null': 'True', 'blank': 'True'})
        },
        'polyorg.party': {
            'Meta': {'object_name': 'Party'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
            'number_of_seats': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
        }
    }

    complete_apps = ['polyorg']


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Lich. Fl. Great Brit. , Edn 3 20 (1879)

#### Original name
Collema crispum f. nudum Schaer.

### Remarks
null


text:
@implementation WDSparkSlider

@synthesize title = title_;
@synthesize value = value_;
@synthesize minValue = minValue_;
@synthesize maxValue = maxValue_;

- (void) awakeFromNib
{
    self.opaque = NO;
    self.backgroundColor = nil;

    // set up the label that indicates the current value
    CGRect frame = self.bounds;
    frame.size.height = kValueLabelHeight;
    valueLabel_ = [[UILabel alloc] initWithFrame:frame];

    valueLabel_.opaque = NO;
    valueLabel_.backgroundColor = nil;
    valueLabel_.text = @"0 pt";
    valueLabel_.font = [UIFont systemFontOfSize:17];
    valueLabel_.textColor = [UIColor blackColor];
    valueLabel_.textAlignment = NSTextAlignmentCenter;

    [self addSubview:valueLabel_];

    // set up the title label
    frame = self.bounds;
    frame.origin.y = CGRectGetMaxY(frame) - kTitleLabelHeight;
    frame.size.height = kTitleLabelHeight;
    frame = CGRectInset(frame, -4, 0);

    title_ = [[UILabel alloc] initWithFrame:frame];

    title_.opaque = NO;
    title_.backgroundColor = nil;
    title_.font = [UIFont systemFontOfSize:13];
    title_.textColor = [UIColor darkGrayColor];
    title_.textAlignment = NSTextAlignmentCenter;

    [self addSubview:title_];

    maxValue_ = 100;
}

- (CGRect) trackRect
{
    CGRect  trackRect = self.bounds;

    trackRect.origin.y += kValueLabelHeight;
    trackRect.size.height -= kValueLabelHeight + kTitleLabelHeight;
    trackRect = CGRectInset(trackRect, kBarInset, 0);

    trackRect.origin.y = WDCenterOfRect(trackRect).y;
    trackRect.size.height = kBarHeight;

    return trackRect;
}

- (void) drawRect:(CGRect)rect
{
    CGContextRef    ctx = UIGraphicsGetCurrentContext();
    CGRect          trackRect = [self trackRect];

    // gray track backround
    [[UIColor colorWithWhite:0.75f alpha:1.0f] set];
    CGContextFillRect(ctx, trackRect);

    // bottom highlight
    [[UIColor colorWithWhite:1 alpha:0.6] set];
    CGContextFillRect(ctx, CGRectOffset(trackRect, 0,1));

    // "progress" bar
    trackRect.size.width *= ((float) value_) / maxValue_;
    [[UIColor blackColor] set];
    CGContextFillRect(ctx, trackRect);
}

- (void) updateIndicator
{
    if (!indicator_) {
        indicator_ = [[UIImageView alloc] initWithImage:[ImageUtility imageNamed:@"spark_knob.png"]];
        [self addSubview:indicator_];
    }

    CGRect trackRect = [self trackRect];

    trackRect = CGRectInset(trackRect, 2.5f, 0);
    trackRect.size.width *= ((float) value_) / maxValue_;

    indicator_.sharpCenter = CGPointMake(CGRectGetMaxX(trackRect), CGRectGetMidY(trackRect));
}

- (NSNumber *) numberValue
{
    return @((int)value_);
}

- (void) setValue:(float)value
{
    if (value == value_) {
        if (!indicator_) {
            // make sure we start in a good state
            [self updateIndicator];
        }

        return;
    }

    value_ = value;
    [self setNeedsDisplay];

    [self updateIndicator];

    int rounded = round(value_);
    valueLabel_.text = [NSString stringWithFormat:@"%d pt", rounded];
}

- (BOOL) beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
{
    initialValue_ = value_;

    dragging_ = YES;
    moved_ = NO;

    indicator_.image = [ImageUtility imageNamed:@"spark_knob_highlighted.png"];

    [self setNeedsDisplay];

    return [super beginTrackingWithTouch:touch withEvent:event];
}

- (BOOL) continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
{
    CGPoint     delta, pt = [touch locationInView:self];
    float       changedValue;

    if (!moved_) {
        moved_ = YES;
        initialPt_ = pt;
    }

    delta = WDSubtractPoints(pt, initialPt_);
    changedValue = round(initialValue_ + (delta.x / kDragDampening));

    if (changedValue < minValue_) {
        changedValue = minValue_;
    } else if (changedValue > maxValue_) {
        changedValue = maxValue_;
    }

    self.value = changedValue;

    return [super continueTrackingWithTouch:touch withEvent:event];
}

- (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event
{
    dragging_ = NO;
    [self setNeedsDisplay];

    indicator_.image = [ImageUtility imageNamed:@"spark_knob.png"];

    [self sendActionsForControlEvents:UIControlEventValueChanged];
    [super endTrackingWithTouch:touch withEvent:event];
}

- (void)cancelTrackingWithEvent:(UIEvent *)event
{
    dragging_ = NO;
    [self setNeedsDisplay];

    indicator_.image = [ImageUtility imageNamed:@"spark_knob.png"];
}

@end