text:
package interest

import "fmt"

// import "hash"

import "github.com/chris-wood/spud/codec"
import "github.com/chris-wood/spud/messages/name"
import "github.com/chris-wood/spud/messages/kex"
import typedhash "github.com/chris-wood/spud/messages/hash"
import "github.com/chris-wood/spud/messages/link"
import "github.com/chris-wood/spud/messages/payload"

type Interest struct {
	name      *name.Name
	keyId     typedhash.Hash
	contentId typedhash.Hash

	// Payload and its type
	payloadType uint16
	dataPayload payload.Payload

	// codec.TLVs
	containers []codec.TLV

	// KEX signalling and encryption information
	kexMessage kex.KEX
}

type interestError struct {
	prob string
}

func (e interestError) Error() string {
	return fmt.Sprintf("%s", e.prob)
}

// Constructors

func CreateWithName(name *name.Name) *Interest {
	return &Interest{name: name, containers: make([]codec.TLV, 0)}
}

func CreateWithNameAndPayload(name *name.Name, payloadType uint16, payloadValue payload.Payload) *Interest {
	return &Interest{name: name, payloadType: payloadType, dataPayload: payloadValue}
}

func CreateFromLink(link link.Link) *Interest {
	return &Interest{name: link.Name(), keyId: link.KeyID(), contentId: link.ContentID(), containers: make([]codec.TLV, 0)}
}

func CreateFromTLV(tlvs codec.TLV) (*Interest, error) {
	var interest Interest
	var interestName *name.Name
	var err error

	containers := make([]codec.TLV, 0)
	var dataPayload payload.Payload

	for _, tlv := range tlvs.Children() {
		if tlv.Type() == codec.T_NAME {
			interestName, err = name.CreateFromTLV(tlv)
			if err != nil {
				return &interest, err
			}
		} else if tlv.Type() == codec.T_KEX {
			kex, err := kex.CreateFromTLV(tlv)
			if err != nil {
				return nil, interestError{"Unable to decode the KEX TLV"}
			}
			containers = append(containers, kex)
		} else if tlv.Type() == codec.T_PAYLDTYPE {
			// pass
		} else if tlv.Type() == codec.T_PAYLOAD {
			dataPayload = payload.Create(tlv.Value())
		} else if tlv.Type() == codec.T_KEYID_REST {
			// pass
		} else if tlv.Type() == codec.T_HASH_REST {
			// pass
		} else {
			fmt.Printf("Unable to parse interest TLV type: %d\n", tlv.Type())
		}
	}

	return &Interest{name: interestName, containers: containers, dataPayload: dataPayload}, nil
}

// codec.TLVs

func (i *Interest) AddContainer(container codec.TLV) {
	i.containers = append(i.containers, container)
}

func (i *Interest) GetContainer(containerType uint16) (codec.TLV, error) {
	var container codec.TLV
	for _, test := range i.containers {
		if test.Type() == containerType {
			return test, nil
		}
	}
	return container, interestError{"No such container"}
}

// TLV functions

func (i Interest) Type() uint16 {
	return uint16(codec.T_INTEREST)
}

func (i Interest) TypeString() string {
	return "Interest"
}

func (i Interest) Length() uint16 {
	length := i.name.Length() + 4

	if i.keyId.Length() > 0 {
		length += i.keyId.Length() + 4
	}
	if i.contentId.Length() > 0 {
		length += i.contentId.Length() + 4
	}
	if i.dataPayload.Length() > 0 {
		// length += 5 // for payload type and TLV header
		length += i.dataPayload.Length() + 4
	}
	for _, container := range i.containers {
		length += container.Length() + 4
	}

	return length
}

func (i Interest) Value() []byte {
	e := codec.Encoder{}
	value := e.EncodeTLV(i.name)

	if i.keyId.Length() > 0 {
		value = append(value, e.EncodeTLV(i.keyId)...)
	}
	if i.contentId.Length() > 0 {
		value = append(value, e.EncodeTLV(i.contentId)...)
	}
	if i.dataPayload.Length() > 0 {
		// XXX: append the payload type, encoded, here
		value = append(value, e.EncodeTLV(i.dataPayload)...)
	}
	for _, container := range i.containers {
		value = append(value, e.EncodeTLV(container)...)
	}

	return value
}

func (i Interest) Children() []codec.TLV {
	children := []codec.TLV{i.name, i.keyId, i.contentId}
	for _, container := range i.containers {
		children = append(children, container)
	}
	return children
}

func (i Interest) String() string {
	return i.name.String()
}

// Message functions

func (i Interest) Name() *name.Name {
	return i.name
}

func (i Interest) Identifier() string {
	return i.name.String()
}

func (i Interest) NamelessIdentifier() string {
	result := ""
	if i.keyId.Length() > 0 {
		result += string(i.keyId.String())
	}
	if i.contentId.Length() > 0 {
		result += string(i.contentId.String())
	}
	return result
}

func (i Interest) Encode() []byte {
	encoder := codec.Encoder{}
	bytes := encoder.EncodeTLV(i)
	return bytes
}

func (i Interest) GetPacketType() uint16 {
	return codec.T_INTEREST
}

func (i Interest) Payload() *payload.Payload {
	return &i.dataPayload
}

func (i Interest) PayloadType() uint16 {
	return i.payloadType
}


text:
package org.easyrec.plugin.slopeone.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.easyrec.model.core.ItemAssocVO;
import org.easyrec.model.core.RatingVO;
import org.easyrec.model.core.TenantVO;
import org.easyrec.plugin.slopeone.DeviationCalculationStrategy;
import org.easyrec.plugin.slopeone.SlopeOneService;
import org.easyrec.plugin.slopeone.model.*;
import org.easyrec.plugin.slopeone.store.dao.ActionDAO;
import org.easyrec.plugin.slopeone.store.dao.DeviationDAO;
import org.easyrec.plugin.support.ExecutablePluginSupport;
import org.easyrec.plugin.support.ExecutablePluginSupport.ExecutionControl;
import org.easyrec.store.dao.core.ItemAssocDAO;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Implementation of SlopeOneService.
Company:  SAT, Research Studios Austria

 *
Copyright:  (c) 2007

last modified:
 $Author: dmann $
 $Date: 2011-12-20 15:22:22 +0100 (Di, 20 Dez 2011) $
 $Revision: 18685 $

 *
 * @author Patrick Marschik
 */
public class SlopeOneServiceImpl implements SlopeOneService {
    private static final Log logger = LogFactory.getLog(SlopeOneServiceImpl.class);

    private ActionDAO actionDAO;
    private DeviationCalculationStrategy deviationCalculation;
    private DeviationDAO deviationDAO;
    private ItemAssocDAO itemAssocDAO;

    public SlopeOneServiceImpl(ItemAssocDAO itemAssocDAO, ActionDAO actionDAO, DeviationDAO deviationDAO,
                               DeviationCalculationStrategy deviationCalculation) {
        this.itemAssocDAO = itemAssocDAO;
        this.actionDAO = actionDAO;
        this.deviationDAO = deviationDAO;
        this.deviationCalculation = deviationCalculation;
    }

    public void calculateDeviations(SlopeOneIntegerConfiguration config, Date lastRun, SlopeOneStats stats,
                                    Set<TenantItem> changedItemIds,
                                    final ExecutablePluginSupport.ExecutionControl control) {
        long start = System.currentTimeMillis();

        // get only the users that did ratings since the last execution
        List<Integer> users = actionDAO.getUsers(config.getTenant(), config.getItemTypes(), lastRun);
        stats.setNoUsers(users.size());

        final int TOTAL_STEPS = users.size();
        int currentStep = 0;

        for (int userId : users) {
            if (control != null)
                control.updateProgress(String.format("Calculating deviations %d/%d", currentStep++, TOTAL_STEPS));

            // for each of these users get all his ratings
            List<RatingVO<Integer, Integer>> ratings =
                    actionDAO.getRatings(config.getTenant(), config.getItemTypes(), userId);
            stats.setNumberOfActionsConsidered(stats.getNumberOfActionsConsidered() + ratings.size());

            // and use them to calculate the new deviations (old deviations, i.e. deviations that were already
            // generated in a prior run are already filtered by the strategy.)
            // moreover a proxy strategy merges the deviations with the deviations in the database (i.e. numerator
            // and denominator are already summed to the current value.)
            DeviationCalculationResult result = deviationCalculation.calculate(userId, ratings, lastRun);
            List<Deviation> deviations = result.getDeviations();
            stats.setNoCreatedDeviations(stats.getNoCreatedDeviations() + result.getCreated());
            stats.setNoModifiedDeviations(stats.getNoModifiedDeviations() + result.getModified());

            if (changedItemIds != null) {
                for (Deviation deviation : deviations) {
                    changedItemIds.add(new TenantItem(deviation.getItem1Id(), deviation.getItem1TypeId()));
                    changedItemIds.add(new TenantItem(deviation.getItem2Id(), deviation.getItem1TypeId()));
                }
            }

            deviationDAO.insertDeviations(deviations);
        }

        if (logger.isDebugEnabled())
            logger.debug("finishing deviations calculation");

        // endUpdate hint to DAO, so that if the DAO is cached the cache has a chance to write through to the underlying
        // store
        deviationDAO.endUpdate();

        stats.setDeviationDuration(System.currentTimeMillis() - start);
    }

    public void generateActions(SlopeOneIntegerConfiguration config, LogEntry lastRun, SlopeOneStats stats) {
        long start = System.currentTimeMillis();

        if (logger.isDebugEnabled())
            logger.debug("starting action generation");

        actionDAO.generateActions(config.getTenant(), config.getItemTypes(), config.getActionType(),
                lastRun.getExecution());

        stats.setActionDuration(System.currentTimeMillis() - start);
    }

