text:
package org.ohdsi.rabbitInAHat;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;

import org.ohdsi.rabbitInAHat.dataModel.Database;
import org.ohdsi.rabbitInAHat.dataModel.Database.CDMVersion;
import org.ohdsi.rabbitInAHat.dataModel.ETL;
import org.ohdsi.rabbitInAHat.dataModel.Field;
import org.ohdsi.rabbitInAHat.dataModel.ItemToItemMap;
import org.ohdsi.rabbitInAHat.dataModel.MappableItem;
import org.ohdsi.rabbitInAHat.dataModel.Mapping;
import org.ohdsi.rabbitInAHat.dataModel.StemTableAdd;
import org.ohdsi.rabbitInAHat.dataModel.Table;
import org.ohdsi.utilities.exception.DuplicateTargetException;
import org.ohdsi.utilities.exception.TypeMismatchException;
import org.ohdsi.whiteRabbit.ObjectExchange;

/**
 * This is the main class for the RabbitInAHat application
 */
public class RabbitInAHatMain implements ResizeListener, ActionListener {

	public final static String		ACTION_CMD_SAVE						= "Save";
	public final static String		ACTION_CMD_SAVE_AS					= "Save As";
	public final static String		ACTION_CMD_SAVE_SQL					= "Save SQL file";
	public final static String		ACTION_CMD_OPEN_ETL_SPECS			= "Open ETL Specs";
	public final static String		ACTION_CMD_OPEN_SCAN_REPORT			= "Open Scan Report";
	public final static String		ACTION_CMD_GENERATE_ETL_DOCUMENT	= "Generate ETL Document";
	public final static String		ACTION_CMD_GENERATE_TEST_FRAMEWORK	= "Generate ETL Test Framework";
	public final static String		ACTION_CMD_GENERATE_PACKAGE_TEST_FRAMEWORK	= "Generate ETL Test Framework (for R Packages)";

	public final static String		ACTION_CMD_DISCARD_COUNTS			= "Discard Value Counts";
	public final static String		ACTION_CMD_FILTER					= "Filter";
	public final static String		ACTION_CMD_MAKE_MAPPING				= "Make Mappings";
	public final static String		ACTION_CMD_REMOVE_MAPPING			= "Remove Mappings";
	public final static String		ACTION_CMD_SET_TARGET_V4			= "CDM v4";
	public final static String		ACTION_CMD_SET_TARGET_V5			= "CDM v5.0.0";
	public final static String		ACTION_CMD_SET_TARGET_V501			= "CDM v5.0.1";
	public final static String		ACTION_ADD_STEM_TABLE				= "Add stem table";
	public final static String		ACTION_CMD_SET_TARGET_CUSTOM		= "Load Custom...";
	public final static String		ACTION_CMD_MARK_COMPLETED			= "Mark Highlighted As Complete";
	public final static String		ACTION_CMD_UNMARK_COMPLETED			= "Mark Highlighted As Incomplete";
	public final static String		ACTION_CMD_HELP						= "Open help Wiki";

	public final static String		WIKI_URL							= "http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:whiterabbit#rabbit-in-a-hat";
	private final static FileFilter	FILE_FILTER_GZ						= new FileNameExtensionFilter("GZIP Files (*.gz)", "gz");
	private final static FileFilter	FILE_FILTER_JSON					= new FileNameExtensionFilter("JSON Files (*.json)", "json");
	private final static FileFilter	FILE_FILTER_DOCX					= new FileNameExtensionFilter("Microsoft Word documents (*.docx)", "docx");
	private final static FileFilter	FILE_FILTER_CSV						= new FileNameExtensionFilter("Text Files (*.csv)", "csv");
	private final static FileFilter	FILE_FILTER_R						= new FileNameExtensionFilter("R script (*.r)", "r");
	private final static FileFilter	FILE_FILTER_XLSX					= new FileNameExtensionFilter("XLSX files (*.xlsx)", "xlsx");
	private final static FileFilter FILE_FILTER_SQL						= new FileNameExtensionFilter("SQL files (*.sql)", "sql");

	private JFrame					frame;
	private JScrollPane				scrollPane1;
	private JScrollPane				scrollPane2;
	private MappingPanel			tableMappingPanel;
	private MappingPanel			fieldMappingPanel;
	private DetailsPanel			detailsPanel;
	private JSplitPane				tableFieldSplitPane;

	private JFileChooser			chooser;

	public static void main(String[] args) {
		new RabbitInAHatMain(args);
	}

	public RabbitInAHatMain(String[] args) {

		// Set look and feel to the system look and feel
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		frame = new JFrame("Rabbit in a Hat");
		frame.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
		frame.setPreferredSize(new Dimension(700, 600));
		frame.setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
		frame.setJMenuBar(createMenuBar());

		ETL etl = new ETL();
		etl.setTargetDatabase(Database.generateCDMModel(CDMVersion.CDMV501));

		ObjectExchange.etl = etl;

		tableMappingPanel = new MappingPanel(etl.getTableToTableMapping());
		tableMappingPanel.addResizeListener(this);
		scrollPane1 = new JScrollPane(tableMappingPanel);
		scrollPane1.setBorder(new TitledBorder("Tables"));
		scrollPane1.getVerticalScrollBar().setUnitIncrement(16);
		scrollPane1.setAutoscrolls(true);
		scrollPane1.setOpaque(true);
		scrollPane1.setBackground(Color.WHITE);

		fieldMappingPanel = new MappingPanel(etl.getTableToTableMapping());
		tableMappingPanel.setSlaveMappingPanel(fieldMappingPanel);
		fieldMappingPanel.addResizeListener(this);
		scrollPane2 = new JScrollPane(fieldMappingPanel);
		scrollPane2.getVerticalScrollBar().setUnitIncrement(16);
		scrollPane2.setVisible(false);
		scrollPane2.setBorder(new TitledBorder("Fields"));

		tableFieldSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane1, scrollPane2);
		tableFieldSplitPane.setDividerLocation(600);
		tableFieldSplitPane.setDividerSize(0);

