text:
<!doctype html>

	<meta charset="UTF-8">
	<title>Document</title>

Password reset requested

{{$token}}


text:
<i class="<?php echo $icon_class; ?> position-left"> <?php echo $title; ?>

<a href="<?php echo site_url('admin'); ?>"> Home

<?php echo $title; ?>

    <?php $this->load->view('Admin/message_view'); ?>

                Upload:

                    <input type="file" class="file-input-ajax" multiple="multiple" accept="image/*" >

                <?php //pr($images); ?>
                <?php foreach ($images as $image) { ?>

                            <a class="fancybox" href="<?php echo HOME_IMAGE . '/' . $image['image']; ?>" data-fancybox-group="gallery"><img src="<?php echo HOME_MEDIUM_IMAGE . '/' . $image['image']; ?>" alt="" />

                            <a class="text-danger-600 delete" onClick="return confirm('Are you sure you want to delete?')" href="Admin/Media/delete/<?php echo base64_encode($image['id']); ?>" data-record="">

                <?php } ?>

<link rel="stylesheet" type="text/css" href="assets/admin/css/jquery.fancybox.css?v=2.1.5" media="screen" />

redpajama_set_name: RedPajamaGithub


text:
BEGIN;

ALTER TABLE documentation
    DROP COLUMN id,
    DROP COLUMN id_bigint,
    DROP COLUMN new_goos,
    DROP COLUMN new_goarch,
    DROP COLUMN zip;

DROP TRIGGER documentation_id_update ON documentation;

END;


text:
function coremask
%
% DESCRIPTION : coremask
% This function builds the mask for user to specify whether or
% not to include core indices in the chronology. User will base
% decision on statistics and other information gained so far. Only
% the unmasked series will be used in subsequent analyses.
%
% INPUTS  :  NONE
%
% OUTPUTS :  NONE
%_________________________________________________________________

% Prompt for the .mat file name
% Load the necessary .mat file(s)
flmat=uigetfile('*.mat','.MAT filename ?');
eval(['load ',flmat]);

% Check if nms matrix exists
if ~exist('nms'),
  jh=jdisp('Core ID matrix does not exist! Wrong filename.');
  pause;
  close(jh);
  return;
end

% Save the original variables in a temporary file
save tempo.mat;

% Initialize the mask identifier
[ns,ms]=size(nms);
fv=[];
for i=1:ns,
  fv=[fv;'-n'];
end

if exist('cmask'),
  mu1=usinp('core mask (cmask) already exists! Overwrite ?');
  if ~mu1,
    return;
  end
end

% Build the mask
dum=[];
for i=1:ms-4,
  dum=[dum,' '];
end
qt=['QUIT',dum];
k=0;
cmask=ones(ns,1);
while k<ns+1,
  nmsn=[nms,fv;qt,'  '];
  k=svmenu('Mask Core ID?',nmsn);
  if k<=ns,
    cmask(k)=0;
    fv(k,:)='-m';
  end
end

% Display the mask vector
disp(cmask);

% Prompt for the file name to store cmask
nsv=shlmnu('Select','Add to file?','Store in new file?','QUIT');
if nsv==1,
  eval(['save ','temp.mat',' cmask']);
  clear all;
  load tempo;
  load temp;
  eval(['save ',flmat]);
elseif nsv==2,
  ofmat=uiputfile('*.mat','.MAT filename ?');
  eval(['save ',ofmat,' cmask']);
end

% End of file


text:
#include <aws/finspace-data/model/ChangesetSummary.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace FinSpaceData
{
namespace Model
{

ChangesetSummary::ChangesetSummary() :
    m_changesetIdHasBeenSet(false),
    m_changesetArnHasBeenSet(false),
    m_datasetIdHasBeenSet(false),
    m_changeType(ChangeType::NOT_SET),
    m_changeTypeHasBeenSet(false),
    m_sourceParamsHasBeenSet(false),
    m_formatParamsHasBeenSet(false),
    m_createTime(0),
    m_createTimeHasBeenSet(false),
    m_status(IngestionStatus::NOT_SET),
    m_statusHasBeenSet(false),
    m_errorInfoHasBeenSet(false),
    m_activeUntilTimestamp(0),
    m_activeUntilTimestampHasBeenSet(false),
    m_activeFromTimestamp(0),
    m_activeFromTimestampHasBeenSet(false),
    m_updatesChangesetIdHasBeenSet(false),
    m_updatedByChangesetIdHasBeenSet(false)
{
}

ChangesetSummary::ChangesetSummary(JsonView jsonValue) :
    m_changesetIdHasBeenSet(false),
    m_changesetArnHasBeenSet(false),
    m_datasetIdHasBeenSet(false),
    m_changeType(ChangeType::NOT_SET),
    m_changeTypeHasBeenSet(false),
    m_sourceParamsHasBeenSet(false),
    m_formatParamsHasBeenSet(false),
    m_createTime(0),
    m_createTimeHasBeenSet(false),
    m_status(IngestionStatus::NOT_SET),
    m_statusHasBeenSet(false),
    m_errorInfoHasBeenSet(false),
    m_activeUntilTimestamp(0),
    m_activeUntilTimestampHasBeenSet(false),
    m_activeFromTimestamp(0),
    m_activeFromTimestampHasBeenSet(false),
    m_updatesChangesetIdHasBeenSet(false),
    m_updatedByChangesetIdHasBeenSet(false)
{
  *this = jsonValue;
}

ChangesetSummary& ChangesetSummary::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("changesetId"))
  {
    m_changesetId = jsonValue.GetString("changesetId");

    m_changesetIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("changesetArn"))
  {
    m_changesetArn = jsonValue.GetString("changesetArn");

    m_changesetArnHasBeenSet = true;
  }

  if(jsonValue.ValueExists("datasetId"))
  {
    m_datasetId = jsonValue.GetString("datasetId");

    m_datasetIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("changeType"))
  {
    m_changeType = ChangeTypeMapper::GetChangeTypeForName(jsonValue.GetString("changeType"));

    m_changeTypeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("sourceParams"))
  {
    Aws::Map<Aws::String, JsonView> sourceParamsJsonMap = jsonValue.GetObject("sourceParams").GetAllObjects();
    for(auto& sourceParamsItem : sourceParamsJsonMap)
    {
      m_sourceParams[sourceParamsItem.first] = sourceParamsItem.second.AsString();
    }
    m_sourceParamsHasBeenSet = true;
  }

  if(jsonValue.ValueExists("formatParams"))
  {
    Aws::Map<Aws::String, JsonView> formatParamsJsonMap = jsonValue.GetObject("formatParams").GetAllObjects();
    for(auto& formatParamsItem : formatParamsJsonMap)
    {
      m_formatParams[formatParamsItem.first] = formatParamsItem.second.AsString();
    }
    m_formatParamsHasBeenSet = true;
  }

  if(jsonValue.ValueExists("createTime"))
  {
    m_createTime = jsonValue.GetInt64("createTime");

    m_createTimeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("status"))
  {
    m_status = IngestionStatusMapper::GetIngestionStatusForName(jsonValue.GetString("status"));

    m_statusHasBeenSet = true;
  }

  if(jsonValue.ValueExists("errorInfo"))
  {
    m_errorInfo = jsonValue.GetObject("errorInfo");

    m_errorInfoHasBeenSet = true;
  }

  if(jsonValue.ValueExists("activeUntilTimestamp"))
  {
    m_activeUntilTimestamp = jsonValue.GetInt64("activeUntilTimestamp");

    m_activeUntilTimestampHasBeenSet = true;
  }

  if(jsonValue.ValueExists("activeFromTimestamp"))
  {
    m_activeFromTimestamp = jsonValue.GetInt64("activeFromTimestamp");

    m_activeFromTimestampHasBeenSet = true;
  }

  if(jsonValue.ValueExists("updatesChangesetId"))
  {
    m_updatesChangesetId = jsonValue.GetString("updatesChangesetId");

    m_updatesChangesetIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("updatedByChangesetId"))
  {
    m_updatedByChangesetId = jsonValue.GetString("updatedByChangesetId");

    m_updatedByChangesetIdHasBeenSet = true;
  }

  return *this;
}

JsonValue ChangesetSummary::Jsonize() const
{
  JsonValue payload;

  if(m_changesetIdHasBeenSet)
  {
   payload.WithString("changesetId", m_changesetId);

  }

  if(m_changesetArnHasBeenSet)
  {
   payload.WithString("changesetArn", m_changesetArn);

  }

  if(m_datasetIdHasBeenSet)
  {
   payload.WithString("datasetId", m_datasetId);

  }

  if(m_changeTypeHasBeenSet)
  {
   payload.WithString("changeType", ChangeTypeMapper::GetNameForChangeType(m_changeType));
  }

  if(m_sourceParamsHasBeenSet)
  {
   JsonValue sourceParamsJsonMap;
   for(auto& sourceParamsItem : m_sourceParams)
   {
     sourceParamsJsonMap.WithString(sourceParamsItem.first, sourceParamsItem.second);
   }
   payload.WithObject("sourceParams", std::move(sourceParamsJsonMap));

  }

  if(m_formatParamsHasBeenSet)
  {
   JsonValue formatParamsJsonMap;
   for(auto& formatParamsItem : m_formatParams)
   {
     formatParamsJsonMap.WithString(formatParamsItem.first, formatParamsItem.second);
   }
   payload.WithObject("formatParams", std::move(formatParamsJsonMap));

  }

  if(m_createTimeHasBeenSet)
  {
   payload.WithInt64("createTime", m_createTime);

  }

  if(m_statusHasBeenSet)
  {
   payload.WithString("status", IngestionStatusMapper::GetNameForIngestionStatus(m_status));
  }

  if(m_errorInfoHasBeenSet)
  {
   payload.WithObject("errorInfo", m_errorInfo.Jsonize());

  }

  if(m_activeUntilTimestampHasBeenSet)
  {
   payload.WithInt64("activeUntilTimestamp", m_activeUntilTimestamp);

  }

  if(m_activeFromTimestampHasBeenSet)
  {
   payload.WithInt64("activeFromTimestamp", m_activeFromTimestamp);

  }

  if(m_updatesChangesetIdHasBeenSet)
  {
   payload.WithString("updatesChangesetId", m_updatesChangesetId);

  }

  if(m_updatedByChangesetIdHasBeenSet)
  {
   payload.WithString("updatedByChangesetId", m_updatedByChangesetId);

  }

  return payload;
}

} // namespace Model
} // namespace FinSpaceData
} // namespace Aws


text:
import sys
import urllib
import urllib2

import psutil

steptime = 5

if len(sys.argv) == 3:
    origin = str(sys.argv[1])
    endpoint = str(sys.argv[2])
    for x in range(60/steptime):
        cpu = psutil.cpu_percent(steptime, percpu=True)
        print cpu
        cpuvalue = 0
        for c in cpu:
            cpuvalue += c
        cpuvalue /= len(cpu)
        print cpuvalue

        url = 'http://%s/api/v1.0/metrics' % endpoint
        data = urllib.urlencode({'origin': origin,
                                 'key': 'cpu_usage',
                                 'value': cpuvalue})
        urllib2.urlopen(url=url, data=data).read()
    sys.exit(0)
else:
    print "Usage run_cron.py <Origin> <API Endpoint>"

    sys.exit(-1)


text:
package org.apache.metron.pcap.query;

import org.apache.commons.cli.*;

/**
 * Provides commmon required fields for the PCAP filter jobs
 */
public class CliParser {
  public static final String BASE_PATH_DEFAULT = "/apps/metron/pcap";
  public static final String BASE_OUTPUT_PATH_DEFAULT = "/tmp";
  public static final int NUM_REDUCERS_DEFAULT = 10;
  public static final int NUM_RECORDS_PER_FILE_DEFAULT = 10000;
  private CommandLineParser parser;

  public CliParser() {
    parser = new PosixParser();
  }

