text:
package jfdi.ui;

import jfdi.ui.items.ListItem;

public class Constants {

    public static final String PRODUCT_NAME = "J.F.D.I.";

    public static final String UI_MESSAGE_GREETING = "\nJ.F.D.I. : Hello there! Nice to see you again! :)";
    public static final String UI_MESSAGE_WELCOME = "\nJ.F.D.I. : If you need help, just type \"help\" :)";
    public static final String UI_MESSAGE_RESPONSE = "\nJ.F.D.I. : %1$s";
    public static final String UI_MESSAGE_WARNING = "\nWarning: %1$s";
    public static final String UI_MESSAGE_ERROR = "\nError: %1$s";
    public static final String UI_MESSAGE_QUIT = "\nBye Bye! See you next time! :)";

    public static final String URL_ROOT_PATH = "/ui/RootLayout.fxml";
    public static final String URL_LIST_PATH = "/ui/ListLayout.fxml";
    public static final String URL_HELP_PATH = "/ui/HelpItem.fxml";
    public static final String URL_ITEM_PATH = "/ui/ListItem.fxml";
    public static final String URL_HEADER_PATH = "/ui/ListHeader.fxml";
    public static final String URL_HAMSMITH_PATH = "/ui/fonts/HammersmithOne.ttf";
    public static final String URL_RALEWAY_PATH = "/ui/fonts/raleway.heavy.ttf";
    public static final String URL_LOGO_PATH = "/ui/images/JFDI_sq.png";

    public static final String CTRL_CMD_PROMPT_TEXT = "(Hello! Please let me know what I can do for you!)";
    public static final String CTRL_CMD_INCOMPLETE = "list";
    public static final String CTRL_CMD_OVERDUE = "list overdue";
    public static final String CTRL_CMD_UPCOMING = "list upcoming";
    public static final String CTRL_CMD_ALL = "list all";
    public static final String CTRL_CMD_COMPLETE = "list completed";
    public static final String CTRL_CMD_SURPRISE = "surprise";
    public static final String CTRL_CMD_SEARCH = "search ";
    public static final String CTRL_CMD_SURPRISE_YAY = "yay";
    public static final String CTRL_CMD_SURPRISE_NAY = "nay";
    public static final String CTRL_CMD_HELP = "help";
    public static final ListItem HEADER_OVERDUE = new ListItem(ListStatus.OVERDUE.toString());
    public static final ListItem HEADER_UPCOMING = new ListItem(ListStatus.UPCOMING.toString());
    public static final ListItem HEADER_OTHERS = new ListItem(ListStatus.OTHERS.toString());

    public enum ListStatus {
        INCOMPLETE, OVERDUE, UPCOMING, ALL, COMPLETE, SEARCH, SURPRISE, SURPRISE_YAY, HELP, OTHERS
    }

    public enum MsgType {
        SUCCESS, WARNING, ERROR, EXIT
    }

    public static final String CMD_ERROR_CANT_ADD_EMPTY = "Cannot add an empty task!";
    public static final String CMD_ERROR_CANT_ADD_DUPLICATE = "Save the trouble. This task already exists :)";
    public static final String CMD_ERROR_CANT_ALIAS_INVALID = "- %s - is an invalid alias for - %s -";
    public static final String CMD_ERROR_CANT_ALIAS_DUPLICATED = " - %s - is an duplicated alias.";
    public static final String CMD_ERROR_CANT_DELETE_NO_ID = "Some stupid error occurred. Cannot delete task(s)!";
    public static final String CMD_ERROR_INIT_FAIL_INVALID = "The folder %s doesn't work. Choose another one!";
    public static final String CMD_ERROR_INIT_FAIL_REPLACED = "Your file %s was moved to %s.";
    public static final String CMD_ERROR_CANT_MARK_NO_ID = "Cannot mark task as completed. The ID #%d does not exist!!";
    public static final String CMD_ERROR_MOVE_FAIL_INVALID = "Cannot move to the folder %s . Choose another one!";
    public static final String CMD_ERROR_MOVE_FAIL_REPLACED =
            "The folder %s is occupied. File has been moved to %s instead!";
    public static final String CMD_ERROR_SURP_FAIL_NO_TASKS =
            "There's really nothing much that you can do now.. take a rest or add more tasks! :D";
    public static final String CMD_ERROR_REDO_FAIL_NO_TASKS = "Cannot find any previous task to redo!";
    public static final String CMD_ERROR_CANT_RENAME_NO_ID = "Cannot rename task. The ID #%d does not exist!";
    public static final String CMD_ERROR_CANT_RENAME_NO_CHANGES = "No difference between new and old name - %s -!";
    public static final String CMD_ERROR_CANT_RENAME_DUPLICATE = "Save the trouble. This task already exists :)";
    public static final String CMD_ERROR_CANT_RESCHEDULE_NO_ID = "Cannot reschedule task. The ID #%d does not exist!";
    public static final String CMD_ERROR_CANT_RESCHEDULE_NO_CHANGES = "No difference between new and old schedule!";
    public static final String CMD_ERROR_CANT_RESCHEDULE_DUPLICATE = "Save the trouble. This task already exists :)";
    public static final String CMD_ERROR_CANT_UNALIAS_NO_ALIAS =
            "Cannot remove alias. The alias - %s - does not exist!";
    public static final String CMD_ERROR_UNDO_FAIL_NO_TASKS = "Cannot find any previous task to undo!";
    public static final String CMD_ERROR_CANT_UNMARK_NO_ID = "Cannot unmark task. The ID #%d does not exist!!";
    public static final String CMD_ERROR_USE_FAIL_INVALID =
            "Cannot use the data at %s . Choose another one!";
    public static final String CMD_ERROR_USE_FAIL_REPLACED =
            "The folder %s contains invalid files. Data has been moved to %s instead!";

    public static final String CMD_SUCCESS_ADDED = "Task #%d - %s - added! :)";
    public static final String CMD_SUCCESS_ALIAS = "Alias - %s - is created for command - %s -! :)";
    public static final String CMD_SUCCESS_REDONE = "Previous command redone! :)";
    public static final String CMD_SUCCESS_UNDONE = "Previous command undone! :)";
    public static final String CMD_SUCCESS_DELETED_1 = "Task #%d deleted! :)";
    public static final String CMD_SUCCESS_DELETED_2 = "Tasks %s deleted! :)";
    public static final String CMD_SUCCESS_HELP = "TO THE RESCUE!!! :D";
    public static final String CMD_SUCCESS_LISTED = "Here is your requested %s list! :)";
    public static final String CMD_SUCCESS_MARKED_1 = "Task #%d completed! Good job! :)";
    public static final String CMD_SUCCESS_MARKED_2 = "Tasks %s completed! Good job! :)";
    public static final String CMD_SUCCESS_MOVED = "The location of your files has been moved to %s ! :)";
    public static final String CMD_SUCCESS_RENAMED = "Task #%d renamed to - %s -! :)";
    public static final String CMD_SUCCESS_RESCHEDULED = "Task #%d rescheduled and shifted to #%d ! :)";
    public static final String CMD_SUCCESS_SEARCH_1 = "Here are your search results for keyword - %s -! :)";
    public static final String CMD_SUCCESS_SEARCH_2 = "Here are your search results for keywords - %s -! :)";
    public static final String CMD_SUCCESS_SHOWDIRECTORY = "Your current directory is %s ";
    public static final String CMD_SUCCESS_SURPRISED = "SURPRISE!!!TAAAADAAAA!!! :D";
    public static final String CMD_SUCCESS_SURPRISED_YAY = "Way to go! You can do it!!! :D";
    public static final String CMD_SUCCESS_UNALIAS = "Alias - %s - is removed! :)";
    public static final String CMD_SUCCESS_UNMARKED_1 = "Task #%d marked as incomplete! :)";
    public static final String CMD_SUCCESS_UNMARKED_2 = "Tasks %s marked as incomplete! :)";
    public static final String CMD_SUCCESS_USED = "You are now using data from %s ! :)";

    public static final String CMD_WARNING_DONTKNOW = "Sorry, I do not understand what you mean by \"%s\" :(";

    public static final String LOG_FXML_PATH = "Loaded %s from %s'.";
    public static final String LOG_SUCCESS_LISTED = "List requested.";
    public static final String LOG_USER_EXIT = "Exited from JFDI.";
    public static final String LOG_INVALID_COMMAND = "Invalid command detected.";
    public static final String LOG_ADDED_SUCCESS = "Displayed successful add event for task #%d.";
    public static final String LOG_ADD_FAIL_EMPTY = "An task failed to add due to empty description.";
    public static final String LOG_ADD_FAIL_DUPLICATE = "A duplicate task was not added.";
    public static final String LOG_DELETED_SUCCESS = "Displayed successful delete event for task #%d.";
    public static final String LOG_UI_LIST = "The current list of task to be displayed is : ";
    public static final String LOG_LOGIC_LIST = "The list of task received from Logic is : ";
    public static final String LOG_IDINDEX_LIST = "The current mapping of On-screen ID and Storage ID is : ";
    public static final String LOG_DELETE_FAIL_NOID = "An non-existent ID was queried for delete.";
    public static final String LOG_RENAMED_SUCCESS = "Displayed successful rename event for task #%d.";
    public static final String LOG_RENAME_FAIL_NOID = "An non-existent ID was queried for rename.";
    public static final String LOG_RENAME_FAIL_NOCHANGE = "A renaming with no change was queried.";
    public static final String LOG_RENAME_FAIL_DUPLICATE = "A task was not renamed as a duplicate task exists.";
    public static final String LOG_RESCHED_SUCCESS = "Displayed successful reschedule event for task #%d.";
    public static final String LOG_RESCHE_FAIL_NOID = "An non-existent ID was queried for reschedule.";
    public static final String LOG_RESCHE_FAIL_NOCHANGE = "A rescheduling with no change was queried.";
    public static final String LOG_RESCHE_FAIL_DUPLICATE = "A task was not rescheduled as a duplicate task exists.";