		detailsPanel = new DetailsPanel();
		detailsPanel.setBorder(new TitledBorder("Details"));
		detailsPanel.setPreferredSize(new Dimension(200, 500));
		detailsPanel.setMinimumSize(new Dimension(0, 0));
		tableMappingPanel.setDetailsListener(detailsPanel);
		fieldMappingPanel.setDetailsListener(detailsPanel);
		JSplitPane leftRightSplinePane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tableFieldSplitPane, detailsPanel);
		leftRightSplinePane.setResizeWeight(0.40);
		frame.add(leftRightSplinePane);

		loadIcons(frame);
		frame.pack();
		frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
		frame.setVisible(true);

		if (args.length > 0) {
			doOpenSpecs(args[0]);
		}
	}

	private void loadIcons(JFrame f) {
		List<Image> icons = new ArrayList<Image>();
		icons.add(loadIcon("RabbitInAHat16.png", f));
		icons.add(loadIcon("RabbitInAHat32.png", f));
		icons.add(loadIcon("RabbitInAHat48.png", f));
		icons.add(loadIcon("RabbitInAHat64.png", f));
		icons.add(loadIcon("RabbitInAHat128.png", f));
		icons.add(loadIcon("RabbitInAHat256.png", f));
		f.setIconImages(icons);
	}

	private Image loadIcon(String name, JFrame f) {
		Image icon = Toolkit.getDefaultToolkit().getImage(RabbitInAHatMain.class.getResource(name));
		MediaTracker mediaTracker = new MediaTracker(f);
		mediaTracker.addImage(icon, 0);
		try {
			mediaTracker.waitForID(0);
			return icon;
		} catch (Exception e1) {
			e1.printStackTrace();
		}
		return null;
	}

	private JMenuBar createMenuBar() {
		JMenuBar menuBar = new JMenuBar();
		JMenu fileMenu = new JMenu("File");
		int menuShortcutMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();

		menuBar.add(fileMenu);

		JMenuItem openScanReportItem = new JMenuItem(ACTION_CMD_OPEN_SCAN_REPORT);
		openScanReportItem.addActionListener(this);
		openScanReportItem.setActionCommand(ACTION_CMD_OPEN_SCAN_REPORT);
		fileMenu.add(openScanReportItem);

		JMenuItem openItem = new JMenuItem(ACTION_CMD_OPEN_ETL_SPECS);
		openItem.addActionListener(this);
		openItem.setActionCommand(ACTION_CMD_OPEN_ETL_SPECS);
		openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, menuShortcutMask));
		fileMenu.add(openItem);

		JMenuItem saveItem = new JMenuItem(ACTION_CMD_SAVE);
		saveItem.addActionListener(this);
		saveItem.setActionCommand(ACTION_CMD_SAVE);
		saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, menuShortcutMask));
		fileMenu.add(saveItem);

		JMenuItem saveAsItem = new JMenuItem(ACTION_CMD_SAVE_AS);
		saveAsItem.addActionListener(this);
		saveAsItem.setActionCommand(ACTION_CMD_SAVE_AS);
		fileMenu.add(saveAsItem);

		JMenuItem saveSQLItem = new JMenuItem(ACTION_CMD_SAVE_SQL);
		saveSQLItem.addActionListener(this);
		saveSQLItem.setActionCommand(ACTION_CMD_SAVE_SQL);
		fileMenu.add(saveSQLItem);

		JMenuItem generateDocItem = new JMenuItem(ACTION_CMD_GENERATE_ETL_DOCUMENT);
		generateDocItem.addActionListener(this);
		generateDocItem.setActionCommand(ACTION_CMD_GENERATE_ETL_DOCUMENT);
		fileMenu.add(generateDocItem);

		JMenuItem generateTestFrameworkItem = new JMenuItem(ACTION_CMD_GENERATE_TEST_FRAMEWORK);
		generateTestFrameworkItem.addActionListener(this);
		generateTestFrameworkItem.setActionCommand(ACTION_CMD_GENERATE_TEST_FRAMEWORK);
		fileMenu.add(generateTestFrameworkItem);

		JMenuItem generatePackageTestFrameworkItem = new JMenuItem(ACTION_CMD_GENERATE_PACKAGE_TEST_FRAMEWORK);
		generatePackageTestFrameworkItem.addActionListener(this);
		generatePackageTestFrameworkItem.setActionCommand(ACTION_CMD_GENERATE_PACKAGE_TEST_FRAMEWORK);
		fileMenu.add(generatePackageTestFrameworkItem);

		JMenu editMenu = new JMenu("Edit");
		menuBar.add(editMenu);

		JMenuItem discardCounts = new JMenuItem(ACTION_CMD_DISCARD_COUNTS);
		discardCounts.addActionListener(this);
		discardCounts.setActionCommand(ACTION_CMD_DISCARD_COUNTS);
		editMenu.add(discardCounts);

		JMenuItem filter = new JMenuItem(ACTION_CMD_FILTER);
		filter.addActionListener(this);
		filter.setActionCommand(ACTION_CMD_FILTER);
		filter.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, menuShortcutMask));
		editMenu.add(filter);

		JMenu setTarget = new JMenu("Set Target Database");

		JMenuItem targetCDMV4 = new JMenuItem(ACTION_CMD_SET_TARGET_V4);
		targetCDMV4.addActionListener(this);
		targetCDMV4.setActionCommand(ACTION_CMD_SET_TARGET_V4);
		setTarget.add(targetCDMV4);

		JMenuItem targetCDMV5 = new JMenuItem(ACTION_CMD_SET_TARGET_V5);
		targetCDMV5.addActionListener(this);
		targetCDMV5.setActionCommand(ACTION_CMD_SET_TARGET_V5);
		setTarget.add(targetCDMV5);

		JMenuItem targetCDMV501 = new JMenuItem(ACTION_CMD_SET_TARGET_V501);
		targetCDMV501.addActionListener(this);
		targetCDMV501.setActionCommand(ACTION_CMD_SET_TARGET_V501);
		setTarget.add(targetCDMV501);

		JMenuItem loadTarget = new JMenuItem(ACTION_CMD_SET_TARGET_CUSTOM);
		loadTarget.addActionListener(this);
		loadTarget.setActionCommand(ACTION_CMD_SET_TARGET_CUSTOM);
		setTarget.add(loadTarget);
		editMenu.add(setTarget);

		JMenuItem addStemTable = new JMenuItem(ACTION_ADD_STEM_TABLE);
		addStemTable.addActionListener(this);
		addStemTable.setActionCommand(ACTION_ADD_STEM_TABLE);
		editMenu.add(addStemTable);

		JMenu arrowMenu = new JMenu("Arrows");
		menuBar.add(arrowMenu);

		JMenuItem makeMappings = new JMenuItem(ACTION_CMD_MAKE_MAPPING);
		makeMappings.addActionListener(this);
		makeMappings.setActionCommand(ACTION_CMD_MAKE_MAPPING);
		makeMappings.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, menuShortcutMask));
		arrowMenu.add(makeMappings);

		JMenuItem removeMappings = new JMenuItem(ACTION_CMD_REMOVE_MAPPING);
		removeMappings.addActionListener(this);
		removeMappings.setActionCommand(ACTION_CMD_REMOVE_MAPPING);
		removeMappings.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, menuShortcutMask));
		arrowMenu.add(removeMappings);

		JMenuItem markCompleted = new JMenuItem(ACTION_CMD_MARK_COMPLETED);
		markCompleted.addActionListener(this);
		markCompleted.setActionCommand(ACTION_CMD_MARK_COMPLETED);
		markCompleted.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, menuShortcutMask));
		arrowMenu.add(markCompleted);

		JMenuItem unmarkCompleted = new JMenuItem(ACTION_CMD_UNMARK_COMPLETED);
		unmarkCompleted.addActionListener(this);
		unmarkCompleted.setActionCommand(ACTION_CMD_UNMARK_COMPLETED);
		unmarkCompleted.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, menuShortcutMask));
		arrowMenu.add(unmarkCompleted);

		// JMenu viewMenu = new JMenu("View");
		// menuBar.add(viewMenu);

		JMenu helpMenu = new JMenu("Help");
		menuBar.add(helpMenu);
		JMenuItem helpItem = new JMenuItem(ACTION_CMD_HELP);
		helpItem.addActionListener(this);
		helpItem.setActionCommand(ACTION_CMD_HELP);
		helpMenu.add(helpItem);

		return menuBar;
	}

	@Override
	public void notifyResized(int height, boolean minimized, boolean maximized) {
		if (scrollPane2.isVisible() == maximized)
			scrollPane2.setVisible(!maximized);

		if (!maximized)
			scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		else
			scrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

		if (!minimized)
			scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		else
			scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

		tableFieldSplitPane.setDividerLocation(height);
	}

	/**
	 * Display file chooser for a path to save or open to
	 *
	 * @param saveMode
	 *            true to display a save dialog, false for open
	 * @param filter
	 *            restrict files displayed
	 * @return if file selected, absolute path of selected file otherwise null
	 */
	private String choosePath(boolean saveMode, FileFilter... filter) {
		String result = null;

		if (chooser == null) {
			chooser = new JFileChooser();
		}
		chooser.resetChoosableFileFilters();
		chooser.setFileFilter(filter[0]);
		for (int i = 1; i < filter.length; i++)
			chooser.addChoosableFileFilter(filter[i]);

		int dialogResult = saveMode ? chooser.showSaveDialog(frame) : chooser.showOpenDialog(frame);
		if (dialogResult == JFileChooser.APPROVE_OPTION)
			result = chooser.getSelectedFile().getAbsolutePath();
		return result;
	}

	private String chooseSavePath(FileFilter... fileFilter) {
		String path = choosePath(true, fileFilter);
		if (path != null && fileFilter[0] == FILE_FILTER_GZ && !path.toLowerCase().endsWith(".json.gz") && !path.toLowerCase().endsWith(".json"))
			path += ".json.gz";
		if (path != null && fileFilter[0] == FILE_FILTER_DOCX && !path.toLowerCase().endsWith(".docx"))
			path += ".docx";
		if (path != null && fileFilter[0] == FILE_FILTER_SQL && !path.toLowerCase().endsWith(".sql"))
			path += ".sql";
		return path;
	}

	private String chooseOpenPath(FileFilter... fileFilter) {
		return choosePath(false, fileFilter);
	}

	@Override
	public void actionPerformed(ActionEvent event) {
		switch (event.getActionCommand()) {
			case ACTION_CMD_SAVE:
				String filename = ObjectExchange.etl.getFilename();
				doSave((filename == null || !filename.toLowerCase().endsWith(".json.gz")) ? chooseSavePath(FILE_FILTER_GZ) : filename);
				break;
			case ACTION_CMD_SAVE_AS:
				doSave(chooseSavePath(FILE_FILTER_GZ, FILE_FILTER_JSON));
				break;
			case ACTION_CMD_SAVE_SQL:
				//TODO finish it
				filename = ObjectExchange.etl.getFilename();
			try {
				doSaveSQL((filename == null || !filename.toLowerCase().endsWith(".sql")) ? chooseSavePath(FILE_FILTER_SQL) : filename);
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
				break;
			case ACTION_CMD_OPEN_ETL_SPECS:
				doOpenSpecs(chooseOpenPath(FILE_FILTER_GZ, FILE_FILTER_JSON));
				break;
			case ACTION_CMD_OPEN_SCAN_REPORT:
				doOpenScanReport(chooseOpenPath(FILE_FILTER_XLSX));
				break;
			case ACTION_CMD_GENERATE_ETL_DOCUMENT:
				doGenerateEtlDoc(chooseSavePath(FILE_FILTER_DOCX));
				break;
			case ACTION_CMD_GENERATE_TEST_FRAMEWORK:
				doGenerateTestFramework(chooseSavePath(FILE_FILTER_R));
				break;
			case ACTION_CMD_GENERATE_PACKAGE_TEST_FRAMEWORK:
				doGeneratePackageTestFramework(chooseSavePath(FILE_FILTER_R));
				break;
			case ACTION_CMD_DISCARD_COUNTS:
				doDiscardCounts();
				break;
			case ACTION_CMD_FILTER:
				doOpenFilterDialog();
				break;
			case ACTION_CMD_MAKE_MAPPING:
				doMakeMappings();
				break;
			case ACTION_CMD_REMOVE_MAPPING:
				doRemoveMappings();
				break;
			case ACTION_CMD_SET_TARGET_V4:
				doSetTargetCDM(CDMVersion.CDMV4);
				break;
			case ACTION_CMD_SET_TARGET_V5:
				doSetTargetCDM(CDMVersion.CDMV5);
				break;
			case ACTION_CMD_SET_TARGET_V501:
				doSetTargetCDM(CDMVersion.CDMV501);
				break;
			case ACTION_CMD_SET_TARGET_CUSTOM:
				doSetTargetCustom(chooseOpenPath(FILE_FILTER_CSV));
				break;
			case ACTION_ADD_STEM_TABLE:
				doAddStemTable();
				break;
			case ACTION_CMD_MARK_COMPLETED:
				doMarkCompleted();
				break;
			case ACTION_CMD_UNMARK_COMPLETED:
				doUnmarkCompleted();
				break;
			case ACTION_CMD_HELP:
				doOpenWiki();
				break;
		}
	}

	private void doAddStemTable() {
		ETL etl = ObjectExchange.etl;
		StemTableAdd.addStemTable(etl);
		ObjectExchange.etl = etl;
		tableMappingPanel.setMapping(etl.getTableToTableMapping());
	}

	private void doGenerateTestFramework(String filename) {
		if (filename != null) {
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			ETLTestFrameWorkGenerator.generate(ObjectExchange.etl, filename);
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private void doGeneratePackageTestFramework(String filename) {
		if (filename != null) {
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			ETLPackageTestFrameWorkGenerator.generate(ObjectExchange.etl, filename);
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private void doOpenWiki() {
		try {
			Desktop desktop = Desktop.getDesktop();
			desktop.browse(new URI(WIKI_URL));
		} catch (URISyntaxException | IOException ex) {

		}
	}

	private void doSetTargetCustom(String fileName) {

		if (fileName != null) {
			File file = new File(fileName);
			InputStream stream;

			try {
				stream = new FileInputStream(file);
				ETL etl = new ETL(ObjectExchange.etl.getSourceDatabase(), Database.generateModelFromCSV(stream, file.getName()));

				etl.copyETLMappings(ObjectExchange.etl);
				tableMappingPanel.setMapping(etl.getTableToTableMapping());
				ObjectExchange.etl = etl;
			} catch (IOException e) {
				// Do nothing if error
			}
		}

	}

	private void doSetTargetCDM(CDMVersion cdmVersion) {
		ETL etl = new ETL(ObjectExchange.etl.getSourceDatabase(), Database.generateCDMModel(cdmVersion));
		etl.copyETLMappings(ObjectExchange.etl);
		tableMappingPanel.setMapping(etl.getTableToTableMapping());
		ObjectExchange.etl = etl;
	}

	private void doOpenFilterDialog() {
		FilterDialog filter;
		filter = new FilterDialog(frame);

		filter.setFilterPanel(tableMappingPanel);

		filter.setVisible(true);
	}

	private void doMakeMappings() {
		if (this.tableMappingPanel.isMaximized()) {
			this.tableMappingPanel.makeMapSelectedSourceAndTarget();
		} else {
			this.fieldMappingPanel.makeMapSelectedSourceAndTarget();
		}

	}

	private void doRemoveMappings() {
		if (this.tableMappingPanel.isMaximized()) {
			this.tableMappingPanel.removeMapSelectedSourceAndTarget();
		} else {
			this.fieldMappingPanel.removeMapSelectedSourceAndTarget();
		}

	}

	private void doDiscardCounts() {
		ObjectExchange.etl.discardCounts();
		detailsPanel.refresh();
	}

	private void doSave(String filename) {
		if (filename != null) {
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			ETL.FileFormat fileFormat = filename.endsWith("json.gz") ? ETL.FileFormat.GzipJson : filename.endsWith("json") ? ETL.FileFormat.Json
					: ETL.FileFormat.Binary;
			ObjectExchange.etl.save(filename, fileFormat);
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private void doOpenSpecs(String filename) {
		if (filename != null) {
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			ETL.FileFormat fileFormat = filename.endsWith(".json.gz") ? ETL.FileFormat.GzipJson : filename.endsWith(".json") ? ETL.FileFormat.Json
					: ETL.FileFormat.Binary;
			try {
				ObjectExchange.etl = ETL.fromFile(filename, fileFormat);
				tableMappingPanel.setMapping(ObjectExchange.etl.getTableToTableMapping());
			} catch (Exception e) {
				e.printStackTrace();
				JOptionPane.showMessageDialog(null, "Invalid File Format", "Error", JOptionPane.ERROR_MESSAGE);
			}
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private void doSaveSQL (String filename) throws FileNotFoundException {
		//TODO
		if (filename != null) {
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			ETL.FileFormat fileFormat = ETL.FileFormat.SQL;

			String comment = null;
			String createTable = null;
			String mapString = null;

			boolean needConcept = false;
			List<Field> conceptList = new ArrayList<>();

			Mapping<Table> tableMap = ObjectExchange.etl.getTableToTableMapping();
			List<MappableItem> list = tableMap.getTargetItems();
			for (MappableItem targetTable : list) {

				List<MappableItem> sourceList = tableMap.getSourceItemsFromTarget(targetTable);

				for (MappableItem sourceTable : sourceList) {
					List<Field> fields = ETLSQLGenerator.castToTable(targetTable).getFields();

					for (Field targetField : fields) {
						if (targetField.getName().toLowerCase().contains("concept")) {
							needConcept = true;
							conceptList.add(targetField);
						}
					}
				}

			}

			if (needConcept) {
				final JFrame parent = new JFrame();
		        JButton button = new JButton();

		        parent.add(button);
		        parent.pack();
		        parent.setVisible(true);

		        button.addActionListener(new java.awt.event.ActionListener() {
		            @Override
		            public void actionPerformed(java.awt.event.ActionEvent evt) {
		                String name = JOptionPane.showInputDialog(parent,
		                        "What is your name?", null);
		            }
		        });
			}

			try {
				comment = ETLSQLGenerator.HEADER_COMMENT;
				createTable = ETLSQLGenerator.getCreateTable();
				mapString = ETLSQLGenerator.getMap();
			}
			catch (TypeMismatchException e) {
				JOptionPane.showMessageDialog(null, "The data types in current mapping does not match. Please only match fields with the same data type.", "Error", JOptionPane.ERROR_MESSAGE);
				frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
				return;
			}
			catch (DuplicateTargetException e) {
				JOptionPane.showMessageDialog(null, "At least one target field is associated with multiple source fields. Please remove extra mappings and try again.", "Error", JOptionPane.ERROR_MESSAGE);
				frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
				return;
			}

			PrintWriter writer = new PrintWriter(filename);
			writer.write(comment);
			writer.write(createTable);
			writer.write(mapString);
			writer.close();
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private void doOpenScanReport(String filename) {
		if (filename != null) {
			boolean replace = true;
			if (ObjectExchange.etl.getSourceDatabase().getTables().size() != 0) {
				Object[] options = { "Replace current data", "Load data on field values only" };
				int result = JOptionPane.showOptionDialog(frame, "You already have source data loaded. Do you want to", "Replace source data?",
						JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
				if (result == -1)
					return;
				if (result == 1)
					replace = false;
			}
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			if (replace) {
				ETL etl = new ETL();
				try {
					etl.setSourceDatabase(Database.generateModelFromScanReport(filename));
					etl.setTargetDatabase(ObjectExchange.etl.getTargetDatabase());
					tableMappingPanel.setMapping(etl.getTableToTableMapping());
					ObjectExchange.etl = etl;
				} catch (Exception e) {
					e.printStackTrace();
					JOptionPane.showMessageDialog(null, "Invalid File Format", "Error", JOptionPane.ERROR_MESSAGE);
				}
			} else {
				try {
					Database newData = Database.generateModelFromScanReport(filename);
					Database oldData = ObjectExchange.etl.getSourceDatabase();
					for (Table newTable : newData.getTables()) {
						Table oldTable = (Table) findByName(newTable.getName(), oldData.getTables());
						if (oldTable != null) {
							for (Field newField : newTable.getFields()) {
								Field oldField = (Field) findByName(newField.getName(), oldTable.getFields());
								if (oldField != null) {
									oldField.setValueCounts(newField.getValueCounts());
								}
							}
						}
					}
				} catch (Exception e) {
					e.printStackTrace();
					JOptionPane.showMessageDialog(null, "Invalid File Format", "Error", JOptionPane.ERROR_MESSAGE);
				}

			}
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private MappableItem findByName(String name, List<? extends MappableItem> list) {
		for (MappableItem item : list)
			if (item.getName().toLowerCase().equals(name.toLowerCase()))
				return item;
		return null;
	}

	private void doGenerateEtlDoc(String filename) {
		if (filename != null) {
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
			ETLDocumentGenerator.generate(ObjectExchange.etl, filename);
			frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	}

	private void doMarkCompleted() {
		this.tableMappingPanel.markCompleted();
		this.fieldMappingPanel.markCompleted();
	}

	private void doUnmarkCompleted() {
		this.tableMappingPanel.unmarkCompleted();
		this.fieldMappingPanel.unmarkCompleted();
	}
}


text:
package org.javaee7.interceptor.aroundconstruct;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

/**
 * @author Radim Hanus
 */
@MyInterceptorBinding
public class GreetingBean implements Greeting {
	private boolean constructed = false;
	private boolean initialized = false;

	private Param param;

	@Inject
	public GreetingBean(Param param) {
		this.param = param;
		constructed = true;
	}

	@PostConstruct
	void onPostConstruct() {
		initialized = true;
	}

	@Override
	public boolean isConstructed() {
		return constructed;
	}

	@Override
	public boolean isInitialized() {
		return initialized;
	}

	@Override
	public Param getParam() {
		return param;
	}
}

redpajama_set_name: RedPajamaGithub


text:
import os
import sys

import numpy as np
import matplotlib.pyplot as plt

from becca.cat_tree import CatTree

import logging

logging.basicConfig(filename='log/log.log', level=logging.DEBUG,
                    format='%(asctime)s %(levelname)s %(name)s %(message)s')
logger = logging.getLogger(os.path.basename(__file__))

class Discretizer(object):
    """
    Incrementally break a set of values and/or strings into categories.
    """

    def __init__(
        self,
        base_position=0,
        n_inputs=0,
        name='discretizer',
        output_dir='output',
        split_frequency=1e3,
    ):
        """
        @param base_position : float
            A value used to sort discretized values when visualizing.
        @param name: string
            A name that helps to identify this instance of Discretizer.
        @param n_inputs: int
            The number of inputs already assigned.
        @param output_dir: string
            The path (relative or absolute) in which to store any outputs.
        @param split_frequency: int
            How often should the discretizer check for category splits?
            This takes a little longer and shoudn't be done every
            time step.
        """
        self.numeric_cats = CatTree(
            base_position=base_position + .25,
            i_input=n_inputs,
            type='numeric',
        )
        self.string_cats = CatTree(
            base_position=base_position - .25,
            i_input=n_inputs + 1,
            type='string',
        )
        self.position = base_position

        self.name = name
        self.output_dir = output_dir
        if not os.path.exists(self.output_dir):
            os.mkdir(self.output_dir)
        # timestep: int
        #     The age of the discretizer in time steps. One data value
        #     is ingested per time step.
        self.timestep = 0
        self.split_frequency = split_frequency

    def __str__(self):
        """
        Represent the Discretizer as a string.
        """
        return self.string_cats.__str__() + self.numeric_cats.__str__()

    def step(
        self,
        input_activities=None,
        n_inputs=0,
        raw_val=0,
    ):
        """
        Incrementally build the set of categories.

        Parameters
        ----------
        input_activities: array of floats
            The under-construction array of input activities
            for this time step.
        n_inputs : int
            The number of inputs currently assigned.
        raw_val: float or string or convertable to string
            The new piece of data to add to the history of observations.

        Returns
        -------
        input_activities: array of floats
            The full, padded array of input activities, updated.
        n_inputs: int
            The number of input activity elements that are currently
            being used.
        """
        self.timestep += 1

        # Determine whether the observation is string or numerical.
        is_string = True
        try:
            float_val = float(raw_val)
            if np.isnan(float_val):
                val = "NaN"
            elif np.isposinf(float_val):
                val = "positive_infinity"
            elif np.isneginf(float_val):
                val = "negative_infinity"
            else:
                val = float_val
                is_string = False
        except ValueError:
            val = str(raw_val)

        # input_activities is modified by calls to categorize()
        if is_string:
            self.string_cats.add(val)
            self.string_cats.categorize(
                val, input_activities, generational_discount=1)
        else:
            self.numeric_cats.add(val)
            self.numeric_cats.categorize(
                val, input_activities, generational_discount=1)

        if self.timestep % self.split_frequency == 0:
            # Try to grow new categories.
            n_inputs = self.numeric_cats.grow(n_inputs)
            n_inputs = self.string_cats.grow(n_inputs)

        return input_activities, n_inputs

    def find_cats(self, vals):
        """
        Find a set of categories for vals.

        @param vals: list of values to break into categories.
            These may be strings, floats or any object that can be
            converted into a float or string.
        """

        if len(vals) < 2:
            logger.error('You need to provide more than one value.')
            logger.error('Try again.')
            sys.exit()

        for val in vals:
            self.step(val)

    def generate(self, i_cat):
        """
        Generate a representative value of a category.
        """
        # TODO
        return i_cat * self.n_max_cats

    def report(self):
        """
        Show the current state of the discretizer.
        """
        plt.figure()
        numeric_ax = plt.subplot(2, 1, 1)
        self.numeric_cats.report(numeric_ax)
        self.string_cats.report()

        filename = os.path.join(
            self.output_dir,
            '_'.join([self.name, 'categories.png']))
        hi_res = 1200
        plt.savefig(filename, dps=hi_res)


text:
int main( int argc, char *argv[])
{

  GtkWidget *window;
  GtkWidget *vbox;

  GtkWidget *menubar;
  GtkWidget *filemenu;
  GtkWidget *file;
  GtkWidget *New;
  GtkWidget *open;
  GtkWidget *quit;

  GtkWidget *sep;

  GtkAccelGroup *accel_group = NULL;

  gtk_init(&argc, &argv);

  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(window), 250, 200);
  gtk_window_set_title(GTK_WINDOW(window), "menu");

  vbox = gtk_vbox_new(FALSE, 0);
  gtk_container_add(GTK_CONTAINER(window), vbox);

  menubar = gtk_menu_bar_new();
  filemenu = gtk_menu_new();

  accel_group = gtk_accel_group_new();
  gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);

  file = gtk_menu_item_new_with_mnemonic("_File");
  New = gtk_image_menu_item_new_from_stock(GTK_STOCK_NEW, NULL);
  open = gtk_image_menu_item_new_from_stock(GTK_STOCK_OPEN, NULL);
  sep = gtk_separator_menu_item_new();
  quit = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel_group);

  gtk_widget_add_accelerator(quit, "activate", accel_group,
      GDK_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);

  gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), filemenu);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), New);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), open);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), sep);
  gtk_menu_shell_append(GTK_MENU_SHELL(filemenu), quit);
  gtk_menu_shell_append(GTK_MENU_SHELL(menubar), file);
  gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 3);

  g_signal_connect_swapped(G_OBJECT(window), "destroy",
      G_CALLBACK(gtk_main_quit), NULL);

  g_signal_connect(G_OBJECT(quit), "activate",
      G_CALLBACK(gtk_main_quit), NULL);

  gtk_widget_show_all(window);

  gtk_main();

  return 0;
}


text:
package tk.martijn_heil.nincore.api.localization;

import org.jetbrains.annotations.NotNull;

public interface LocalizationManager
{
    void setLocalizationEnabled(boolean value);

    boolean isLocalizationEnabled();

    @NotNull
    MinecraftLocale getDefaultMinecraftLocale();

    /**
     * The standard default {@link tk.martijn_heil.nincore.api.localization.MinecraftLocale} is
     * {@link tk.martijn_heil.nincore.api.localization.MinecraftLocale#BRITISH_ENGLISH}
     *
     * @param minecraftLocale The {@link tk.martijn_heil.nincore.api.localization.MinecraftLocale} to set default.
     */
    void setDefaultMinecraftLocale(@NotNull tk.martijn_heil.nincore.api.localization.MinecraftLocale minecraftLocale);
}


text:
class MojoWebUIHandler;

namespace content {
class WebUIDataSource;
}

class MojoWebUIControllerBase : public content::WebUIController {
 public:
  explicit MojoWebUIControllerBase(content::WebUI* contents);
  ~MojoWebUIControllerBase() override;

  // WebUIController overrides:
  void RenderViewCreated(content::RenderViewHost* render_view_host) override;

 protected:
  // Invoke to register mapping between binding file and resource id (IDR_...).
  void AddMojoResourcePath(const std::string& path, int resource_id);

 private:
  // Bindings files are registered here.
  content::WebUIDataSource* mojo_data_source_;

  DISALLOW_COPY_AND_ASSIGN(MojoWebUIControllerBase);
};

// MojoWebUIController is intended for web ui pages that use mojo. It is
// expected that subclasses will do two things:
// . In the constructor invoke AddMojoResourcePath() to register the bindings
//   files, eg:
//     AddMojoResourcePath("chrome/browser/ui/webui/omnibox/omnibox.mojom",
//                         IDR_OMNIBOX_MOJO_JS);
// . Override BindUIHandler() to create and bind the implementation of the
//   bindings.
template <typename Interface>
class MojoWebUIController : public MojoWebUIControllerBase {
 public:
  explicit MojoWebUIController(content::WebUI* contents)
      : MojoWebUIControllerBase(contents), weak_factory_(this) {}
  virtual ~MojoWebUIController() {}
  virtual void RenderViewCreated(
      content::RenderViewHost* render_view_host) override {
    MojoWebUIControllerBase::RenderViewCreated(render_view_host);
    render_view_host->GetMainFrame()->GetServiceRegistry()->
        AddService<Interface>(
            base::Bind(&MojoWebUIController::BindUIHandler,
                       weak_factory_.GetWeakPtr()));
  }

 protected:
  // Invoked to create the specific bindings implementation.
  virtual void BindUIHandler(mojo::InterfaceRequest<Interface> request) = 0;

 private:
  base::WeakPtrFactory<MojoWebUIController> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(MojoWebUIController);
};

#endif  // CHROME_BROWSER_UI_WEBUI_MOJO_WEB_UI_CONTROLLER_H_


text:
#include "private/pthread_support.h"

/* derived from pthread_stop_world.c */

# if defined(GC_OPENBSD_THREADS)

/* We hold allocation lock.  Should do exactly the right thing if the	*/
/* world is stopped.  Should not fail if it isn't.			*/
void GC_push_all_stacks()
{
    GC_bool found_me = FALSE;
    size_t nthreads = 0;
    int i;
    GC_thread p;
    ptr_t lo, hi;
    pthread_t me = pthread_self();

    if (!GC_thr_initialized) GC_thr_init();
#   if DEBUG_THREADS
        GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me);
#   endif
    for (i = 0; i < THREAD_TABLE_SZ; i++) {
      for (p = GC_threads[i]; p != 0; p = p -> next) {
        if (p -> flags & FINISHED) continue;
	++nthreads;
        if (THREAD_EQUAL(p -> id, me)) {
#  	    ifdef SPARC
	        lo = (ptr_t)GC_save_regs_in_stack();
#  	    else
 	        lo = GC_approx_sp();
#           endif
	    found_me = TRUE;
	} else {
	    lo = p -> stop_info.stack_ptr;
	}
        if ((p -> flags & MAIN_THREAD) == 0) {
	    hi = p -> stack_end;
        } else {
            /* The original stack. */
            hi = GC_stackbottom;
        }
#	if DEBUG_THREADS
            GC_printf("Stack for thread 0x%x = [%p,%p)\n",
    	              (unsigned)(p -> id), lo, hi);
#	endif
	if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
#       ifdef STACK_GROWS_UP
	  /* We got them backwards! */
          GC_push_all_stack(hi, lo);
#       else
          GC_push_all_stack(lo, hi);
#	endif
      }
    }
    if (GC_print_stats == VERBOSE) {
	GC_log_printf("Pushed %d thread stacks\n", nthreads);
    }
    if (!found_me && !GC_in_thread_creation)
      ABORT("Collecting from unknown thread.");
}

/* We hold the allocation lock.  Suspend all threads that might	*/
/* still be running. */
void GC_suspend_all()
{
    int i;
    GC_thread p;
    int result;
    pthread_t my_thread = pthread_self();

    for (i = 0; i < THREAD_TABLE_SZ; i++) {
      for (p = GC_threads[i]; p != 0; p = p -> next) {
        if (!THREAD_EQUAL(p -> id, my_thread)) {
            if (p -> flags & FINISHED) continue;
	    if (p -> thread_blocked) /* Will wait */ continue;
#	    if DEBUG_THREADS
	      GC_printf("Suspending thread 0x%x\n",
			(unsigned)(p -> id));
#	    endif

            if (pthread_suspend_np(p -> id) != 0)
              ABORT("pthread_suspend_np failed");

	   /*
	    * This will only work for userland pthreads. It will
	    * fail badly on rthreads. Perhaps we should consider
	    * a pthread_sp_np() function that returns the stack
	    * pointer for a suspended thread and implement in
	    * both pthreads and rthreads.
	    */
	   p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET);
        }
      }
    }
}