    public void nonPersonalizedRecommendations(final SlopeOneIntegerConfiguration config, final SlopeOneStats stats,
                                               final Date execution, final Set<TenantItem> changedItemIds,
                                               final ExecutionControl control) {
        final long start = System.currentTimeMillis();

        final int MAX_ITEMASSOCS = 50000;
        // atomic to support usage in changedItemIds.forEach(AnonymousClass)
        final AtomicInteger itemAssocCount = new AtomicInteger(0);

        final int TOTAL_STEPS = changedItemIds.size();
        // atomic to support usage in changedItemIds.forEach(AnonymousClass)
        final AtomicInteger currentStep = new AtomicInteger(0);

        Integer maxRecsPerItem = config.getMaxRecsPerItem();
        final List<ItemAssocVO<Integer,Integer>> itemAssocs =
                new ArrayList<ItemAssocVO<Integer,Integer>>(
                        Math.min(changedItemIds.size() * (maxRecsPerItem != null ? maxRecsPerItem : 10),
                                MAX_ITEMASSOCS));

        for (TenantItem changedItem : changedItemIds) {
            if (control != null) control.updateProgress(
                    String.format("Calculating non-personalized recommendations %d/%d", currentStep.getAndIncrement(),
                            TOTAL_STEPS));

            List<Deviation> deviations = deviationDAO.getDeviationsOrdered(config.getTenant(),
                    changedItem.getItemTypeId(), changedItem.getItemId(), config.getMinRatedCount(),
                    config.getMaxRecsPerItem());

            for (Deviation deviation : deviations) {
                ItemAssocVO<Integer,Integer> assoc =
                        new ItemAssocVO<Integer,Integer>(config.getTenant(),
                                deviation.getItem1(), config.getAssocType(), deviation.getDeviation(),
                                deviation.getItem2(), config.getSourceType(), config.getNonPersonalizedSourceInfo(),
                                config.getViewType(), Boolean.TRUE, execution);

                itemAssocs.add(assoc);
            }

            if (itemAssocs.size() >= MAX_ITEMASSOCS) {
                itemAssocCount.getAndAdd((itemAssocs.size()));
                itemAssocDAO.insertOrUpdateItemAssocs(itemAssocs);
                itemAssocs.clear();
            }
        }

        if (itemAssocs.size() > 0) {
            itemAssocCount.getAndAdd((itemAssocs.size()));
            itemAssocDAO.insertOrUpdateItemAssocs(itemAssocs);
            itemAssocs.clear();
        }

        itemAssocDAO.removeItemAssocByTenant(config.getTenant(), config.getAssocType(), config.getSourceType(),
                execution);

        stats.setNumberOfRulesCreated(itemAssocCount.get());
        stats.setNonPersonalizedDuration(System.currentTimeMillis() - start);
    }

    @SuppressWarnings({"UnusedDeclaration"})
    public void personalizedRecommendations(TenantVO tenant, SlopeOneIntegerConfiguration config, SlopeOneStats stats,
                                            Date execution, Set<TenantItem> changedItemIds, boolean weighted,
                                            final ExecutionControl control) {
        List<Integer> userIds = actionDAO.getUsers(config.getTenant(), config.getItemTypes(), execution);

        final int TOTAL_STEPS = userIds.size();
        int currentStep = 0;

        for (int userId : userIds) {
            if (control != null) control.updateProgress(
                    String.format("Calculating personalized recommendations %d/%d", currentStep++, TOTAL_STEPS));

            List<RatingVO<Integer, Integer>> ratings = actionDAO.getRatings(
                    config.getTenant(), config.getItemTypes(), userId);

            for (RatingVO<Integer, Integer> rating : ratings) {
                int itemId = rating.getItem().getItem();
                int itemTypeId = rating.getItem().getType();

                if (!changedItemIds.contains(new TenantItem(itemId, itemTypeId))) continue;

                List<Deviation> deviations = deviationDAO.getDeviationsOrdered(config.getTenant(), itemTypeId, itemId,
                        config.getMinRatedCount(), config.getMaxRecsPerItem());

                double recommendation = weighted ? weightedRecommendations(rating, deviations)
                                                 : plainRecommendations(rating, deviations);

                if (logger.isDebugEnabled())
                    logger.debug("created recommendation " + recommendation);
                // TODO write to database
            }
        }
    }

    private double weightedRecommendations(final RatingVO<Integer, Integer> rating,
                                           final List<Deviation> deviations) {
        double numerator = 0.0;
        long denominator = 0L;

        int itemId = rating.getItem().getItem();

        for (Deviation deviation : deviations) {
            if (deviation.getItem2Id() == itemId) continue;

            numerator += (deviation.getDeviation() * rating.getRatingValue()) * deviation.getDenominator();
            denominator += deviation.getDenominator();
        }

        return numerator / denominator;
    }