    public static final char ARROW_UP = 0x25b2;
    public static final char ARROW_DOWN = 0x25bC;
    public static final String HELP_HOT_KEYS_DESC = "Navigate the tabs using hot keys";
    public static final String HELP_HOT_KEYS_COMMAND = "Incomplete <F1> / Overdue <F2> / Upcoming <F3> "
            + "/ All <F4> / Completed <F5> / Surprise <F6> / Help <F7>";
    public static final String HELP_PAGE_UP_DOWN_DESC = "Scroll the on-screen list";
    public static final String HELP_PAGE_UP_DOWN_COMMAND = "press your keyboard's page up/down button";
    public static final String HELP_UP_DOWN_DESC = "Scroll through your previous commands";
    public static final String HELP_UP_DOWN_COMMAND = "press your keyboard's up (" + ARROW_UP + ") / down ("
            + ARROW_DOWN + ") arrow";
    public static final String HELP_ADD_FLOATING_DESC = "Add a task with no time or date";
    public static final String HELP_ADD_FLOATING_COMMAND = "add <task description>";
    public static final String HELP_ADD_POINT_DESC = "Add a task to be done AT/ON a particular date and time";
    public static final String HELP_ADD_POINT_COMMAND = "add <task description> <at/on> <date-time>";
    public static final String HELP_ADD_DEADLINE_DESC = "Add a task to be done BY a certain date and time";
    public static final String HELP_ADD_DEADLINE_COMMAND = "add <task description> by <date-time>";
    public static final String HELP_ADD_EVENT_DESC = "Add a task with a start and end date";
    public static final String HELP_ADD_EVENT_COMMAND = "add <task description> from <date-time> to <date-time>";
    public static final String HELP_LIST_DESC = "See incomplete/overdue/upcoming/all/completed tasks";
    public static final String HELP_LIST_COMMAND = "list <incomplete/overdue/upcoming/all/completed>";
    public static final String HELP_RENAME_DESC = "Rename a task";
    public static final String HELP_RENAME_COMMAND = "rename <task number> <new task description>";
    public static final String HELP_RESCH_DESC = "Reschedule a task";
    public static final String HELP_RESCH_COMMAND = "reschedule <task number> <new task date-time>";
    public static final String HELP_REMOVE_TIME_DESC = "Remove date and time restrictions";
    public static final String HELP_REMOVE_TIME_COMMAND = "reschedule <task number>";
    public static final String HELP_DONE_DESC = "Mark task as completed";
    public static final String HELP_DONE_COMMAND = "mark <task number>";
    public static final String HELP_UNDONE_DESC = "Mark task as incomplete";
    public static final String HELP_UNDONE_COMMAND = "unmark <task number>";
    public static final String HELP_DELETE_DESC = "Delete a task";
    public static final String HELP_DELETE_COMMAND = "delete <task number(s)>";
    public static final String HELP_SEARCH_DESC = "Search through your tasks for specific keywords";
    public static final String HELP_SEARCH_COMMAND = "search <keyword(s)>";
    public static final String HELP_UNDO_DESC = "Undo your previous change";
    public static final String HELP_UNDO_COMMAND = "undo";
    public static final String HELP_CREATE_ALIAS_DESC = "Define your own alias (command)";
    public static final String HELP_CREATE_ALIAS_COMMAND = "alias <default command> <new alias>";
    public static final String HELP_DELETE_ALIAS_DESC = "Remove a previously defined alias";
    public static final String HELP_DELETE_ALIAS_COMMAND = "unalias <alias>";
    public static final String HELP_WILDCARD_DESC = "Let JFDI surprise you";
    public static final String HELP_WILDCARD_COMMAND = "surprise!";
    public static final String HELP_CHECK_DIR_DESC = "Check what the current directory is";
    public static final String HELP_CHECK_DIR_COMMAND = "directory";
    public static final String HELP_USE_DIR_DESC = "Use data from another directory";
    public static final String HELP_USE_DIR_COMMAND = "use <new directory>";
    public static final String HELP_MOVE_DIR_DESC = "Move existing program data to another directory";
    public static final String HELP_MOVE_DIR_COMMAND = "move <new directory>";
    public static final String HELP_EXIT_DESC = "GET OUT OF JFDI :(";
    public static final String HELP_EXIT_COMMAND = "quit";

    public static final String ITEM_ROW_INDEX = " #%d  ";
    public static final String ITEM_NO_TIMEDATE = "Anytime ~";
    public static final String ITEM_DEADLINE = "by %s";
    public static final String ITEM_POINT_TASK = "on %s";
    public static final String ITEM_EVENT_TASK = "from %s to %s";
}


text:
package org.zeprs.unittest.persistence;

import org.zeprs.unittest.ZeprsTest;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Dave Peckham
 * Date: Mar 29, 2004
 * Time: 3:55:09 PM
 * To change this template use File | Settings | File Templates.
 */
public class FormFieldTest extends ZeprsTest {

    private String listName = "FormFields";
    private String name = "FormField";
    private String className = "org.cidrz.webapp.dynasite.valueobject.FormField";
    private String dao = "org.cidrz.webapp.dynasite.dao.FormFieldDAO";
    private Class[] argClazz = new Class[]{Long.class};
    private Object[] args = new Object[]{new Long("6")};