void GC_stop_world()
{
    int i;

    GC_ASSERT(I_HOLD_LOCK());
#   if DEBUG_THREADS
      GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self());
#   endif

    /* Make sure all free list construction has stopped before we start. */
    /* No new construction can start, since free list construction is	*/
    /* required to acquire and release the GC lock before it starts,	*/
    /* and we have the lock.						*/
#   ifdef PARALLEL_MARK
      GC_acquire_mark_lock();
      GC_ASSERT(GC_fl_builder_count == 0);
      /* We should have previously waited for it to become zero. */
#   endif /* PARALLEL_MARK */

    GC_suspend_all();

#   ifdef PARALLEL_MARK
      GC_release_mark_lock();
#   endif
    #if DEBUG_THREADS
      GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self());
    #endif
}

/* Caller holds allocation lock, and has held it continuously since	*/
/* the world stopped.							*/
void GC_start_world()
{
    pthread_t my_thread = pthread_self();
    register int i;
    register GC_thread p;
    register int result;

#   if DEBUG_THREADS
      GC_printf("World starting\n");
#   endif

    for (i = 0; i < THREAD_TABLE_SZ; i++) {
      for (p = GC_threads[i]; p != 0; p = p -> next) {
        if (!THREAD_EQUAL(p -> id, my_thread)) {
            if (p -> flags & FINISHED) continue;
	    if (p -> thread_blocked) continue;
	    #if DEBUG_THREADS
	      GC_printf("Resuming thread 0x%x\n",
			(unsigned)(p -> id));
	    #endif

            if (pthread_resume_np(p -> id) != 0)
              ABORT("pthread_kill failed");
        }
      }
    }
#    if DEBUG_THREADS
      GC_printf("World started\n");
#    endif
}