  public Options buildOptions() {
    Options options = new Options();
    options.addOption(newOption("h", "help", false, "Display help"));
    options.addOption(newOption("bp", "base_path", true, String.format("Base PCAP data path. Default is '%s'", BASE_PATH_DEFAULT)));
    options.addOption(newOption("bop", "base_output_path", true, String.format("Query result output path. Default is '%s'", BASE_OUTPUT_PATH_DEFAULT)));
    options.addOption(newOption("st", "start_time", true, "(required) Packet start time range.", true));
    options.addOption(newOption("nr", "num_reducers", true, String.format("Number of reducers to use (defaults to %s)", NUM_REDUCERS_DEFAULT)));
    options.addOption(newOption("rpf", "records_per_file", true, String.format("Number of records to include in each output pcap file (defaults to %s)", NUM_RECORDS_PER_FILE_DEFAULT)));
    options.addOption(newOption("et", "end_time", true, "Packet end time range. Default is current system time."));
    options.addOption(newOption("df", "date_format", true, "Date format to use for parsing start_time and end_time. Default is to use time in millis since the epoch."));
    return options;
  }

  protected Option newOption(String opt, String longOpt, boolean hasArg, String desc) {
    return newOption(opt, longOpt, hasArg, desc, false);
  }

  protected Option newOption(String opt, String longOpt, boolean hasArg, String desc, boolean required) {
    Option option = new Option(opt, longOpt, hasArg, desc);
    option.setRequired(required);
    return option;
  }

  public void parse(CommandLine commandLine, CliConfig config) throws java.text.ParseException {
    if (commandLine.hasOption("help")) {
      config.setShowHelp(true);
    }
    if (commandLine.hasOption("date_format")) {
      config.setDateFormat(commandLine.getOptionValue("date_format"));
    }
    if (commandLine.hasOption("base_path")) {
      config.setBasePath(commandLine.getOptionValue("base_path"));
    } else {
      config.setBasePath(BASE_PATH_DEFAULT);
    }
    if (commandLine.hasOption("base_output_path")) {
      config.setBaseOutputPath(commandLine.getOptionValue("base_output_path"));
    } else {
      config.setBaseOutputPath(BASE_OUTPUT_PATH_DEFAULT);
    }
    if (commandLine.hasOption("start_time")) {
      try {
        if (commandLine.hasOption("date_format")) {
          long startTime = config.getDateFormat().parse(commandLine.getOptionValue("start_time")).getTime();
          config.setStartTime(startTime);
        } else {
          long startTime = Long.parseLong(commandLine.getOptionValue("start_time"));
          config.setStartTime(startTime);
        }
      } catch (NumberFormatException nfe) {
        //no-op
      }
    }
    if (commandLine.hasOption("num_reducers")) {
      int numReducers = Integer.parseInt(commandLine.getOptionValue("num_reducers"));
      config.setNumReducers(numReducers);
    }
    else {
      config.setNumReducers(NUM_REDUCERS_DEFAULT);
    }
    if (commandLine.hasOption("records_per_file")) {
      int numRecordsPerFile = Integer.parseInt(commandLine.getOptionValue("records_per_file"));
      config.setNumRecordsPerFile(numRecordsPerFile);
    }
    else {
      config.setNumRecordsPerFile(NUM_RECORDS_PER_FILE_DEFAULT);
    }
    if (commandLine.hasOption("end_time")) {
      try {
        if (commandLine.hasOption("date_format")) {
          long endTime = config.getDateFormat().parse(commandLine.getOptionValue("end_time")).getTime();
          config.setEndTime(endTime);
        } else {
          long endTime = Long.parseLong(commandLine.getOptionValue("end_time"));
          config.setEndTime(endTime);
        }
      } catch (NumberFormatException nfe) {
        //no-op
      }
    }
  }

  public void printHelp(String msg, Options opts) {
    new HelpFormatter().printHelp(msg, opts);
  }

  protected CommandLineParser getParser() {
    return parser;
  }
}


text:
@interface DKAsyncStorageActor () {
 @public
  id<DKListStorageDisplayEx> storage_;
  id<BSBserCreator> creator_;
}

- (void)callCallbackWithDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback
                                       withJavaUtilList:(id<JavaUtilList>)res;

- (JavaUtilArrayList *)convertListWithJavaUtilList:(id<JavaUtilList>)records;

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor, storage_, id<DKListStorageDisplayEx>)
J2OBJC_FIELD_SETTER(DKAsyncStorageActor, creator_, id<BSBserCreator>)

__attribute__((unused)) static void DKAsyncStorageActor_callCallbackWithDKListEngineDisplayLoadCallback_withJavaUtilList_(DKAsyncStorageActor *self, id<DKListEngineDisplayLoadCallback> callback, id<JavaUtilList> res);

__attribute__((unused)) static JavaUtilArrayList *DKAsyncStorageActor_convertListWithJavaUtilList_(DKAsyncStorageActor *self, id<JavaUtilList> records);

@interface DKAsyncStorageActor_AddOrUpdate () {
 @public
  id<JavaUtilList> items_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_AddOrUpdate, items_, id<JavaUtilList>)

@interface DKAsyncStorageActor_Replace () {
 @public
  id<JavaUtilList> items_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_Replace, items_, id<JavaUtilList>)

@interface DKAsyncStorageActor_Remove () {
 @public
  IOSLongArray *keys_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_Remove, keys_, IOSLongArray *)

@interface DKAsyncStorageActor_LoadItem () {
 @public
  jlong key_;
  id<DKAsyncStorageActor_LoadItemCallback> callback_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadItem, callback_, id<DKAsyncStorageActor_LoadItemCallback>)

@interface DKAsyncStorageActor_LoadCount () {
 @public
  id<DKAsyncStorageActor_LoadCountCallback> callback_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadCount, callback_, id<DKAsyncStorageActor_LoadCountCallback>)

@interface DKAsyncStorageActor_LoadHead () {
 @public
  id<DKAsyncStorageActor_LoadItemCallback> callback_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadHead, callback_, id<DKAsyncStorageActor_LoadItemCallback>)

@interface DKAsyncStorageActor_LoadForward () {
 @public
  NSString *query_;
  JavaLangLong *topSortKey_;
  jint limit_;
  id<DKListEngineDisplayLoadCallback> callback_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadForward, query_, NSString *)
J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadForward, topSortKey_, JavaLangLong *)
J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadForward, callback_, id<DKListEngineDisplayLoadCallback>)

@interface DKAsyncStorageActor_LoadBackward () {
 @public
  NSString *query_;
  JavaLangLong *topSortKey_;
  jint limit_;
  id<DKListEngineDisplayLoadCallback> callback_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadBackward, query_, NSString *)
J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadBackward, topSortKey_, JavaLangLong *)
J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadBackward, callback_, id<DKListEngineDisplayLoadCallback>)

@interface DKAsyncStorageActor_LoadCenter () {
 @public
  JavaLangLong *centerSortKey_;
  jint limit_;
  id<DKListEngineDisplayLoadCallback> callback_;
}

@end

J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadCenter, centerSortKey_, JavaLangLong *)
J2OBJC_FIELD_SETTER(DKAsyncStorageActor_LoadCenter, callback_, id<DKListEngineDisplayLoadCallback>)

@implementation DKAsyncStorageActor

- (instancetype)initWithDKListStorageDisplayEx:(id<DKListStorageDisplayEx>)storage
                             withBSBserCreator:(id<BSBserCreator>)creator {
  DKAsyncStorageActor_initWithDKListStorageDisplayEx_withBSBserCreator_(self, storage, creator);
  return self;
}

- (void)addOrUpdateWithJavaUtilList:(id<JavaUtilList>)items {
  if ([((id<JavaUtilList>) nil_chk(items)) size] == 1) {
    BSBserObject<DKListEngineItem> *item = [items getWithInt:0];
    [((id<DKListStorageDisplayEx>) nil_chk(storage_)) updateOrAddWithValue:new_DKListEngineRecord_initWithKey_withOrder_withQuery_withData_([((BSBserObject<DKListEngineItem> *) nil_chk(item)) getEngineId], [item getEngineSort], [item getEngineSearch], [item toByteArray])];
  }
  else if ([items size] > 0) {
    id<JavaUtilList> updated = new_JavaUtilArrayList_init();
    for (BSBserObject<DKListEngineItem> * __strong i in items) {
      [updated addWithId:new_DKListEngineRecord_initWithKey_withOrder_withQuery_withData_([((BSBserObject<DKListEngineItem> *) nil_chk(i)) getEngineId], [i getEngineSort], [i getEngineSearch], [i toByteArray])];
    }
    [((id<DKListStorageDisplayEx>) nil_chk(storage_)) updateOrAddWithList:updated];
  }
}

- (void)replaceWithJavaUtilList:(id<JavaUtilList>)items {
  id<JavaUtilList> updated = new_JavaUtilArrayList_init();
  for (BSBserObject<DKListEngineItem> * __strong i in nil_chk(items)) {
    [updated addWithId:new_DKListEngineRecord_initWithKey_withOrder_withQuery_withData_([((BSBserObject<DKListEngineItem> *) nil_chk(i)) getEngineId], [i getEngineSort], [i getEngineSearch], [i toByteArray])];
  }
  [((id<DKListStorageDisplayEx>) nil_chk(storage_)) clear];
  [storage_ updateOrAddWithList:updated];
}

- (void)removeWithLongArray:(IOSLongArray *)keys {
  if (((IOSLongArray *) nil_chk(keys))->size_ == 1) {
    [((id<DKListStorageDisplayEx>) nil_chk(storage_)) deleteWithKey:IOSLongArray_Get(keys, 0)];
  }
  else if (keys->size_ > 0) {
    [((id<DKListStorageDisplayEx>) nil_chk(storage_)) deleteWithKeys:keys];
  }
}

- (void)clear {
  [((id<DKListStorageDisplayEx>) nil_chk(storage_)) clear];
}

- (void)loadItemWithLong:(jlong)key
withDKAsyncStorageActor_LoadItemCallback:(id<DKAsyncStorageActor_LoadItemCallback>)callback {
  DKListEngineRecord *record = [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadItemWithKey:key];
  if (record != nil) {
    @try {
      BSBserObject<DKListEngineItem> *res = ((BSBserObject<DKListEngineItem> *) BSBser_parseWithBSBserObject_withByteArray_([((id<BSBserCreator>) nil_chk(creator_)) createInstance], [record getData]));
      [((id<DKAsyncStorageActor_LoadItemCallback>) nil_chk(callback)) onLoadedWithBSBserObject:res];
    }
    @catch (JavaIoIOException *e) {
      [((JavaIoIOException *) nil_chk(e)) printStackTrace];
      [((id<DKAsyncStorageActor_LoadItemCallback>) nil_chk(callback)) onLoadedWithBSBserObject:nil];
    }
  }
  else {
    [((id<DKAsyncStorageActor_LoadItemCallback>) nil_chk(callback)) onLoadedWithBSBserObject:nil];
  }
}

- (void)loadHeadWithDKAsyncStorageActor_LoadItemCallback:(id<DKAsyncStorageActor_LoadItemCallback>)callback {
  id<JavaUtilList> records = [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadForwardWithSortKey:nil withLimit:1];
  if ([((id<JavaUtilList>) nil_chk(records)) size] != 1) {
    [((id<DKAsyncStorageActor_LoadItemCallback>) nil_chk(callback)) onLoadedWithBSBserObject:nil];
    return;
  }
  DKListEngineRecord *record = [records getWithInt:0];
  @try {
    [((id<DKAsyncStorageActor_LoadItemCallback>) nil_chk(callback)) onLoadedWithBSBserObject:BSBser_parseWithBSBserObject_withByteArray_([((id<BSBserCreator>) nil_chk(creator_)) createInstance], [((DKListEngineRecord *) nil_chk(record)) getData])];
  }
  @catch (JavaIoIOException *e) {
    [((JavaIoIOException *) nil_chk(e)) printStackTrace];
    [((id<DKAsyncStorageActor_LoadItemCallback>) nil_chk(callback)) onLoadedWithBSBserObject:nil];
  }
}