    public void testOne() {

        Class clazz = null;
        try {
            clazz = Class.forName(className);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        Object object = null;
        try {
            object = clazz.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }

        Class daoClazz = null;
        try {
            daoClazz = Class.forName(dao);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        Method m = null;
        try {
            m = daoClazz.getDeclaredMethod("getOne", argClazz);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }

        try {
            object = m.invoke(object, args);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            fail("Failed to get " + name);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
            fail("Failed to get " + name);
        }
        assertNotNull(name + " was null", object);
    }

    public void testList() {

        Class daoClazz = null;
        try {
            daoClazz = Class.forName(dao);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        List list = null;
        Method m = null;
        try {
            m = daoClazz.getDeclaredMethod("getAll", new Class[]{});
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        try {
            list = (List) m.invoke(null, new Object[]{});
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            fail("Failed to get list of " + listName);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
            fail("Failed to get list of " + listName);
        }
        assertNotNull(listName + " list was null", list);
    }

    public void testSharedFormFields() {

        Class daoClazz = null;
        try {
            daoClazz = Class.forName(dao);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        List list = null;
        Method m = null;
        try {
            m = daoClazz.getDeclaredMethod("getAllSharedFields", new Class[]{});
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        try {
            list = (List) m.invoke(null, new Object[]{});
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            fail("Failed to get list of " + listName);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
            fail("Failed to get list of " + listName);
        }
        assertNotNull(listName + " list was null", list);
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php
function messageSystems() {
	if(Yii::$app->session->get('message') != null) {
		?>
			<script type="text/javascript">
				messageSystems('<?php echo Yii::$app->session->getFlash('message'); ?>');
			</script>
		<?php
	}
}


text:
<!DOCTYPE html>

<meta charset="utf-8">
<title>Nate Pinchot | DjangoCon in Austin, TX</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="DjangoCon US 2015 in Austin, TX" property="og:title"/>
<meta content="website" property="og:type"/>
<meta content="https://2015.djangocon.us/" property="og:url"/>
<meta content="DjangoCon US 2015" property="og:site_name"/>
<meta content="A six-day not-for-profit by-the-community and for-the-community international conference for the Django web framework. " property="og:description"/>
<meta content="https://2015.djangocon.us/site_media/static/images/djangocon-logo-thumb.png" property="og:image"/>
<link href="/site_media/static/main.css" media="screen,projection" rel="stylesheet" type="text/css"/>

<link href="/site_media/static/images/favicon.ico" rel="shortcut icon"/>

</meta></meta>

<button class="navbar-toggle" data-target=".navbar-collapse" data-toggle="collapse" type="button">
Toggle navigation

</button>

                About

What is Djangocon?

DjangoCon Organizers

Code of Conduct

Diversity

Accessibility

Financial Aid

Childcare

Volunteers

Contact Us

                Schedule

Tutorial Schedule

Talk Schedule

Sprints

DjangoGirls Austin Workshop

Beginner's Guide

                Registration

Register for DjangoCon US

Register for DjangoGirls Austin Workshop

Register for Hotel Accommodations

                Venue

Hotel Accommodations

Travel

City Guide to Austin

                Speaking

Call For Proposals

Speaker Mentors

Lightning Talks

                Sponsors

Become a Sponsor

DjangoCon Sponsors

                News

Log in

Sign up

<form action="https://2015.djangocon.us/account/logout/" id="accountLogOutForm" method="POST" style="display: none;">
<input name="csrfmiddlewaretoken" type="hidden" value="vKDUxSvBXQum2uTW0DN1QlXrjKdu8pjA"/>
</form>

Nate Pinchot

About Me

I'm located in Austin, TX.

I'm excited about developing software, extremely dedicated, and will work harder than necessary to get the job done. I strive to create quality implementations of code to best serve the purpose at hand.

"I am always proud of the work that I do."

My Site: http://natepinchot.com

Current & Past Employment

Since early August of 2012, I've worked with the intelligent people at UndercoverTourist, where I focus on the development of our website. I greatly enjoy and appreciate the lack of corporate stoogery and politics and the opportunity for my voice to be heard.

UndercoverTourist Site: https://www.undercovertourist.com

Between early 2001 and August of 2012, I worked at Datacore Consulting, where I helped clients create great software with captivating user experiences and intuitive user interfaces.

Skills and Core Competencies

Languages

Python, C#, JavaScript, Ruby, PHP

Server Technologies

nginx, uWSGI, AWS

Web Development Technologies

HTML, CSS, Django

Life Goals

One day I hope to be able to make homemade lasagna from scratch that is as delicious as my Grandmother's was.

Presentations

E-Commerce with Django at Scale: Effective Performance Lessons Learned

                        Monday
                        2:50 p.m.–3:15 p.m.
                        in
                        Salons CDE

Questions? Comments?
Contact Us

                  Design + Build by
                      Lincoln Loop

                      Hosted on Gondor

                      Presented by DEFNA

©2016 DjangoCon


text:
import java.util.ArrayList;

public class LongestCommonPrefix{
	public static String LongestCommonPrefix(String[] strs){
		if (strs.length == 1 ){
			return strs[0];
		}
		String strPrefix = "";
		for (int i=0;i<=strs.length-1;i=i+2){
			String strFore = strs[i];
			String strBack = (i == strs.length-1)?strs[i]:strs[i+1];
			System.out.println("strFore"+strFore);
			System.out.println("strBack"+strBack);
			int jFlag = -1;
			while (++jFlag>=0 && jFlag<strFore.length() && jFlag<strBack.length()){
				char chFore = strFore.charAt(jFlag);
				char chBack = strBack.charAt(jFlag);

				if (strPrefix == ""){
					if (i != 0){
						return strPrefix;
					}
					if (chFore == chBack){
						continue;
					}
				}
				else{
					if(jFlag >= strPrefix.length()){
						break;
					}
					if (chFore == chBack && chFore == strPrefix.charAt(jFlag)){
						continue;
					}
				}
				break;
			}
			System.out.println("jFlag"+jFlag);
			strPrefix = strFore.substring(0,jFlag);
			System.out.println("strPrefix"+strPrefix);
			if(strPrefix.length() == 0){
				return strPrefix;
			}
		}
		return strPrefix;
	}
	public static void main(String[] args){
		if(LongestCommonPrefix(new String[]{"aaa","aa","aaa"}).equals("aa")){
			System.out.println("success");
		}
		else{
			System.out.println("fail");
		}
		if(LongestCommonPrefix(new String[]{"123","12","123"}).equals("12")){
			System.out.println("success");
		}
		else{
			System.out.println("fail");
		}
		if(LongestCommonPrefix(new String[]{"1","1","11"}).equals("1")){
			System.out.println("success");
		}
		else{
			System.out.println("fail");
		}
		if(LongestCommonPrefix(new String[]{"a"})=="a"){
			System.out.println("success");
		}
		else{
			System.out.println("fail");
		}
	}
}


text:
package org.knowm.xchange.bity.dto.account;

import com.fasterxml.jackson.annotation.JsonProperty;

public class BityToken {

  @JsonProperty("scope")
  private String scope;

  @JsonProperty("access_token")
  private String accessToken;

  @JsonProperty("expires_in")
  private Integer expiresIn;

  @JsonProperty("refresh_token")
  private String refreshToken;

  @JsonProperty("token_type")
  private String tokenType;

  @JsonProperty("scope")
  public String getScope() {
    return scope;
  }

  @JsonProperty("scope")
  public void setScope(String scope) {
    this.scope = scope;
  }

  @JsonProperty("access_token")
  public String getAccessToken() {
    return accessToken;
  }

  @JsonProperty("access_token")
  public void setAccessToken(String accessToken) {
    this.accessToken = accessToken;
  }

  @JsonProperty("expires_in")
  public Integer getExpiresIn() {
    return expiresIn;
  }

  @JsonProperty("expires_in")
  public void setExpiresIn(Integer expiresIn) {
    this.expiresIn = expiresIn;
  }

  @JsonProperty("refresh_token")
  public String getRefreshToken() {
    return refreshToken;
  }

  @JsonProperty("refresh_token")
  public void setRefreshToken(String refreshToken) {
    this.refreshToken = refreshToken;
  }

  @JsonProperty("token_type")
  public String getTokenType() {
    return tokenType;
  }

  @JsonProperty("token_type")
  public void setTokenType(String tokenType) {
    this.tokenType = tokenType;
  }
}


text:
from pyfaces import pyfaces
import sys,time

# if __name__ == "__main__":
#     try:
#         start = time.time()
#         argsnum=len(sys.argv)
#         print "args:",argsnum
#         if(argsnum<5):
#             print "usage:python pyfacesdemo imgname dirname numofeigenfaces threshold "
#             sys.exit(2)
#         imgname=sys.argv[1]
#         dirname=sys.argv[2]
#         egfaces=int(sys.argv[3])
#         thrshld=float(sys.argv[4])
#         pyf=pyfaces.PyFaces(imgname,dirname,egfaces,thrshld)
#         end = time.time()
#         print 'took :',(end-start),'secs'
#     except Exception,detail:
#         print detail.args
#         print "usage:python pyfacesdemo imgname dirname numofeigenfaces threshold "

import sh, subprocess, os
from PIL import Image

start = time.time()

def crop_img(img):
  X = 200
  Y = 60
  WIDTH = 240
  HEIGHT = 320
  img = Image.open(img)
  # img2 = img.crop((X, Y, X+WIDTH, Y+HEIGHT))
  # img2.save("image_cropped.jpg")
  img_cropped = img.crop((X, Y, X+WIDTH, Y+HEIGHT))
  img_cropped.save('image_cropped.jpg')
  print img_cropped.size, '\n'

CWP = os.getcwd()   # Get current working directory
CWP_parent = '/'.join(CWP.split('/')[:-1])

def run_bash_cmd(cmd):
  process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
  output = process.communicate()[0]
  return output

print("Taking a photo!")
# CAPTURE_COMMAND = "fswebcam -r 1280x720 image.jpg"
CAPTURE_COMMAND = "fswebcam -r 640x426 image.jpg"
print run_bash_cmd(CAPTURE_COMMAND)

print("Cropping...")
imgname = CWP + "/image.jpg"
crop_img(imgname)
imgname = CWP + "/image_cropped.jpg"

print("Run face recognition!")
# FACE_REC_COMMAND = "python pyfacescmd/pyfacesdemo %s 12 3" % image_path

dirname = CWP_parent + "/images/gallery/"
egfaces = 12
thrshld = 3
pyf=pyfaces.PyFaces(imgname,dirname,egfaces,thrshld)
end = time.time()
print 'took :',(end-start),'secs'


text:
<?php

namespace Flarum\Sticky\Listener;

use Flarum\Event\ConfigureDiscussionGambits;
use Flarum\Event\ConfigureDiscussionSearch;
use Flarum\Sticky\Gambit\StickyGambit;
use Flarum\Tags\Gambit\TagGambit;
use Illuminate\Contracts\Events\Dispatcher;

class PinStickiedDiscussionsToTop
{
    /**
     * @param Dispatcher $events
     */
    public function subscribe(Dispatcher $events)
    {
        $events->listen(ConfigureDiscussionGambits::class, [$this, 'addStickyGambit']);
        $events->listen(ConfigureDiscussionSearch::class, [$this, 'reorderSearch']);
    }

    /**
     * @param ConfigureDiscussionGambits $event
     */
    public function addStickyGambit(ConfigureDiscussionGambits $event)
    {
        $event->gambits->add(StickyGambit::class);
    }

    /**
     * @param ConfigureDiscussionSearch $event
     */
    public function reorderSearch(ConfigureDiscussionSearch $event)
    {
        if ($event->criteria->sort === null) {
            $search = $event->search;
            $query = $search->getQuery();

            if (! is_array($query->orders)) {
                $query->orders = [];
            }

            foreach ($search->getActiveGambits() as $gambit) {
                if ($gambit instanceof TagGambit) {
                    array_unshift($query->orders, ['column' => 'is_sticky', 'direction' => 'desc']);

                    return;
                }
            }

            $query->leftJoin('users_discussions', function ($join) use ($search) {
                $join->on('users_discussions.discussion_id', '=', 'discussions.id')
                     ->where('discussions.is_sticky', '=', true)
                     ->where('users_discussions.user_id', '=', $search->getActor()->id);
            });

            // TODO: Might be quicker to do a subquery in the order clause than a join?
            $grammar = $query->getGrammar();
            $readNumber = $grammar->wrap('users_discussions.read_number');
            $lastPostNumber = $grammar->wrap('discussions.last_post_number');

            array_unshift($query->orders, [
                'type' => 'raw',
                'sql' => "(is_sticky AND ($readNumber IS NULL OR $lastPostNumber > $readNumber)) desc"
            ]);
        }
    }
}


text:
<assembly>
  <id>src</id>
  <formats>
    <format>tar.gz</format>
    <format>tar.bz2</format>
    <format>zip</format>
  </formats>
  <fileSets>
    <fileSet>
      <directory>${basedir}/target/dist-src</directory>
      <outputDirectory></outputDirectory>
      <includes>
        <include>**</include>
      </includes>
      <excludes>
        <exclude>**/target/**</exclude>
        <exclude>**/.svn/**</exclude>
      </excludes>
    </fileSet>
  </fileSets>
</assembly>


text:
package org.apache.qpid.protonj2.types.transport;

import org.apache.qpid.protonj2.types.UnsignedByte;

public enum SenderSettleMode {

    UNSETTLED(0), SETTLED(1), MIXED(2);

    private UnsignedByte value;

    private SenderSettleMode(int value) {
        this.value = UnsignedByte.valueOf((byte)value);
    }

    public static SenderSettleMode valueOf(UnsignedByte value) {
        return value == null ? MIXED : SenderSettleMode.valueOf(value.byteValue());
    }

    public static SenderSettleMode valueOf(byte value) {
        switch (value) {
            case 0:
                return SenderSettleMode.UNSETTLED;
            case 1:
                return SenderSettleMode.SETTLED;
            case 2:
                return SenderSettleMode.MIXED;
            default:
                throw new IllegalArgumentException("The value can be only 0 (for UNSETTLED), 1 (for SETTLED) and 2 (for MIXED)");
        }
    }

    public byte byteValue() {
        return value.byteValue();
    }

    public UnsignedByte getValue() {
        return value;
    }
}


text:
<?php

namespace spec\Knp\FriendlyContexts\Guesser;

use Knp\FriendlyContexts\Faker\Provider\Base;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class DecimalGuesserSpec extends ObjectBehavior
{
    function let(Base $faker)
    {
        $faker->getParent()->willReturn('parent');
        $this->addFaker($faker);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Knp\FriendlyContexts\Guesser\DecimalGuesser');
    }

    function it_should_transform_a_string_to_float()
    {
        $this->transform('12.21')->shouldReturn(12.21);
    }

    function it_should_supports_decimal_mapping()
    {
        $mapping = [
            'fieldName'  => "pricing",
            'type'       => "decimal",
            'scale'      => 0,
            'length'     => null,
            'unique'     => false,
            'nullable'   => false,
            'precision'  => 0,
            'columnName' => "pricing",
        ];

        $this->supports($mapping)->shouldReturn(true);
    }

    function it_should_supports_float_mapping()
    {
        $mapping = [
            'fieldName'  => "pricing",
            'type'       => "float",
            'scale'      => 0,
            'length'     => null,
            'unique'     => false,
            'nullable'   => false,
            'precision'  => 0,
            'columnName' => "pricing",
        ];

        $this->supports($mapping)->shouldReturn(true);
    }

    function it_should_not_supports_other_mapping()
    {
        $mapping = [
            'fieldName'  => "pricing",
            'type'       => "int",
            'scale'      => 0,
            'length'     => null,
            'unique'     => false,
            'nullable'   => false,
            'precision'  => 0,
            'columnName' => "pricing",
        ];

        $this->supports($mapping)->shouldReturn(false);
    }

    function it_should_use_precision_and_scale_parameter_while_faking_a_decimal(Base $faker)
    {
        $mapping = [
            'scale'     => 3,
            'precision' => 5,
        ];

        $faker->fake('randomFloat', [3, 0, 99.999])->shouldBeCalled();

        $this->fake($mapping);
    }

    function it_should_use_only_min_limit_of_0_if_precision_and_scale_parameters_are_not_provided(Base $faker)
    {
        $faker->fake('randomFloat', [null, 0, null])->shouldBeCalled();

        $this->fake([]);
    }

    function it_should_use_precision_parameter_to_determine_max_decimal_value(Base $faker)
    {
        $mapping = [
            'precision' => 5,
        ];

        $faker->fake('randomFloat', [0, 0, 99999])->shouldBeCalled();

        $this->fake($mapping);
    }

    function it_should_use_scale_parameter_to_generate_decimal_number(Base $faker)
    {
        $mapping = [
            'scale' => 3,
        ];

        $faker->fake('randomFloat', [3, 0, 0.999])->shouldBeCalled();

        $this->fake($mapping);
    }

    function it_should_fake_decimal_number_if_scale_equals_precision(Base $faker)
    {
        $mapping = [
            'scale'     => 5,
            'precision' => 5,
        ];

        $faker->fake('randomFloat', [5, 0, 0.99999])->shouldBeCalled();

        $this->fake($mapping);
    }
}


text:
export * from '@ember/test-helpers';

// TODO: deprecate these once new API is rolled out
export { default as TestModule } from './legacy-0-6-x/test-module';
export { default as TestModuleForAcceptance } from './legacy-0-6-x/test-module-for-acceptance';
export { default as TestModuleForComponent } from './legacy-0-6-x/test-module-for-component';
export { default as TestModuleForModel } from './legacy-0-6-x/test-module-for-model';


text:
@extends('core::public.master')
@inject('page', 'typicms.galleries.page')

@section('title', $model->title . ' – ' . trans('galleries::global.name') . ' – ' . $websiteTitle)
@section('ogTitle', $model->title)
@section('description', $model->summary)
@section('image', $model->present()->thumbAbsoluteSrc())
@section('bodyClass', 'body-galleries body-gallery-' . $model->id . ' body-page body-page-' . $page->id)

@section('main')

    @include('core::public._btn-prev-next', ['module' => 'Galleries', 'model' => $model])

    @include('galleries::public._slider')

{{ $model->title }}

{{ nl2br($model->summary) }}

{!! $model->present()->body !!}

    @include('galleries::public._thumbs')

@stop


text:
#import <Foundation/NSAKDeserializer.h>

@interface NSDirInfoDeserializer : NSAKDeserializer
{
}

- (id)deserializePListValueIn:(id)arg1 key:(id)arg2 length:(unsigned long long)arg3;

@end


text:
using System;
using System.Data;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml;
using System.Reflection;
using System.Threading;
using  NUnit.Framework;
using CookComputing.XmlRpc;

namespace ntest
{
  [TestFixture]
  public class SerializeResponseTest
  {
    [Test]
    public void PaoloLiveraniProblem()
    {
      try
      {
        XmlRpcResponse resp = new XmlRpcResponse(new DataSet());
        Stream responseStream = new MemoryStream();
        var serializer = new XmlRpcResponseSerializer();
        serializer.SerializeResponse(responseStream, resp);
      }
      catch(XmlRpcInvalidReturnType ex)
      {
        string s = ex.Message;
      }
    }

    class FooClass
    {
      public void Foo()
      {
        Console.WriteLine("Foo called");
      }
    }

//    [Test]
//    public void VoidReturn()
//    {
//      MethodInfo mi = typeof(FooClass).GetMethod("Foo");
//      FooClass fooInst = new FooClass();
//      object ret = mi.Invoke(fooInst, new object[0]);
//      XmlRpcResponse xmlRpcResp = new XmlRpcResponse(ret);
//      Stream responseStream = new MemoryStream();
//      XmlRpcSerializer serializer = new XmlRpcSerializer();
//      serializer.SerializeResponse(responseStream, xmlRpcResp);
//      responseStream.Seek(0, SeekOrigin.Begin);
//      TextReader trdr = new StreamReader(responseStream);
//      String s = trdr.ReadLine();
//      while (s != null)
//      {
//        Console.WriteLine(s);
//        s = trdr.ReadLine();
//      }
//      responseStream.Seek(0, SeekOrigin.Begin);
//      xmlRpcResp = serializer.DeserializeResponse(responseStream,
//        typeof(string));
//
//    }
  }
}


text:
package com.innovaee.eorder.resource;

import com.innovaee.eorder.entity.Order;
import com.innovaee.eorder.entity.OrderItem;
import com.innovaee.eorder.service.OrderService;
import com.innovaee.eorder.vo.OrderItemVO;

import org.apache.log4j.Logger;
import org.springframework.context.annotation.Scope;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 * @Title: OrderResource
 * @Description: 订单资源
 * @version V1.0
 */
@Path("/orders")
public class OrderResource {

    private Logger logger = Logger.getLogger(this.getClass());

    /** 订单服务类对象 */
    private OrderService orderService;

    /**
     * 根据orderId查询订单明细
     *
     * @param orderId
     *            订单ID
     * @return 订单明细列表
     */
    @GET
    @Path("/{orderId}")
    @Scope("request")
    @Produces(MediaType.APPLICATION_JSON)
    public Map<String, List<OrderItemVO>> getOrderItemsByOrderId(
            @PathParam("orderId") Integer orderId) {
        logger.info("[REST_CALL= getOrderItemsByOrderId, orderId=" + orderId
                + "]");

        List<OrderItemVO> orderItemVOs = new ArrayList<OrderItemVO>();
        Order order = orderService.getOrderById(orderId);
        List<OrderItem> orderItems = new ArrayList<OrderItem>(
                order.getOrderItems());
        OrderItemVO orderItemVO = null;
        for (OrderItem orderItem : orderItems) {
            orderItemVO = new OrderItemVO();
            orderItemVO.setId(orderItem.getId());
            orderItemVO.setDishId(orderItem.getDish().getId());
            orderItemVO.setDishName(orderItem.getDish().getName());
            orderItemVO.setDishPrice(orderItem.getDish().getPrice());
            orderItemVO.setDishPicture(orderItem.getDish().getPicPath());
            orderItemVO.setDishAmount(orderItem.getDishAmount());
            orderItemVOs.add(orderItemVO);
        }

        Map<String, List<OrderItemVO>> result = new HashMap<String, List<OrderItemVO>>();
        result.put("orders", orderItemVOs);

        return result;
    }

    public OrderService getOrderService() {
        return orderService;
    }

    public void setOrderService(OrderService orderService) {
        this.orderService = orderService;
    }

    public OrderResource() {
        super();
    }
}


text:
"""
@file test_accel_bma180.py
"""
##
# @addtogroup soletta sensor
# @brief This is sensor test based on soletta app
# @brief test sensor bma180 on Galileo/MinnowMax
##

import os
import time
from oeqa.utils.helper import shell_cmd
from oeqa.oetest import oeRuntimeTest
from oeqa.runtime.sensor.EnvirSetup import EnvirSetup
from oeqa.utils.decorators import tag

@tag(TestType="FVT", FeatureID="IOTOS-757")
class TestAccelBMA180(oeRuntimeTest):
    """
    @class TestAccelBMA180
    """
    def setUp(self):
        '''Generate test app on target
        @fn setUp
        @param self
        @return'''
        print ('start!\n')
        #connect sensor and DUT through board
        #shell_cmd("sudo python "+ os.path.dirname(__file__) + "/Connector.py bma180")
        envir = EnvirSetup(self.target)
        envir.envirSetup("bma180","accel")
    def tearDown(self):
        '''unload bma180 driver
        @fn tearDown
        @param self
        @return'''
        (status, output) = self.target.run("cat /sys/devices/virtual/dmi/id/board_name")
        if "Minnow" in output:
           (status, output) = self.target.run(
                         "cd /sys/bus/i2c/devices; \
                          echo 0x40 >i2c-1/delete_device")
        elif "Galileo" in output or "SDS" in output:
           (status, output) = self.target.run(
                         "cd /sys/bus/i2c/devices; \
                          echo 0x40 >i2c-0/delete_device")

    def test_Accel_BMA180(self):
        '''Execute the test app and verify sensor data
        @fn test_Accel_BMA180
        @param self
        @return'''
        print ('start reading data!')
        (status, output) = self.target.run(
                         "chmod 777 /opt/apps/test_accel_bma180.fbp")
        (status, output) = self.target.run(
                         "cd /opt/apps; ./test_accel_bma180.fbp >re.log")
        error = output
        #check whether data collected
        (status, output) = self.target.run(
                         "cp /opt/apps/re.log /home/root/bma180.log")
        (status, output) = self.target.run("cat /opt/apps/re.log|grep direction-vector")
        print (output + "\n")
        self.assertEqual(status, 0, msg="Error messages: %s" % error)
        #make sure sensor data is valid
        (status, output) = self.target.run("cat /opt/apps/re.log|grep '0.000000, 0.000000, 0.000000'")
        self.assertEqual(status, 1, msg="Error messages: %s" % output)


text:
package com.hxm.earlgrey.control;

import static com.hxm.earlgrey.control.Job.ID_DATE_FORMAT;
import java.io.File;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

/**
 * Created by hxm on 17-2-13.
 */
@Service
public class JobService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    private DateFormat df = new SimpleDateFormat(ID_DATE_FORMAT);
    public static final String COLLECTION_NAME_FLOWQUERY = "FlowQuery-";
    private long t = 0;
    private int count = 0;

    @Value("${spark.home}")
    private String sparkHome;

    @Autowired
    private JobsRepository repository;
    @Autowired
    private MongoTemplate mongoTemplate;

    private Map<String, Process> jobs = new HashMap<>();
    private Object lock = new Object();

    String create(String name, final Job.TYPE type, final Map<String, String> params) {
        if (name == null || name.isEmpty()) throw new IllegalArgumentException("job name needed");

        switch (type) {
            case FlowQuery:
                String startTime = params.get(Job.PARAM_STARTTIME);
                if (startTime == null || startTime.isEmpty())
                    throw new IllegalArgumentException("Need start time");
                try {
                    df.parse(startTime);
                } catch (ParseException pe) {
                    throw new IllegalArgumentException("Start time format error");
                }

                String endTime = params.get(Job.PARAM_ENDTIME);
                if (endTime == null || endTime.isEmpty())
                    throw new IllegalArgumentException("Need end time");
                try {
                    df.parse(endTime);
                } catch (ParseException pe) {
                    throw new IllegalArgumentException("End time format error");
                }

                String srcAddress = params.get(Job.PARAM_SRCADDRESS);
                String dstAddress = params.get(Job.PARAM_DSTADDRESS);
                if (srcAddress == null && dstAddress == null)
                    throw new IllegalArgumentException("Need source or destination address");
                if (srcAddress != null) {
                    if (srcAddress.isEmpty())
                        throw new IllegalArgumentException("Source ip cannot be empty");
                    try {
                        InetAddress.getByName(srcAddress);
                    } catch (UnknownHostException uhe) {
                        throw new IllegalArgumentException("Illegal source ip");
                    }
                }
                if (dstAddress != null) {
                    if (dstAddress.isEmpty())
                        throw new IllegalArgumentException("Destination ip cannot be empty");
                    try {
                        InetAddress.getByName(dstAddress);
                    } catch (UnknownHostException uhe) {
                        throw new IllegalArgumentException("Illegal destination ip");
                    }
                }
                break;
            case Test:
                break;
            default:
                throw new IllegalArgumentException("Job type cannot be recognized");
        }

        //TODO: test job id
        Date d = new Date();
        String id = df.format(d);
        synchronized (lock) {
            if (t == d.getTime()) {
                id += "-" + ++count;
            } else {
                count = 0;
            }
            t = d.getTime();
        }
        Job j = new Job(id, type, name, params);
        repository.save(j);
        return id;
    }

    Job getJob(String jobId) throws JobException {
        if (jobId == null || jobId.isEmpty())
            throw new IllegalArgumentException("jobId cannot be null or empty");
        Job job = repository.findOne(jobId);
        if (job == null) throw new JobException("Job " + jobId + " not found");
        return job;
    }

    /**
     * log file name: logs/job-{type}-{id}.log
     * submit spark job deploy client
     *
     * @param jobId
     * @throws JobException
     */
    void start(final String jobId) throws JobException {
        final Job job = getJob(jobId);
        if (job.getStatus() != Job.STATUS.Created)
            throw new JobException("Job " + jobId + "cannot be started, status:" + job.getStatus());

        final CountDownLatch startedSignal = new CountDownLatch(1);

        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    List<String> command;
                    switch (job.getType()) {
                        case Test:
                            command = makeTestCommand(job);
                            break;
                        case FlowQuery:
                            command = makeFlowQueryCommand();
                            break;
                        default:
                            throw new IllegalArgumentException("Job type known " + job.getType());
                    }
                    ProcessBuilder pb = new ProcessBuilder(command);
                    pb.directory(new File(sparkHome));
                    //FIXME: directory should log put
                    File log = new File(sparkHome + "/logs/job-" + job.getType() + "-" + job.getId() + ".log");
                    log.createNewFile();
                    pb.redirectErrorStream(true);
                    pb.redirectOutput(ProcessBuilder.Redirect.appendTo(log));
                    //job status updated in job
                    Process p = pb.start();
                    jobs.put(jobId, p);
                    startedSignal.countDown();

                    p.waitFor();
                } catch (Exception e) {
                    logger.error("Start process error:", e);
                    job.setStatus(Job.STATUS.Failed);
                    job.setStatusDetail(e.getMessage());
                    repository.save(job);
                } finally {
                    jobs.remove(jobId);
                    startedSignal.countDown();
                }
            }
        });
        //t.setDaemon(true);
        t.start();
        try {
            startedSignal.await();
        } catch (InterruptedException ie) {
            ie.printStackTrace();
        }
    }

    void cancel(String jobId) throws JobException {
        Job job = getJob(jobId);
        Process jobProcess = jobs.get(jobId);
        //TODO: job in db, not in memory
        if (jobProcess == null) throw new JobException("Job not found in memory" + jobId);
        //TODO: exception handling
        jobProcess.destroy();
        job.setStatus(Job.STATUS.Canceled);
        repository.save(job);
        jobs.remove(jobId);
    }

    void delete(String jobId) throws JobException {
        Job job = getJob(jobId);
        if (job.getStatus() == Job.STATUS.Started)
            throw new IllegalStateException("Job " + jobId + " is in progress, cannot be deleted");
        switch (job.getType()) {
            case FlowQuery:
                String C_NAME = COLLECTION_NAME_FLOWQUERY + jobId;
                mongoTemplate.dropCollection(C_NAME);
                break;
            default:
                throw new IllegalArgumentException("Job type cannot be recognized");
        }
        repository.delete(jobId);
    }

    void logException(String jobId, Exception e) {
        logger.error("Job " + jobId + " exception", e);
        try {
            Job job = repository.findOne(jobId);
            //REFACTOR: show more message
            job.setStatusDetail(e.getMessage());
            job.setStatus(Job.STATUS.Error);
            repository.save(job);
        } catch (Exception ignored) {
            ignored.printStackTrace();
        }
    }

    @Value("${projectHome}")
    String projectHome;
    private List<String> makeTestCommand(Job job) {
        String testJarFile = projectHome + "/testjob/target/testjob-0.1.jar";

        List<String> command = new LinkedList<>();
        command.add(Job.JAVA_COMMAND);
        command.add("-jar");
        command.add(testJarFile);
        command.add(job.getId());
        String runningTime = job.getParams().get(Job.PARAM_RUNNING_TIME);
        if (runningTime == null)
            throw new IllegalArgumentException("Job test need parameter running time");
        command.add(runningTime);
        return command;
    }

    private List<String> makeFlowQueryCommand() {
        List<String> command = new LinkedList<>();
        return command;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SchoolClasses
{
    interface IComment
    {
        string Comment { get; set; }

        void AddComment(string comment);

        void ChangeComment(string newComment);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
PopupPlugin
</TITLE>

<META NAME="date" CONTENT="2013-05-03">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

gui.control

Class PopupPlugin

java.lang.Object
  edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
      edu.uci.ics.jung.visualization.control.AbstractPopupGraphMousePlugin
          gui.control.PopupPlugin

All Implemented Interfaces:
edu.uci.ics.jung.visualization.control.GraphMousePlugin, java.awt.event.MouseListener, java.util.EventListener

public class PopupPlugin
extends edu.uci.ics.jung.visualization.control.AbstractPopupGraphMousePlugin

Menu po kliknuti pravym tlacitkom na vrchol.

Author:

Lukas Sekerak

Constructor Summary

PopupPlugin(edu.uci.ics.jung.visualization.VisualizationViewer<Vertex,java.lang.Integer> vv,
            GraphHolder holder,
            IStatus status,
            DisplayControl dp,
            TranslatingSreen ts)

Method Summary

Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractPopupGraphMousePlugin

mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased

Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin

getCursor, getModifiers, checkModifiers, setCursor, setModifiers

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

PopupPlugin

public PopupPlugin(edu.uci.ics.jung.visualization.VisualizationViewer<Vertex,java.lang.Integer> vv,
                   GraphHolder holder,
                   IStatus status,
                   DisplayControl dp,
                   TranslatingSreen ts)

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
//  Plugins
var gulp = require('gulp'),
    browserSync     = require('browser-sync'),
    compass         = require('gulp-compass'),
    plumber         = require('gulp-plumber'),
    autoprefixer    = require('gulp-autoprefixer'),
    cp              = require('child_process');

//  Messages
var messages = {
    jekyllBuild: 'Running: $ jekyll build'
};

//  Jekyll Build
gulp.task('jekyll-build', function (done) {
    browserSync.notify(messages.jekyllBuild);
    return cp.spawn('jekyll.bat', ['build'], {stdio: 'inherit'})
        .on('close', done);

});

//  Jekyll Rebuild & Reload
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
    browserSync.reload();
});

//  Jekyll Serve
gulp.task('browser-sync', ['compass', 'jekyll-build'], function() {
    browserSync.init({
        server: '_site',
        notify: false
    });
});

//  Compass
gulp.task('compass', function() {
    gulp.src('_sass/**/*.scss')
        .pipe(plumber())
        .pipe(compass({
            config_file:  'config.rb',
            //  css:          '_site/css',
            css:          '_includes',
            sass:         '_sass'
        }))
        .pipe(autoprefixer({
            browsers:  ['last 2 versions'],
            cascade:   false
        }))
        //  .pipe(gulp.dest('_site/css'))
        .pipe(gulp.dest('_includes'))
        .pipe(browserSync.reload({
            stream:true
        }))
        //  .pipe(gulp.dest('css'));
        .pipe(gulp.dest('_includes'));
});

//  Watch
gulp.task('watch', function () {
    gulp.watch('_sass/**/*.scss', ['compass']);
    gulp.watch(['*.html', 'js/*.js', '_layouts/*.html', '_posts/*', '_includes/*.html', '_includes/*.css'], ['jekyll-rebuild']);
});

//  Default
gulp.task('default', ['browser-sync', 'watch']);


text:
<!DOCTYPE html>

    <meta charset="utf8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
    <meta property="og:title" content="TWGL.js - textures" />
    <meta property="og:type" content="website" />
    <meta property="og:image" content="http://twgljs.org/examples/screenshots/textures.png" />
    <meta property="og:description" content="TWGL.js - textures" />
    <meta property="og:url" content="http://twgljs.org" />

    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:site" content="@greggman">
    <meta name="twitter:creator" content="@greggman">
    <meta name="twitter:domain" content="twgljs.org">
    <meta name="twitter:title" content="TWGL.js - textures">
    <meta name="twitter:url" content="http://twgljs.org/examples/textures.html">
    <meta name="twitter:description" content="TWGL.js - textures">
    <meta name="twitter:image:src" content="http://twgljs.org/examples/screenshots/textures.png">

    <link href="/resources/images/twgljs-icon.png" rel="shortcut icon" type="image/png">

    <title>twgl.js - textures</title>

    <canvas id="c"></canvas>

twgl.js - textures


text:
require "frontend_notifier/application_controller"
require "frontend_notifier/frontend_notifier_engine"


text:
package com.spm.taas.adapters;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.spm.taas.R;
import com.spm.taas.customview.TextViewIkarosRegular;
import com.spm.taas.models.DashBoardModel;

import java.util.LinkedList;

/**
 * Created by saikatpakira on 10/10/16.
 */

public class DashBoardAdapter extends RecyclerView.Adapter<DashBoardAdapter.ViewHolderDash> {

    private Context mContext;
    private LinkedList<DashBoardModel> mainData;
    private LayoutInflater inflater = null;

    public DashBoardAdapter(final Context mContext, final LinkedList<DashBoardModel> mainData) {

        this.mContext = mContext;
        this.mainData = mainData;
        inflater = LayoutInflater.from(mContext);

    }

    @Override
    public ViewHolderDash onCreateViewHolder(ViewGroup parent, int viewType) {

        if (viewType == 1) {//======Header
            return (new ViewHolderDash(inflater.inflate(R.layout.items_with_header_landing, parent, false), viewType));
        } else {
            return (new ViewHolderDash(inflater.inflate(R.layout.items_landing_subject, parent, false), viewType));
        }

    }

    @Override
    public void onBindViewHolder(ViewHolderDash holder, int position) {

        holder.subjectText.setText(mainData.get(position).getSubjectName());
        holder.subjectCount.setText(mainData.get(position).getSubjectCount());
        //Log.i("tipikal", "Count : " + mainData.get(position).getHeaderCount() + " Position : " + position);

        if (mainData.get(position).isHeader()) {
            holder.headerText.setText(mainData.get(position).getHeaderName());
            holder.headerCount.setText(mainData.get(position).getHeaderCount());
            holder.headerView.setCardBackgroundColor(ContextCompat.getColor(mContext, mainData.get(position).getHeaderColor()));
        }

    }

    @Override
    public int getItemCount() {
        return mainData.size();
    }

    @Override
    public int getItemViewType(int position) {
        if (mainData.get(position).isHeader()) {
            return 1;
        } else {
            return 0;
        }
    }

    public static class ViewHolderDash extends RecyclerView.ViewHolder {

        private TextViewIkarosRegular headerText, headerCount, subjectText, subjectCount;
        private CardView headerView = null;

        public ViewHolderDash(View itemView, int type_) {
            super(itemView);

            subjectText = (TextViewIkarosRegular) itemView.findViewById(R.id.subject_name);
            subjectCount = (TextViewIkarosRegular) itemView.findViewById(R.id.subject_count);

            if (type_ == 1) {
                headerText = (TextViewIkarosRegular) itemView.findViewById(R.id.header_text);
                headerCount = (TextViewIkarosRegular) itemView.findViewById(R.id.header_count);
                headerView = (CardView) itemView.findViewById(R.id.card_view);
            }

        }
    }
}


text:
namespace Lvd {
namespace TestSystem {

struct Directory;

} // end of namespace TestSystem
} // end of namespace Lvd

using namespace Lvd;
using namespace std;
using namespace TestSystem;

namespace Test {
namespace LinearEmbedding {

template <typename Domain_, typename Codomain_, typename Scalar_, typename EmbeddingId_>
void check_linear_embedding(Context const &context)
{
    typedef Tenh::LinearEmbedding_c<Domain_, Codomain_, Scalar_, EmbeddingId_, Tenh::WithExceptions::ENABLED> LinearEmbedding;
    std::string error_string;
    bool is_consistent = linear_embedding_is_consistent(LinearEmbedding(), &error_string);
    if (!is_consistent)
        std::cerr << error_string;
    assert(is_consistent);
}

template <typename Domain_, typename Codomain_, typename Scalar_, typename EmbeddingId_>
void check_mutual_adjointness(Context const &context)
{
    Domain_ domain;
    Codomain_ codomain;

    typedef Tenh::ImplementationOf_t<Domain_, Scalar_> D;
    typedef Tenh::ImplementationOf_t<Codomain_, Scalar_> C;

    D d(Tenh::Static<Tenh::WithoutInitialization>::SINGLETON);
    typename C::Dual c(Tenh::Static<Tenh::WithoutInitialization>::SINGLETON);

    for (typename D::ComponentIndex i; i.is_not_at_end(); ++i)
        d[i] = i.value() * (i.value() + 3);
    for (typename C::Dual::ComponentIndex i; i.is_not_at_end(); ++i)
        c[i] = i.value() * (i.value() + 1);

    Tenh::AbstractIndex_c<'i'> j;
    // ensure that the embed and coembed operations are mutually adjoint with
    // respect to the appropriate natural pairings.
    assert_eq(d.embed(codomain, j)*c(j) - d(j)*c.coembed(dual(domain), j), Scalar_(0));
}

template <typename BasedVectorSpace_, typename Scalar_>
void add_checks(Directory &parent)
{
    {
        Directory &identity_embedding_dir = parent.GetSubDirectory("identity embedding");

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(identity_embedding_dir, "identity on " + Tenh::type_string_of<BasedVectorSpace_>(), check_linear_embedding<BasedVectorSpace_, BasedVectorSpace_, Scalar_, Tenh::IdentityEmbedding>, RESULT_NO_ERROR);
    }

    typedef Tenh::Scalar2TensorProductOfBasedVectorSpaces_c<BasedVectorSpace_, BasedVectorSpace_> Scalar2;
    typedef Tenh::Diagonal2TensorProductOfBasedVectorSpaces_c<BasedVectorSpace_, BasedVectorSpace_> Diag2;
    typedef Tenh::DirectSum_c<Tenh::Typle_t<BasedVectorSpace_>> DirectSum;
    typedef Tenh::ExteriorPowerOfBasedVectorSpace_c<1, BasedVectorSpace_> ExteriorPower1;
    typedef Tenh::ExteriorPowerOfBasedVectorSpace_c<2, BasedVectorSpace_> ExteriorPower2;
    typedef Tenh::ExteriorPowerOfBasedVectorSpace_c<3, BasedVectorSpace_> ExteriorPower3;
    typedef Tenh::ExteriorPowerOfBasedVectorSpace_c<4, BasedVectorSpace_> ExteriorPower4;
    typedef Tenh::ExteriorPowerOfBasedVectorSpace_c<5, BasedVectorSpace_> ExteriorPower5;
    typedef Tenh::SymmetricPowerOfBasedVectorSpace_c<1, BasedVectorSpace_> SymmetricPower1;
    typedef Tenh::SymmetricPowerOfBasedVectorSpace_c<2, BasedVectorSpace_> SymmetricPower2;
    typedef Tenh::SymmetricPowerOfBasedVectorSpace_c<3, BasedVectorSpace_> SymmetricPower3;
    typedef Tenh::SymmetricPowerOfBasedVectorSpace_c<4, BasedVectorSpace_> SymmetricPower4;
    typedef Tenh::SymmetricPowerOfBasedVectorSpace_c<5, BasedVectorSpace_> SymmetricPower5;
    typedef typename Tenh::TensorPowerOfBasedVectorSpace_f<1, BasedVectorSpace_>::T TensorPower1;
    typedef typename Tenh::TensorPowerOfBasedVectorSpace_f<2, BasedVectorSpace_>::T TensorPower2;
    typedef typename Tenh::TensorPowerOfBasedVectorSpace_f<3, BasedVectorSpace_>::T TensorPower3;
    typedef typename Tenh::TensorPowerOfBasedVectorSpace_f<4, BasedVectorSpace_>::T TensorPower4;
    typedef typename Tenh::TensorPowerOfBasedVectorSpace_f<5, BasedVectorSpace_>::T TensorPower5;

    {
        Directory &natural_embedding_dir = parent.GetSubDirectory("natural embedding");

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<Diag2>(), check_linear_embedding<Scalar2, Diag2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<SymmetricPower2>(), check_linear_embedding<Scalar2, SymmetricPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_linear_embedding<Scalar2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Diag2>() + " into " + Tenh::type_string_of<SymmetricPower2>(), check_linear_embedding<Scalar2, SymmetricPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Diag2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_linear_embedding<Scalar2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        static Uint32 const DIM = Tenh::DimensionOf_f<BasedVectorSpace_>::V;
        if (DIM >= 1)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<ExteriorPower1>() + " into " + Tenh::type_string_of<TensorPower1>(), check_linear_embedding<ExteriorPower1, TensorPower1, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 2)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<ExteriorPower2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_linear_embedding<ExteriorPower2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 3)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<ExteriorPower3>() + " into " + Tenh::type_string_of<TensorPower3>(), check_linear_embedding<ExteriorPower3, TensorPower3, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 4)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<ExteriorPower4>() + " into " + Tenh::type_string_of<TensorPower4>(), check_linear_embedding<ExteriorPower4, TensorPower4, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 5)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<ExteriorPower5>() + " into " + Tenh::type_string_of<TensorPower5>(), check_linear_embedding<ExteriorPower5, TensorPower5, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<SymmetricPower1>() + " into " + Tenh::type_string_of<TensorPower1>(), check_linear_embedding<SymmetricPower1, TensorPower1, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<SymmetricPower2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_linear_embedding<SymmetricPower2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<SymmetricPower3>() + " into " + Tenh::type_string_of<TensorPower3>(), check_linear_embedding<SymmetricPower3, TensorPower3, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<SymmetricPower4>() + " into " + Tenh::type_string_of<TensorPower4>(), check_linear_embedding<SymmetricPower4, TensorPower4, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<SymmetricPower5>() + " into " + Tenh::type_string_of<TensorPower5>(), check_linear_embedding<SymmetricPower5, TensorPower5, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
    }

    {
        Directory &mutual_adjointness_dir = parent.GetSubDirectory("mutual adjointness");

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<Diag2>(), check_mutual_adjointness<Scalar2, Diag2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<SymmetricPower2>(), check_mutual_adjointness<Scalar2, SymmetricPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_mutual_adjointness<Scalar2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Diag2>() + " into " + Tenh::type_string_of<SymmetricPower2>(), check_mutual_adjointness<Scalar2, SymmetricPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Diag2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_mutual_adjointness<Scalar2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        static Uint32 const DIM = Tenh::DimensionOf_f<BasedVectorSpace_>::V;
        if (DIM >= 1)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<ExteriorPower1>() + " into " + Tenh::type_string_of<TensorPower1>(), check_mutual_adjointness<ExteriorPower1, TensorPower1, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 2)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<ExteriorPower2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_mutual_adjointness<ExteriorPower2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 3)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<ExteriorPower3>() + " into " + Tenh::type_string_of<TensorPower3>(), check_mutual_adjointness<ExteriorPower3, TensorPower3, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 4)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<ExteriorPower4>() + " into " + Tenh::type_string_of<TensorPower4>(), check_mutual_adjointness<ExteriorPower4, TensorPower4, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        if (DIM >= 5)
            LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<ExteriorPower5>() + " into " + Tenh::type_string_of<TensorPower5>(), check_mutual_adjointness<ExteriorPower5, TensorPower5, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<SymmetricPower1>() + " into " + Tenh::type_string_of<TensorPower1>(), check_mutual_adjointness<SymmetricPower1, TensorPower1, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<SymmetricPower2>() + " into " + Tenh::type_string_of<TensorPower2>(), check_mutual_adjointness<SymmetricPower2, TensorPower2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<SymmetricPower3>() + " into " + Tenh::type_string_of<TensorPower3>(), check_mutual_adjointness<SymmetricPower3, TensorPower3, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<SymmetricPower4>() + " into " + Tenh::type_string_of<TensorPower4>(), check_mutual_adjointness<SymmetricPower4, TensorPower4, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<SymmetricPower5>() + " into " + Tenh::type_string_of<TensorPower5>(), check_mutual_adjointness<SymmetricPower5, TensorPower5, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
    }

}