void GC_stop_init() {
}

#endif


text:
package com.smartdevicelink.test.rpc.notifications;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCMessage;
import com.smartdevicelink.proxy.rpc.Headers;
import com.smartdevicelink.proxy.rpc.OnSystemRequest;
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.RequestType;
import com.smartdevicelink.test.BaseRpcTests;
import com.smartdevicelink.test.TestValues;
import com.smartdevicelink.test.Validator;

import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;

import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.assertTrue;
import static junit.framework.TestCase.fail;

/**
 * This is a unit test class for the SmartDeviceLink library project class :
 * {@link com.smartdevicelink.proxy.rpc.OnSystemRequest}
 */
public class OnSystemRequestTests extends BaseRpcTests {

    @Override
    protected RPCMessage createMessage() {
        OnSystemRequest msg = new OnSystemRequest();

        msg.setFileType(TestValues.GENERAL_FILETYPE);
        msg.setLength(TestValues.GENERAL_LONG);
        msg.setOffset(TestValues.GENERAL_LONG);
        msg.setRequestType(TestValues.GENERAL_REQUESTTYPE);
        msg.setRequestSubType(TestValues.GENERAL_STRING);
        msg.setTimeout(TestValues.GENERAL_INT);
        msg.setUrl(TestValues.GENERAL_STRING);

        return msg;
    }

    @Override
    protected String getMessageType() {
        return RPCMessage.KEY_NOTIFICATION;
    }

    @Override
    protected String getCommandType() {
        return FunctionID.ON_SYSTEM_REQUEST.toString();
    }

    @Override
    protected JSONObject getExpectedParameters(int sdlVersion) {
        JSONObject result = new JSONObject();

        try {
            result.put(OnSystemRequest.KEY_FILE_TYPE, TestValues.GENERAL_FILETYPE);
            result.put(OnSystemRequest.KEY_LENGTH, TestValues.GENERAL_LONG);
            result.put(OnSystemRequest.KEY_TIMEOUT, TestValues.GENERAL_INT);
            result.put(OnSystemRequest.KEY_OFFSET, TestValues.GENERAL_LONG);
            result.put(OnSystemRequest.KEY_URL, TestValues.GENERAL_STRING);
            result.put(OnSystemRequest.KEY_REQUEST_TYPE, TestValues.GENERAL_REQUESTTYPE);
            result.put(OnSystemRequest.KEY_REQUEST_SUB_TYPE, TestValues.GENERAL_STRING);
        } catch (JSONException e) {
            fail(TestValues.JSON_FAIL);
        }

        return result;
    }

    /**
     * Tests the expected values of the RPC message.
     */
    @Test
    public void testRpcValues() {
        // Test Values
        FileType fileType = ((OnSystemRequest) msg).getFileType();
        Long length = ((OnSystemRequest) msg).getLength();
        int timeout = ((OnSystemRequest) msg).getTimeout();
        Long offset = ((OnSystemRequest) msg).getOffset();
        String url = ((OnSystemRequest) msg).getUrl();
        RequestType requestType = ((OnSystemRequest) msg).getRequestType();
        String requestSubType = ((OnSystemRequest) msg).getRequestSubType();

        // Valid Tests
        assertEquals(TestValues.MATCH, TestValues.GENERAL_FILETYPE, fileType);
        assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, length);
        assertEquals(TestValues.MATCH, TestValues.GENERAL_INT, timeout);
        assertEquals(TestValues.MATCH, TestValues.GENERAL_LONG, offset);
        assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, url);
        assertEquals(TestValues.MATCH, TestValues.GENERAL_REQUESTTYPE, requestType);
        assertEquals(TestValues.MATCH, TestValues.GENERAL_STRING, requestSubType);

        // Test Body
        OnSystemRequest osr = (OnSystemRequest) msg;
        String body = osr.getBody();
        assertNull(TestValues.NULL, body);

        String testBody = "123ABC";
        osr.setBody(testBody);

        String readBody = osr.getBody();
        assertEquals(TestValues.MATCH, testBody, readBody);

        // Test Headers
        Headers headers = osr.getHeader();
        assertNull(TestValues.NULL, headers);

        Headers testHeaders = new Headers();
        testHeaders.setCharset("ASCII");
        testHeaders.setConnectTimeout(1000);
        testHeaders.setContentLength(1024);
        testHeaders.setContentType("application/json");
        testHeaders.setDoInput(false);
        testHeaders.setDoOutput(true);
        testHeaders.setInstanceFollowRedirects(true);
        testHeaders.setReadTimeout(800);
        testHeaders.setRequestMethod("POST");
        testHeaders.setUseCaches(false);
        osr.setHeaders(testHeaders);

        Headers readHeaders = osr.getHeader();
        assertTrue(TestValues.TRUE, Validator.validateHeaders(testHeaders, readHeaders));

        // Invalid/Null Tests
        OnSystemRequest msg = new OnSystemRequest();
        assertNotNull(TestValues.NOT_NULL, msg);
        testNullBase(msg);

        assertNull(TestValues.NULL, msg.getFileType());
        assertNull(TestValues.NULL, msg.getLength());
        assertNull(TestValues.NULL, msg.getOffset());
        assertNull(TestValues.NULL, msg.getTimeout());
        assertNull(TestValues.NULL, msg.getUrl());
        assertNull(TestValues.NULL, msg.getRequestType());
        assertNull(TestValues.NULL, msg.getRequestSubType());
    }

    @Test
    public void testUrlParam() {

        OnSystemRequest msg = new OnSystemRequest();

        StringBuilder longUrl = new StringBuilder("https://test.url");
        while (longUrl.length() < 10000) {
            longUrl.append("/test");
        }

        msg.setUrl(longUrl.toString());

        // test url length has not changed
        assertEquals(TestValues.MATCH, msg.getUrl().length(), longUrl.length());

        // test empty url
        msg.setUrl("");
        assertEquals(TestValues.MATCH, msg.getUrl(), "");

        msg.setUrl(longUrl.substring(0, 1000));
        assertEquals(TestValues.MATCH, msg.getUrl().length(), 1000);
    }
}


text:
from base64 import b64encode
from bs4 import BeautifulSoup
import datetime
import os
from prettyprint import pp_str
import re
import time
from urllib import urlretrieve
from urllib2 import Request, urlopen