    private double plainRecommendations(final RatingVO<Integer, Integer> rating,
                                        final List<Deviation> deviations) {
        double numerator = 0.0;
        long denominator = 0L;

        int itemId = rating.getItem().getItem();

        for (Deviation deviation : deviations) {
            if (deviation.getItem2Id() == itemId) continue;

            numerator += deviation.getDeviation() * rating.getRatingValue();
            denominator++;
        }

        return numerator / denominator;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.gk969.gallery.gallery3d.app;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.RelativeLayout;

import com.gk969.UltimateImgSpider.R;

import java.util.HashMap;
import java.util.Map;

public class PhotoPageBottomControls implements OnClickListener {
    public interface Delegate {
        public boolean canDisplayBottomControls();
        public boolean canDisplayBottomControl(int control);
        public void onBottomControlClicked(int control);
        public void refreshBottomControlsWhenReady();
    }

    private Delegate mDelegate;
    private ViewGroup mParentLayout;
    private ViewGroup mContainer;

    private boolean mContainerVisible = false;
    private Map<View, Boolean> mControlsVisible = new HashMap<View, Boolean>();

    private Animation mContainerAnimIn = new AlphaAnimation(0f, 1f);
    private Animation mContainerAnimOut = new AlphaAnimation(1f, 0f);
    private static final int CONTAINER_ANIM_DURATION_MS = 200;

    private static final int CONTROL_ANIM_DURATION_MS = 150;
    private static Animation getControlAnimForVisibility(boolean visible) {
        Animation anim = visible ? new AlphaAnimation(0f, 1f)
                : new AlphaAnimation(1f, 0f);
        anim.setDuration(CONTROL_ANIM_DURATION_MS);
        return anim;
    }

    public PhotoPageBottomControls(Delegate delegate, Context context, RelativeLayout layout) {
        mDelegate = delegate;
        mParentLayout = layout;

        LayoutInflater inflater = (LayoutInflater) context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        mParentLayout.addView(mContainer);

        for (int i = mContainer.getChildCount() - 1; i >= 0; i--) {
            View child = mContainer.getChildAt(i);
            child.setOnClickListener(this);
            mControlsVisible.put(child, false);
        }

        mContainerAnimIn.setDuration(CONTAINER_ANIM_DURATION_MS);
        mContainerAnimOut.setDuration(CONTAINER_ANIM_DURATION_MS);

        mDelegate.refreshBottomControlsWhenReady();
    }

    private void hide() {
        mContainer.clearAnimation();
        mContainerAnimOut.reset();
        mContainer.startAnimation(mContainerAnimOut);
        mContainer.setVisibility(View.INVISIBLE);
    }

    private void show() {
        mContainer.clearAnimation();
        mContainerAnimIn.reset();
        mContainer.startAnimation(mContainerAnimIn);
        mContainer.setVisibility(View.VISIBLE);
    }

    public void refresh() {
        boolean visible = mDelegate.canDisplayBottomControls();
        boolean containerVisibilityChanged = (visible != mContainerVisible);
        if (containerVisibilityChanged) {
            if (visible) {
                show();
            } else {
                hide();
            }
            mContainerVisible = visible;
        }
        if (!mContainerVisible) {
            return;
        }
        for (View control : mControlsVisible.keySet()) {
            Boolean prevVisibility = mControlsVisible.get(control);
            boolean curVisibility = mDelegate.canDisplayBottomControl(control.getId());
            if (prevVisibility.booleanValue() != curVisibility) {
                if (!containerVisibilityChanged) {
                    control.clearAnimation();
                    control.startAnimation(getControlAnimForVisibility(curVisibility));
                }
                control.setVisibility(curVisibility ? View.VISIBLE : View.INVISIBLE);
                mControlsVisible.put(control, curVisibility);
            }
        }
        // Force a layout change
        mContainer.requestLayout(); // Kick framework to draw the control.
    }

    public void cleanup() {
        mParentLayout.removeView(mContainer);
        mControlsVisible.clear();
    }

    @Override
    public void onClick(View view) {
        Boolean controlVisible = mControlsVisible.get(view);
        if (mContainerVisible && controlVisible != null && controlVisible.booleanValue()) {
            mDelegate.onBottomControlClicked(view.getId());
        }
    }
}


text:
import { descending } from 'd3';

export default function setYDomain() {
    //Sort summarized data by descending total.
    this.current_data.sort((a, b) =>
        b.total < a.total ? -1 : b.total > a.total ? 1 : b.total >= a.total ? 0 : NaN
    );

    //Sort y-domain by descending total.
    this.y_dom.sort((a, b) => {
        const order = this.current_data.map(d => d.key);
        return order.indexOf(b) < order.indexOf(a)
            ? -1
            : order.indexOf(b) > order.indexOf(a)
            ? 1
            : order.indexOf(b) >= order.indexOf(a)
            ? 0
            : NaN;
    });

    //Limit y-domain to key values in summarized data.
    this.y_dom = this.y_dom.filter(d => this.current_data.map(di => di.key).indexOf(d) > -1);

    //Sort y-domain alphanumerically or descending total.
    this.y_dom = this.config.alphabetize ? this.y_dom.sort(descending) : this.y_dom;

    //Limit y-domain to first [chart.config.cutoff] values.
    if (this.config.cutoff !== 'All') {
        this.y_dom_length = this.y_dom.length;
        this.y_dom = this.y_dom.filter((d, i) => i >= this.y_dom.length - this.config.cutoff);
    } else {
        this.y_dom_length = this.y_dom.length; // ensure that "X more items" does not appear on Show All
    }
}


text:
;(function() {
  function Tablesort(el, options) {
    if (!(this instanceof Tablesort)) return new Tablesort(el, options);

    if (!el || el.tagName !== 'TABLE') {
      throw new Error('Element must be a table');
    }
    this.init(el, options || {});
  }

  var sortOptions = [];

  var createEvent = function(name) {
    var evt;

    if (!window.CustomEvent || typeof window.CustomEvent !== 'function') {
      evt = document.createEvent('CustomEvent');
      evt.initCustomEvent(name, false, false, undefined);
    } else {
      evt = new CustomEvent(name);
    }

    return evt;
  };

  var getInnerText = function(el,options) {
    return el.getAttribute(options.sortAttribute || 'data-sort') || el.textContent || el.innerText || '';
  };

  // Default sort method if no better sort method is found
  var caseInsensitiveSort = function(a, b) {
    a = a.trim().toLowerCase();
    b = b.trim().toLowerCase();

    if (a === b) return 0;
    if (a < b) return 1;

    return -1;
  };

  var getCellByKey = function(cells, key) {
    return [].slice.call(cells).find(function(cell) {
      return cell.getAttribute('data-sort-column-key') === key;
    });
  };

  // Stable sort function
  // If two elements are equal under the original sort function,
  // then there relative order is reversed
  var stabilize = function(sort, antiStabilize) {
    return function(a, b) {
      var unstableResult = sort(a.td, b.td);

      if (unstableResult === 0) {
        if (antiStabilize) return b.index - a.index;
        return a.index - b.index;
      }

      return unstableResult;
    };
  };

  Tablesort.extend = function(name, pattern, sort) {
    if (typeof pattern !== 'function' || typeof sort !== 'function') {
      throw new Error('Pattern and sort must be a function');
    }

    sortOptions.push({
      name: name,
      pattern: pattern,
      sort: sort
    });
  };

  Tablesort.prototype = {

    init: function(el, options) {
      var that = this,
          firstRow,
          defaultSort,
          i,
          cell;

      that.table = el;
      that.thead = false;
      that.options = options;

      if (el.rows && el.rows.length > 0) {
        if (el.tHead && el.tHead.rows.length > 0) {
          for (i = 0; i < el.tHead.rows.length; i++) {
            if (el.tHead.rows[i].getAttribute('data-sort-method') === 'thead') {
              firstRow = el.tHead.rows[i];
              break;
            }
          }
          if (!firstRow) {
            firstRow = el.tHead.rows[el.tHead.rows.length - 1];
          }
          that.thead = true;
        } else {
          firstRow = el.rows[0];
        }
      }

      if (!firstRow) return;

      var onClick = function() {
        if (that.current && that.current !== this) {
          that.current.removeAttribute('aria-sort');
        }

        that.current = this;
        that.sortTable(this);
      };

      // Assume first row is the header and attach a click handler to each.
      for (i = 0; i < firstRow.cells.length; i++) {
        cell = firstRow.cells[i];
        cell.setAttribute('role','columnheader');
        if (cell.getAttribute('data-sort-method') !== 'none') {
          cell.tabindex = 0;
          cell.addEventListener('click', onClick, false);

          if (cell.getAttribute('data-sort-default') !== null) {
            defaultSort = cell;
          }
        }
      }

      if (defaultSort) {
        that.current = defaultSort;
        that.sortTable(defaultSort);
      }
    },

    sortTable: function(header, update) {
      var that = this,
          columnKey = header.getAttribute('data-sort-column-key'),
          column = header.cellIndex,
          sortFunction = caseInsensitiveSort,
          item = '',
          items = [],
          i = that.thead ? 0 : 1,
          sortMethod = header.getAttribute('data-sort-method'),
          sortOrder = header.getAttribute('aria-sort');

      that.table.dispatchEvent(createEvent('beforeSort'));

      // If updating an existing sort, direction should remain unchanged.
      if (!update) {
        if (sortOrder === 'ascending') {
          sortOrder = 'descending';
        } else if (sortOrder === 'descending') {
          sortOrder = 'ascending';
        } else {
          sortOrder = that.options.descending ? 'descending' : 'ascending';
        }

        header.setAttribute('aria-sort', sortOrder);
      }

      if (that.table.rows.length < 2) return;

      // If we force a sort method, it is not necessary to check rows
      if (!sortMethod) {
        var cell;
        while (items.length < 3 && i < that.table.tBodies[0].rows.length) {
          if(columnKey) {
            cell = getCellByKey(that.table.tBodies[0].rows[i].cells, columnKey);
          } else {
            cell = that.table.tBodies[0].rows[i].cells[column];
          }

          // Treat missing cells as empty cells
          item = cell ? getInnerText(cell,that.options) : "";

          item = item.trim();

          if (item.length > 0) {
            items.push(item);
          }

          i++;
        }

        if (!items) return;
      }

      for (i = 0; i < sortOptions.length; i++) {
        item = sortOptions[i];

        if (sortMethod) {
          if (item.name === sortMethod) {
            sortFunction = item.sort;
            break;
          }
        } else if (items.every(item.pattern)) {
          sortFunction = item.sort;
          break;
        }
      }

      that.col = column;

      for (i = 0; i < that.table.tBodies.length; i++) {
        var newRows = [],
            noSorts = {},
            j,
            totalRows = 0,
            noSortsSoFar = 0;

        if (that.table.tBodies[i].rows.length < 2) continue;

        for (j = 0; j < that.table.tBodies[i].rows.length; j++) {
          var cell;

          item = that.table.tBodies[i].rows[j];
          if (item.getAttribute('data-sort-method') === 'none') {
            // keep no-sorts in separate list to be able to insert
            // them back at their original position later
            noSorts[totalRows] = item;
          } else {
            if (columnKey) {
              cell = getCellByKey(item.cells, columnKey);
            } else {
              cell = item.cells[that.col];
            }
            // Save the index for stable sorting
            newRows.push({
              tr: item,
              td: cell ? getInnerText(cell,that.options) : '',
              index: totalRows
            });
          }
          totalRows++;
        }
        // Before we append should we reverse the new array or not?
        // If we reverse, the sort needs to be `anti-stable` so that
        // the double negatives cancel out
        if (sortOrder === 'descending') {
          newRows.sort(stabilize(sortFunction, true));
        } else {
          newRows.sort(stabilize(sortFunction, false));
          newRows.reverse();
        }

        // append rows that already exist rather than creating new ones
        for (j = 0; j < totalRows; j++) {
          if (noSorts[j]) {
            // We have a no-sort row for this position, insert it here.
            item = noSorts[j];
            noSortsSoFar++;
          } else {
            item = newRows[j - noSortsSoFar].tr;
          }

          // appendChild(x) moves x if already present somewhere else in the DOM
          that.table.tBodies[i].appendChild(item);
        }
      }

      that.table.dispatchEvent(createEvent('afterSort'));
    },

    refresh: function() {
      if (this.current !== undefined) {
        this.sortTable(this.current, true);
      }
    }
  };

  if (typeof module !== 'undefined' && module.exports) {
    module.exports = Tablesort;
  } else {
    window.Tablesort = Tablesort;
  }
})();


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: dcm4chee-prefetch-service.xml 5630 2008-01-02 14:15:30Z gunterze $ -->
<server>
  <classpath codebase="lib" archives="dcm4chee-hl7.jar"/>
  <mbean code="org.dcm4chex.archive.hl7.HL7CmdService"
    name="dcm4chee.archive:service=HL7Cmd"
    xmbean-dd="xmdesc/dcm4chee-hl7cmd-xmbean.xml">
    <depends optional-attribute-name="HL7ServerName"
      >dcm4chee.archive:service=HL7Server</depends>
    <depends optional-attribute-name="TemplatesServiceName"
      >dcm4chee.archive:service=Templates</depends>
  </mbean>
</server>


text:
/**
 * @file libohigrove/alcohol-sensor.c
 * @author Marco Giammarini <m.giammarini@warcomeb.it>
 * @brief
 */

#include "alcohol-sensor.h"

void OhiGroveAlcoholSensor_init (OhiGroveAlcoholSensor_Device* dev)
{
    dev->pin = OhiGrove_getAnalogPin(dev->connector,OHIGROVE_PIN_NUMBER_1);

    if (dev->pin != ADC_PINS_NONE)
    {
    	dev->device = OhiGrove_getAnalogDevice(dev->connector,OHIGROVE_PIN_NUMBER_1);
    	dev->channel = OhiGrove_getAnalogChannel(dev->connector,OHIGROVE_PIN_NUMBER_1);

        Adc_enablePin(dev->device,dev->pin);
    }
    else
    {
    	return; /* TODO: add errors! */
    }
}

uint16_t OhiGroveAlcoholSensor_get (OhiGroveAlcoholSensor_Device* dev)
{
    uint16_t result;

    Adc_readValue(dev->device,dev->channel,&result,ADC_INPUTTYPE_SINGLE_ENDED);
    return result;
}


text:
package io.moo.propane.providers;

import io.moo.propane.sources.ConfigData;

/**
 * @author bagdemir
 * @since 1.0
 * @version 1.0
 */
public class ConfigurationEnvironmentFilter implements ConfigurationFilter {

  @Override
  public ConfigData filter(final ConfigData data) {
    // filter code implement here.
    return data;
  }
}


text:
title: Overview to Rails Model-View-Controller Convention
description: An overview of how all the Rails magic ties together before we get into the details.
---

when you run:

    rails g scaffold Book

Rails will create a host of new files:

$ rails g model Book
      invoke  active_record
      create    db/migrate/20140303194714_create_books.rb
      create    app/models/book.rb

$ rails g controller Books show index

      create  app/controllers/books_controller.rb
       route  get "books/index"
       route  get "books/show"
      invoke  erb
      create    app/views/books
      create    app/views/books/show.html.erb
      create    app/views/books/index.html.erb

# Migration
The first file is a "migration". This is simply a convenience. Your app uses a database, and Rails is giving you a template for configuring that app in ActiveRecord lingo.

# Model
With the database altered, your Rails app now has a Book class, which you can start adding data to:

Think of ActiveRecord as the Ruby interface for creating and finding things in your database. Instead of writing SQL, you write this:

# Router

So we've confirmed that our Rails app talks to the database...but we're not making a database app, we're making a web app. How does a user, with a web browser, get to peruse our books? This job falls to the Rails router and ActionController.

First, the router:

       route  get "books/index"
       route  get "books/show"

# Controller

      create  app/controllers/books_controller.rb

With the Rails controller,

# View

The `rails g controller` command actually sets up the View files, as Rails convention assumes

## View helpers

books_path(Book.first[1])

# Why convention?

For newcomers to Rails, especially for those new to programming, period,  this magic can be the source of a lot of confusion. Because they can't understand that "books_path" is a Rails-meta-magically generated method dependent on other things.

So they'll do something like, "I want a Magazine", create a "MagazineController" (but not the model), and not realize that Magazine.create does not exist, nor will magazines/ go to a listing of magazines.

But if you're a relatively experienced programmer (and it took me awhile to get at this), Rails' magic is not magic, but just well-thought out conventions that, at anytime, I can break as needed.

This is a frustrating situation. The only thing I can tell you is to BREAK SHIT, frequently and often (and on your own time). Until you understand how to make books_path not go to /books/ (And then how to fix it), Rails will always be a baffling mystery.

On the other hand, if you're a framework veteran, after you get familiar with the conventions, you'll appreciate the boilerplate dullness that Rails saves you from. The rest of this guide is going to follow convention and will only break it with purpose.


text:
include $(TOPDIR)/rules.mk

LUCI_TITLE:= Net-SNMP LuCI interface
LUCI_DEPENDS:=+luci-base +snmpd
LUCI_PKGARCH:=all
LUCI_DESCRIPTION:=Some common net-snmp config items. In no way is this comprehensive.

PKG_MAINTAINER:= Karl Palsson <karlp@etactica.com>
PKG_LICENSE:=Apache-2.0

include ../../luci.mk

# call BuildPackage - OpenWrt buildroot signature


text:
if (self instanceof ServiceWorkerGlobalScope) {
  addEventListener('install', () => {
    skipWaiting();
  });
  addEventListener('activate', async () => {
    await self.registration.unregister();
    const allClients = await clients.matchAll({
      includeUncontrolled: true,
    });
    for (const client of allClients) client.navigate('/');
  });
}


text:
from iptest.assert_util import skiptest
skiptest("win32")
from iptest.cominterop_util import *
from System import NullReferenceException
from System.Runtime.InteropServices import COMException

com_type_name = "DlrComLibrary.ReturnValues"

#------------------------------------------------------------------------------
# Create a COM object
com_obj = getRCWFromProgID(com_type_name)

#------------------------------------------------------------------------------

#Test making calls to COM methods which return non-HRESULT values
def test_nonHRESULT_retvals():
    com_obj.mNoRetVal()  #void
    AreEqual(com_obj.mIntRetVal(), 42) #int
    #The method with two return values is a signature that tlbimp cant handle so it skips it.
    try:
        AreEqual(com_obj.mTwoRetVals(), 42) #Todo: What should be the expected behaviour for the IDispatch mode - 42 or [3,42]
    except AttributeError:
        pass

#Test making calls to COM methods which return error values of HRESULT.
def test_HRESULT_Error():
    AssertErrorWithPartialMessage(NullReferenceException, "Custom error message for E_POINTER", com_obj.mNullRefException)

    # The CLR COM interop support does not use the custom error message provided by the user.
    #AssertErrorWithPartialMessage(NullReferenceException, "Object reference not set to an instance of an object.", com_obj.mNullRefException, bugid="NEEDED?")

    if is_vista:
        AssertErrorWithPartialMessage(COMException, "Migration source incorrect. (Exception from HRESULT: 0x8028005E)", com_obj.mGenericCOMException)
    else:
        print("By Design: 409994")

#------------------------------------------------------------------------------
run_com_test(__name__, __file__)


text:
package org.jboss.weld.junit5.explicitInjection;

import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolutionException;
import org.junit.jupiter.api.extension.ParameterResolver;

/**
 * Custom extension just to verify a case where we declare we cannot handle some types.
 * @author Matej Novotny
 */
public class CustomExtension implements ParameterResolver {

    @Override
    public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
        // dumb approach but we only ever resolve Bar anyway :)
        return new Bar(CustomExtension.class.getSimpleName());
    }

    @Override
    public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
        return parameterContext.getParameter().getType().equals(Bar.class);
    }

}