- (void)loadCountWithDKAsyncStorageActor_LoadCountCallback:(id<DKAsyncStorageActor_LoadCountCallback>)callback {
  [((id<DKAsyncStorageActor_LoadCountCallback>) nil_chk(callback)) onLoadedWithInt:[((id<DKListStorageDisplayEx>) nil_chk(storage_)) getCount]];
}

- (void)loadForwardWithNSString:(NSString *)query
               withJavaLangLong:(JavaLangLong *)topSortKey
                        withInt:(jint)limit
withDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback {
  JavaUtilArrayList *res;
  if (query == nil) {
    res = DKAsyncStorageActor_convertListWithJavaUtilList_(self, [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadForwardWithSortKey:topSortKey withLimit:limit]);
  }
  else {
    res = DKAsyncStorageActor_convertListWithJavaUtilList_(self, [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadForwardWithQuery:query withSortKey:topSortKey withLimit:limit]);
  }
  DKAsyncStorageActor_callCallbackWithDKListEngineDisplayLoadCallback_withJavaUtilList_(self, callback, res);
}

- (void)loadBackwardWithNSString:(NSString *)query
                withJavaLangLong:(JavaLangLong *)topSortKey
                         withInt:(jint)limit
withDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback {
  JavaUtilArrayList *res;
  if (query == nil) {
    res = DKAsyncStorageActor_convertListWithJavaUtilList_(self, [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadBackwardWithSortKey:topSortKey withLimit:limit]);
  }
  else {
    res = DKAsyncStorageActor_convertListWithJavaUtilList_(self, [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadBackwardWithQuery:query withSortKey:topSortKey withLimit:limit]);
  }
  DKAsyncStorageActor_callCallbackWithDKListEngineDisplayLoadCallback_withJavaUtilList_(self, callback, res);
}

- (void)loadCenterWithJavaLangLong:(JavaLangLong *)centerSortKey
                           withInt:(jint)limit
withDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback {
  JavaUtilArrayList *res;
  res = DKAsyncStorageActor_convertListWithJavaUtilList_(self, [((id<DKListStorageDisplayEx>) nil_chk(storage_)) loadCenterWithSortKey:centerSortKey withLimit:limit]);
  DKAsyncStorageActor_callCallbackWithDKListEngineDisplayLoadCallback_withJavaUtilList_(self, callback, res);
}

- (void)callCallbackWithDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback
                                       withJavaUtilList:(id<JavaUtilList>)res {
  DKAsyncStorageActor_callCallbackWithDKListEngineDisplayLoadCallback_withJavaUtilList_(self, callback, res);
}

- (JavaUtilArrayList *)convertListWithJavaUtilList:(id<JavaUtilList>)records {
  return DKAsyncStorageActor_convertListWithJavaUtilList_(self, records);
}

- (void)onReceiveWithId:(id)message {
  if ([message isKindOfClass:[DKAsyncStorageActor_AddOrUpdate class]]) {
    [self addOrUpdateWithJavaUtilList:[((DKAsyncStorageActor_AddOrUpdate *) nil_chk(((DKAsyncStorageActor_AddOrUpdate *) check_class_cast(message, [DKAsyncStorageActor_AddOrUpdate class])))) getItems]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_Remove class]]) {
    [self removeWithLongArray:[((DKAsyncStorageActor_Remove *) nil_chk(((DKAsyncStorageActor_Remove *) check_class_cast(message, [DKAsyncStorageActor_Remove class])))) getKeys]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_Clear class]]) {
    [self clear];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_Replace class]]) {
    [self replaceWithJavaUtilList:[((DKAsyncStorageActor_Replace *) nil_chk(((DKAsyncStorageActor_Replace *) check_class_cast(message, [DKAsyncStorageActor_Replace class])))) getItems]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_LoadItem class]]) {
    [self loadItemWithLong:[((DKAsyncStorageActor_LoadItem *) nil_chk(((DKAsyncStorageActor_LoadItem *) check_class_cast(message, [DKAsyncStorageActor_LoadItem class])))) getKey] withDKAsyncStorageActor_LoadItemCallback:[((DKAsyncStorageActor_LoadItem *) nil_chk(((DKAsyncStorageActor_LoadItem *) check_class_cast(message, [DKAsyncStorageActor_LoadItem class])))) getCallback]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_LoadCount class]]) {
    [self loadCountWithDKAsyncStorageActor_LoadCountCallback:[((DKAsyncStorageActor_LoadCount *) nil_chk(((DKAsyncStorageActor_LoadCount *) check_class_cast(message, [DKAsyncStorageActor_LoadCount class])))) getCallback]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_LoadHead class]]) {
    [self loadHeadWithDKAsyncStorageActor_LoadItemCallback:[((DKAsyncStorageActor_LoadHead *) nil_chk(((DKAsyncStorageActor_LoadHead *) check_class_cast(message, [DKAsyncStorageActor_LoadHead class])))) getCallback]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_LoadForward class]]) {
    [self loadForwardWithNSString:[((DKAsyncStorageActor_LoadForward *) nil_chk(((DKAsyncStorageActor_LoadForward *) check_class_cast(message, [DKAsyncStorageActor_LoadForward class])))) getQuery] withJavaLangLong:[((DKAsyncStorageActor_LoadForward *) nil_chk(((DKAsyncStorageActor_LoadForward *) check_class_cast(message, [DKAsyncStorageActor_LoadForward class])))) getTopSortKey] withInt:[((DKAsyncStorageActor_LoadForward *) nil_chk(((DKAsyncStorageActor_LoadForward *) check_class_cast(message, [DKAsyncStorageActor_LoadForward class])))) getLimit] withDKListEngineDisplayLoadCallback:[((DKAsyncStorageActor_LoadForward *) nil_chk(((DKAsyncStorageActor_LoadForward *) check_class_cast(message, [DKAsyncStorageActor_LoadForward class])))) getCallback]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_LoadBackward class]]) {
    [self loadBackwardWithNSString:[((DKAsyncStorageActor_LoadBackward *) nil_chk(((DKAsyncStorageActor_LoadBackward *) check_class_cast(message, [DKAsyncStorageActor_LoadBackward class])))) getQuery] withJavaLangLong:[((DKAsyncStorageActor_LoadBackward *) nil_chk(((DKAsyncStorageActor_LoadBackward *) check_class_cast(message, [DKAsyncStorageActor_LoadBackward class])))) getTopSortKey] withInt:[((DKAsyncStorageActor_LoadBackward *) nil_chk(((DKAsyncStorageActor_LoadBackward *) check_class_cast(message, [DKAsyncStorageActor_LoadBackward class])))) getLimit] withDKListEngineDisplayLoadCallback:[((DKAsyncStorageActor_LoadBackward *) nil_chk(((DKAsyncStorageActor_LoadBackward *) check_class_cast(message, [DKAsyncStorageActor_LoadBackward class])))) getCallback]];
  }
  else if ([message isKindOfClass:[DKAsyncStorageActor_LoadCenter class]]) {
    [self loadCenterWithJavaLangLong:[((DKAsyncStorageActor_LoadCenter *) nil_chk(((DKAsyncStorageActor_LoadCenter *) check_class_cast(message, [DKAsyncStorageActor_LoadCenter class])))) getCenterSortKey] withInt:[((DKAsyncStorageActor_LoadCenter *) nil_chk(((DKAsyncStorageActor_LoadCenter *) check_class_cast(message, [DKAsyncStorageActor_LoadCenter class])))) getLimit] withDKListEngineDisplayLoadCallback:[((DKAsyncStorageActor_LoadCenter *) nil_chk(((DKAsyncStorageActor_LoadCenter *) check_class_cast(message, [DKAsyncStorageActor_LoadCenter class])))) getCallback]];
  }
  else {
    [self dropWithId:message];
  }
}

@end

void DKAsyncStorageActor_initWithDKListStorageDisplayEx_withBSBserCreator_(DKAsyncStorageActor *self, id<DKListStorageDisplayEx> storage, id<BSBserCreator> creator) {
  (void) DKActor_init(self);
  self->storage_ = storage;
  self->creator_ = creator;
}

DKAsyncStorageActor *new_DKAsyncStorageActor_initWithDKListStorageDisplayEx_withBSBserCreator_(id<DKListStorageDisplayEx> storage, id<BSBserCreator> creator) {
  DKAsyncStorageActor *self = [DKAsyncStorageActor alloc];
  DKAsyncStorageActor_initWithDKListStorageDisplayEx_withBSBserCreator_(self, storage, creator);
  return self;
}

void DKAsyncStorageActor_callCallbackWithDKListEngineDisplayLoadCallback_withJavaUtilList_(DKAsyncStorageActor *self, id<DKListEngineDisplayLoadCallback> callback, id<JavaUtilList> res) {
  if ([((id<JavaUtilList>) nil_chk(res)) size] == 0) {
    [((id<DKListEngineDisplayLoadCallback>) nil_chk(callback)) onLoadedWithItems:res withTopKey:0 withBottomKey:0];
  }
  else {
    jlong topSort, bottomSort;
    topSort = bottomSort = [((BSBserObject<DKListEngineItem> *) nil_chk([res getWithInt:0])) getEngineSort];
    for (BSBserObject<DKListEngineItem> * __strong t in res) {
      jlong sort = [((BSBserObject<DKListEngineItem> *) nil_chk(t)) getEngineSort];
      if (topSort < sort) {
        topSort = sort;
      }
      if (bottomSort > sort) {
        bottomSort = sort;
      }
    }
    [((id<DKListEngineDisplayLoadCallback>) nil_chk(callback)) onLoadedWithItems:res withTopKey:topSort withBottomKey:bottomSort];
  }
}

JavaUtilArrayList *DKAsyncStorageActor_convertListWithJavaUtilList_(DKAsyncStorageActor *self, id<JavaUtilList> records) {
  JavaUtilArrayList *res = new_JavaUtilArrayList_init();
  for (DKListEngineRecord * __strong record in nil_chk(records)) {
    @try {
      BSBserObject<DKListEngineItem> *loaded = ((BSBserObject<DKListEngineItem> *) BSBser_parseWithBSBserObject_withByteArray_([((id<BSBserCreator>) nil_chk(self->creator_)) createInstance], [((DKListEngineRecord *) nil_chk(record)) getData]));
      [res addWithId:loaded];
    }
    @catch (JavaIoIOException *e) {
      [((JavaIoIOException *) nil_chk(e)) printStackTrace];
    }
  }
  return res;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor)

@implementation DKAsyncStorageActor_AddOrUpdate

- (instancetype)initWithJavaUtilList:(id<JavaUtilList>)items {
  DKAsyncStorageActor_AddOrUpdate_initWithJavaUtilList_(self, items);
  return self;
}

- (id<JavaUtilList>)getItems {
  return items_;
}

@end

void DKAsyncStorageActor_AddOrUpdate_initWithJavaUtilList_(DKAsyncStorageActor_AddOrUpdate *self, id<JavaUtilList> items) {
  (void) NSObject_init(self);
  self->items_ = items;
}

DKAsyncStorageActor_AddOrUpdate *new_DKAsyncStorageActor_AddOrUpdate_initWithJavaUtilList_(id<JavaUtilList> items) {
  DKAsyncStorageActor_AddOrUpdate *self = [DKAsyncStorageActor_AddOrUpdate alloc];
  DKAsyncStorageActor_AddOrUpdate_initWithJavaUtilList_(self, items);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_AddOrUpdate)

@implementation DKAsyncStorageActor_Replace

- (instancetype)initWithJavaUtilList:(id<JavaUtilList>)items {
  DKAsyncStorageActor_Replace_initWithJavaUtilList_(self, items);
  return self;
}