template <typename BasedVectorSpace0_, typename BasedVectorSpace1_, typename Scalar_>
void add_checks_for_two_spaces(Directory &parent)
{
    typedef Tenh::Scalar2TensorProductOfBasedVectorSpaces_c<BasedVectorSpace0_, BasedVectorSpace1_> Scalar2;
    typedef Tenh::Diagonal2TensorProductOfBasedVectorSpaces_c<BasedVectorSpace0_, BasedVectorSpace1_> Diag2;
    typedef Tenh::TensorProductOfBasedVectorSpaces_c<Tenh::Typle_t<BasedVectorSpace0_, BasedVectorSpace1_>> Tensor2;

    {
        Directory &natural_embedding_dir = parent.GetSubDirectory("natural embedding");

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<Diag2>(), check_linear_embedding<Scalar2, Diag2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<Tensor2>(), check_linear_embedding<Scalar2, Tensor2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(natural_embedding_dir, Tenh::type_string_of<Diag2>() + " into " + Tenh::type_string_of<Tensor2>(), check_linear_embedding<Scalar2, Tensor2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
    }

    {
        Directory &mutual_adjointness_dir = parent.GetSubDirectory("mutual adjointness");

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<Diag2>(), check_mutual_adjointness<Scalar2, Diag2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Scalar2>() + " into " + Tenh::type_string_of<Tensor2>(), check_mutual_adjointness<Scalar2, Tensor2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);

        LVD_ADD_NAMED_TEST_CASE_FUNCTION(mutual_adjointness_dir, Tenh::type_string_of<Diag2>() + " into " + Tenh::type_string_of<Tensor2>(), check_mutual_adjointness<Scalar2, Tensor2, Scalar_, Tenh::NaturalEmbedding>, RESULT_NO_ERROR);
    }
}