class Radiko:
    # Radiko urls
    player_url = 'http://radiko.jp/player/swf/player_3.0.0.01.swf'
    auth1_fms_url = 'https://radiko.jp/v2/api/auth1_fms'
    auth2_fms_url = 'https://radiko.jp/v2/api/auth2_fms'
    stream_xml_url = 'http://radiko.jp/v2/station/stream/'
    list_xml_url = 'http://radiko.jp/v2/station/list/'

    # local files
    tmp_dir = '/tmp/radikor'
    player_file = tmp_dir + '/player.swf'
    key_file = tmp_dir + '/authkey.png'
    partial_key_file = tmp_dir + '/partial_key'

    # local commands
    swfextract_path = '/usr/local/bin/swfextract'
    rtmpdump_path = '/usr/local/bin/rtmpdump'
    ffmpeg_path = '/usr/local/bin/ffmpeg'

    # stream parameters
    stream_url_parts = []
    auth_token = ''
    region = ''

    def __init__(self):
        self.__get_authkey()
        auth1_fms = self.__get_auth_fms(self.auth1_fms_url)
        self.auth_token, length, offset = self.__get_auth_params(auth1_fms)
        partial_key = self.__get_partial_key(offset, length)
        auth2_fms = self.__get_auth_fms(self.auth2_fms_url, self.auth_token, partial_key)
        self.region = self.__get_region(auth2_fms)

    def play(self, ch):
        stream_url_parts = self.__get_stream_url(ch)
        os.system(self.rtmpdump_path + ' -v' +
                  ' -r ' + stream_url_parts[0] +
                  ' --app ' + stream_url_parts[1] +
                  ' --playpath ' + stream_url_parts[2] +
                  ' -W ' + self.player_url +
                  ' -C S:"" -C S:"" -C S:"" -C S:' + self.auth_token +
                  ' --live | mplayer -')

    def record(self, ch, duration, out_dir):
        stream_url_parts = self.__get_stream_url(ch)
        file_name = str(time.mktime(datetime.datetime.now().utctimetuple()))
        os.system(self.rtmpdump_path + ' -v' +
                  ' -r ' + stream_url_parts[0] +
                  ' --app ' + stream_url_parts[1] +
                  ' --playpath ' + stream_url_parts[2] +
                  ' -W ' + self.player_url +
                  ' -C S:"" -C S:"" -C S:"" -C S:' + self.auth_token +
                  ' --live' +
                  ' --stop ' + str(duration * 60) +
                  ' --flv ' + self.tmp_dir + '/' + file_name)
        os.system(self.ffmpeg_path +
                  ' -loglevel quiet'
                  ' -y'
                  ' -i ' + self.tmp_dir + '/' + file_name +
                  ' -acodec libmp3lame'
                  ' -ab 128k'
                  ' "' + out_dir + '/' + file_name + '.mp3"')

    def list(self):
        list_xml = urlopen(self.list_xml_url + self.region + '.xml')
        soup = BeautifulSoup(list_xml)
        names = soup.find_all('name')
        ids = soup.find_all('id')
        stations = {name.string: id.string for name, id in zip(names, ids)}
        print 'Your region code is "' + self.region + '", and stations in your region are:'
        print pp_str(stations)

    def __get_authkey(self):
        # download player.swf
        if os.path.isdir(self.tmp_dir) is False:
            os.mkdir(self.tmp_dir)
        urlretrieve(self.player_url, self.player_file)
        # extract authkey.jpg
        os.system(self.swfextract_path +
                  ' -b 14 ' + self.player_file +
                  ' -o ' + self.key_file)

    def __get_auth_fms(self, url, token=None, key=None):
        req = Request(url)
        req.add_header('pragma', 'no-cache')
        req.add_header('X-Radiko-App', 'pc_1')
        req.add_header('X-Radiko-App-Version', '2.0.1')
        req.add_header('X-Radiko-User', 'test-stream')
        req.add_header('X-Radiko-Device', 'pc')
        if token is not None:
            req.add_header('X-Radiko-Authtoken', token)
        if key is not None:
            req.add_header('X-Radiko-Partialkey', key)
        req.add_data('\r\n')
        return urlopen(req).read()

    def __get_auth_params(self, fms_data):
        token = re.compile(r'X-Radiko-AuthToken=([\w-]+)')\
            .search(fms_data)\
            .group(1)
        length = re.compile(r'X-Radiko-KeyLength=(\d+)')\
            .search(fms_data)\
            .group(1)
        offset = re.compile(r'X-Radiko-KeyOffset=(\d+)')\
            .search(fms_data)\
            .group(1)
        return token, length, offset

    def __get_partial_key(self, offset, length):
        os.system('dd if=' + self.key_file +
                  ' bs=1' +
                  ' skip=' + offset +
                  ' count=' + length +
                  ' 2> /dev/null' +
                  '> ' + self.partial_key_file)
        return b64encode(open(self.partial_key_file).read())

    def __get_region(self, fms_data):
        return re.compile(r'.*(JP\d+),.*')\
            .search(fms_data)\
            .group(1)

    def __get_stream_url(self, ch):
        stream_xml = urlopen(self.stream_xml_url + ch + '.xml')
        stream_url = BeautifulSoup(stream_xml).find('item').string
        parts = re.compile(r'^(rtmpe://.*?)/(.*)/(.*)').search(stream_url)
        return [parts.group(1), parts.group(2), parts.group(3)]


text:
package eu.revevol.calendar.util;

import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.googlecode.objectify.ObjectifyService;
import eu.revevol.calendar.model.Asset;
import eu.revevol.calendar.model.Reservation;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import org.junit.After;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

/**
 *
 * @author Clement Hannicq <clement.hannicq@revevol.eu>
 */
public class CollisionTest {

    private final LocalServiceTestHelper helper
            = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());

    private ArrayList<Asset> assets = new ArrayList<Asset>();

    private Reservation A10_12 = new Reservation();
    private Reservation A10_12bis = new Reservation();
    private Reservation A10_12other = new Reservation();
    private Reservation AB10_12 = new Reservation();
    private Reservation B10_12 = new Reservation();
    private Reservation A8_10 = new Reservation();
    private Reservation A12_15 = new Reservation();

    static {
        ObjectifyService.factory().register(Asset.class);

    }

    public CollisionTest() {
    }

    @Before
    public void setUp() {
        Calendar calendar = new GregorianCalendar();
        calendar.set(2014, 3, 14);
        Date date = calendar.getTime();
        calendar.add(Calendar.DATE, 1);
        Date datePlusOne = calendar.getTime();
        helper.setUp();

        Asset a = new Asset();
        a.name = "a";
        a.id = 1L;
        assets.add(a);
        Asset b = new Asset();
        b.name = "b";
        b.id = 2L;
        assets.add(b);
        ObjectifyService.ofy().save().entities(assets).now();
        ArrayList<Asset> La = new ArrayList<Asset>();
        La.add(a);
        ArrayList<Asset> Lab = new ArrayList<Asset>();
        Lab.add(a);
        Lab.add(b);
        ArrayList<Asset> Lb = new ArrayList<Asset>();
        La.add(b);

        A10_12.date = date;
        A10_12.start = 10;
        A10_12.end = 12;
        A10_12.id = 10121L;
        A10_12.setAssets(La);

        A10_12bis.date = date;
        A10_12bis.start = 10;
        A10_12bis.end = 12;
        A10_12bis.id = A10_12.id;
        A10_12bis.setAssets(Lab);

        A10_12other.date = datePlusOne;
        A10_12other.start = 10;
        A10_12other.end = 12;
        A10_12other.id = 101218L;
        A10_12other.setAssets(La);

        AB10_12.date = date;
        AB10_12.start = 10;
        AB10_12.end = 12;
        AB10_12.id = 10122L;
        AB10_12.setAssets(Lab);

        B10_12.date = date;
        B10_12.start = 10;
        B10_12.end = 12;
        B10_12.id = 10123L;
        B10_12.setAssets(Lb);

        A8_10.date = date;
        A8_10.start = 8;
        A8_10.end = 10;
        A8_10.id = 1012134L;
        A8_10.setAssets(La);

        A12_15.date = date;
        A12_15.start = 12;
        A12_15.end = 15;
        A12_15.id = 10121344L;
        A12_15.setAssets(La);
    }

    @After
    public void tearDown() {
        helper.tearDown();
    }

    /**
     * Test of collide method, of class Collision.
     */
    @Test
    public void testManyDevices() {
        boolean expResult = true;
        boolean result = Collision.collide(A10_12, AB10_12);
        assertEquals(expResult, result);
    }

    @Test
    public void testUpdate() {
        boolean expResult = false;
        boolean result = Collision.collide(A10_12, A10_12bis);
        assertEquals(expResult, result);
    }

    @Test
    public void testOtherDay() {
        boolean expResult = false;
        boolean result = Collision.collide(A10_12, A10_12other);
        assertEquals(expResult, result);
    }

    @Test
    public void testOtherAsset() {
        boolean expResult = false;
        boolean result = Collision.collide(A10_12, B10_12);
        assertEquals(expResult, result);
    }

    @Test
    public void testBefore() {
        boolean expResult = false;
        boolean result = Collision.collide(A10_12, A12_15);
        assertEquals(expResult, result);
    }

    @Test
    public void testAfter() {
        boolean expResult = false;
        boolean result = Collision.collide(A8_10, A10_12);
        assertEquals(expResult, result);
    }

}


text:
app
	.controller('AuthCtrl', function (loginFactory) {
		const login = this;

		login.loginUser = (email, password) => {
			loginFactory.login(email, password);
		}
		login.registerUser = (email, password) => {
			loginFactory.register(email, password);
		}
	})


text:
package com.example.lang.generic;

import java.lang.reflect.*;
import java.util.HashSet;

public class Reflect {

    private static HashSet<String> s_processed = new HashSet<String>();

    private static void describe(String lead, Field field) {
        // get base and generic types, check kind
        Class<?> btype = field.getType();
        Type gtype = field.getGenericType();
        if (gtype instanceof ParameterizedType) {
            // list basic parameterized type information
            ParameterizedType ptype = (ParameterizedType) gtype;
            System.out.println(lead + field.getName() + " is of parameterized type");
            System.out.println(lead + ' ' + btype.getName());
            // print list of actual types for parameters
            System.out.print(lead + " using types (");
            Type[] actuals = ptype.getActualTypeArguments();
            for (int i = 0; i < actuals.length; i++) {
                if (i > 0) {
                    System.out.print(" ");
                }
                Type actual = actuals[i];
                if (actual instanceof Class) {
                    System.out.print(((Class) actual).getName());
                } else {
                    System.out.print(actuals[i]);
                }
            }
            System.out.println(")");
            // analyze all parameter type classes
            for (int i = 0; i < actuals.length; i++) {
                Type actual = actuals[i];
                if (actual instanceof Class) {
                    analyze(lead, (Class) actual);
                }
            }
        } else if (gtype instanceof GenericArrayType) {
            // list array type and use component type
            System.out.println(lead + field.getName() + " is array type " + gtype);
            gtype = ((GenericArrayType) gtype).getGenericComponentType();
        } else {
            // just list basic information
            System.out.println(lead + field.getName() + " is of type " + btype.getName());
        }
        // analyze the base type of this field
        analyze(lead, btype);
    }

    private static void analyze(String lead, Class<?> clas) {
        // substitute component type in case of an array
        if (clas.isArray()) {
            clas = clas.getComponentType();
        }
        // make sure class should be expanded
        String name = clas.getName();
        if (!clas.isPrimitive() && !clas.isInterface() && !name.startsWith("java.lang.") && !s_processed.contains(name)) {
            // print introduction for class
            s_processed.add(name);
            System.out.println(lead + "Class " + clas.getName() + " details:");
            // process each field of class
            String indent = lead + ' ';
            Field[] fields = clas.getDeclaredFields();
            for (int i = 0; i < fields.length; i++) {
                Field field = fields[i];
                if (!Modifier.isStatic(field.getModifiers())) {
                    describe(indent, field);
                }
            }
        }
    }

    public static void main(String[] args) throws Exception {
        analyze("", Base.class);
    }
}


text:
/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */
package net.sourceforge.pmd.util.viewer.model;

import net.sourceforge.pmd.lang.ast.xpath.Attribute;

/**
 * A toolkit for vaious attribute translations
 *
 * @author Boris Gruschko ( boris at gruschko.org )
 * @version $Id$
 */

public class AttributeToolkit {

    /**
     * formats a value for its usage in XPath expressions
     *
     * @param attribute atribute which value should be formatted
     * @return formmated value
     */
    public static String formatValueForXPath(Attribute attribute) {
        return '\'' + attribute.getStringValue() + '\'';
    }

    /**
     * constructs a predicate from the given attribute
     *
     * @param attribute attribute to be formatted as predicate
     * @return predicate
     */
    public static String constructPredicate(Attribute attribute) {
        return "[@" + attribute.getName() + '=' +
                formatValueForXPath(attribute) + ']';
    }
}


text:
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/include/autoprepend.php');
include_once('Inscrit.class.php');
include_once('Categorie.class.php');
include_once('Inscrit.class.php');
?>


text:
package org.ralasafe.servlet;

import javax.servlet.http.HttpServletRequest;

import org.ralasafe.privilege.PrivilegeManager;

public class NonRolePrivilegeMngAction extends AbstractTreeAction{

	public AbstractTreeHandler createTreeHandler(HttpServletRequest req) {
		PrivilegeManager  manager=WebUtil.getPrivilegeManager(req);
		return new NonRolePrivilegeTreeHandler(manager);
	}

}


text:
package com.netflix.spinnaker.fiat.roles;