- (id<JavaUtilList>)getItems {
  return items_;
}

@end

void DKAsyncStorageActor_Replace_initWithJavaUtilList_(DKAsyncStorageActor_Replace *self, id<JavaUtilList> items) {
  (void) NSObject_init(self);
  self->items_ = items;
}

DKAsyncStorageActor_Replace *new_DKAsyncStorageActor_Replace_initWithJavaUtilList_(id<JavaUtilList> items) {
  DKAsyncStorageActor_Replace *self = [DKAsyncStorageActor_Replace alloc];
  DKAsyncStorageActor_Replace_initWithJavaUtilList_(self, items);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_Replace)

@implementation DKAsyncStorageActor_Remove

- (instancetype)initWithLongArray:(IOSLongArray *)keys {
  DKAsyncStorageActor_Remove_initWithLongArray_(self, keys);
  return self;
}

- (IOSLongArray *)getKeys {
  return keys_;
}

@end

void DKAsyncStorageActor_Remove_initWithLongArray_(DKAsyncStorageActor_Remove *self, IOSLongArray *keys) {
  (void) NSObject_init(self);
  self->keys_ = keys;
}

DKAsyncStorageActor_Remove *new_DKAsyncStorageActor_Remove_initWithLongArray_(IOSLongArray *keys) {
  DKAsyncStorageActor_Remove *self = [DKAsyncStorageActor_Remove alloc];
  DKAsyncStorageActor_Remove_initWithLongArray_(self, keys);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_Remove)

@implementation DKAsyncStorageActor_Clear

- (instancetype)init {
  DKAsyncStorageActor_Clear_init(self);
  return self;
}

@end

void DKAsyncStorageActor_Clear_init(DKAsyncStorageActor_Clear *self) {
  (void) NSObject_init(self);
}

DKAsyncStorageActor_Clear *new_DKAsyncStorageActor_Clear_init() {
  DKAsyncStorageActor_Clear *self = [DKAsyncStorageActor_Clear alloc];
  DKAsyncStorageActor_Clear_init(self);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_Clear)

@implementation DKAsyncStorageActor_LoadItem

- (instancetype)initWithLong:(jlong)key
withDKAsyncStorageActor_LoadItemCallback:(id<DKAsyncStorageActor_LoadItemCallback>)callback {
  DKAsyncStorageActor_LoadItem_initWithLong_withDKAsyncStorageActor_LoadItemCallback_(self, key, callback);
  return self;
}

- (jlong)getKey {
  return key_;
}

- (id<DKAsyncStorageActor_LoadItemCallback>)getCallback {
  return callback_;
}

@end

void DKAsyncStorageActor_LoadItem_initWithLong_withDKAsyncStorageActor_LoadItemCallback_(DKAsyncStorageActor_LoadItem *self, jlong key, id<DKAsyncStorageActor_LoadItemCallback> callback) {
  (void) NSObject_init(self);
  self->key_ = key;
  self->callback_ = callback;
}

DKAsyncStorageActor_LoadItem *new_DKAsyncStorageActor_LoadItem_initWithLong_withDKAsyncStorageActor_LoadItemCallback_(jlong key, id<DKAsyncStorageActor_LoadItemCallback> callback) {
  DKAsyncStorageActor_LoadItem *self = [DKAsyncStorageActor_LoadItem alloc];
  DKAsyncStorageActor_LoadItem_initWithLong_withDKAsyncStorageActor_LoadItemCallback_(self, key, callback);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadItem)

@implementation DKAsyncStorageActor_LoadCount

- (instancetype)initWithDKAsyncStorageActor_LoadCountCallback:(id<DKAsyncStorageActor_LoadCountCallback>)callback {
  DKAsyncStorageActor_LoadCount_initWithDKAsyncStorageActor_LoadCountCallback_(self, callback);
  return self;
}

- (id<DKAsyncStorageActor_LoadCountCallback>)getCallback {
  return callback_;
}

@end

void DKAsyncStorageActor_LoadCount_initWithDKAsyncStorageActor_LoadCountCallback_(DKAsyncStorageActor_LoadCount *self, id<DKAsyncStorageActor_LoadCountCallback> callback) {
  (void) NSObject_init(self);
  self->callback_ = callback;
}

DKAsyncStorageActor_LoadCount *new_DKAsyncStorageActor_LoadCount_initWithDKAsyncStorageActor_LoadCountCallback_(id<DKAsyncStorageActor_LoadCountCallback> callback) {
  DKAsyncStorageActor_LoadCount *self = [DKAsyncStorageActor_LoadCount alloc];
  DKAsyncStorageActor_LoadCount_initWithDKAsyncStorageActor_LoadCountCallback_(self, callback);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadCount)

@implementation DKAsyncStorageActor_LoadHead

- (instancetype)initWithDKAsyncStorageActor_LoadItemCallback:(id<DKAsyncStorageActor_LoadItemCallback>)callback {
  DKAsyncStorageActor_LoadHead_initWithDKAsyncStorageActor_LoadItemCallback_(self, callback);
  return self;
}

- (id<DKAsyncStorageActor_LoadItemCallback>)getCallback {
  return callback_;
}

@end

void DKAsyncStorageActor_LoadHead_initWithDKAsyncStorageActor_LoadItemCallback_(DKAsyncStorageActor_LoadHead *self, id<DKAsyncStorageActor_LoadItemCallback> callback) {
  (void) NSObject_init(self);
  self->callback_ = callback;
}

DKAsyncStorageActor_LoadHead *new_DKAsyncStorageActor_LoadHead_initWithDKAsyncStorageActor_LoadItemCallback_(id<DKAsyncStorageActor_LoadItemCallback> callback) {
  DKAsyncStorageActor_LoadHead *self = [DKAsyncStorageActor_LoadHead alloc];
  DKAsyncStorageActor_LoadHead_initWithDKAsyncStorageActor_LoadItemCallback_(self, callback);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadHead)

@implementation DKAsyncStorageActor_LoadForward

- (instancetype)initWithNSString:(NSString *)query
                withJavaLangLong:(JavaLangLong *)topSortKey
                         withInt:(jint)limit
withDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback {
  DKAsyncStorageActor_LoadForward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(self, query, topSortKey, limit, callback);
  return self;
}

- (NSString *)getQuery {
  return query_;
}

- (JavaLangLong *)getTopSortKey {
  return topSortKey_;
}

- (jint)getLimit {
  return limit_;
}

- (id<DKListEngineDisplayLoadCallback>)getCallback {
  return callback_;
}

@end

void DKAsyncStorageActor_LoadForward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(DKAsyncStorageActor_LoadForward *self, NSString *query, JavaLangLong *topSortKey, jint limit, id<DKListEngineDisplayLoadCallback> callback) {
  (void) NSObject_init(self);
  self->query_ = query;
  self->topSortKey_ = topSortKey;
  self->limit_ = limit;
  self->callback_ = callback;
}

DKAsyncStorageActor_LoadForward *new_DKAsyncStorageActor_LoadForward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(NSString *query, JavaLangLong *topSortKey, jint limit, id<DKListEngineDisplayLoadCallback> callback) {
  DKAsyncStorageActor_LoadForward *self = [DKAsyncStorageActor_LoadForward alloc];
  DKAsyncStorageActor_LoadForward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(self, query, topSortKey, limit, callback);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadForward)

@implementation DKAsyncStorageActor_LoadBackward

- (instancetype)initWithNSString:(NSString *)query
                withJavaLangLong:(JavaLangLong *)topSortKey
                         withInt:(jint)limit
withDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback {
  DKAsyncStorageActor_LoadBackward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(self, query, topSortKey, limit, callback);
  return self;
}

- (NSString *)getQuery {
  return query_;
}

- (JavaLangLong *)getTopSortKey {
  return topSortKey_;
}

- (jint)getLimit {
  return limit_;
}

- (id<DKListEngineDisplayLoadCallback>)getCallback {
  return callback_;
}

@end

void DKAsyncStorageActor_LoadBackward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(DKAsyncStorageActor_LoadBackward *self, NSString *query, JavaLangLong *topSortKey, jint limit, id<DKListEngineDisplayLoadCallback> callback) {
  (void) NSObject_init(self);
  self->query_ = query;
  self->topSortKey_ = topSortKey;
  self->limit_ = limit;
  self->callback_ = callback;
}

DKAsyncStorageActor_LoadBackward *new_DKAsyncStorageActor_LoadBackward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(NSString *query, JavaLangLong *topSortKey, jint limit, id<DKListEngineDisplayLoadCallback> callback) {
  DKAsyncStorageActor_LoadBackward *self = [DKAsyncStorageActor_LoadBackward alloc];
  DKAsyncStorageActor_LoadBackward_initWithNSString_withJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(self, query, topSortKey, limit, callback);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadBackward)

@implementation DKAsyncStorageActor_LoadCenter

- (instancetype)initWithJavaLangLong:(JavaLangLong *)centerSortKey
                             withInt:(jint)limit
 withDKListEngineDisplayLoadCallback:(id<DKListEngineDisplayLoadCallback>)callback {
  DKAsyncStorageActor_LoadCenter_initWithJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(self, centerSortKey, limit, callback);
  return self;
}

- (JavaLangLong *)getCenterSortKey {
  return centerSortKey_;
}

- (jint)getLimit {
  return limit_;
}

- (id<DKListEngineDisplayLoadCallback>)getCallback {
  return callback_;
}

@end

void DKAsyncStorageActor_LoadCenter_initWithJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(DKAsyncStorageActor_LoadCenter *self, JavaLangLong *centerSortKey, jint limit, id<DKListEngineDisplayLoadCallback> callback) {
  (void) NSObject_init(self);
  self->centerSortKey_ = centerSortKey;
  self->limit_ = limit;
  self->callback_ = callback;
}

DKAsyncStorageActor_LoadCenter *new_DKAsyncStorageActor_LoadCenter_initWithJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(JavaLangLong *centerSortKey, jint limit, id<DKListEngineDisplayLoadCallback> callback) {
  DKAsyncStorageActor_LoadCenter *self = [DKAsyncStorageActor_LoadCenter alloc];
  DKAsyncStorageActor_LoadCenter_initWithJavaLangLong_withInt_withDKListEngineDisplayLoadCallback_(self, centerSortKey, limit, callback);
  return self;
}

J2OBJC_CLASS_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadCenter)

J2OBJC_INTERFACE_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadItemCallback)

J2OBJC_INTERFACE_TYPE_LITERAL_SOURCE(DKAsyncStorageActor_LoadCountCallback)


text:
layout: page
title: Hines Llc. Dinner
date: 2016-05-24
author: Denise Bennett
tags: weekly links, java
status: published
summary: Vestibulum interdum arcu vel tincidunt eleifend. Donec imperdiet varius arcu.
banner: images/banner/leisure-05.jpg
booking:
  startDate: 07/03/2019
  endDate: 07/08/2019
  ctyhocn: LBBHSHX
  groupCode: HLD
published: true
---
Quisque accumsan dapibus dolor nec porttitor. Etiam vel euismod nibh. Etiam molestie tortor eu leo commodo tincidunt. Praesent nec justo nec diam faucibus fermentum. Praesent fermentum, sapien non ornare aliquam, arcu lectus maximus turpis, id convallis lectus turpis vitae arcu. Cras blandit feugiat est, ut porttitor quam laoreet at. Donec sed urna eget enim imperdiet laoreet a quis erat. Phasellus at eros commodo tellus blandit dictum eu id urna. Pellentesque quis turpis laoreet, rutrum arcu ut, aliquet risus. In ex ex, ornare laoreet ipsum id, lacinia molestie mi. Curabitur at nisl sed ligula blandit bibendum eu at ligula. Sed eget sapien nisi. Praesent non orci lorem. Donec at ex varius, tincidunt ante vitae, eleifend purus.