void AddTests0 (Lvd::TestSystem::Directory &parent);
void AddTests1 (Lvd::TestSystem::Directory &parent);
void AddTests2 (Lvd::TestSystem::Directory &parent);
void AddTests3 (Lvd::TestSystem::Directory &parent);
void AddTests4 (Lvd::TestSystem::Directory &parent);
void AddTests5 (Lvd::TestSystem::Directory &parent);

} // end of namespace LinearEmbedding
} // end of namespace Test

#endif // !defined(TEST_LINEAREMBEDDING_HPP_)


text:
@implementation client_search_dal

+ (NSNumber *)getMaxId
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSNumber *rtn;
    FMResultSet *result = [db executeQuery:@"SELECT MAX(search_id) FROM client_search"];
    if ([result next]) {
        int maxId = [result intForColumnIndex:0] + 1;
        rtn = [NSNumber numberWithInt:maxId];
    }
    [db close];
    return rtn;
}

+ (BOOL)exists:(NSNumber *)search_id
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    BOOL rtn = NO;
    FMResultSet *result = [db executeQuery:@"SELECT COUNT(search_id) FROM client_search WHERE search_id = ?", search_id];
    if ([result next]) {
        int count = [result intForColumnIndex:0];
        if (count == 0) {
            rtn = NO;
        }
        else {
            rtn = YES;
        }
    }
    [db close];
    return rtn;
}