import com.netflix.spinnaker.fiat.model.resources.Role;
import com.netflix.spinnaker.fiat.permissions.ExternalUser;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface UserRolesProvider {

  default List<Role> loadUnrestrictedRoles() {
    return new ArrayList<>();
  }

  /**
   * Load the roles assigned to the {@link com.netflix.spinnaker.fiat.permissions.ExternalUser
   * user}.
   *
   * @param user to load roles for
   * @return Roles assigned to the {@link com.netflix.spinnaker.fiat.permissions.ExternalUser user}
   *     with the given id.
   */
  List<Role> loadRoles(ExternalUser user);

  /**
   * Load the roles assigned to each {@link com.netflix.spinnaker.fiat.permissions.ExternalUser
   * user's} id in users.
   *
   * @param users to load roles for
   * @return Map whose keys are the {@link com.netflix.spinnaker.fiat.permissions.ExternalUser
   *     user's} id and values are their assigned roles.
   */
  Map<String, Collection<Role>> multiLoadRoles(Collection<ExternalUser> users);
}


text:
package org.cloudfoundry.uaa.tokens;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.cloudfoundry.Nullable;

/**
 * The base class for token keys
 */
public abstract class AbstractTokenKey {

    /**
     * The algorithm
     */
    @JsonProperty("alg")
    public abstract String getAlgorithm();

    /**
     * The exponent
     */
    @JsonProperty("e")
    public abstract String getE();

    /**
     * The id
     */
    @JsonProperty("kid")
    @Nullable
    public abstract String getId();

    /**
     * The key type
     */
    @JsonProperty("kty")
    public abstract KeyType getKeyType();

    /**
     * The modulus
     */
    @JsonProperty("n")
    public abstract String getN();

    /**
     * The use
     */
    @JsonProperty("use")
    public abstract String getUse();

    /**
     * The value
     */
    @JsonProperty("value")
    public abstract String getValue();

}


text:
    Lädt ein Hilfsprogramm als gepacktes Archiv herunter und installiert es innerhalb
    des Hudson-Arbeitsverzeichnisses.
    Beispiel: http://apache.promopeddler.com/ant/binaries/apache-ant-1.7.1-bin.zip
    (oder ein Spiegelserver, der näher zu Ihrem Hudson-Server liegt) mit der Angabe eines
    Unterverzeichnisses von apache-ant-1.7.1.


text:
cask 'cookie' do
  version '5.8.4'
  sha256 '0fc446e8d0866d02658e532100724c4a8e4e9fbbeef5bed4364993ab2825e81e'

  url "https://sweetpproductions.com/products/cookie#{version.major}/Cookie#{version.major}.dmg"
  appcast "https://sweetpproductions.com/products/cookie#{version.major}/appcast.xml"
  name 'Cookie'
  homepage 'https://sweetpproductions.com/'

  depends_on macos: '>= :el_capitan'

  app 'Cookie.app'

  zap trash: [
               '~/Library/Application Scripts/com.sweetpproductions.Cookie5',
               '~/Library/Containers/com.sweetpproductions.Cookie5',
               '~/Library/Preferences/com.sweetpproductions.Cookie5.plist',
             ]
end


text:
#ifndef __LogConfigSerializer_H_
#define __LogConfigSerializer_H_

#include "OgreLodPrerequisites.h"

#include "OgreDataStream.h"
#include "OgreSerializer.h"

namespace Ogre
{

    class _OgreLodExport LodConfigSerializer :
        public Ogre::Serializer
    {

    public:

        LodConfigSerializer();

        void exportLodConfig(Ogre::LodConfig& config, const Ogre::String& filename,
                             Endian endianMode = ENDIAN_NATIVE);
        void exportLodConfig(Ogre::LodConfig& config, Ogre::DataStreamPtr stream,
                             Endian endianMode = ENDIAN_NATIVE);

        void importLodConfig(Ogre::LodConfig* config, const Ogre::String& filename);
        void importLodConfig(Ogre::LodConfig* config, DataStreamPtr& stream);

    protected:

        enum LodConfigChunkID
        {
            LCCID_FILE_HEADER = 0x300,
            LCCID_LOD_CONFIG = 0x400,
            LCCID_BASIC_INFO = 0x500,
            LCCID_LOD_LEVELS = 0x600,
            LCCID_ADVANCED_INFO = 0x700,
            LCCID_PROFILE = 0x800,
        };

        void readLodConfig();
        void readLodBasicInfo();
        void readLodLevels();
        void readLodAdvancedInfo();
        void readLodProfile();

        void writeLodConfig();
        size_t calcLodConfigSize();
        void writeLodBasicInfo();
        size_t calcLodBasicInfoSize();
        void writeLodLevels();
        size_t calcLodLevelsSize();
        void writeLodAdvancedInfo();
        size_t calcLodAdvancedInfoSize();
        void writeLodProfile();
        size_t calcLodProfileSize();

        LodConfig* mLodConfig;
    };
}
#endif


text: export * from './OTLPTraceExporter';


text:
<!DOCTYPE html>

  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>Changelog | Susy Documentation</title>

  <link href="assets/img/favicon.ico" rel="shortcut icon">
  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,400i,700,700i" rel="stylesheet">

  <link rel="stylesheet" href="assets/webpack/app_styles.min.css" />

  <svg xmlns="http://www.w3.org/2000/svg" hidden>
  <symbol id="icon-logo" viewBox="0 0 16 16">
    <path d="M.2 8L0 7.8v-.2C.8 6.9 1.9 5.9 2.7 5l.4.3c-.5.8-1.1 1.6-1.8 2.3 1 1.2 1 1.3 1.7 2.4l-.4.3c-.4-.4-.5-.6-1-1C1 8.6 1.1 8.7.2 8zM13 10c.6-1.1.7-1.1 1.7-2.4-.6-.6-1.3-1.5-1.7-2.3l.3-.3c.8.8 1.8 1.8 2.7 2.6v.2l-.8.7c-.3.3-1.2 1.1-1.8 1.7L13 10z"/><path d="M2.6 13.1H3c.9 0 1.1-.2 1.1-1.4V4.2c0-1.1-.2-1.4-1.1-1.4h-.4v-.6h4.5v.7h-.3c-.9 0-1.1.2-1.1 1.4v3.2h4.6V4.2c0-1.1-.2-1.4-1.1-1.4h-.3v-.6h4.5v.7H13c-.9 0-1.1.2-1.1 1.4v7.5c0 1.1.2 1.4 1.1 1.4h.4v.7H8.9v-.7h.3c.9 0 1.1-.2 1.1-1.4V8.2H5.7v3.5c0 1.1.2 1.4 1.1 1.4h.3v.7H2.6v-.7z"/>
  </symbol>
  <symbol id="icon-menu" viewBox="0 0 24 28">
    <path d="M24 21v2c0 .547-.453 1-1 1H1c-.547 0-1-.453-1-1v-2c0-.547.453-1 1-1h22c.547 0 1 .453 1 1zm0-8v2c0 .547-.453 1-1 1H1c-.547 0-1-.453-1-1v-2c0-.547.453-1 1-1h22c.547 0 1 .453 1 1zm0-8v2c0 .547-.453 1-1 1H1c-.547 0-1-.453-1-1V5c0-.547.453-1 1-1h22c.547 0 1 .453 1 1z"/>
  </symbol>
</svg>

  <button data-nav-toggle data-toggle="button" aria-controls="nav" aria-pressed="false" type="button" data-toggle-synced="false">

  <svg data-icon="menu" data-icon-size="nav-icon" ><title>menu</title><use xlink:href="#icon-menu" />
  </svg>

  </button>

        Susy

          3.0.5

    <form action="search.html">
      <input type="text" name="q" placeholder="Search…" required minlength="3">
    </form>

        Susy

              Philosophy

              Changelog

              Contributing

Public Grid API

      Grid Configuration

      Grid Functions

Extras

      Extending Susy

      Su: Core Math Engine

      Plugin: SVG Grid Image

Internal Functions (Private)

      Susy Normalization

      Susy Syntax Parser

      Su Input Validation

      Versioning

          External Links

              Susy Website

              Twitter @SassSusy

              Intro to Susy3

              Susy2 Documentation

              OddBird

  <svg data-icon="logo" data-icon-size="footer-logo" ><use xlink:href="#icon-logo" />
  </svg>

          Documented with

            Herman

          by

            OddBird

    Susy »
    Changelog

Changelog

3.0.5 - April 30, 2018

BUGFIX: Update gutter alias default $context

3.0.4 - April 30, 2018

BUGFIX: Gutter function works when default columns
setting is not parser-friendly (e.g. 150px susy-repeat(2)).

Update dev dependencies.

3.0.3 - January 30, 2018

Fix missing doc JSON file in npm package.

Update dev dependencies.

3.0.2 - January 25, 2018

Documentation updates.

3.0.1 - August 27, 2017

NEW: susy-version() function for accessing the active version number.

Documentation improvements.

3.0.0 - June 29, 2017

See Introducing Susy3,
Understanding Spread in Susy3.

Site moved to oddbird.net/susy/

Docs moved to oddbird.net/susy/docs/

BREAKING: No More Mixins!
span, container, gutters, last, gallery, etc.
have all been removed from Susy.
Web layout has become too powerful & flexible to contain
in a simple set of shortcuts.

BREAKING: Remove rubygems/bower, to distribute on npm only.

BREAKING: Trim down to the core math, and a thin layer of api functions:

susy-span() (aliased as span)
to return a column-spanning width.

susy-gutter() (aliased as gutter)
to return a gutter width.

susy-slice() (aliased as slice)
to return a slice of asymmetrical grid.

BREAKING: Simplify to four settings:

columns to define the grid columns
as a list of lengths or unitless relative numbers.

gutters to define the length or relative size of a gutter.

spread to define the default spread of a span
across adjacent gutters.

container-spread to define the default spread of a container
across side-edge gutters.

BREAKING: Add support for calc() output,
so mixed-unit grids are possible.
This means the old inside-static solution
has been replaced by calc() output as well.

BREAKING: Shorthand syntax for on-the-fly span and settings.
This is similar to the previous shorthand,
but has been simplified to remove mixin-related features.

starting with a count, length, or column-list "span"

at $n, first, or last location on asymmetrical grids

narrow, wide, or wider for spread

of $n <spread> for available grid columns and container-spread

set-gutters $n shorthand to override global gutter settings

NEW: susy-repeat() function
to generate repeating gradients with the same syntax
provided in CSS Grid templates

NEW: SVG Grid plugin (susy/plugins/svg-grid),
to provide grid-debugging options
when applied as a background image to any container element:

svg-grid-colors global setting accepts one or more colors

susy-svg-grid() function returns inline svg
for use in the background or generated content properties

NEW: susy-compile() and su-call() plugin helpers,
to aide with conversions between the user API and internal math functions.
This is primarily useful for anyone building Susy extensions or mixins.

NEW: prefixed and unprefixed versions of all major API functions.
Import susy-prefix instead of susy
to eliminate the un-prefixed alias versions.

3.0.0-beta.1 - June 19, 2017

BREAKING: _prefix.scss has been renamed _susy-prefix.scss
for clarity when importing.

BREAKING: susy-call() has been renamed su-call().
since it is directly related to accessing the su functions.

BREAKING: Remove support for non-list columns:
'columns': 4 => 'columns': susy-repeat(4) == 'columns': 1 1 1 1.

BREAKING: Remove support for $count x $width syntax in columns:
'columns': 4 x 120px =>
'columns': susy-repeat(4, 120px) == 'columns': 120px 120px 120px 120px.

BREAKING: Remove rubygems/bower, to distribute on npm only.

BREAKING: Add support for calc() output,
so all mixed-unit grids are possible.
This means the old inside-static solution
has been replaced by calc() output as well.

BREAKING: su-sum has been renamed _su-sum
and is now considered a private function.

SVG background images now have a default size included.
You can override the default using the CSS background-size property.

Add list-flattening to columns normalization,
so that susy-repeat() can be used along-side other values.

Improved documentation

3.0.0-alpha.6 - Apr 25, 2017

Fix bug in empty gutter() alias

Add susy-repeat() function
to generate repeating gradients with the same syntax
provided in CSS Grid templates

Add susy-compile() and susy-call() plugin helpers,
to aide with conversions between the user API and
internal math functions.

3.0.0-alpha.5 - Feb 14, 2017

SVG Grid plugin, to provide grid-debugging options:

svg-grid-colors global setting accepts one or more colors

susy-svg-grid() function returns inline svg
for use in the background or generated content properties

Add set-gutters $n shorthand to override global gutter settings

Allow gutters function to take either context-only,
or full span/context shorthand —
useful when passing in details from a combined mixin