text:
'use strict';

/* jshint -W098 */
angular.module('mean.persona').controller('Persona.EditarPersonaJuridica.DatosAdicionalesController', function(
    $scope, personaJuridica, toastr){

    $scope.view = {
        persona: personaJuridica
    };

    $scope.submit = function(){
        if ($scope.form.$valid) {
            $scope.view.persona.$save().then(
                function(data){
                    toastr.success('Persona actualizada');
                },
                function error(err){
                    toastr.error(err.data.message);
                }
            );
        }
    };

});


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="e594465c-4a1c-406f-a3bf-a17ec7ca0b21" name="Default" comment="" />
    <ignored path="$PROJECT_DIR$/out/" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
      <file leaf-file-name="FirstTestMain.java" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/src/com/company/FirstTestMain.java">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="200">
              <caret line="8" column="118" lean-forward="false" selection-start-line="8" selection-start-column="105" selection-end-line="8" selection-end-column="118" />
              <folding>
                <element signature="imports" expanded="true" />
                <marker date="1521218165267" expanded="true" signature="1145:1189" ph="SELECT * FRO... employees" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="GradleLocalSettings">
    <option name="externalProjectsViewState">
      <projects_view />
    </option>
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/src/com/company/Main.java" />
        <option value="$PROJECT_DIR$/src/com/company/FirstTestMain.java" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
  <component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
    <sorting>DEFINITION_ORDER</sorting>
  </component>
  <component name="ProjectFrameBounds" extendedState="7">
    <option name="x" value="82" />
    <option name="y" value="38" />
    <option name="width" value="1400" />
    <option name="height" value="1000" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <expand>
            <path>
              <item name="DB Apps Introduction - JDBC" type="b2602c69:ProjectViewProjectNode" />
              <item name="DB Apps Introduction - JDBC" type="462c0819:PsiDirectoryNode" />
            </path>
            <path>
              <item name="DB Apps Introduction - JDBC" type="b2602c69:ProjectViewProjectNode" />
              <item name="DB Apps Introduction - JDBC" type="462c0819:PsiDirectoryNode" />
              <item name="src" type="462c0819:PsiDirectoryNode" />
            </path>
            <path>
              <item name="DB Apps Introduction - JDBC" type="b2602c69:ProjectViewProjectNode" />
              <item name="DB Apps Introduction - JDBC" type="462c0819:PsiDirectoryNode" />
              <item name="src" type="462c0819:PsiDirectoryNode" />
              <item name="company" type="462c0819:PsiDirectoryNode" />
            </path>
            <path>
              <item name="DB Apps Introduction - JDBC" type="b2602c69:ProjectViewProjectNode" />
              <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
            </path>
          </expand>
          <select />
        </subPane>
      </pane>
      <pane id="PackagesPane" />
      <pane id="AndroidView" />
      <pane id="Scope" />
      <pane id="Scratches" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="aspect.path.notification.shown" value="true" />
    <property name="last_opened_file_path" value="C:/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar!/" />
    <property name="project.structure.last.edited" value="Global Libraries" />
    <property name="project.structure.proportion" value="0.15" />
    <property name="project.structure.side.proportion" value="0.2" />
  </component>
  <component name="RunDashboard">
    <option name="ruleStates">
      <list>
        <RuleState>
          <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
        </RuleState>
        <RuleState>
          <option name="name" value="StatusDashboardGroupingRule" />
        </RuleState>
      </list>
    </option>
  </component>
  <component name="RunManager" selected="Application.Main">
    <configuration name="Main" type="Application" factoryName="Application" temporary="true">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <option name="MAIN_CLASS_NAME" value="com.company.FirstTestMain" />
      <option name="VM_PARAMETERS" value="" />
      <option name="PROGRAM_PARAMETERS" value="" />
      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" value="" />
      <option name="ENABLE_SWING_INSPECTOR" value="false" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <module name="DB Apps Introduction - JDBC" />
      <envs />
      <RunnerSettings RunnerId="Run" />
      <ConfigurationWrapper RunnerId="Run" />
    </configuration>
    <configuration default="true" type="Application" factoryName="Application">
      <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
      <option name="MAIN_CLASS_NAME" />
      <option name="VM_PARAMETERS" />
      <option name="PROGRAM_PARAMETERS" />
      <option name="WORKING_DIRECTORY" />
      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
      <option name="ALTERNATIVE_JRE_PATH" />
      <option name="ENABLE_SWING_INSPECTOR" value="false" />
      <option name="ENV_VARIABLES" />
      <option name="PASS_PARENT_ENVS" value="true" />
      <module name="" />
      <envs />
      <method />
    </configuration>
    <recent_temporary>
      <list size="1">
        <item index="0" class="java.lang.String" itemvalue="Application.Main" />
      </list>
    </recent_temporary>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="e594465c-4a1c-406f-a3bf-a17ec7ca0b21" name="Default" comment="" />
      <created>1521133979740</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1521133979740</updated>
      <workItem from="1521133983444" duration="13524000" />
    </task>
    <servers />
  </component>
  <component name="TimeTrackingManager">
    <option name="totallyTimeSpent" value="13524000" />
  </component>
  <component name="ToolWindowManager">
    <frame x="-8" y="-8" width="1936" height="1056" extended-state="7" />
    <editor active="true" />
    <layout>
      <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
      <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3290735" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19427083" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.399361" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="TypeScriptGeneratedFilesManager">
    <option name="version" value="1" />
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager>
      <option name="time" value="1" />
    </breakpoint-manager>
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="jar://C:/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar!/com/mysql/jdbc/NonRegisteringDriver.class">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="178">
          <caret line="118" column="0" lean-forward="false" selection-start-line="118" selection-start-column="0" selection-end-line="118" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/src/com/company/FirstTestMain.java">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="200">
          <caret line="8" column="118" lean-forward="false" selection-start-line="8" selection-start-column="105" selection-end-line="8" selection-end-column="118" />
          <folding>
            <element signature="imports" expanded="true" />
            <marker date="1521218165267" expanded="true" signature="1145:1189" ph="SELECT * FRO... employees" />
          </folding>
        </state>
      </provider>
    </entry>
  </component>
  <component name="masterDetails">
    <states>
      <state key="ArtifactsStructureConfigurable.UI">
        <settings>
          <artifact-editor />
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
      <state key="FacetStructureConfigurable.UI">
        <settings>
          <last-edited>No facets are configured</last-edited>
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
      <state key="GlobalLibrariesConfigurable.UI">
        <settings>
          <last-edited>mysql-connector-java-5.1.46-bin</last-edited>
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
      <state key="JdkListConfigurable.UI">
        <settings>
          <last-edited>1.8</last-edited>
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
      <state key="ModuleStructureConfigurable.UI">
        <settings>
          <last-edited>DB Apps Introduction - JDBC</last-edited>
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
                <option value="0.6" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
      <state key="ProjectLibrariesConfigurable.UI">
        <settings>
          <splitter-proportions>
            <option name="proportions">
              <list>
                <option value="0.2" />
              </list>
            </option>
          </splitter-proportions>
        </settings>
      </state>
    </states>
  </component>