+ (BOOL)add:(client_search *)model
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    BOOL rtn;
    rtn = [db executeUpdate:@"INSERT INTO client_search (search_id, display_name, field_name, field_type, search_type, search_index, data_version) VALUES (?, ?, ?, ?, ?, ?, ?)", model.search_id, model.display_name, model.field_name, model.field_type, model.search_type, model.search_index, model.data_version];
    [db close];
    return rtn;
}

+ (BOOL)update:(client_search *)model
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    BOOL rtn;
    rtn = [db executeUpdate:@"UPDATE client_search SET display_name = ?, field_name = ?, field_type = ?, search_type = ?, search_index = ?, data_version = ? WHERE search_id = ?", model.display_name, model.field_name, model.field_type, model.search_type, model.search_index, model.data_version, model.search_id];
    [db close];
    return rtn;
}

+ (BOOL)delete:(NSNumber *)search_id
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    BOOL rtn;
    rtn = [db executeUpdate:@"DELETE FROM client_search WHERE search_id = ?", search_id];
    [db close];
    return rtn;
}

+ (BOOL)deleteList:(NSString *)where
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    BOOL rtn;
    NSString *strSql = [NSString stringWithFormat:@"DELETE FROM client_search WHERE %@", where];
    rtn = [db executeUpdate:strSql];
    [db close];
    return rtn;
}