More test coverage, including error-handling!

3.0.0-alpha.1 - Sep 6, 2016

No Mixins!

Trim down to the core math, and a thin layer of api functions:

susy-span() to return a column-spanning width

susy-gutter() to return a gutter width

susy-slice() to return a slice of asymmetrical grid

Simplify to four settings:

columns to define the grid columns
as a list of comparable or unitless relative numbers

gutters to define the size of a gutter
in units comparable to the columns,
or a unitless relative number

spread to define the default spread of a span
across adjacent gutters

container-spread to define the default spread of a container
across side-edge gutters

Shorthand syntax for overriding settings on-the-fly:

starting with a count, length, or column-list span

at $n, first, or last location on asymmetrical grids

narrow, wide, or wider for spread

of $n <spread> for available grid columns and container-spread

2.2.5 - May 14 2015

Pass grid arguments to overlay positioning mixin.

2.2.3 - Apr 28 2015

Work around libsass fraction bug.

2.2.2 - Jan 23 2015

Fix bug in npm package.

2.2.1 - Jan 14 2015

Release npm susy package.

Add global $susy-media map for creating named breakpoints.

Add internal media-query support for susy-breakpoint
without requiring the Breakpoint plugin.

susy-breakpoint mixin no longer requires $layout argument.
By default, no changes will be made to your existing layout.

Update global-box-sizing and the legacy border-box-sizing
mixins to optionally take another argument, $inherit. This new
argument is a boolean value that defaults to false, meaning the
behavior of these mixins will not change by default. The default
behavior sets all elements to use the specified box-sizing,
which can only be changed explicitly on a per-element basis. By passing
in $inherit as true, the box-sizing is set on the
html element, and all other elements inherit this property. This
means that the box-sizing can be changed at the component level
and all nested elements will inherit this change. This cascading
effect can be prevented by explicitly setting box-sizing on the
exceptions within the nested context.

Add su import at root level.

Both su and susy work with the latest LibSass master branch (3.0.2+).
There are a few exceptions:

The susysone syntax

overlay grid output

The inherit option for global-box-sizing & border-box-sizing

2.1.3 - Jul 16 2014

Baseline grid image uses px instead of %.

Updated Sass dependency to work with 3.4.

2.1.2 - Apr 28 2014

first and last keywords output 0 margins instead of null
so they can be used to override previous span settings.

Output :before / :after rather than ::before / ::after
to support IE8.