</project>


text:
sap.ui.define(['jquery.sap.global'],
	function(jQuery) {
		"use strict";

		function buildDocuJSON(xml, oConfig) {
			var xmlDom = xml2dom(xml, oConfig);
			var aSingles = ["topictitle1", "shortdesc"];

			var processSingleNode = function(className, xmlDOMObj) {
				var oXMLDOM = xmlDOMObj || xmlDom;
				var oNodes = oXMLDOM.getElementsByClassName(className);
				if (oNodes.length === 0) {
					return '';
				}
				var nodeText = jQuery("
").html(removeHTMLTags(oNodes[0].innerHTML)).text();
				return oNodes && oNodes.length > 0 && ("innerHTML" in oNodes[0]) && nodeText || '';
			};

			var removeHTMLTags = function(txt) {
				return txt.replace(/<[^>]*>/g, " ")
						.replace(/\s{2,}/g, ' ');
			};

			/**
			 * Adjusts link href values
			 * @param element The DOM element which may contain cross reference links
			 */
			var fixLinks = function(element) {
				var links = element.querySelectorAll("a.xref, a.link, area"),
					i,
					link,
					href,
					startsWithHash,
					startsWithHTTP;

				for (i = 0; i < links.length; i++) {
					link = links[i];
					href = link.getAttribute("href");
					startsWithHash = href.indexOf("#") == 0;
					startsWithHTTP = href.indexOf("http") == 0;

					// absolute links should open in a new window
					if (startsWithHTTP) {
						link.setAttribute('target', '_blank');
					}
					// absolute links and links starting with # are ok and should not be modified
					if (startsWithHTTP || startsWithHash) {
						continue;
					}

					// API reference are recognized by "/docs/api/" string
					if (href.indexOf("/docs/api/") > -1) {
						href = href.substr(0, href.lastIndexOf(".html"));
						href = href.substr(href.lastIndexOf('/') + 1);
						href = "#/api/" + href;
					} else if (href.indexOf("explored.html") > -1) { // explored app links have explored.html in them
						href = href.split("../").join("");
						href = oConfig.exploredURI + href;
					} else { // we assume all other links are links to other documentation pages
						href = href.substr(0, href.lastIndexOf(".html"));
						href = "#/topic/" + href;
					}

					link.setAttribute("href", href);
				}
			};

			var fixImgLocation = function(element) {
				var images = element.querySelectorAll("img");

				for (var i = 0; i < images.length; i++) {
					images[i].setAttribute("src", oConfig.docuPath + images[i].getAttribute("src"));
				}

				return element.innerHTML;
			};

			var processSections = function() {
				/* "Invalid DOM Elements" (ones that should not be added to the body) are:
					- all scripts
					- element with class topictitle1 (this is used as title)
					- element with class shortdesc (this is used as subtitle)
					- element with id local-navigation (this is the left-side navigation which we already have)
					- element with tag header
					- element with id footer-container
					- element with id nav.mobile-nav
					- element with id breadcrumb-container
					- element with id content-toolbar (it contains info about the previous page)
					- element with class related-links (it contains the related links info and should have a custom position)
				 */
				var wrapperContainer = xmlDom,
					invalidChildren = wrapperContainer.querySelectorAll("script, .topictitle1, .shortdesc, #local-navigation, header, #footer-container, nav.mobile-nav, #breadcrumb-container, #content-toolbar"),
					invalidChildParent, i;

				for (var i = 0; i < invalidChildren.length; i++) {
					invalidChildParent = invalidChildren[i].parentElement;
					invalidChildParent.removeChild(invalidChildren[i]);
				}

				fixLinks(wrapperContainer);
				fixImgLocation(wrapperContainer);

				json['html'] =  wrapperContainer.innerHTML;
			};

			var json = {};
			aSingles.forEach(function(singleNode, idx){
				json[singleNode] = processSingleNode(singleNode);
			});

			processSections();

			return json;

		}

		function xml2dom(xml, oConfig) {
			var dom = jQuery.parseHTML(xml);
			var mainDivName = oConfig.topicHtmlMainDivId;
			for (var i = 0; i < dom.length; i++) {
				if (dom[i].getAttribute && dom[i].getAttribute("id") === mainDivName) {
					var newHTML = '
' + dom[i].innerHTML + '
';
					dom[i].innerHTML = newHTML;
					return dom[i];
				}
			}
		}

		return {
			DomXml2JSON : buildDocuJSON,
			XML2DOM: xml2dom,
			XML2JSON: buildDocuJSON
		};

	});


text:
package com.marcus_chang.test.Project_Stage_X_Iteration_X.Module_X;

import com.marcus_chang.test.TestUtils.ProjectParams;
import com.marcus_chang.test.TestUtils.TestUtilFunctions;
import junit.framework.Assert;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.SimpleLayout;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by changxuliang(marcus chang) on 2015/3/17.
 * This java file is used for the auto ui test of the test case X on the Matrix
 * It covers Firefox, Firefox & IE
 */
public class TestCase_X_Firefox {
    @Test
    /**
     *-> TestCaseName_HomePage_Firefox_Test() is used for test the homepage go top function
     */
    public void TestCaseName_HomePage_Firefox_Test() throws IOException {
        //Try to get this file's parent path
        String parentPath = System.getProperty("user.dir");

        Logger logger = Logger.getLogger(TestCase_X_Firefox.class);
        //BasicConfigurator.configure();

        Properties prop = new Properties();

        prop.setProperty("log4j.rootLogger", "ALL, FirefoxTestOutputFile");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile", "org.apache.log4j.FileAppender");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.File", parentPath + ProjectParams.FirefoxTest_X_HomePage_LayOut);
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout", "org.apache.log4j.PatternLayout");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout.ConversionPattern", "%d{HH:mm:ss,SSS} [%t] %-5p %C{1} : %m%n");

        PropertyConfigurator.configure(prop);

        //logger.setLevel(Level.ALL);
        SimpleLayout FirefoxTest_X_layout = new SimpleLayout();
        //HTMLLayout htmlLayout = new HTMLLayout();
        FileAppender FirefoxTest_X_appender = null;
        //create the selenium verify | assert methods object
        //SeleneseTestBase seleneseTestBase=new SeleneseTestBase();

        try {
            System.out.println(parentPath);
            System.out.println();
            FirefoxTest_X_appender = new FileAppender(FirefoxTest_X_layout, parentPath + ProjectParams.FirefoxTest_X_HomePage_LayOut, false);
        } catch (Exception e) {
            logger.fatal("the FileAppender cannot be initialized, please check the output path!");
        }

        logger.addAppender(FirefoxTest_X_appender);
        logger.info("-----> Begin to set the driver properties : Firefox driver path = " + ProjectParams.FireFoxDriverLocalPath + " <-----");

        // setup the local FireFox driver path
        System.setProperty("webdriver.firefox.bin", ProjectParams.FireFoxDriverLocalPath);
        //create a FirefoxDriver instance
        WebDriver driver = new FirefoxDriver();
        //Open the target URL
        driver.get(ProjectParams.TestURL);
        //create the testUtilFunctions instance
        TestUtilFunctions testUtil = new TestUtilFunctions();
        //maximize the window
        driver.manage().window().maximize();

        testUtil.waitForElement(driver, By.id("simplemodal-data"), (long)5000);

        if (testUtil.isElementPresent(driver, By.id("simplemodal-data"))) {

            WebElement Btn_PopUp21Medal_Close = driver.findElement(By.xpath("//*[@id=\"simplemodal-data\"]/span[1]"));
            testUtil.waitForTime(2000);
            Btn_PopUp21Medal_Close.click();

        } else {
            System.out.println("The 21 metal is not located!");
        }

        //execute the JS to simulate the scroll action which jump to the bottom of the homepage
        testUtil.waitForTime(3000);
        ((JavascriptExecutor) driver).executeScript("scrollTo(0,10000)");

        testUtil.waitForElement(driver, By.id("gotop"), (long)2000);
        WebElement Btn_GoTop = driver.findElement(By.id("gotop"));

        Assert.assertTrue((Btn_GoTop.isDisplayed()));

        if (Btn_GoTop.isDisplayed()){

            Btn_GoTop.click();
            testUtil.waitForTime(3000);
            //verify the page is scrolled to the top when the webdriver sims click the "Jump to Top" button
            WebElement tab_left_banner = driver.findElement(By.id("tab_left"));
            Assert.assertTrue(tab_left_banner.isDisplayed());

        }else{
            System.out.println("the button [Jump to Top] is not found");
        }

        //close the browser after all above test
        driver.quit();
    }

    @Test
    /**
     *-> TestCaseName_StandardTopic_Firefox_Test() is used for test the standard topic go top function
     */
    public void TestCaseName_StandardTopic_Firefox_Test() throws IOException {
        //Try to get this file's parent path
        String parentPath = System.getProperty("user.dir");

        Logger logger = Logger.getLogger(TestCase_X_Firefox.class);
        //BasicConfigurator.configure();

        Properties prop = new Properties();

        prop.setProperty("log4j.rootLogger", "ALL, FirefoxTestOutputFile");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile", "org.apache.log4j.FileAppender");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.File", parentPath + ProjectParams.FirefoxTest_X_StdTopic_LayOut);
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout", "org.apache.log4j.PatternLayout");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout.ConversionPattern", "%d{HH:mm:ss,SSS} [%t] %-5p %C{1} : %m%n");

        PropertyConfigurator.configure(prop);

        //logger.setLevel(Level.ALL);
        SimpleLayout FirefoxTest_X_layout = new SimpleLayout();
        //HTMLLayout htmlLayout = new HTMLLayout();
        FileAppender FirefoxTest_X_appender = null;
        //create the selenium verify | assert methods object
        //SeleneseTestBase seleneseTestBase=new SeleneseTestBase();

        try {
            System.out.println(parentPath);
            System.out.println();
            FirefoxTest_X_appender = new FileAppender(FirefoxTest_X_layout, parentPath + ProjectParams.FirefoxTest_X_StdTopic_LayOut, false);
        } catch (Exception e) {
            logger.fatal("the FileAppender cannot be initialized, please check the output path!");
        }

        logger.addAppender(FirefoxTest_X_appender);
        logger.info("-----> Begin to set the driver properties : Firefox driver path = " + ProjectParams.FireFoxDriverLocalPath + " <-----");

        //  setup the local Firefox driver path
        System.setProperty("webdriver.firefox.bin", ProjectParams.FireFoxDriverLocalPath);
        // create a FirefoxDriver instance
        WebDriver driver = new FirefoxDriver();
        // Open the target URL
        driver.get(ProjectParams.StandardTopicURL);
        //create the testUtilFunctions instance
        TestUtilFunctions testUtil = new TestUtilFunctions();
        //maximize the window
        driver.manage().window().maximize();

        testUtil.waitForElement(driver, By.id("simplemodal-data"), (long)5000);

        if (testUtil.isElementPresent(driver, By.id("simplemodal-data"))) {

            WebElement Btn_PopUp21Medal_Close = driver.findElement(By.xpath("//*[@id=\"simplemodal-data\"]/span[1]"));
            testUtil.waitForTime(2000);
            Btn_PopUp21Medal_Close.click();

        } else {
            System.out.println("The 21 metal is not located!");
        }

        //execute the JS to simulate the scroll action which jump to the bottom of the homepage
        testUtil.waitForTime(3000);
        ((JavascriptExecutor) driver).executeScript("scrollTo(0,10000)");

        testUtil.waitForElement(driver, By.id("gotop"), (long)2000);
        WebElement Btn_GoTop = driver.findElement(By.id("gotop"));

        Assert.assertTrue((Btn_GoTop.isDisplayed()));

        if (Btn_GoTop.isDisplayed()){

            Btn_GoTop.click();
            testUtil.waitForTime(3000);
            //verify the page is scrolled to the top when the webdriver sims click the "Jump to Top" button
            WebElement share_title = driver.findElement(By.xpath("//*[@id=\"share_title\"]"));
            Assert.assertTrue(share_title.isDisplayed());

        }else{
            System.out.println("the button [Jump to Top] is not found");
        }

        // close the browser after all above test
        driver.quit();
    }

    @Test
    /**
     *-> TestCaseName_PKTopic_Firefox_Test() is used for test the PK topic go top function
     */
    public void TestCaseName_PKTopic_Firefox_Test() throws IOException {
        //Try to get this file's parent path
        String parentPath = System.getProperty("user.dir");

        Logger logger = Logger.getLogger(TestCase_X_Firefox.class);
        //BasicConfigurator.configure();

        Properties prop = new Properties();

        prop.setProperty("log4j.rootLogger", "ALL, FirefoxTestOutputFile");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile", "org.apache.log4j.FileAppender");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.File", parentPath + ProjectParams.FirefoxTest_X_PKTopic_LayOut);
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout", "org.apache.log4j.PatternLayout");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout.ConversionPattern", "%d{HH:mm:ss,SSS} [%t] %-5p %C{1} : %m%n");

        PropertyConfigurator.configure(prop);

        //logger.setLevel(Level.ALL);
        SimpleLayout FirefoxTest_X_layout = new SimpleLayout();
        //HTMLLayout htmlLayout = new HTMLLayout();
        FileAppender FirefoxTest_X_appender = null;
        //create the selenium verify | assert methods object
        //SeleneseTestBase seleneseTestBase=new SeleneseTestBase();

        try {
            System.out.println(parentPath);
            System.out.println();
            FirefoxTest_X_appender = new FileAppender(FirefoxTest_X_layout, parentPath + ProjectParams.FirefoxTest_X_PKTopic_LayOut, false);
        } catch (Exception e) {
            logger.fatal("the FileAppender cannot be initialized, please check the output path!");
        }

        logger.addAppender(FirefoxTest_X_appender);
        logger.info("-----> Begin to set the driver properties : Firefox driver path = " + ProjectParams.FireFoxDriverLocalPath + " <-----");

        //  setup the local Firefox driver path
        System.setProperty("webdriver.firefox.bin", ProjectParams.FireFoxDriverLocalPath);
        // create a FirefoxDriver instance
        WebDriver driver = new FirefoxDriver();
        // Open the target URL
        driver.get(ProjectParams.PKTopicURL);
        //create the testUtilFunctions instance
        TestUtilFunctions testUtil = new TestUtilFunctions();
        //maximize the window
        driver.manage().window().maximize();

        testUtil.waitForElement(driver, By.id("simplemodal-data"), (long)5000);

        if (testUtil.isElementPresent(driver, By.id("simplemodal-data"))) {

            WebElement Btn_PopUp21Medal_Close = driver.findElement(By.xpath("//*[@id=\"simplemodal-data\"]/span[1]"));
            testUtil.waitForTime(2000);
            Btn_PopUp21Medal_Close.click();

        } else {
            System.out.println("The 21 metal is not located!");
        }

        //execute the JS to simulate the scroll action which jump to the bottom of the homepage
        testUtil.waitForTime(3000);
        ((JavascriptExecutor) driver).executeScript("scrollTo(0,10000)");

        testUtil.waitForElement(driver, By.id("gotop"), (long)2000);
        WebElement Btn_GoTop = driver.findElement(By.id("gotop"));

        Assert.assertTrue((Btn_GoTop.isDisplayed()));

        if (Btn_GoTop.isDisplayed()){

            Btn_GoTop.click();
            testUtil.waitForTime(3000);
            //verify the page is scrolled to the top when the webdriver sims click the "Jump to Top" button
            WebElement share_title = driver.findElement(By.xpath("//*[@id=\"share_title\"]"));
            Assert.assertTrue(share_title.isDisplayed());

        }else{
            System.out.println("the button [Jump to Top] is not found");
        }

        // close the browser after all above test
        driver.quit();
    }

    @Test
    /**
     *-> TestCaseName_SKUdetails_Firefox_Test() is used for test the SKU details page go top function
     */
    public void TestCaseName_SKUdetails_Firefox_Test() throws IOException {
        //Try to get this file's parent path
        String parentPath = System.getProperty("user.dir");

        Logger logger = Logger.getLogger(TestCase_X_Firefox.class);
        //BasicConfigurator.configure();

        Properties prop = new Properties();

        prop.setProperty("log4j.rootLogger", "ALL, FirefoxTestOutputFile");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile", "org.apache.log4j.FileAppender");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.File", parentPath + ProjectParams.FirefoxTest_X_SkuDetailsPage_LayOut);
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout", "org.apache.log4j.PatternLayout");
        prop.setProperty("log4j.appender.FirefoxTestOutputFile.layout.ConversionPattern", "%d{HH:mm:ss,SSS} [%t] %-5p %C{1} : %m%n");

        PropertyConfigurator.configure(prop);

        //logger.setLevel(Level.ALL);
        SimpleLayout FirefoxTest_X_layout = new SimpleLayout();
        //HTMLLayout htmlLayout = new HTMLLayout();
        FileAppender FirefoxTest_X_appender = null;
        //create the selenium verify | assert methods object
        //SeleneseTestBase seleneseTestBase=new SeleneseTestBase();

        try {
            System.out.println(parentPath);
            System.out.println();
            FirefoxTest_X_appender = new FileAppender(FirefoxTest_X_layout, parentPath + ProjectParams.FirefoxTest_X_SkuDetailsPage_LayOut, false);
        } catch (Exception e) {
            logger.fatal("the FileAppender cannot be initialized, please check the output path!");
        }

        logger.addAppender(FirefoxTest_X_appender);
        logger.info("-----> Begin to set the driver properties : Firefox driver path = " + ProjectParams.FireFoxDriverLocalPath + " <-----");

        //  setup the local Firefox driver path
        System.setProperty("webdriver.firefox.bin", ProjectParams.FireFoxDriverLocalPath);
        // create a FirefoxDriver instance
        WebDriver driver = new FirefoxDriver();
        // Open the target URL
        driver.get(ProjectParams.SKUDetailsURL);
        //create the testUtilFunctions instance
        TestUtilFunctions testUtil = new TestUtilFunctions();
        //maximize the window
        driver.manage().window().maximize();

        testUtil.waitForElement(driver, By.id("simplemodal-data"), (long)5000);

        if (testUtil.isElementPresent(driver, By.id("simplemodal-data"))) {

            WebElement Btn_PopUp21Medal_Close = driver.findElement(By.xpath("//*[@id=\"simplemodal-data\"]/span[1]"));
            testUtil.waitForTime(2000);
            Btn_PopUp21Medal_Close.click();

        } else {
            System.out.println("The 21 metal is not located!");
        }

        //execute the JS to simulate the scroll action which jump to the bottom of the homepage
        testUtil.waitForTime(3000);
        ((JavascriptExecutor) driver).executeScript("scrollTo(0,10000)");

        testUtil.waitForElement(driver, By.id("gotop"), (long)2000);
        WebElement Btn_GoTop = driver.findElement(By.id("gotop"));

        Assert.assertTrue((Btn_GoTop.isDisplayed()));

        if (Btn_GoTop.isDisplayed()){

            Btn_GoTop.click();
            testUtil.waitForTime(3000);
            //verify the page is scrolled to the top when the webdriver sims click the "Jump to Top" button
            WebElement Test_logo = driver.findElement(By.xpath("/html/body/div[2]/h1/a[2]/img"));
            Assert.assertTrue(Test_logo.isDisplayed());

        }else{
            System.out.println("the button [Jump to Top] is not found");
        }

        // close the browser after all above test
        driver.quit();
    }

}