+ (client_search *)get:(NSNumber *)search_id
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    client_search *rtn;
    FMResultSet *result = [db executeQuery:@"SELECT * FROM client_search WHERE search_id = ?", search_id];
    while ([result next]) {
        rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.field_type = [NSNumber numberWithInt:[result intForColumn:@"field_type"]];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        rtn.search_index = [NSNumber numberWithInt:[result intForColumn:@"search_index"]];
        rtn.data_version = [NSNumber numberWithInt:[result intForColumn:@"data_version"]];
        break;
    }
    [db close];
    return rtn;
}

+ (NSArray *)getList:(NSString *)where
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSString *strSql = [NSString stringWithFormat:@"SELECT * FROM client_search WHERE %@", where];
    FMResultSet *result = [db executeQuery:strSql];
    while ([result next]) {
        client_search *rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.field_type = [NSNumber numberWithInt:[result intForColumn:@"field_type"]];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        rtn.search_index = [NSNumber numberWithInt:[result intForColumn:@"search_index"]];
        rtn.data_version = [NSNumber numberWithInt:[result intForColumn:@"data_version"]];
        [array addObject:rtn];
    }
    [db close];
    return array;
}

+ (NSArray *)getList:(NSString *)where order:(NSString *)order
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSString *strSql = [NSString stringWithFormat:@"SELECT * FROM client_search WHERE %@ ORDER BY %@", where, order];
    FMResultSet *result = [db executeQuery:strSql];
    while ([result next]) {
        client_search *rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.field_type = [NSNumber numberWithInt:[result intForColumn:@"field_type"]];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        rtn.search_index = [NSNumber numberWithInt:[result intForColumn:@"search_index"]];
        rtn.data_version = [NSNumber numberWithInt:[result intForColumn:@"data_version"]];
        [array addObject:rtn];
    }
    [db close];
    return array;
}

+ (NSArray *)getList:(NSString *)where order:(NSString *)order top:(NSInteger)top
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSString *strSql = [NSString stringWithFormat:@"SELECT * FROM client_search WHERE %@ ORDER BY %@ LIMIT 0,%d", where, order, top];
    FMResultSet *result = [db executeQuery:strSql];
    while ([result next]) {
        client_search *rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.field_type = [NSNumber numberWithInt:[result intForColumn:@"field_type"]];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        rtn.search_index = [NSNumber numberWithInt:[result intForColumn:@"search_index"]];
        rtn.data_version = [NSNumber numberWithInt:[result intForColumn:@"data_version"]];
        [array addObject:rtn];
    }
    [db close];
    return array;
}

+ (NSArray *)getList:(NSString *)where order:(NSString *)order beginIndex:(NSInteger)beginIndex length:(NSInteger)length
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSString *strSql = [NSString stringWithFormat:@"SELECT * FROM client_search WHERE %@ ORDER BY %@ LIMIT %d,%d", where, order, beginIndex, length];
    FMResultSet *result = [db executeQuery:strSql];
    while ([result next]) {
        client_search *rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.field_type = [NSNumber numberWithInt:[result intForColumn:@"field_type"]];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        rtn.search_index = [NSNumber numberWithInt:[result intForColumn:@"search_index"]];
        rtn.data_version = [NSNumber numberWithInt:[result intForColumn:@"data_version"]];
        [array addObject:rtn];
    }
    [db close];
    return array;
}

+ (NSArray *)getList:(NSString *)where order:(NSString *)order page:(NSInteger)page pageSize:(NSInteger)pageSize
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSInteger beginIndex = (page - 1) * pageSize;
    NSInteger length = pageSize;
    NSString *strSql = [NSString stringWithFormat:@"SELECT * FROM client_search WHERE %@ ORDER BY %@ LIMIT %d,%d", where, order, beginIndex, length];
    FMResultSet *result = [db executeQuery:strSql];
    while ([result next]) {
        client_search *rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.field_type = [NSNumber numberWithInt:[result intForColumn:@"field_type"]];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        rtn.search_index = [NSNumber numberWithInt:[result intForColumn:@"search_index"]];
        rtn.data_version = [NSNumber numberWithInt:[result intForColumn:@"data_version"]];
        [array addObject:rtn];
    }
    [db close];
    return array;
}

+ (client_search *)convertJsonToModel:(NSDictionary *)json
{
    client_search *model = [[client_search alloc] init];
    model.search_id = [json objectForKey:@"search_id"];
    model.display_name = [json objectForKey:@"display_name"];
    model.field_name = [json objectForKey:@"field_name"];
    model.field_type = [json objectForKey:@"field_type"];
    model.search_type = [json objectForKey:@"search_type"];
    model.search_index = [json objectForKey:@"search_index"];
    model.data_version = [json objectForKey:@"data_version"];
    return model;
}

+ (NSArray *)convertJsonToList:(NSArray *)jsons
{
    NSMutableArray *array = [[NSMutableArray alloc] init];
    for (NSDictionary *json in jsons) {
        client_search *model = [[client_search alloc] init];
        model.search_id = [json objectForKey:@"search_id"];
        model.display_name = [json objectForKey:@"display_name"];
        model.field_name = [json objectForKey:@"field_name"];
        model.field_type = [json objectForKey:@"field_type"];
        model.search_type = [json objectForKey:@"search_type"];
        model.search_index = [json objectForKey:@"search_index"];
        model.data_version = [json objectForKey:@"data_version"];
        [array addObject:model];
    }
    return array;
}

+ (NSArray *)getListForSearch
{
    NSString *dbPath = [BaseInfo getDataBasePath];
    FMDatabase *db = [[FMDatabase alloc] initWithPath:dbPath];
    [db open];
    NSMutableArray *array = [[NSMutableArray alloc] init];
    NSString *strSql = [NSString stringWithFormat:@"SELECT search_id,display_name,field_name,search_type FROM client_search ORDER BY search_index ASC"];
    FMResultSet *result = [db executeQuery:strSql];
    while ([result next]) {
        client_search *rtn = [[client_search alloc] init];
        rtn.search_id = [NSNumber numberWithInt:[result intForColumn:@"search_id"]];
        rtn.display_name = [result stringForColumn:@"display_name"];
        rtn.field_name = [result stringForColumn:@"field_name"];
        rtn.search_type = [NSNumber numberWithInt:[result intForColumn:@"search_type"]];
        [array addObject:rtn];
    }
    [db close];
    return array;
}

@end


text:
package com.asakusafw.bulkloader.importer;

import java.sql.Connection;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Map;
import java.util.TreeSet;

import com.asakusafw.bulkloader.bean.ImportBean;
import com.asakusafw.bulkloader.bean.ImportTargetTableBean;
import com.asakusafw.bulkloader.cache.GetCacheInfoLocal;
import com.asakusafw.bulkloader.cache.LocalCacheInfo;
import com.asakusafw.bulkloader.cache.LocalCacheInfoRepository;
import com.asakusafw.bulkloader.common.DBConnection;
import com.asakusafw.bulkloader.common.FileNameUtil;
import com.asakusafw.bulkloader.exception.BulkLoaderReRunnableException;
import com.asakusafw.bulkloader.exception.BulkLoaderSystemException;
import com.asakusafw.bulkloader.log.Log;
import com.asakusafw.bulkloader.transfer.FileProtocol;
import com.asakusafw.thundergate.runtime.cache.CacheInfo;
import com.asakusafw.thundergate.runtime.cache.ThunderGateCacheSupport;