Load Susy paths in Compass if required, otherwise add it to SASS_PATH.
[Adrien Antoine <https://github.com/Alshten>_]

Compass 1.0 config no longer needs to require 'susy'.
Susy is registered with Compass automatically.

Add $clean argument to layout and with-layout mixins,
for creating new layout contexts from a clean slate.

2.1.1 - Mar 13 2014

Rename core math functions, and prepare for decomposition.

column-count() => susy-count()

column-sum() => susy-sum()

column-span() => susy-slice()

column-span-sum() => susy()

Add tests for core math validation.

2.0.0 — Mar 10 2014

New susyone tests for split-columns, is-default-layout, medialayout, columns,
relative-width, columns width and nth-of-type (using True).

Sass 3.3.0 (Maptastic Maple)

Rename local 2.0 variables that conflict with global susyone settings.

Susyone container mixin applies full container settings at every breakpoint.

2.0.0.rc.2 — Mar 4 2014

Fix templates_path and compass project templates

Fix Compass "rem" integration to respect $rhythm-units setting.

2.0.0.rc.1 — Feb 7 2014

Add browser support module with settings to use-custom mixins
for background-image,
background-options (-size, -clip, -origin),
box-sizing, clearfix, and rem.
If you set to false,
we'll make sure everything works well on modern browsers.
If you set to true,
we'll check for existing mixins (e.g. from Compass or Bourbon)
to provide more powerful legacy support.

… code-block: scss

$susy: (
use-custom: (
clearfix: false,
background-image: true,
background-options: false,
box-sizing: true,
rem: true,
), );

Fix bugs caused by Sass changes to str-index(),
#{&}, and @at-root.

Fix Bower dependencies, and add support for Sache.

Remove legacy Compass polyfils from susyone code.

2.0.0.beta.3 — Jan 10 2014

Fix a bug making show-grid unaware of local debug/output keywords.

Added Susyone syntax for those that need to use the old Susy syntax,
with updated Sass and Compass.

@import 'susyone';

2.0.0.beta.2 — Jan 6 2014

Allow nesting of Susy settings.

show-grid mixin can output either background or overlay grids.

Add isolate function to return isolation offset width.

Fix a bug with last output for split-gutter layouts.

Fix a bug with split-gutter span(), and narrow/wider keywords.

Fix a bug with bleed and null + inside gutters.

bleed output uses TRBL shorthand when possible.

Clean up and document the core math functions.

Document upgrade path, core-math, and DIY grids.

BREAKING:

Move debug settings into $susy: (debug: (<settings>));.

Replace show-grid setting with new debug: image setting.

Add debug: output setting and keywords
to toggle between background and overlay grid images.

Remove grid-overlay mixin.

Becomes part of show-grid mixin.

Doesn't take $selector argument — should be nested instead.

Can still be used multiple times.

isolate mixin now interprets span argument as location,
unless location is otherwise specified.

isolate(2) is the same as isolate(at 2).

isolate(25%) will isolate at 25%.

Rename setting controls for consistency.

set-grid => layout

use-grid => with-layout

pad and squish use RL shorthand for shared context.

pad(1, 3 of 12) => pad(1 3 of 12)

2.0.0.beta.1 — Dec 24 2013

Add susy-breakpoint mixin for basic integration with Breakpoint

Syntax: breakpoint($query, $layout, $no-query)
where $query and no-query follow the Breakpoint syntax,
and $layout uses the Susy syntax for defining grids.

Add layout function to convert layouts from shorthand syntax to map.

Add full keyword shortcut for full-width spans.

BREAKING: Remove unclear row and unrow mixins.

Add break and nobreak mixins/keywords
to create a new line before any element in the layout.

BREAKING: Rename is-container: container setting/value to role: nest.

BREAKING: Rename layout-method setting to output.

BREAKING: Rename layout-math setting to math.

Clean up division between math/output/syntax layers.

gutters and container-position can be set to null.

If gutters are set to 0 or null, they will have no output.

BREAKING: full output matches span patterns.

BREAKING: Debug grids are hidden by default.

BREAKING: Remove nth-last/-omega/-first/-alpha
as confusing & out-of-scope.
Format your nth-selectors manually to apply first/last mixins.

Gutter mixins/functions can accept context-only (without the "of" syntax):

gutters(of 10 .25) == gutters(10 .25)

Unitless numbers are used for context.

Lengths (with units) are used as explicit gutter-overrides.

BREAKING: Re-purposed susy-set as reverse of susy-get —
to adjust a single setting.
Example: @include susy-set(gutter-position, inside);

Replace global box-sizing setting with global-box-sizing.

Let Susy know what box model you are using globally.

box-sizing can still be passed as a keyword argument.

Add global-box-sizing() mixin to set your global box model.

Example: @include global-box-sizing(border-box);

You can still use the legacy @include border-box-sizing; as a shortcut.

Uses your global setting as a default.

Updates your global setting to match, if you pass a different value.

gallery and span mixins take global-box-sizing into account.

2.0.0-alpha.6 — Dec 5 2013

Rewrite syntax parsing so parser and resulting maps are shared across Susy.

Fix explicit-span bug causing large gutters.

Padding mixins now respect inside gutters.

Backwards Incompatible:

Removed gutters $n keyword in shorthand syntax
for setting explicit gutters.
Use (gutter-override: $n) map instead.

2.0.0-alpha.5 — Nov 25 2013

Compass is no longer a dependency.

Only registers as a compass extension if compass is present.

Any mixin/function that accepts natural language syntax also accepts maps.

Maps and natural language can be mixed:

$large: (columns: 12, gutters: .5);

span(3 $large no-gutters)

Add full mixin for full-width spans.

Backwards Incompatible:

Requires Sass 3.3

Default settings are handled with a Sass map on the $susy variable.
Example: $susy: (columns: 12, gutters: .25) etc.

bleed now takes standard span syntax, with multiple (TRBL) spans.

e.g. bleed(1em 2 of 8) for 1em top/bottom and 2-columns left/right.

Add bleed-x/bleed-y mixins for horizontal and vertical shortcuts.

Span arguments now accept narrow, wide, or wider keywords.

The wide keyword replaces the old outer keyword.

This setting has been re-named from outer to spread.

Re-wrote grid debugging

More concise & accurate output for symmetrical grids.

Changed grid-background() to show-grid()/show-grids()

Changed overlay-grid() to grid-overlay()

Moved settings into $debug: (color: rgba(#66f, .25), toggle: top right);

Removed overlay-position setting.

Only display vertical-rhythms when $base-line-height is available.

split gutters are no longer removed at the grid edges.

first and last are not special cases for split gutter-handling.

pass the container argument to wrappers you plan to nest inside.

first/alpha/last/omega/nth- mixins require grid context.

2.0.0-alpha.4 — Sept 4 2013

Add bleed mixin.

Fix bug with fluid inside-gutter calculations.

$last-flow setting controls the flow direction of row-ending elements.

background-grid-output now accepts $line-height argument.

Compass modules are imported as needed.

grid-background, grid-overlay, grid-background-output,
& $grid-background-color
have been renamed to remiain consistent and avoid conflicts with Compass:

grid-background => background-grid

grid-overlay => overlay-grid

grid-background-output => background-grid-output

$grid-background-color => $grid-color

span mixing accepts nested @content, and uses nested context.

Add inside-static option for static gutters in otherwise fluid grids.

gutters mixin uses span syntax, accepts explicit gutter span.

Explicit gutter-overrides are divided when gutters are split/inside.

2.0.0-alpha.3 — July 9 2013

row now includes clearfix, and unrow removes clearfix.

gallery output should override previous gallery settings.

Removed nth-gallery and isolate-gallery in favor of single,
isolated gallery mixin.

Add padding-span syntax: prefix, suffix, and pad.

Add margin-span syntax: pre, post, push, pull, and squish.

New gutters mixin adds gutters to an element.

gutter function now returns half-widths when using split/inside gutters.

Add outer keyword to span syntax,
to return span-width including gutters.

Works with both span mixin and span function.

Replaces Susy 1.0 space function.

Add comrehensive unit tests, using True.

Improve fall-abck handling of ommitted arguments.

Add container function to return a given container's width.

Add auto keyword to override $container-width,
otherwise respect existing width.

Renamed $isolate to $layout-method

No longer accepts boolean.

Accepts keywords isolate and (default) float.

Renamed $static to $layout-math

No longer accepts boolean.

Accepts keywords static (use given units)
and (default) fluid (use % units).

Add show-columns and show-baseline keywords
to $show-grids setting.
show will show both columns/baseline, default is show-columns.

2.0.0-alpha.2 — May 7 2013

Added gutter <length>/gutters <length>
to override the attached gutter width on a single span.

NOTE: gutters 0 is not the same as no-gutters.
0 is an output value, no-gutters removes output.

Added container span option
to remove inside gutters from nesting containers.

Added before/after/split/inside/no-gutters gutter options.

Added gallery mixin for auto-generating gallery layouts.

Moved grid-backgrounds into language layer, and made them syntax-aware.

Added row/unrow, first/last, alpha/omega,
nth-first/nth-last, and nth-alpha/nth-omega.

Added container and span mixins with new syntax.

Added syntax-aware math functions (span/gutter/outer-span).

Added rough translate-susy1-settings mixin.

Moved syntax-specific math into language layer.

Fleshed-out new language syntax.

Added get-grid, set-grid, and use-grid
and declaring and managing settings.

Remove breakpoint core requirement (will come back as option)

2.0.0-alpha.1 — Jan 26 2013

Susy 2.0 was re-written from the ground up.

Functioning math engine

Initial string parsing for natural syntax

Float/Isolation output methods

Removed all ECHOE/RAKE stuff in favor of vanilla .gemspec

Added Ruby based String Split function

Added Sass based grid-add function, to add grids à la Singularity

Added default variables

1.0.5 — Nov 27 2012

Add support for rem-units.

Clean-up quoted arguments.

Fix a few bugs related to the override settings.

1.0.4 — Nov 3 2012

Fix bug in nested mixins that adjust support
(e.g. nth-omeg inside at-breakpoint).

Remove non-ie experimental support in at-breakpoint ie-fallback output.

1.0.3 — Oct 20 2012

Fix Compass dependencies.

1.0.2 — Oct 20 2012

Fix a bug with container-outer-width ignoring $columns argument.

Turn off legacy-ie support inside CSS3 selectors (nth-omega etc).

1.0.1 — Sept 12 2012

Fix a bug in the relationship
between $container-width and $border-box-sizing,
so that grid-padding is subtracted from the width in certain cases.

Reset right margin to auto rather than 0 with remove-omega.

1.0 — Aug 14 2012

This release is loaded with new features, but don't let that fool you. Susy
just became shockingly simple to use.

The gem name has changed from compass-susy-plugin to susy.
First uninstall the old gem, then install the new one.
If you have both gems installed, you will get errors.

Semantics:

We re-arranged the code
in order to make the syntax simpler and more consistent:

$total-cols is now $total-columns.

$col-width is now $column-width.

$side-gutter-width is now $grid-padding
and gets applied directly to the grid container.

un-column & reset-column mixins have merged into reset-columns.

columns has been renamed span-columns
to resolve the conflict with CSS3 columns.
See other improvements to span-columns below.

We also removed several bothersome requirements:

The alpha mixin is no longer needed. Ever.

The omega no longer takes a $context argument.

full has been removed entirely.
Elements will be full-width by default.
You can add clear: both; back in as needed.

side-gutter() is no longer needed.
You can use the $grid-padding setting directly.

Upgrade:

That's all you need in order to upgrade from Susy 0.9.

Uninstall and re-install the gem.

Find and replace the semantic changes listed above.

You're done! Stop worrying about all that "nested vs. root" bullshit,
and start playing with the new toys!

If you use the $from directional arguments
directly in the span-columns mixin,
there may be one more change to make.
See below:

New Features:

span-columns supports new features:

"omega" can be applied directly through the $columns argument.

Internal padding can be added through the $padding argument.

This pushes the $from argument from third position into fourth.

at-breakpoint allows you to change layouts at media breakpoints.

container accepts multiple media-layout combinations as a shortcut.

layout allows you to use a different layout at any time.

with-grid-settings allows you to change any or all grid settings.

set-container-width does what it says, without the other container code.

$breakpoint-media-output, $breakpoint-ie-output,
and $breakpoint-raw-output
settings help manage the different outputs from at-breakpoint
when you have IE-overrides living in a file of their own.

border-box-sizing will  apply the popular * { box-sizing: border-box }
universal box-model fix, as well as changing the Susy $border-box-model
setting for you, so Susy knows to adjust some math.

The space() function can be used anywhere you need column+gutter math.

push/pull/pre/post/squish mixins help manage margins.

use the nth-omega mixin to set omega on any nth-child, nth-of-type,
first, last, or only element.

remove-omega and remove-nth-omega will remove
the omega-specific styles from an element.

$container-width will override the width of your container
with any arbitrary length.

$container-style will override the type of grid container
(magic, fluid, fixed, static, etc) to use.

0.9 — Apr 25 2011

Everything here is about simplicity. Susy has scaled back to it's most basic
function: providing flexible grids. That is all.

Deprecated:

The susy/susy import is deprecated in favor of simply importing susy.

The show-grid import is deprecated in favor of CSS3 gradient-based
grid-images. You can now use the susy-grid-background mixin. See below.

Removed:

Susy no longer imports all of compass.

Susy no longer establishes your baseline and no longer provides a reset.
All of that is in the Compass core. You can (and should!) keep using them,
but you will need to import them from compass.

New:

Use susy-grid-background mixin on any container to display the grid.
This toggles on and off with the same controls that are used by the compass
grid-background module.

0.9.beta.3 — Mar 16 2011

Deprecated:

The susy/reset import has been deprecated
in favor of the Compass core compass/reset import.

The susy mixin has been deprecated.
If you plan to continue using vertical-rhythms,
you should replace it with the establish-baseline mixin
from the Compass Core.

Removed:

The vertical-rhythm module has moved into compass core.
The API remains the same, but if you were importing it directly,
you will have to update that import.
($px2em was removed as part of this, but didn't make it into core).

The defaults template has been removed as 'out-of-scope'.
This will not effect upgrading in any way,
but new projects will not get a template with default styles.

New Features:

Susy now supports RTL grids and bi-directional sites
using the $from-direction variable (default: left)
and an optional additional from-direction argument on all affected mixins.
Thanks to @bangpound for the initial implementation.

Susy is now written in pure Sass! No extra Ruby functions included!
Thanks to the Sass team for making it possible.

0.8.1 — Sep 24 2010

Fixed typos in tutorial and _defaults.scss

0.8.0 — Aug 13 2010

Deprecated:

The skip-link was deprecated as it doesn't belong in Susy.

All the IE-specific mixins have been deprecated,
along with the $hacks variable.
Hacks are now used in the default mixins as per Compass.

The hide mixin was deprecated in favor of the Compass hide-text mixin.

Other Changes:

inline-block-list will be moved to the compass core soon.
In preparation, I've cleaned it up some.
You can now apply a padding of "0" to override previous padding arguments.
You can also use inline-block-list-container
and inline-block-list-item as you would
with the Compass horizontal-list mixins.

The $align arguments have been removed
from both the susy and container mixins.
Text-alignment is no longer used or needed in achieving page centering.
That was a cary-over from the IE5 Mac days.

The container mixin now uses the pie-clearfix
compass mixin to avoid setting the overflow to hidden.

Default styles have been cleaned up to account
for better font stacks and typography, html5 elements,
vertically-rhythmed forms, expanded print styles,
use of @extend, and overall simplification.

0.7.0 — Jun 01 2010

updated documentation

0.7.0.rc2 — May 13 2010

Fixes a bug with grid.png and a typo in the readme. Nothing major here.

0.7.0.rc1 — May 12 2010

template cleanup & simplification - no more pushing CSSEdit comments, etc.

expanded base and defaults with better fonts & styles out-of-the-box

expanded readme documentation.
This will expand out into a larger docs/tutorial site in the next week.

0.7.0.pre8 — Apr 20 2010

mostly syntax and gem cleanup

added un-column mixin to reset elements previously declared as columns.

added rhythm mixin as shortcut for leaders/trailers. accepts 4 args:
leader, padding-leader, padding-trailer, trailer.

added a warning on alpha
to remind you that alpha is not needed at nested levels.

0.7.0.pre7 — Apr 13 2010

Requires HAML 3 and Compass 0.10.0.rc2

Internal syntax switched to scss. This will have little or no effect on users.
You can still use Susy with either (Sass/Scss) syntax.

$default-rhythm-border-style overrides default rhythm border styles

Better handling of sub-pixel rounding for IE6

0.7.0.pre6 — Mar 29 2010

Added +h-borders() shortcut for vertical_rhythm +horizontal-borders()

Fixed vertical rhythm font-size typo (thanks @oscarduignan)

Added to template styles, so susy is already in place from the start

0.7.0.pre5 — Mar 19 2010

Expanded and adjusted _vertical_rhythm.sass
in ways that are not entirely backwards compatible.
Check the file for details.

_defaults.sass is re-ordered from inline to block.

:focus defaults cleaned up.

README and docs updated.

0.7.0.pre4 — Jan 20 2010

Update: pre2 was missing a file in the manifest. Use pre4.

Update: Forgot to note one change:
+susy is no longer assigned to the body tag,
but instead at the top level of the document
(not nested under anything).

Warning: This update is not backwards compatible.
We've changed some things. You'll have to change some things.
Our changes were fairly major in cleaning up the code -
yours will be minor and also clean up some code.

Added:

new _vertical_rhythm.sass (thanks to Chris Eppstein)
provides better establishing of the baseline grid,
as well as mixins to help you manage it.

!px2em has replaced px2em() - see below.

Removed:

px2em() has been removed and replaced with a simple variable
!px2em which returns the size of one pixel
relative to your basic em-height.
Multiply against your desired px dimensions
(i.e. border-width = !px2em*5px will output the em-equivalent of 5px).

!base_font_size_px and !base_line_height_px
have been replaced with !base_font_size and !base_line_height
which take advantage of sass's built-in unit handling.

!grid_units is not needed,
as you can now declare your units directly
in the other grid _width variables.
Use any one type of units in declaring your grid.
The units you use will be used in setting the container size.

Once you've upgraded, before you compile your files, make these changes:

remove the "_px" from the font-size and line-height variables,
and add "px" to their values.

remove the !grid_units variable
and add units to your grid variable values.

find any uses of px2em() and replace them with something.

enjoy!

0.7.0.pre1 — Nov 30 2009

Not a lot of new functionality here –
it all moved over to Compass 0.10.0 –
mostly just cleaning it up to match.

simplified the default styles
and gave them their own project template (_defaults.sass).

defaults not imported by ie.sass,
as ie.sass should be cascading on top of screen.sass anyway

changed the syntax to match CSS and Compass
(property: replaces :property)

added more inline documentation and brought tutorial up to date

moved CSS3 module over to Compass

import the compass HTML5 reset along with the normal reset by default
(because Susy loves the future)

little internal management fixes and so on and so on…

Older

Not documented here. Check the commit log…


text:
ALTER PROCEDURE [dw].[p_lataa_f_yo_harjoittelukoulut]
AS
TRUNCATE TABLE dw.f_yo_harjoittelukoulut;

INSERT INTO dw.f_yo_harjoittelukoulut (
	[d_yliopisto_id]
	,[vuosi]
	,[harjoittelukoulun_oppilaat_yhteensa]
	,[harjoittelukoulun_oppilaat_esiopetus]
	,[harjoittelukoulun_oppilaat_perusopetuksen_vuodet_1_6]
	,[harjoittelukoulun_oppilaat_perusopetuksen_vuodet_7_9]
	,[harjoittelukoulun_oppilaat_lukio]
	,[harjoittelukoulun_kokonaistuntimaara]
	,[harjoittelukoulun_opettajankoulutustehtavien_kokonaisviikkotunnit]
	,[loadtime]
	,[source]
	,[username]
	)
SELECT s2.id
	,[Vuosi]
	,COALESCE([Harjoittelukoulun oppilaat, yhteensä], 0)
	,COALESCE([Harjoittelukoulun oppilaat, esiopetus], 0)
	,COALESCE([Harjoittelukoulun oppilaat, perusopetuksen vuodet 1-6], 0)
	,COALESCE([Harjoittelukoulun oppilaat, perusopetuksen vuodet 7-9], 0)
	,COALESCE([Harjoittelukoulun oppilaat, lukio], 0)
	,COALESCE([Harjoittelukoulun kokonaistuntimäärä], 0)
	,COALESCE([Harjoittelukoulun opettajankoulutustehtävien kokonaisviikkotunnit], 0)
	,getdate()
	,'etl: p_lataa_f_yo_harjoittelukoulut'
	,suser_sname()
FROM [sa].[sa_suorat_yo9_harjoittelukoulut] s1
JOIN [dw].[d_yo] s2 ON s1.yliopisto = s2.yo_tunnus
;


text:
<?xml version="1.0"?>
<!--Phoronix Test Suite v3.0.0a3 (Iveland) [ http://www.phoronix-test-suite.com/ ]-->
<PhoronixTestSuite>
  <TestInformation>
    <Title>POV-Ray</Title>
    <AppVersion>3.6.1</AppVersion>
    <Description>This is a test of POV-Ray, the Persistence of Vision Raytracer. POV-Ray is used to create 3D graphics using ray-tracing.</Description>
    <ResultScale>Seconds</ResultScale>
    <Proportion>LIB</Proportion>
    <SubTitle>Total Time</SubTitle>
    <TimesToRun>1</TimesToRun>
  </TestInformation>
  <TestProfile>
    <Version>1.0.0</Version>
    <SupportedPlatforms>Linux, Solaris</SupportedPlatforms>
    <SoftwareType>Utility</SoftwareType>
    <TestType>Processor</TestType>
    <License>Free</License>
    <Status>Verified</Status>
    <ExternalDependencies>build-utilities</ExternalDependencies>
    <EnvironmentSize>12.7</EnvironmentSize>
    <ProjectURL>http://www.povray.org/</ProjectURL>
    <Maintainer>Michael Larabel</Maintainer>
  </TestProfile>
</PhoronixTestSuite>