* Sed blandit dolor ac velit ullamcorper, quis rutrum ipsum aliquam
* Proin efficitur felis cursus, auctor turpis non, maximus lacus
* Donec eu lacus tristique, sollicitudin velit a, condimentum eros
* Donec vitae sem nec magna pharetra gravida
* Aenean commodo lectus sit amet justo gravida, vitae sagittis ipsum sollicitudin.

Pellentesque nibh erat, vulputate eu congue id, ultricies eget augue. Duis eget gravida elit, sit amet dignissim sapien. Phasellus consequat varius feugiat. Nunc eu est urna. Suspendisse rhoncus tempor risus ut vestibulum. Ut ut risus fringilla libero mollis sodales. Aliquam sit amet tempus quam, ac venenatis mauris. Nam venenatis enim sed tellus elementum, at mattis quam blandit. Quisque nec euismod risus.
Vestibulum hendrerit neque ut massa varius, eget cursus ligula feugiat. In viverra facilisis dolor, vel sollicitudin massa viverra vel. Sed imperdiet eros id lacus dictum, a porta massa eleifend. Praesent sed dolor eu diam molestie porttitor. Duis in neque aliquam, pulvinar turpis gravida, porttitor elit. Phasellus ullamcorper vehicula aliquam. Donec dictum elit id massa pellentesque, sollicitudin pharetra mauris consequat. Vivamus odio neque, auctor at lectus ut, iaculis dictum velit. Cras urna nisi, pulvinar ultricies ipsum at, feugiat dignissim nunc.


text:
set -ex

heroku plugins:install heroku-container-registry
heroku container:login
heroku container:push web --app ml-tv
heroku run "cd /go/src/github.com/ml-tv/tv-api && goose up" --app ml-tv


text:
<!DOCTYPE html>

  <title></title>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css">
  <link rel="stylesheet" href="../styles/main.css" type="text/css">

Blog

            <button class="week1">Week 1</button>
            <button class="week2">Week 2</button>
            <button class="week3">Week 3</button>
            <button class="week4">Week 4</button>
            <button class="week5">Week 5</button>

        <button class="week6">Week 6</button>
        <button class="week7">Week 7</button>
        <button class="week8">Week 8</button>
        <button class="week9">Week 9</button>
        <button class="home">Home</button>

Javascript vs HTML

 Javascript is a lot harder than html and css. There is so much more content and so many more interactions that you need
             to learn. It's pretty overwhelming really. Control flows and loops is when you have a function or something that you
             want to happen, but only when the correct conditions are met. It's like doing laundry. You follow the specific steps
             of putting clothes in the washing machine, then the powder, and then you turn it on. Then you have to keep checking it until
             it's finished, and only once th washing machines finished do you take the washing and hang it outside.
             Data arrays are a collection of values and are accessed from the array via "indexing". Each data point within the array
             is given a number starting from 0, so all you need do is refer to the specific number within the array when you want to call it.
             When you want to call a piece of data within an object it is different, you must refer to it by its name.
             A function in Javascript is a set of instructions and parameters used to find a value or complete a task.
             Functions are very common and all have unique names which you can use to call them.

Mindfulness Conversation

I thought it was a very interesting exercise. It kind of reminded me of being in school; listening intently and as if
             I could be asked a question by the teacher at any moment. It certainly helped me retain the conversation better, and reduce
             misunderstandings by atleast 17%. Huge success.
             To practice mindfulness I will continue trying these sorts of conversations with my brother and continue doing 2 minutes
             of mindfulness a day.


text:
<?php

/*
 * This file is part of the MilioooMessageBundle package.
 *
 * (c) Michiel boeckaert <boeckaert@gmail.com>
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

/**
 * Description of FormModelProcessorInterface
 *
 * @author Michiel Boeckaert <boeckaert@gmail.com>
 */
class NewMultipleThreadDoctrineProcessor
{
    //todo
}


text:
using SkiResort.XamarinApp.Interfaces;
using SkiResort.XamarinApp.Services;
using SkiResort.XamarinApp.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace SkiResort.XamarinApp.Pages
{
    public class RentalPage : TabbedPage, IBarTint
    {
        public RentalPage()
        {
            BarBackgroundColor = Device.OS == TargetPlatform.iOS ? Config.DEFAULT_BAR_COLOR : Config.PRIMARY_COLOR;
            BarTextColor = Config.DEFAULT_BAR_TEXT_COLOR;

            Title = "Rental Reservation";

            var rentalListPage = NavigationService.Instance.CreatePage(typeof(RentalListViewModel));
            var rentalFormPage = NavigationService.Instance.CreatePage(typeof(RentalFormViewModel));

            Children.Add(rentalListPage);
            Children.Add(rentalFormPage);

            MessagingCenter.Subscribe<RentalFormViewModel>(this, "SetRentalListTab", (sender) => {
                SelectedItem = Children[0];
                MessagingCenter.Send(this, "Refresh");
            });
        }

        public Color GetBarBackgroundColor() => Config.BLUE_BAR_COLOR;
        public Color GetBarTextColor() => Config.DEFAULT_BAR_TEXT_COLOR;
    }
}


text:
require 'spec_helper'

require 'rails'
require 'action_controller/railtie'
require 'opbeat/integration/railtie'

describe 'Rails integration' do
  include Rack::Test::Methods

  def boot
    TinderButForHotDogs.initialize!
    TinderButForHotDogs.routes.draw do
      get 'error', to: 'users#error'
      get 'json', to: 'users#other'
      root to: 'users#index'
    end
  end

  before :all do
    class TinderButForHotDogs < ::Rails::Application
      config.secret_key_base = '__secret_key_base'

      config.logger = Logger.new(DEBUG ? STDOUT : nil)
      config.logger.level = Logger::DEBUG

      config.eager_load = false

      config.opbeat.app_id = 'APP_ID'
      config.opbeat.organization_id = 'ORGANIZATION_ID'
      config.opbeat.secret_token = 'SECRET_TOKEN'
      config.opbeat.disable_worker = true
    end

    class UsersController < ActionController::Base
      def index
        if Rails.version.to_i >= 5
          render plain: 'HOT DOGS!'
        else
          render text: 'HOT DOGS!'
        end
      end

      def other
        json = Opbeat.trace('JSON.dump') { sleep 0.1; { result: :ok } }
        render json: json
      end

      def error
        raise Exception.new("NO KETCHUP!")
      end
    end

    boot
  end

  after :all do
    Object.send(:remove_const, :TinderButForHotDogs)
    Object.send(:remove_const, :UsersController)
    Rails.application = nil
    Opbeat.stop!
  end

  def app
    @app ||= Rails.application
  end

  before :each do
    Opbeat::Client.inst.queue.clear
    Opbeat::Client.inst.instance_variable_set :@pending_transactions, []
  end

  it "adds an exception handler and handles exceptions" do
    get '/error'

    expect(Opbeat::Client.inst.queue.length).to be 1
  end

  it "traces actions and enqueues transaction" do
    get '/'

    expect(Opbeat::Client.inst.pending_transactions.length).to be 1
  end

  it "logs when failing to report error" do
    allow(Opbeat::Client.inst).to receive(:report).and_raise
    allow(Rails.logger).to receive(:error)

    get '/404'

    expect(Rails.logger).to have_received(:error).with(/\*\* \[Opbeat\] Error capturing/)
  end
end


text:
class CallTree(object):

    def __init__(self, node, cube, parent=None):

        self.idx = int(node.get('id'))
        self.metrics = {}

        region_id = int(node.get('calleeId'))
        self.region = cube.rindex[region_id]

        # Append the cnode to the corresponding region
        self.cube = cube
        cube.rindex[region_id].cnodes.append(self)

        self.parent = parent
        self.children = []

        # Construct the inclusive and exclusive index maps
        # These may be breadth-first and depth-first, respectively, but my
        # memory is that they are similar, but not identical, to them.
        cube.exclusive_index.append(self.idx)

        for child_node in node.findall('cnode'):
            child_tree = CallTree(child_node, cube, self)
            self.children.append(child_tree)

    def __getitem__(self, index):
        # TODO: Assert integer
        return self.children[index]

    def update_index(self, index):
        self.cube.inclusive_index.extend([c.idx for c in self.children])

        index[self.idx] = self
        for child in self.children:
            child.update_index(index)

    def print_tree(self, indent='', depth=None):
        print(indent + '- ' + self.region.name)

        if depth is not None:
            depth = depth - 1

        if depth is None or depth > 0:
            for child in self.children:
                child.print_tree(indent + '  ', depth=depth)

    def print_weights(self, metric_name, interval=None):
        # TODO: Check that metric is inclusive
        # TODO: Check arguments

        sloc, eloc = interval if interval else (0, -1)

        self_sum = sum(self.metrics[metric_name][sloc:eloc])

        weights = {}
        reg_idx = {}
        children_sum = 0.
        for idx, child in enumerate(self.children):
            child_sum = sum(child.metrics[metric_name][sloc:eloc])
            children_sum += child_sum

            weights[child.region.name] = child_sum / self_sum
            reg_idx[child.region.name] = idx

        weights[self.region.name] = (self_sum - children_sum) / self_sum
        reg_idx[self.region.name] = '-'

        for region in sorted(weights, key=weights.get, reverse=True):
            print('{:.3f}: [{}] {}'
                  ''.format(weights[region], reg_idx[region], region))