text:
using namespace std;

class Crawler {
    public:
        Crawler(
            unordered_set <string> roots,
            const string &hostWhitelistFilename,
            const string &hostBlacklistFilename,
            const string &destDir,
            const int numPagesToCrawl,
            const size_t concurrencyLimit
        );
        ~Crawler();

        void readFileToSet(const string &filename, unordered_set <string> set);
        void crawlTask(string);
        string exec(const char*);
        void startCrawl();

    private:
        unordered_set <string> roots;
        unordered_set <string> hostWhitelist;
        unordered_set <string> hostBlacklist;
        unordered_set <string> seenUrls;
        queue <string> crawlQueue;
        ThreadPool pool;
        atomic <int> numPagesCrawled {0};
        string dataDirectory;
        hash <string> h;
};
#endif // CRAWLER_H


text:
-- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Oct 22, 2017 at 08:57 AM
-- Server version: 5.7.14
-- PHP Version: 5.6.25

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `documenttrackingsystem`
--

-- --------------------------------------------------------

--
-- Table structure for table `colleges`
--

CREATE TABLE `colleges` (
  `collegeId` varchar(50) NOT NULL,
  `collegefull` varchar(100) NOT NULL,
  `collegeDesc` varchar(200) NOT NULL,
  `collegeDean` varchar(50) NOT NULL,
  `collegeLogo` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `colleges`
--

INSERT INTO `colleges` (`collegeId`, `collegefull`, `collegeDesc`, `collegeDean`, `collegeLogo`) VALUES
('COE', 'College of Engineering', 'cater engineering stuffs', 'hitler', 'http://localhost/Document-Tracking-System-BSIT3A/assets/images/COElogo1.jpg'),
('COS', 'College of Sciences', 'Caters technological courses', 'Renegado', 'http://localhost/Document-Tracking-System-BSIT3A/assets/images/');

-- --------------------------------------------------------

--
-- Table structure for table `contactus`
--

CREATE TABLE `contactus` (
  `idno` int(11) NOT NULL,
  `sender` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `content` varchar(300) NOT NULL,
  `datecreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dateseen` varchar(50) NOT NULL,
  `seen` tinyint(1) NOT NULL,
  `bookmarked` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `contactus`
--

INSERT INTO `contactus` (`idno`, `sender`, `email`, `content`, `datecreated`, `dateseen`, `seen`, `bookmarked`) VALUES
(1, 'Mwen', 'mw.cabuang@gmail.com', 'HELLO FAFA', '2017-09-30 03:53:03', '2017-10-01 04:25:15pm', 1, 1),
(2, 'Giane Noda', 'giane.noda@gmail.com', 'Umutot ako kanina', '2017-09-30 12:55:16', '2017-10-03 05:44:06pm', 1, 0),
(5, 'Mark Wendell Cabuang', 'aocabuang@gmail.com', 'why is it that you are not updating the functions?', '2017-10-12 10:18:07', '2017-10-21 04:01:16 pm', 1, 0),
(6, 'Luis Felipe Lazaro', 'luisfelipelazaro@gmail.com', 'isheteyo isheteyo naninai nai nai HAHHAHA', '2017-10-12 10:42:53', '', 0, 0),
(7, 'mwen', 'mwen@gmail.com', '13man', '2017-10-14 05:51:19', '', 0, 0),
(8, 'Mark Wendell Cabuang', 'AoCabuang@gmail.com', '', '2017-10-14 23:47:19', '', 0, 0);

-- --------------------------------------------------------

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `deptId` int(10) NOT NULL,
  `collegeId` varchar(50) NOT NULL,
  `department` varchar(100) NOT NULL,
  `departmentHead` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`deptId`, `collegeId`, `department`, `departmentHead`) VALUES
(206, 'COS', 'Physics Department', ''),
(225, 'COE', 'Mechanical Department', ''),
(322, 'COE', 'Electrical Engineering Department', ''),
(865, 'COE', 'MechatronicsEngineering Department', ''),
(880, 'COS', 'Mathematics Department', '');

-- --------------------------------------------------------

--
-- Table structure for table `documents`
--

CREATE TABLE `documents` (
  `id` int(2) NOT NULL,
  `trackcode` varchar(10) NOT NULL,
  `filename` varchar(100) NOT NULL,
  `fileDesc` varchar(400) NOT NULL,
  `path` varchar(400) NOT NULL,
  `sender` varchar(100) NOT NULL,
  `receiver` varchar(100) NOT NULL,
  `datecreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dateReceived` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` varchar(100) NOT NULL,
  `seen` tinyint(1) NOT NULL,
  `sentDelete` tinyint(1) NOT NULL,
  `inboxDelete` tinyint(1) NOT NULL,
  `draft` tinyint(1) NOT NULL,
  `draftDelete` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `documents`
--

INSERT INTO `documents` (`id`, `trackcode`, `filename`, `fileDesc`, `path`, `sender`, `receiver`, `datecreated`, `dateReceived`, `status`, `seen`, `sentDelete`, `inboxDelete`, `draft`, `draftDelete`) VALUES
(95, '757-854-79', 'test6.jpg', 'test6', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg', '1', '7896', '2017-10-15 15:12:24', '0000-00-00 00:00:00', 'pending', 0, 0, 0, 0, 0),
(96, '356-080-69', 'savetest1.jpg', 'savetest1', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg', '1', '7896', '2017-10-15 15:16:17', '0000-00-00 00:00:00', 'pending', 0, 0, 0, 1, 0),
(97, '845-753-89', 'heyah.jpg', 'heyah', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg', '7896', '1', '2017-10-16 13:57:41', '0000-00-00 00:00:00', 'pending', 0, 0, 0, 0, 0),
(98, '446-956-05', 'test 2.jpg', 'test 2', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg', 'aomwen', 'admin', '2017-10-16 13:59:26', '2017-10-18 03:49:33', 'received', 1, 0, 0, 0, 0),
(99, '662-222-57', 'test 4.jpg', 'test 4', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg', 'aomwen', 'rbituonan', '2017-10-16 14:22:35', '0000-00-00 00:00:00', 'pending', 0, 0, 0, 0, 0),
(100, '348-197-27', 'test.jpg', 'test', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg', 'aomwen', 'rbituonan', '2017-10-16 14:22:52', '0000-00-00 00:00:00', 'pending', 0, 0, 0, 1, 0);

-- --------------------------------------------------------

--
-- Table structure for table `files`
--

CREATE TABLE `files` (
  `fileId` int(11) NOT NULL,
  `fileName` varchar(100) NOT NULL,
  `fileAuthor` varchar(100) NOT NULL,
  `fileCode` varchar(4) NOT NULL,
  `fileCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `fileComment` varchar(100) NOT NULL,
  `filePath` varchar(300) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `files`
--

INSERT INTO `files` (`fileId`, `fileName`, `fileAuthor`, `fileCode`, `fileCreated`, `fileComment`, `filePath`) VALUES
(1, 'auditory of salary', 'aomwen', '4567', '2017-10-17 06:23:34', 'Recheck: all of the record properly', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg'),
(2, 'Manual', 'admin', '6069', '2017-10-17 07:20:30', 'How to use the system', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/bg4.jpg'),
(3, 'books', 'admin', '5569', '2017-10-20 04:13:49', 'hehehe', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/if_book_461367.png'),
(6, 'Networking', 'aomwen', '7106', '2017-10-20 14:35:34', 'Laboratory Activiy', 'http://localhost/BEFOREABBIE/Document-Tracking-System-BSIT3A/uploads/lab-2_6_2.pdf'),
(7, 'mga ating nakaw', 'aomwen', '6565', '2017-10-20 15:11:45', 'nakaw namin tong budget', 'http://localhost/BEFOREABBIE/Document-Tracking-System-BSIT3A/uploads/lab-2_6_2.pdf'),
(8, 'compose test 1', 'aomwen', '9568', '2017-10-20 15:31:27', 'testing compose', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/lab-2_6_2.pdf'),
(9, 'auditory of salary (Mathematics Dept)', 'aomwen', '8371', '2017-10-20 15:33:41', 'year 2017', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/lab-2_6_2.pdf'),
(10, 'download test', 'aomwen', '1136', '2017-10-21 04:28:14', 'testing download', 'http://localhost/BEFOREABBIE/Document-Tracking-System-BSIT3A/uploads/lab-2_6_2.pdf');

-- --------------------------------------------------------

--
-- Table structure for table `forwardroute`
--

CREATE TABLE `forwardroute` (
  `routeId` int(4) NOT NULL,
  `fileCode` varchar(100) NOT NULL,
  `fileName` varchar(100) NOT NULL,
  `forwardComment` varchar(200) NOT NULL,
  `forwardDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `sender` varchar(100) NOT NULL,
  `receiver` varchar(100) NOT NULL,
  `allowLog` tinyint(1) NOT NULL,
  `allowForward` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `forwardroute`
--

INSERT INTO `forwardroute` (`routeId`, `fileCode`, `fileName`, `forwardComment`, `forwardDate`, `sender`, `receiver`, `allowLog`, `allowForward`) VALUES
(1425, '4567', 'auditory of salary', 'Rechech: files properly', '2017-10-17 06:24:06', 'aomwen', 'giane.noda', 1, 1),
(8600, '6069', 'Manual', 'read this', '2017-10-17 07:21:56', 'admin', 'aomwen', 1, 1);

-- --------------------------------------------------------

--
-- Table structure for table `positions`
--

CREATE TABLE `positions` (
  `positionId` int(11) NOT NULL,
  `position` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `positions`
--

INSERT INTO `positions` (`positionId`, `position`) VALUES
(1, 'Instructor III'),
(2, 'Instructor II');

-- --------------------------------------------------------

--
-- Table structure for table `registrardoctype`
--

CREATE TABLE `registrardoctype` (
  `typeId` int(11) NOT NULL,
  `docType` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `registrardoctype`
--

INSERT INTO `registrardoctype` (`typeId`, `docType`) VALUES
(1, 'Certificate of Scholarship'),
(2, 'Lost Registration Form'),
(3, 'Transcript of Record'),
(4, 'mmm');

-- --------------------------------------------------------

--
-- Table structure for table `registrardocuments`
--

CREATE TABLE `registrardocuments` (
  `idno` int(11) NOT NULL,
  `regTrackcode` varchar(10) NOT NULL,
  `typeId` int(11) NOT NULL,
  `dateAdmitted` varchar(30) NOT NULL,
  `dateReleased` varchar(30) NOT NULL,
  `status` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `registrardocuments`
--

INSERT INTO `registrardocuments` (`idno`, `regTrackcode`, `typeId`, `dateAdmitted`, `dateReleased`, `status`) VALUES
(1, '614-363-54', 1, '2017-10-20', '2017-10-20', 'For Pickup');

-- --------------------------------------------------------

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `roleId` int(11) NOT NULL,
  `role` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`roleId`, `role`) VALUES
(1, 'Admin'),
(2, 'Faculty'),
(3, 'Registrar'),
(4, 'Department Head'),
(5, 'Dean');

-- --------------------------------------------------------

--
-- Table structure for table `urls`
--

CREATE TABLE `urls` (
  `roleId` int(11) NOT NULL,
  `url` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `urls`
--

INSERT INTO `urls` (`roleId`, `url`) VALUES
(1, 'http://localhost/Document-Tracking-System-BSIT3A/ManageAdmin/viewmsgtoAdmin'),
(1, 'ManageAdmin'),
(1, 'AdminOffices');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `userId` int(4) NOT NULL,
  `username` varchar(20) NOT NULL,
  `password` varchar(20) NOT NULL,
  `path` varchar(400) NOT NULL,
  `email` varchar(50) NOT NULL,
  `position` varchar(20) NOT NULL,
  `collegeId` varchar(20) NOT NULL,
  `department` varchar(50) NOT NULL,
  `firstname` varchar(100) NOT NULL,
  `lastname` varchar(100) NOT NULL,
  `active` tinyint(4) NOT NULL,
  `roleId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`userId`, `username`, `password`, `path`, `email`, `position`, `collegeId`, `department`, `firstname`, `lastname`, `active`, `roleId`) VALUES
(1, 'admin', 'admin', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/user/21268064_1658337384197256_457833495_o.jpg', 'aocabuang@gmail.com', 'Administrator', 'Admin', 'Administration', 'Mark Wendell', 'Cabuang', 1, 1),
(7896, 'aomwen', '123456', 'http://localhost/Document-Tracking-System-BSIT3A/uploads/user/house1.jpg', 'AoCabuang@gmail.com', 'Instructor II', 'COS', 'Mathematics Department', 'Mark Wendell', 'Cabuang', 0, 2);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `colleges`
--
ALTER TABLE `colleges`
  ADD PRIMARY KEY (`collegeId`);

--
-- Indexes for table `contactus`
--
ALTER TABLE `contactus`
  ADD KEY `idno` (`idno`);

--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
  ADD PRIMARY KEY (`deptId`);

--
-- Indexes for table `documents`
--
ALTER TABLE `documents`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `trackcode` (`trackcode`);

--
-- Indexes for table `files`
--
ALTER TABLE `files`
  ADD PRIMARY KEY (`fileId`),
  ADD UNIQUE KEY `fileCode` (`fileCode`);

--
-- Indexes for table `forwardroute`
--
ALTER TABLE `forwardroute`
  ADD PRIMARY KEY (`routeId`);

--
-- Indexes for table `positions`
--
ALTER TABLE `positions`
  ADD PRIMARY KEY (`positionId`);

--
-- Indexes for table `registrardoctype`
--
ALTER TABLE `registrardoctype`
  ADD PRIMARY KEY (`typeId`);

--
-- Indexes for table `registrardocuments`
--
ALTER TABLE `registrardocuments`
  ADD UNIQUE KEY `regTrackcode` (`regTrackcode`),
  ADD KEY `idno` (`idno`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`roleId`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`userId`),
  ADD KEY `userid` (`userId`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `contactus`
--
ALTER TABLE `contactus`
  MODIFY `idno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `documents`
--
ALTER TABLE `documents`
  MODIFY `id` int(2) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=101;
--
-- AUTO_INCREMENT for table `files`
--
ALTER TABLE `files`
  MODIFY `fileId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `positions`
--
ALTER TABLE `positions`
  MODIFY `positionId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `registrardoctype`
--
ALTER TABLE `registrardoctype`
  MODIFY `typeId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `registrardocuments`
--
ALTER TABLE `registrardocuments`
  MODIFY `idno` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `roleId` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


text:
<!DOCTYPE html >

    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />

    <title>A Gantt chart Grow effect</title>

    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A Gantt chart Grow" />

A Gantt chart Grow effect

    <canvas id="cvs" width="500" height="250">[No canvas support]</canvas>

    This goes in the documents header:

<script src="RGraph.common.core.js"></script>
<script src="RGraphgantt.js"></script>

    Put this where you want the chart to show up:

<canvas id="cvs" width="600" height="250">
    [No canvas support]
</canvas>

    This is the code that generates the chart:

<script>
    window.onload = function ()
    {
        var data = [
            [0,5,null,'Fred','Gradient(aqua:white)'],
            [7,10,null,'Barney','Gradient(red:#fdd)'],
            [15,5,null,'Jerry','Gradient(blue:#ddf)'],
            [15,10,null,'Ben','Gradient(green:#dfd)'],
            [23,5,null,'Rachel','Gradient(black:#ddd)'],
            [27,5,null,'Paul','Gradient(gray:white)']
        ];

        var gantt = new RGraph.Gantt({
            id: 'cvs',
            data: data,
            options: {
                borders: false,
                xmax: 30,
                backgroundGridAutofitNumhlines: 6,
                backgroundGridAutofitNumvlines: 30
            }
        }).grow();
    };
</script>

        « Back


text:
package com.distribuit.datos.actor

import akka.actor.{ Actor, ActorLogging, ActorRef, Props }
import akka.routing.FromConfig
import com.distribuit.datos.message._

import scala.collection.mutable

class DatosGuardian(val groups: Map[String, mutable.Buffer[WorkerSchema]]) extends Actor with ActorLogging {
  val datos: ActorRef = context.actorOf(Props[Datos].withRouter(FromConfig()).withDispatcher("akka.actor.dispatcher.datos"), name = "Datos")
  val uniqueIdGenerator: ActorRef = context.actorOf(Props(new UniqueIdGenerator), "UniqueIdGenerator")
  var status: Status = Running
  val groupManagers: Map[String, ActorRef] = groups.map(
    group =>
      group._1 -> context.actorOf(Props(new GroupManager(group._2, datos, uniqueIdGenerator)), group._1)
  )

  sys addShutdownHook {
    status = ShuttingDown
  }

  override def receive: Receive = {
    case ShutDown =>
      datos ! ShutDown
      groupManagers.values.foreach(_ ! ShutDown)
  }
}


text:
from fah_converter import *
print(covert_c_to_f(41.6))
print(test_value)


text:
import {Type} from "@tsed/core";
import {Header} from "swagger-schema-official";

export interface ISwaggerResponses {
    /**
     * Use IResponseOptions.type instead of
     * @deprecated
     */
    use?: Type<any>;
    type?: Type<any>;
    collection?: Type<any>;
    description?: string;
    examples?: { [exampleName: string]: string };
    headers?: { [headerName: string]: Header };
}


text:
#ifndef XEN_VM_APPLIANCE_DECL_H
#define XEN_VM_APPLIANCE_DECL_H

typedef void *xen_vm_appliance;

struct xen_vm_appliance_set;
struct xen_vm_appliance_record;
struct xen_vm_appliance_record_set;
struct xen_vm_appliance_record_opt;
struct xen_vm_appliance_record_opt_set;

#endif


text:
title: "I want your skulls"
excerpt: "PaperFaces portrait of @misfit82 drawn with Paper by 53 on an iPad."
image:
  path: &image /assets/images/paperfaces-misfit82-twitter-lg.jpg
  feature: *image
  thumb: /assets/images/paperfaces-misfit82-twitter-150.jpg
tags: [portrait, illustration, Paper by 53]
---

I want your skulls — I need your skulls. PaperFaces avatar portrait of @misfit82.

{% include boilerplate/paperfaces-2.md %}

Sketching out the composition with pencil.

Work in progress screenshots (Paper by 53).


text:
package cz.tmapy.android.trex.layout;

import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

import java.text.SimpleDateFormat;

import cz.tmapy.android.trex.Const;
import cz.tmapy.android.trex.R;

/**
 * Adapter for track list row
 * Created by Kamil Svoboda on 16.9.2015.
 */
public class TrackDataCursorAdapter extends CursorAdapter {
    private LayoutInflater mInflater;

    public TrackDataCursorAdapter(Context context, Cursor c, int flags) {
        super(context, c, flags);
        mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {

        TextView tagView = (TextView) view.findViewById(R.id.text_tracks_list_item_tag);
        String tag = cursor.getString(1);
        tagView.setText(tag);
        tagView.setVisibility((tag != null && !tag.isEmpty()) ? View.VISIBLE : View.GONE);

        TextView lengthView = (TextView) view.findViewById(R.id.text_tracks_list_item_length);
        Long d = (cursor.getLong(6) - cursor.getLong(2)) / 1000;
        lengthView.setText(String.format("%.2f", (cursor.getFloat(10) / 1000)) + " km");

        TextView durationView = (TextView) view.findViewById(R.id.text_tracks_list_item_duration);
        durationView.setText(String.format("%d:%02d:%02d", d / 3600, (d % 3600) / 60, (d % 60)));

        TextView timeView = (TextView) view.findViewById(R.id.text_tracks_list_item_time);
        timeView.setText(new SimpleDateFormat("H:mm").format(cursor.getLong(2)));

        TextView dateView = (TextView) view.findViewById(R.id.text_tracks_list_item_date);
        dateView.setText(new SimpleDateFormat("d.M.").format(cursor.getLong(2)));

        TextView speedView = (TextView) view.findViewById(R.id.text_tracks_list_item_speed);
        speedView.setText(String.format("%.0f", (cursor.getFloat(11) / 1000) * 3600) + "/" + String.format("%.0f", (cursor.getFloat(12) / 1000) * 3600) + " km/h");

        TextView elevView = (TextView) view.findViewById(R.id.text_tracks_list_item_elevation);
        elevView.setText(String.format("%.0f", cursor.getDouble(13)) + "/" + String.format("%.0f", cursor.getDouble(14)) + " m");

        TextView addView = (TextView) view.findViewById(R.id.text_tracks_list_item_address);
        addView.setText((cursor.getString(5) != null ? cursor.getString(5) + " - " : "") + (cursor.getString(9) != null ? cursor.getString(9) : ""));
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        return mInflater.inflate(R.layout.tracks_listview_row, parent, false);
    }
}