/**
 * Decides import protocol and configures each {@link ImportTargetTableBean table information}.
 * @since 0.2.3
 */
public class ImportProtocolDecide {

    static final Log LOG = new Log(ImportProtocolDecide.class);

    /**
     * Executes this operation.
     * @param bean importer been
     * @throws BulkLoaderSystemException if failed to decide import protocol
     * @throws BulkLoaderReRunnableException if failed to decide import protocol, but is worth retrying operation later
     * @throws IllegalArgumentException if some parameters were {@code null}
     */
    public void execute(ImportBean bean) throws BulkLoaderSystemException, BulkLoaderReRunnableException {
        if (bean == null) {
            throw new IllegalArgumentException("bean must not be null"); //$NON-NLS-1$
        }
        LOG.info("TG-IMPORTER-11001",
                bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
        boolean findCache = false;
        for (String tableName : bean.getImportTargetTableList()) {
            ImportTargetTableBean table = bean.getTargetTable(tableName);
            if (table.getCacheId() == null) {
                setContentProtocol(tableName, table);
            } else {
                findCache = true;
            }
        }
        if (findCache == false) {
            LOG.info("TG-IMPORTER-11003",
                    bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
        } else {
            prepareForCache(bean);
        }
        LOG.info("TG-IMPORTER-11002",
                bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
    }

    /**
     * Cleanup cache for retry the importer operation.
     * @param bean importer been
     * @throws BulkLoaderSystemException if failed to cleanup
     * @throws IllegalArgumentException if some parameters were {@code null}
     */
    public void cleanUpForRetry(ImportBean bean) throws BulkLoaderSystemException {
        if (bean == null) {
            throw new IllegalArgumentException("bean must not be null"); //$NON-NLS-1$
        }
        boolean findCache = false;
        for (String tableName : bean.getImportTargetTableList()) {
            ImportTargetTableBean table = bean.getTargetTable(tableName);
            if (table.getCacheId() != null) {
                findCache = true;
            }
        }
        if (findCache == false) {
            return;
        }
        LOG.info("TG-IMPORTER-11012",
                bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
        Connection connection = DBConnection.getConnection();
        LocalCacheInfoRepository repository = new LocalCacheInfoRepository(connection);
        try {
            repository.releaseLock(bean.getExecutionId());
        } finally {
            DBConnection.closeConn(connection);
        }
    }

    private void prepareForCache(ImportBean bean) throws BulkLoaderSystemException, BulkLoaderReRunnableException {
        assert bean != null;
        boolean succeed = false;
        Connection connection = DBConnection.getConnection();
        LocalCacheInfoRepository repository = new LocalCacheInfoRepository(connection);
        try {
            LOG.info("TG-IMPORTER-11004",
                    bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
            acquireCacheLock(bean, repository);

            LOG.info("TG-IMPORTER-11006",
                    bean.getTargetName(), bean.getBatchId(), bean.getJobflowId(), bean.getExecutionId());
            Map<String, CacheInfo> map = collectRemoteCacheInfo(bean);

            for (String tableName : bean.getImportTargetTableList()) {
                ImportTargetTableBean tableInfo = bean.getTargetTable(tableName);
                String cacheId = tableInfo.getCacheId();
                if (cacheId == null) {
                    assert tableInfo.getImportProtocol() != null;
                    continue;
                }

                CacheInfo currentRemoteInfo = map.get(tableInfo.getDfsFilePath());
                Calendar startTimestamp = computeStartTimestamp(currentRemoteInfo, repository, tableName, tableInfo);

                tableInfo.setStartTimestamp(startTimestamp);
                LocalCacheInfo nextLocalInfo = new LocalCacheInfo(
                        cacheId,
                        null,
                        startTimestamp,
                        tableName,
                        tableInfo.getDfsFilePath());

                ThunderGateCacheSupport model = createDataModelObject(tableName, tableInfo);
                Calendar nextTimestamp = repository.putCacheInfo(nextLocalInfo);
                CacheInfo nextRemoteInfo = new CacheInfo(
                        CacheInfo.FEATURE_VERSION,
                        cacheId,
                        nextTimestamp,
                        tableName,
                        tableInfo.getImportTargetColumns(),
                        model.getClass().getName(),
                        model.__tgc__DataModelVersion());

                FileProtocol.Kind kind = startTimestamp == null
                    ? FileProtocol.Kind.CREATE_CACHE
                    : FileProtocol.Kind.UPDATE_CACHE;
                FileProtocol protocol = new FileProtocol(kind, tableInfo.getDfsFilePath(), nextRemoteInfo);
                tableInfo.setImportProtocol(protocol);
            }
            succeed = true;
        } finally {
            if (succeed == false) {
                repository.releaseLock(bean.getExecutionId());
            }
            DBConnection.closeConn(connection);
        }
    }

    private void acquireCacheLock(
            ImportBean bean,
            LocalCacheInfoRepository repository) throws BulkLoaderSystemException, BulkLoaderReRunnableException {
        assert bean != null;
        assert repository != null;
        for (String tableName : bean.getImportTargetTableList()) {
            ImportTargetTableBean tableInfo = bean.getTargetTable(tableName);
            if (tableInfo.getCacheId() == null) {
                assert tableInfo.getImportProtocol() != null;
                continue;
            }
            boolean locked = repository.tryLock(bean.getExecutionId(), tableInfo.getCacheId(), tableName);
            if (locked == false) {
                throw new BulkLoaderReRunnableException(getClass(), "TG-IMPORTER-11005",
                        tableName,
                        tableInfo.getCacheId());
            }
        }
    }

    private Calendar computeStartTimestamp(
            CacheInfo remoteInfo,
            LocalCacheInfoRepository repository,
            String tableName,
            ImportTargetTableBean tableInfo) throws BulkLoaderSystemException {
        assert repository != null;
        assert tableName != null;
        assert tableInfo != null;
        String cacheId = tableInfo.getCacheId();
        assert cacheId != null;
        if (remoteInfo == null) {
            LOG.info("TG-IMPORTER-11009", tableName, cacheId);
            return null;
        }
        if (remoteInfo.getFeatureVersion().equals(CacheInfo.FEATURE_VERSION) == false) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Invalid feature version: expected \"{0}\", but was \"{1}\"",
                    CacheInfo.FEATURE_VERSION, remoteInfo.getFeatureVersion()));
            return null;
        }
        if (remoteInfo.getId().equals(cacheId) == false) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent cache ID: expected {0}, but was {1}",
                    cacheId, remoteInfo.getId()));
            return null;
        }
        if (remoteInfo.getTableName().equals(tableName) == false) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent table name: expected {0}, but was {1}",
                    tableName, remoteInfo.getTableName()));
            return null;
        }
        if (remoteInfo.getColumnNames().equals(new HashSet<>(tableInfo.getImportTargetColumns())) == false) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent column set: expected {0}, but was {1}",
                    new TreeSet<>(tableInfo.getImportTargetColumns()), remoteInfo.getColumnNames()));
            return null;
        }

        ThunderGateCacheSupport model = createDataModelObject(tableName, tableInfo);
        if (remoteInfo.getModelClassName().equals(model.getClass().getName()) == false) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent model class: expected {0}, but was {1}",
                    model.getClass().getName(), remoteInfo.getModelClassName()));
            return null;
        }
        if (remoteInfo.getModelClassVersion() != model.__tgc__DataModelVersion()) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent model version: expected {0}, but was {1}",
                    model.__tgc__DataModelVersion(), remoteInfo.getModelClassVersion()));
            return null;
        }

        LocalCacheInfo local = repository.getCacheInfo(remoteInfo.getId());
        if (local == null) {
            LOG.info("TG-IMPORTER-11008", tableName, cacheId);
            return null;
        }

        Calendar timestamp = remoteInfo.getTimestamp();
        Calendar localTimestamp = local.getLocalTimestamp();
        if (localTimestamp == null || timestamp.compareTo(localTimestamp) > 0) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent timestamp: expected is <= {0}, but was {1} (local DB was restored from backup?)",
                    format(localTimestamp), format(timestamp)));
            return null;
        }
        Calendar createdTimestamp = local.getRemoteTimestamp();
        if (createdTimestamp != null && timestamp.compareTo(createdTimestamp) < 0) {
            LOG.warn("TG-IMPORTER-11010", tableName, cacheId, MessageFormat.format(
                    "Inconsistent timestamp: expected is >= {0}, but was {1} (remote FS was restored from backup?)",
                    format(createdTimestamp), format(timestamp)));
            return null;
        }

        LOG.info("TG-IMPORTER-11007",
                tableName, cacheId, format(timestamp));
        return timestamp;
    }

    private String format(Calendar calendar) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (calendar == null) {
            return formatter.format(new Date(0L));
        } else {
            return formatter.format(calendar.getTime());
        }
    }

    private ThunderGateCacheSupport createDataModelObject(
            String tableName,
            ImportTargetTableBean tableInfo) throws BulkLoaderSystemException {
        assert tableName != null;
        assert tableInfo != null;
        try {
            return tableInfo.getImportTargetType()
                .asSubclass(ThunderGateCacheSupport.class)
                .newInstance();
        } catch (Exception e) {
            throw new BulkLoaderSystemException(e, getClass(), "TG-IMPORTER-11011",
                    tableName,
                    tableInfo.getCacheId(),
                    tableInfo.getImportTargetType().getName());
        }
    }

    private void setContentProtocol(String tableName, ImportTargetTableBean table) {
        assert tableName != null;
        assert table != null;
        String remoteLocation = FileNameUtil.createSendImportFileName(tableName);
        FileProtocol protocol = new FileProtocol(FileProtocol.Kind.CONTENT, remoteLocation, null);
        table.setImportProtocol(protocol);
    }

    /**
     * Collects remote cache information related to the import targets.
     * This will return the pairs - {@link ImportTargetTableBean#getDfsFilePath()} and corresponded cache information.
     * If a target table does not use cache feature or related cache did not exist, there will be not in the result.
     * @param bean importer information
     * @return the collected pairs
     * @throws BulkLoaderSystemException if failed to obtain remote cache info
     * @throws IllegalArgumentException if some parameters were {@code null}
     */
    protected Map<String, CacheInfo> collectRemoteCacheInfo(ImportBean bean) throws BulkLoaderSystemException {
        if (bean == null) {
            throw new IllegalArgumentException("bean must not be null"); //$NON-NLS-1$
        }
        GetCacheInfoLocal client = new GetCacheInfoLocal();
        return client.get(bean);
    }
}