text:
module API
  class DeployKeys < Grape::API::Instance
    include PaginationParams

    before { authenticate! }

    helpers do
      def add_deploy_keys_project(project, attrs = {})
        project.deploy_keys_projects.create(attrs)
      end

      # rubocop: disable CodeReuse/ActiveRecord
      def find_by_deploy_key(project, key_id)
        project.deploy_keys_projects.find_by!(deploy_key: key_id)
      end
      # rubocop: enable CodeReuse/ActiveRecord
    end

    desc 'Return all deploy keys'
    params do
      use :pagination
    end
    get "deploy_keys" do
      authenticated_as_admin!

      present paginate(DeployKey.all), with: Entities::DeployKey
    end

    params do
      requires :id, type: String, desc: 'The ID of the project'
    end
    resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
      before { authorize_admin_project }

      desc "Get a specific project's deploy keys" do
        success Entities::DeployKeysProject
      end
      params do
        use :pagination
      end
      # rubocop: disable CodeReuse/ActiveRecord
      get ":id/deploy_keys" do
        keys = user_project.deploy_keys_projects.preload(:deploy_key)

        present paginate(keys), with: Entities::DeployKeysProject
      end
      # rubocop: enable CodeReuse/ActiveRecord

      desc 'Get single deploy key' do
        success Entities::DeployKeysProject
      end
      params do
        requires :key_id, type: Integer, desc: 'The ID of the deploy key'
      end
      get ":id/deploy_keys/:key_id" do
        key = find_by_deploy_key(user_project, params[:key_id])

        present key, with: Entities::DeployKeysProject
      end

      desc 'Add new deploy key to a project' do
        success Entities::DeployKeysProject
      end
      params do
        requires :key, type: String, desc: 'The new deploy key'
        requires :title, type: String, desc: 'The name of the deploy key'
        optional :can_push, type: Boolean, desc: "Can deploy key push to the project's repository"
      end
      # rubocop: disable CodeReuse/ActiveRecord
      post ":id/deploy_keys" do
        params[:key].strip!

        # Check for an existing key joined to this project
        deploy_key_project = user_project.deploy_keys_projects
                          .joins(:deploy_key)
                          .find_by(keys: { key: params[:key] })

        if deploy_key_project
          present deploy_key_project, with: Entities::DeployKeysProject
          break
        end

        # Check for available deploy keys in other projects
        key = current_user.accessible_deploy_keys.find_by(key: params[:key])
        if key
          deploy_key_project = add_deploy_keys_project(user_project, deploy_key: key, can_push: !!params[:can_push])

          present deploy_key_project, with: Entities::DeployKeysProject
          break
        end

        # Create a new deploy key
        deploy_key_attributes = declared_params.except(:can_push).merge(user: current_user)
        deploy_key_project = add_deploy_keys_project(user_project, deploy_key_attributes: deploy_key_attributes, can_push: !!params[:can_push])

        if deploy_key_project.valid?
          present deploy_key_project, with: Entities::DeployKeysProject
        else
          render_validation_error!(deploy_key_project)
        end
      end
      # rubocop: enable CodeReuse/ActiveRecord

      desc 'Update an existing deploy key for a project' do
        success Entities::DeployKey
      end
      params do
        requires :key_id, type: Integer, desc: 'The ID of the deploy key'
        optional :title, type: String, desc: 'The name of the deploy key'
        optional :can_push, type: Boolean, desc: "Can deploy key push to the project's repository"
        at_least_one_of :title, :can_push
      end
      put ":id/deploy_keys/:key_id" do
        deploy_keys_project = find_by_deploy_key(user_project, params[:key_id])

        if !can?(current_user, :update_deploy_key, deploy_keys_project.deploy_key) &&
            !can?(current_user, :update_deploy_keys_project, deploy_keys_project)
          forbidden!(nil)
        end

        update_params = {}
        update_params[:can_push] = params[:can_push] if params.key?(:can_push)
        update_params[:deploy_key_attributes] = { id: params[:key_id] }

        if can?(current_user, :update_deploy_key, deploy_keys_project.deploy_key)
          update_params[:deploy_key_attributes][:title] = params[:title] if params.key?(:title)
        end

        result = deploy_keys_project.update(update_params)

        if result
          present deploy_keys_project, with: Entities::DeployKeysProject
        else
          render_validation_error!(deploy_keys_project)
        end
      end

      desc 'Enable a deploy key for a project' do
        detail 'This feature was added in GitLab 8.11'
        success Entities::DeployKey
      end
      params do
        requires :key_id, type: Integer, desc: 'The ID of the deploy key'
      end
      post ":id/deploy_keys/:key_id/enable" do
        key = ::Projects::EnableDeployKeyService.new(user_project,
                                                      current_user, declared_params).execute

        if key
          present key, with: Entities::DeployKey
        else
          not_found!('Deploy Key')
        end
      end

      desc 'Delete deploy key for a project' do
        success Key
      end
      params do
        requires :key_id, type: Integer, desc: 'The ID of the deploy key'
      end
      # rubocop: disable CodeReuse/ActiveRecord
      delete ":id/deploy_keys/:key_id" do
        deploy_key_project = user_project.deploy_keys_projects.find_by(deploy_key_id: params[:key_id])
        not_found!('Deploy Key') unless deploy_key_project

        destroy_conditionally!(deploy_key_project)
      end
      # rubocop: enable CodeReuse/ActiveRecord
    end
  end
end


text:
const frontMatter = require('front-matter');
const markdownIt = require('markdown-it');
const markdownItUtils = require('markdown-it/lib/common/utils');
const Prism = require('prismjs');
require('prismjs/components/prism-jsx');
const renderDemo = require('./render-demo');
const renderCodePenButton = require('./render-codepen-button');

const md = markdownIt({
    html: true,
    linkify: true,
    typographer: true,
    highlight: (str, lang) => {
        const prismLang = Prism.languages[lang];
        if (lang && prismLang) {
            return Prism.highlight(str, prismLang);
        }
        return '';
    }
});

const demoLanguagesMap = new Map([
    ['jsx_demo', 'jsx'],
    ['jsx_demo_class', 'jsx'],
]);

function getCode(lang, token, fn) {
    if (lang === 'jsx_demo') {
        return fn(token.content);
    }
    if (lang === 'jsx_demo_class') {
        return fn(token.content, true);
    }
    return '';
}

function getCodePenCode(lang, token) {
    return getCode(lang, token, renderCodePenButton);
}

function getDemoCode(lang, token) {
    return getCode(lang, token, renderDemo);
}

md.renderer.rules.table_open = () => '<table class="mdl-data-table mdl-shadow--2dp">\n';

// const defaultFenceRenderer = md.renderer.rules.fence;
// https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js#L31
md.renderer.rules.fence = (tokens, idx, options) => {
    const token = tokens[idx];
    const info = token.info ? markdownItUtils.unescapeAll(token.info).trim() : '';
    const langName = info ? info.split(/\s+/g)[0] : '';
    const realLangName = demoLanguagesMap.has(langName) ? demoLanguagesMap.get(langName) : langName;

    const highlighted = options.highlight(token.content, realLangName)
        || markdownItUtils.escapeHtml(token.content);

    const demo = getDemoCode(langName, token);
    const prefix = `<pre class="language-${realLangName}"><code class="language-${realLangName}">`;
    const suffix = `</code>${getCodePenCode(langName, token)}</pre>`;
    return demo + prefix + highlighted + suffix;
};

module.exports = function mdLoader(content) {
    this.cacheable();
    const meta = frontMatter(content);
    const body = md.render(meta.body);
    const result = {
        ...meta.attributes,
        body,
    };
    this.value = result;
    return `module.exports = ${JSON.stringify(result)}`;
};


text:
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/routing
        https://symfony.com/schema/routing/routing-1.0.xsd">

    <route id="blog" path="/blog">
        <default key="_controller">
            <string>AcmeBlogBundle:Blog:index</string>
        </default>
        <default key="values">
            <map>
                <list key="list">
                    <bool>true</bool>
                    <int>1</int>
                    <float>3.5</float>
                    <string>foo</string>
                </list>
            </map>
        </default>
    </route>
</routes>


text:
require 'xmpp4r/pubsub/helper/servicehelper'
require 'xmpp4r/pubsub/helper/nodebrowser'

module Jabber
  module PubSub
    class NodeHelper < ServiceHelper

      attr_reader :nodename
      attr_reader :name
      attr_reader :jiod
      attr_reader :my_subscriptions
      ##
      # creates a new node
      # new(client,service,nodename)
      # stream:: [Jabber::Stream]
      # jid:: [String] (jid of the pubsub service)
      # nodename:: [String]
      def initialize(stream,jid,nodename=nil,create_if_not_exist=true)
        super(stream,jid)
        @nodename = nodename
	@jid = jid
	@stream = client

	get_subscriptions

	if create_if_not_exist and not node_exist?
	  # if no nodename is given a instant node will created
	  # (if the service supports instant nodes)
	  @nodename = create_node
	end
      end

      ##
      # creates the node
      # create(configuration=nil)
      # configuration:: [Jabber::XData]
      def create_node(configuration=nil)
        create(@nodename,configuration)
      end

      ##
      # get the configuration of the node
      # get_configuration(configuration=nil)
      # configuration:: [Jabber::XData]
      def get_configuration(subid=nil)
        get_options(@nodename,subid)
      end

      ##
      # set the configuration of the node
      # set_configuration(configuration=nil)
      # configuration:: [Jabber::XData]
      # subid:: [String] default is nil
      def set_configuration(configuration,subid=nil)
        set_options(@nodename,configuration,subid)
      end

      ##
      # deletes the node
      # delete
      def delete_node
        delete(@nodename)
      end

      ##
      # publishing content on this node
      # publish_content(items)
      # items:: [REXML::Element]
      def publish_content(items)
        publish(@nodename,items)
      end

      ##
      # gets all items from the node
      # get_all_items
      def get_all_items
        items(@nodename)
      end

      ##
      # get a count of items
      # get_items(count)
      # count:: [Fixnum]
      def get_items(count)
        items(@nodename,count)
      end

      ##
      # get all node affiliations
      # get_affiliations
      def get_affiliations
        affiliations
      end

      ##
      # get all subscriptions on this node
      # get_subscriptions
      def get_subscriptions
        subscriptions(@nodename)
      end

      ##
      # get all subscribers subscribed on this node
      # get_subscribers
      def get_subscribers
        @subscriptions = subscribers(@nodename)
      end

      ##
      # subscribe to this node
      # do_subscribe
      def do_subscribe
        subscribe(@nodename)
	get_subscriptions
      end

      ##
      # unsubscribe from this node
      # do_unsubscribe(subid = nil)
      # subid:: [String]
      def do_unsubscribe(subid)
        unsubscribe(@nodename,subid)
      end

      ##
      # purge all items from this node
      # purge_items
      def purge_items
        purge(@nodename)
      end

    private

      def node_exist?
        nodebrowser = PubSub::NodeBrowser.new(@stream)
        nodebrowser.nodes.include?(nodename)
      end
      def disco_info
      end

    end #class
  end #module
end #module


text:
__author__ = 'peter'

def populate(model,value,modified):
    if value is None:
        model.native_size = {'value': None, 'modified': modified}
    else:
        model.native_size = {'value': float(value), 'modified': modified}


text:
<?php

namespace Craue\FormFlowBundle\DependencyInjection;

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

class CraueFormFlowExtension extends Extension {

	/**
	 * {@inheritDoc}
	 */
	public function load(array $config, ContainerBuilder $container) {
		$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
		$loader->load('form_flow.xml');
		$loader->load('twig.xml');
		$loader->load('util.xml');
	}

}


text:
package info.armado.ausleihe.database.access

import java.lang.{Long => JLong}
import javax.transaction.Transactional

import info.armado.ausleihe.database.barcode.Barcode
import info.armado.ausleihe.database.entities.HasBarcode

import scala.collection.JavaConverters.asScalaBufferConverter
import scala.util.Try

/**
  * An abstract Data Access Object for entities, like games, identity cards and envelopes which have a barcode.
  *
  * @param entityType The class of the entity [[Entity]], this class needs to have a barcode
  * @tparam Entity The type of entity
  * @tparam PK     The type of the primary key of the entity
  * @author Marc Arndt
  * @since 25.06.17
  */
abstract class EntityDao[Entity <: HasBarcode, PK](entityType: Class[Entity]) extends Dao[Entity, PK](entityType) {
  /**
    * Queries the database for an [[Entity]], which belongs to the given `barcode`
    *
    * @param barcode The barcode of the queried entity
    * @return The object belonging to the given barcode wrapped inside a [[Some]] instance or [[None]], if no such
    *         object exists in the database
    */
  def selectByBarcode(barcode: Barcode): Option[Entity] =
    Try(
      em.createQuery(s"from ${entityType.getSimpleName} entity where entity.barcode = :barcode", entityType)
        .setParameter("barcode", barcode).getSingleResult
    ).toOption

  /**
    * Queries the database for an activated [[Entity]], which belongs to the given `barcode`
    *
    * @param barcode The barcode of the queried entity
    * @return The object belonging to the given barcode wrapped inside a [[Some]] instance or [[None]], if no such
    *         object exists in the database
    */
  def selectActivatedByBarcode(barcode: Barcode): Option[Entity] =
    Try(
      em.createQuery(s"from ${entityType.getSimpleName} entity where entity.barcode = :barcode and entity.available = true", entityType)
        .setParameter("barcode", barcode).getSingleResult
    ).toOption

  /**
    * Queries the database for a list of all available entities
    *
    * @return A list of all available entities
    */
  def selectAllAvailable(): List[Entity] =
    em.createQuery(s"from ${entityType.getSimpleName} entity where entity.available = true", entityType)
      .getResultList.asScala.toList

  /**
    * Filters the already persisted barcodes from a given list of entities with barcodes and returns them
    *
    * @param envelopes A list of entities with a barcode, containing already persisted and not not persisted entities
    * @return A list of already persisted barcodes from the barcodes of the given entities
    */
  @Transactional
  def selectAllAlreadyPersisted(envelopes: List[Entity]): Set[Barcode] = envelopes.map(_.barcode).filter(exists).toSet

  /**
    * This method returns the number of currently available entites. An
    * entity is available, if its available property is set to true.
    *
    * @return The number of all available entities
    */
  def selectAvailableNumber: Long =
    em.createQuery(s"select count(*) from ${entityType.getSimpleName} entity where entity.available = true", classOf[JLong]).getSingleResult

  /**
    * Queries the database if an [[Entity]] for the given `barcode` exists
    *
    * @param barcode The barcode of the checked entity
    * @return True if an entity with the given `barcode` exists, false otherwise
    */
  def exists(barcode: Barcode): Boolean = {
    val count = em
      .createQuery(s"select count(*) from ${entityType.getSimpleName} entity where entity.barcode = :barcode", classOf[JLong])
      .setParameter("barcode", barcode).getSingleResult

    count > 0
  }

  /**
    * Tries to activate the [[Entity]] with the given `barcode`.
    * This will fail if no [[Entity]] with the given `barcode` exists
    *
    * @param barcode The barcode of the entity to activate
    * @return True if the the entity could be activated, false otherwise
    */
  @Transactional
  def activate(barcode: Barcode): Boolean = {
    val updateCount = em
      .createQuery(s"update ${entityType.getSimpleName} entity set entity.available = true where entity.barcode = :barcode")
      .setParameter("barcode", barcode).executeUpdate

    updateCount == 1
  }

  /**
    * Tries to deactivate the [[Entity]] with the given `barcode`.
    * This will fail if no [[Entity]] with the given `barcode` exists
    *
    * @param barcode The barcode of the entity to deactivate
    * @return True if the the entity could be deactivated, false otherwise
    */
  @Transactional
  def deactivate(barcode: Barcode): Boolean = {
    val updateCount = em
      .createQuery(s"update ${entityType.getSimpleName} entity set entity.available = false where entity.barcode = :barcode")
      .setParameter("barcode", barcode).executeUpdate

    updateCount == 1
  }
}


text:
package org.apache.tinkerpop.gremlin.python;

public class GenerateGremlinPython {

    private GenerateGremlinPython() {
        // just need the main method
    }

    public static void main(String[] args) {
        TraversalSourceGenerator.create(args[0]);
        GraphTraversalSourceGenerator.create(args[1]);
    }
}


text:
/**
 * Room Controller
 *
 * @param {Object} $scope
 * @param {RoomRepository} RoomRepository
 */
function RoomConfigController($scope, repository)
{
    this.$scope     = $scope;
    this.repository = repository;
    this.config     = null;

    // Binding:
    this.onJoined    = this.onJoined.bind(this);
    this.toggleBonus = this.toggleBonus.bind(this);
    this.setMaxScore = this.setMaxScore.bind(this);
    this.setVariable = this.setVariable.bind(this);
    this.applyScope  = this.applyScope.bind(this);

    // Hydratign scope
    this.$scope.toggleBonus = this.toggleBonus;
    this.$scope.setMaxScore = this.setMaxScore;
    this.$scope.setVariable = this.setVariable;

    this.repository.on('config:max-score', this.applyScope);
    this.repository.on('config:variable', this.applyScope);
    this.repository.on('config:bonus', this.applyScope);

    this.$scope.$parent.$watch('room', this.onJoined);
}

/**
 * On room joined
 */
RoomConfigController.prototype.onJoined = function()
{
    if (this.$scope.$parent.room) {
        this.config = this.$scope.$parent.room.config;

        this.$scope.config = this.config;
    }
};

/**
 * Toggle bonus
 *
 * @param {String} bonus
 */
RoomConfigController.prototype.toggleBonus = function(bonus)
{
    if (this.config.bonusExists(bonus)) {
        var config = this.config;

        this.repository.setConfigBonus(bonus, function (result) {
            config.setBonus(bonus, result.enabled);
        });
    }
};

/**
 * Set max score
 */
RoomConfigController.prototype.setMaxScore = function(maxScore)
{
    var config = this.config;

    this.repository.setConfigMaxScore(maxScore, function (result) {
        config.setMaxScore(result.maxScore);
    });
};

/**
 * Set variable
 */
RoomConfigController.prototype.setVariable = function(variable)
{
    if (this.config.variableExists(variable)) {
        var config = this.config;

        this.repository.setConfigVariable(variable, this.config.getVariable(variable), function (result) {
            config.setVariable(result.variable, result.value);
        });
    }
};

/**
 * Apply scope
 */
RoomConfigController.prototype.applyScope = CurvytronController.prototype.applyScope;


text:
package org.apache.sling.cassandra.test.data.populator.perf;

import org.apache.sling.commons.testing.integration.HttpTestBase;
import org.apache.sling.servlets.post.SlingPostConstants;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Test the PlanetsResourceProvider that the test-services bundles provides
 */
public class CassandraResourceProviderCreateTest extends HttpTestBase {

    private static List<String> exerciseList = new ArrayList<String>();
    private static List<String> testList = new ArrayList<String>();
    private static List<Long> firstRun = new ArrayList<Long>();
    private static List<Long> secondRun = new ArrayList<Long>();

    private static File file = new File("/home/dishara/mystuff/sling/svn/slinglatest/launchpad/integration-tests/CassandraCreateLatencyReport.txt");
    private static FileWriter fileWriter;

    static {
        loadTestLists();
        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException ignore) {
            }
        }
        try {
            fileWriter = new FileWriter(file, true);
        } catch (IOException ignore) {
        }

    }

    private static void loadTestLists() {
        int exerciseCount = 0;
        int testCount = 0;

        for (int i = 0; i < 1000; i++) {
            if (i % 2 == 0) {
                if (exerciseCount < 100) {
                    exerciseList.add(String.valueOf(i));
                    System.out.println("Exercise: " + i);
                    exerciseCount++;
                }
            } else {
                if (testCount < 100) {
                    testList.add(String.valueOf(i));
                    System.out.println("Test: " + i);
                    testCount++;
                }
            }
        }

    }

    private void createAllExerciseData(String parentNode) throws IOException {
        Map<String, String> props = new HashMap<String, String>();
        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
        Map<String, String> props1 = new HashMap<String, String>();
        props1.put("metadata", "resolutionPathInfo=json");
        props1.put("resourceType", "nt:cassandra0");
        props1.put("resourceSuperType", "nt:supercass1");
        props.put(SlingPostConstants.RP_CHECKIN, "true");

        for (String s : exerciseList) {
            testClient.createNode(HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s, props, props1, true);
        }

    }

    private void writeToFile(String s) throws IOException {
        fileWriter.write(s + "\n");
    }

    private void createAllTestData(String parentNode, List<Long> result, Map<String, Long> nodeMap) throws IOException {
        Map<String, String> props = new HashMap<String, String>();
        props.put(SlingPostConstants.RP_CONTENT_TYPE, "json");
        Map<String, String> props1 = new HashMap<String, String>();
        props1.put("metadata", "resolutionPathInfo=json");
        props1.put("resourceType", "nt:cassandra0");
        props1.put("resourceSuperType", "nt:supercass1");
        props.put(SlingPostConstants.RP_CHECKIN, "true");

        writeToFile("#######################################################################################################################");
        writeToFile("############################ HTTP CUD Latency Report on Test Data under " + parentNode + " ################################");
        writeToFile("#######################################################################################################################");

        long subTotal = 0;

        for (String s : testList) {
            long startTime = System.currentTimeMillis();

            String url = HTTP_BASE_URL + "/content/cassandra/" + parentNode + "/" + s;
            testClient.createNode(url, props, props1, true);
            long latency = System.currentTimeMillis() - startTime;
            result.add(latency);
            subTotal = subTotal + latency;
            writeToFile("[TEST] Latency: " + latency + " (ms) HTTP URI " + url);
            System.out.println(url);
        }
        nodeMap.put(parentNode, subTotal);
    }

    public void testMovieResource() throws Exception {
        String[] nodes = new String[]{"LA", "MA", "SA"};
//        String[] nodes = new String[]{"A", "B", "C", "D", "E", "F"};
        Map<String, Long> firstNodeMap = new HashMap<String, Long>();
        Map<String, Long> secondNodeMap = new HashMap<String, Long>();

        writeToFile("============================================ FIRST RUN ============================================================");
        for (String s : nodes) {
            createAllTestData(s, firstRun, firstNodeMap);
        }
        long firstRunTotal = 0;
        long secondRunTotal = 0;

        for (long l1 : firstRun) {
            firstRunTotal = firstRunTotal + l1;
        }

        for (long l2 : secondRun) {
            secondRunTotal = secondRunTotal + l2;
        }

        writeToFile("===========================================================================================================================");
        writeToFile("========================================== FIRST RUN TEST SUMMERY==========================================================");
        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + firstNodeMap.get("LA") / testList.size() + " (ms)");
        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + firstNodeMap.get("MA") / testList.size() + " (ms)");
        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + firstNodeMap.get("SA") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + firstNodeMap.get("D") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + firstNodeMap.get("E") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + firstNodeMap.get("F") / testList.size() + " (ms)");
        writeToFile("[FIRST RUN] #TOTAL CALLS = " + firstRun.size() + " Total Average Latency = " + firstRunTotal / firstRun.size() + " (ms)");
        writeToFile("===========================================================================================================================");
//        writeToFile("========================================== SECOND RUN TEST SUMMERY==========================================================");
//        writeToFile("[RESULT] Average Latency Under Node A(1K)   = " + secondNodeMap.get("LA") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node B(10K)  = " + secondNodeMap.get("MA") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node C(100K) = " + secondNodeMap.get("SA") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node D(1M)   = " + secondNodeMap.get("D") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node E(10M)  = " + secondNodeMap.get("E") / testList.size() + " (ms)");
//        writeToFile("[RESULT] Average Latency Under Node F(100M) = " + secondNodeMap.get("F") / testList.size() + " (ms)");
//        writeToFile("[FIRST RUN] #TOTAL CALLS = " + secondRun.size() + " Total Average Latency = " + secondRunTotal / secondRun.size() + " (ms)");
        writeToFile("===========================================================================================================================");
        fileWriter.close();
    }

}


text:
<?php
/**
 * Created by PhpStorm.
 * User: higakiyuusuke
 * Date: 2014/04/30
 * Time: 16:16
 */

namespace Acme\RentacarBundle\Service;

use Symfony\Bridge\Doctrine\RegistryInterface;
use Acme\RentacarBundle\Entity\User;
use Acme\RentacarBundle\Entity\Reservation;
/**
 *  ReservationService
 *
 * @author Yusuke Higaki <yusuke.higaki@dzb.jp>
 */

class ReservationService
{
    /**
     * @var RegistryInterface
     */
    private $managerRegistry;

    /**
     * @var MailService
     */
    private $mailService;

    /**
     *  Constructor.
     *
     * @param RegistryInterface $managerRegistry
     * @param MailService @mailService
     */

   public function __construct(RegistryInterface $managerRegistry , MailService $mailService)
   {
       $this->managerRegistry = $managerRegistry;
       $this->mailService = $mailService;
   }

    /**
     * Save Reservatioin.
     *
     * @param Reservation $reservation
     * @param User $user
     */
    public function saveReservation(Reservation $reservation , User $user)
    {
        $manager = $this->managerRegistry->getEntityManager();
        $reservation->setUser($user);
        $date = date_create(date("Y-m-d H:i:s"));
        $reservation->setCreatedAt($date);
        $reservation->setUpdatedAt($date);

        $manager->persist($reservation);
        $manager->flush();

        $this->mailService->sendReservationMail($reservation,$user);
    }

}


text:
declare module "*.vert" {
  declare const shader: string
  export default shader
}

declare module "*.frag" {
  declare const shader: string
  export default shader
}


text:
/**
 * @fileoverview Utility functions for handling VariablesBoolean and procedure names.
 * Note that VariablesBoolean and procedures share the same name space, meaning that
 * one can't have a variable and a procedure of the same name.
 * @author fraser@google.com (Neil Fraser)
 */
'use strict';

goog.provide('Blockly.VariablesBoolean');

// TODO(scr): Fix circular dependencies
// goog.require('Blockly.Block');
goog.require('Blockly.Workspace');

/**
 * Category to separate variable names from procedures and generated functions.
 */
Blockly.VariablesBoolean.NAME_TYPE = 'VARIABLE';

/**
 * Find all user-created VariablesBoolean.
 * @param {Blockly.Block=} opt_block Optional root block.
 * @return {!Array.<string>} Array of variable names.
 */
Blockly.VariablesBoolean.allVariables = function(opt_block) {
  var blocks;
  if (opt_block) {
    blocks = opt_block.getDescendants();
  } else {
    blocks = Blockly.mainWorkspace.getAllBlocks();
  }
  var variableHash = Object.create(null);
  // Iterate through every block and add each variable to the hash.
  for (var x = 0; x < blocks.length; x++) {
    var func = blocks[x].getVars;
    if (func) {
      var blockVariablesBoolean = func.call(blocks[x]);
      for (var y = 0; y < blockVariablesBoolean.length; y++) {
        var varName = blockVariablesBoolean[y];
        // Variable name may be null if the block is only half-built.
        if (varName) {
          variableHash[varName.toLowerCase()] = varName;
        }
      }
    }
  }
  // Flatten the hash into a list.
  var variableList = [];
  for (var name in variableHash) {
    variableList.push(variableHash[name]);
  }
  return variableList;
};

/**
 * Find all user-created VariablesBoolean.
 * @param {Blockly.Block=} opt_block Optional root block.
 * @return {!Array.<string>} Array of variable names.
 */
Blockly.VariablesBoolean.allVariablesBoolean = function(opt_block) {

	Blockly.VariablesBoolean.clearList();
  // Flatten the hash into a list.
  var variableList = [];

    for (var x = 0; x < boolean_variables.length; x++) {
		variableList.push(boolean_variables[x]);
    }

  return variableList;
};

/**
* return one user created boolean variable
* @return {string} name of first declared integer
*/
Blockly.VariablesBoolean.randomVariablesBoolean = function() {
  var variables = Blockly.VariablesBoolean.allVariablesBoolean();
  var number = Math.floor((Math.random() * variables.length) + 0);
  return variables[number];

};

/**
 * Find all instances of the specified variable and rename them.
 * @param {string} oldName Variable to rename.
 * @param {string} newName New variable name.
 */
Blockly.VariablesBoolean.renameVariable = function(oldName, newName) {

  if(string_variables.indexOf(newName)>=0 || boolean_variables.indexOf(newName)>=0 || int_variables.indexOf(newName)>=0){
	  window.alert("You cannot use the same name for two different variables! Try another one.");
  }else if(newName == "DefaultInt" || newName == "DefaultString"){
	  window.alert("This name is reserverd. Use another one");
  } else {
	  var blocks = Blockly.mainWorkspace.getAllBlocks();
	  // Iterate through every block.
	  for (var x = 0; x < blocks.length; x++) {
		var func = blocks[x].renameVar;
		if (func) {
		  func.call(blocks[x], oldName, newName);
		}
	  }
	  //boolean_variables.indexOf(oldName) = newName;
	  if(boolean_variables.indexOf(oldName) >= 0){
	   boolean_variables[boolean_variables.indexOf(oldName)] = newName;
	  }else{
			if(boolean_variables.indexOf(newName) < 0){
			  boolean_variables[boolean_variables.length] = newName;
			}
	   }
  }
};

Blockly.VariablesBoolean.clearList = function() {
   var lista_completa = Blockly.VariablesBoolean.allVariables();

    for (var x = 0; x < boolean_variables.length; x++) {
		if(lista_completa.indexOf(boolean_variables[x]) < 0){
			boolean_variables.splice(x,1);
		}
	}
}

Blockly.VariablesBoolean.declareIfNot = function(name) {
	if(boolean_variables.indexOf(name) < 0){
		  boolean_variables[boolean_variables.length] = name;
		}
}

/**
 * Construct the blocks required by the flyout for the variable category.
 * @param {!Array.<!Blockly.Block>} blocks List of blocks to show.
 * @param {!Array.<number>} gaps List of widths between blocks.
 * @param {number} margin Standard margin width for calculating gaps.
 * @param {!Blockly.Workspace} workspace The flyout's workspace.
 */
Blockly.VariablesBoolean.flyoutCategory = function(blocks, gaps, margin, workspace) {
  var variableList = Blockly.VariablesBoolean.allVariablesBoolean();
  variableList.sort(goog.string.caseInsensitiveCompare);
  // In addition to the user's VariablesBoolean, we also want to display the default
  // variable name at the top.  We also don't want this duplicated if the
  // user has created a variable of the same name.
  variableList.unshift(null);
  var defaultVariable = undefined;
  for (var i = 0; i < variableList.length; i++) {
    if (variableList[i] === defaultVariable) {
      continue;
    }
    var getBlock = Blockly.Blocks['VariablesBoolean_get'] ?
        Blockly.Block.obtain(workspace, 'VariablesBoolean_get') : null;
    getBlock && getBlock.initSvg();
    var setBlock = Blockly.Blocks['VariablesBoolean_set'] ?
        Blockly.Block.obtain(workspace, 'VariablesBoolean_set') : null;
    setBlock && setBlock.initSvg();
    if (variableList[i] === null) {
      defaultVariable = (getBlock || setBlock).getVars()[0];
    } else {
      getBlock && getBlock.setFieldValue(variableList[i], 'VAR');
      setBlock && setBlock.setFieldValue(variableList[i], 'VAR');
    }
    setBlock && blocks.push(setBlock);
    getBlock && blocks.push(getBlock);
    if (getBlock && setBlock) {
      gaps.push(margin, margin * 3);
    } else {
      gaps.push(margin * 2);
    }
  }
};

/**
* Return a new variable name that is not yet being used. This will try to
* generate single letter variable names in the range 'i' to 'z' to start with.
* If no unique name is located it will try 'i1' to 'z1', then 'i2' to 'z2' etc.
* @return {string} New variable name.
*/
Blockly.VariablesBoolean.generateUniqueName = function() {
  var variableList = Blockly.Variables.allVariables();
  var newName = '';
  if (variableList.length) {
    variableList.sort(goog.string.caseInsensitiveCompare);
    var nameSuffix = 0, potName = 'i', i = 0, inUse = false;
    while (!newName) {
      i = 0;
      inUse = false;
      while (i < variableList.length && !inUse) {
        if (variableList[i].toLowerCase() == potName) {
          // This potential name is already used.
          inUse = true;
        }
        i++;
      }
      if (inUse) {
        // Try the next potential name.
        if (potName[0] === 'z') {
          // Reached the end of the character sequence so back to 'a' but with
          // a new suffix.
          nameSuffix++;
          potName = 'a';
        } else {
          potName = String.fromCharCode(potName.charCodeAt(0) + 1);
          if (potName[0] == 'l') {
            // Avoid using variable 'l' because of ambiguity with '1'.
            potName = String.fromCharCode(potName.charCodeAt(0) + 1);
          }
        }
        if (nameSuffix > 0) {
          potName += nameSuffix;
        }
      } else {
        // We can use the current potential name.
        newName = potName;
      }
    }
  } else {
    newName = 'i';
  }

  /*boolean_variables[boolean_variables.length] = newName;
  if(boolean_variables.indexOf(newName) < 0) {
		boolean_variables[boolean_variables.length] = newName;
	}*/
  return newName;
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace TapTrack.Demo
{
    /// <summary>
    /// Interaction logic for BatchPasswordEntryForm.xaml
    /// </summary>
    public partial class BatchPasswordEntryForm : Window
    {
        public BatchPasswordEntryForm()
        {
            InitializeComponent();
        }

        public string enteredPassword = null;

        private void setBatchPassword_Click(object sender, RoutedEventArgs e)
        {
            if(batchTagPasswordEntry.Password == batchTagPasswordConfirmation.Password)
            {
                this.enteredPassword = batchTagPasswordEntry.Password;
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                batchTagPasswordEntry.Clear();
                batchTagPasswordConfirmation.Clear();
            }

        }
    }
}


text:
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.dumpChildFrames();
}
</script>
<iframe src="resources/text.txt"></iframe>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>JPA Security - Project Information</title>

    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
    <meta name="Date-Revision-yyyymmdd" content="20190731" />
    <meta http-equiv="Content-Language" content="en" />

        Last Published: 2019-07-31

                 Version: 1.0.0-SNAPSHOT

JPA Security

                          Introduction

                          Download

                          Documentation

                          Reference Manual

                          Simple Tutorial

                          Petclinic Tutorial

                          E-Learning Sample

Project Documentation

            Project Information

                          Continuous Integration

                          Dependencies

                          Issue Tracking

                          Mailing Lists

                          Plugin Management

                          Project License

                          Project Plugins

                          Project Summary

                          Project Team

                          Source Repository

                          Project Reports

Project Information

This document provides an overview of the various documents and links that are part of this project's general information. All of this content is automatically generated by Maven on behalf of the project.

Overview

Document
Description

Continuous Integration
This is a link to the definitions of all continuous integration processes that builds and tests code on a frequent, regular basis.

Dependencies
This document lists the project's dependencies and provides information on each dependency.

Issue Tracking
This is a link to the issue management system for this project. Issues (bugs, features, change requests) can be created and queried using this link.

Mailing Lists
This document provides subscription and archive information for this project's mailing lists.

Plugin Management
This document lists the plugins that are defined through pluginManagement.

Project License
This is a link to the definitions of project licenses.

Project Plugins
This document lists the build plugins and the report plugins used by this project.

Project Summary
This document lists other related information of this project

Project Team
This document provides information on the members of this project. These are the individuals who have contributed to the project in one form or another.

Source Repository
This is a link to the online source repository that can be viewed via a web browser.

              Copyright ©                   2019.
          All Rights Reserved.


text:
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PdfNetCore.Models;
using PdfNetCore.Services;

namespace PdfNetCore.Controllers
{
    [ApiController]
    [Route("pdf")]
    public class PdfController : ControllerBase
    {

        public IPdfGeneratorService PdfGenerationService { get; }
        public IHtmlGenerationService HtmlGenerationService { get; }

        public PdfController(IPdfGeneratorService pdfGenerationService, IHtmlGenerationService htmlGenerationService)
        {
            PdfGenerationService = pdfGenerationService;
            HtmlGenerationService = htmlGenerationService;
        }

        [HttpGet]
        [Route("{id}")]
        public async Task<IActionResult> Get(string id, [FromQuery]bool? html)
        {
            var model = GetDtoFromStorage(id);

            if (html.GetValueOrDefault())
            {
                var htmlResult = await HtmlGenerationService.Generate(model);
                return new ContentResult() {
                    Content = htmlResult,
                    ContentType = "text/html",
                    StatusCode = 200 };
            }

            var result = await PdfGenerationService.Generate(model);
            return File(result, "application/pdf", $"Quote - {model.Number}.pdf");
        }

        private static Quote GetDtoFromStorage(string id)
        {
            return new Quote()
            {
                Number = id,
                CreatedDate = DateTime.Now,
                 Customer = new Customer()
                 {
                     CustomerName = "Rahul Nath",
                     Address = "100 Unknown Street, Suburb, 1010",
                     Email = "rahul@test.com",
                     Mobile = "099887766"
                 },
                 Discount = 20,
                 SubTotal = 1555,
                 TotalPrice = 1535,
                 Notes = "My Notes",
                 Items = new System.Collections.Generic.List<QuoteItem>()
                 {
                     new QuoteItem()
                     {
                         Description = "IPhone 11",
                         Quantity = 1,
                         TotalPrice = 1500,
                         UnitPrice = 1500
                     },
                     new QuoteItem()
                     {
                         Description = "IPhone 11 Screen Protector",
                         Quantity = 1,
                         TotalPrice = 35,
                         UnitPrice = 35
                     },
                     new QuoteItem()
                     {
                         Description = "Discount",
                         Quantity = 1,
                         TotalPrice = 20,
                         UnitPrice = 20
                     }
                 }
            };
        }
    }
}