text:
<!doctype html>

<meta charset="utf-8"/>
<title>GAME</title>
<link rel="shortcut icon" href="./flavicon.ico" >

<link rel="stylesheet" href="./bootstrap.min.css" >

Czekaj na gracza...

                Do końca:

                 Loading...

               20 s

Gracze:

            Punkty:

           Punkty:

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;

namespace AllReady.Migrations
{
    public partial class ChangeItineraryRequestRelationship : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_ItineraryRequest_RequestId",
                table: "ItineraryRequest");

            migrationBuilder.AddColumn<int>(
                name: "ItineraryId",
                table: "Request",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_ItineraryRequest_RequestId",
                table: "ItineraryRequest",
                column: "RequestId",
                unique: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_ItineraryRequest_RequestId",
                table: "ItineraryRequest");

            migrationBuilder.DropColumn(
                name: "ItineraryId",
                table: "Request");

            migrationBuilder.CreateIndex(
                name: "IX_ItineraryRequest_RequestId",
                table: "ItineraryRequest",
                column: "RequestId");
        }
    }
}


text:
import React from 'react';
import {Link} from 'react-router';

class HomePage extends React.Component {
  render() {
    return (

Hello

          <Link to="about" className="btn btn-primary btn-lg">Learn more</Link>

    );
  }
}

export default HomePage;


text:
/**
 * Expose `stop`
 */

module.exports = stop;

/**
 * Call `preventDefault` and `stopPropagation` on `e`
 *
 * @param {Event} e
 * @return {Event}
 * @public
 */

function stop(e) {
  e.preventDefault();
  e.stopPropagation();
  return e;
}


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <stdint.h>

#include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
#include <limits>
#include <string>
#include <utility>
#include <vector>

#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/md5.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/printing/common/print_messages.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "content/public/test/browser_test_utils.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/filename_util.h"
#include "pdf/pdf.h"
#include "printing/pdf_render_settings.h"
#include "printing/units.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"

#if defined(OS_WIN)
#include <fcntl.h>
#include <io.h>
#endif

using content::WebContents;
using content::WebContentsObserver;

namespace printing {

// Number of color channels in a BGRA bitmap.
const int kColorChannels = 4;
const int kDpi = 300;

// Every state is used when the document is a non-PDF source. When the source is
// a PDF, kWaitingToSendSaveAsPDF, kWaitingToSendPageNumbers, and
// kWaitingForFinalMessage are the only states used.
enum State {
  // Waiting for the first message so the program can select Save as PDF
  kWaitingToSendSaveAsPdf = 0,
  // Waiting for the second message so the test can set the layout
  kWaitingToSendLayoutSettings = 1,
  // Waiting for the third message so the test can set the page numbers
  kWaitingToSendPageNumbers = 2,
  // Waiting for the forth message so the test can set the headers checkbox
  kWaitingToSendHeadersAndFooters = 3,
  // Waiting for the fifth message so the test can set the background checkbox
  kWaitingToSendBackgroundColorsAndImages = 4,
  // Waiting for the sixth message so the test can set the margins combobox
  kWaitingToSendMargins = 5,
  // Waiting for the final message so the program can save to PDF.
  kWaitingForFinalMessage = 6,
};

// Settings for print preview. It reflects the current options provided by
// print preview. If more options are added, more states should be added and
// there should be more settings added to this struct.
struct PrintPreviewSettings {
  PrintPreviewSettings(bool is_portrait,
                       const std::string& page_numbers,
                       bool headers_and_footers,
                       bool background_colors_and_images,
                       MarginType margins,
                       bool source_is_pdf)
      : is_portrait(is_portrait),
        page_numbers(page_numbers),
        headers_and_footers(headers_and_footers),
        background_colors_and_images(background_colors_and_images),
        margins(margins),
        source_is_pdf(source_is_pdf) {}

  bool is_portrait;
  std::string page_numbers;
  bool headers_and_footers;
  bool background_colors_and_images;
  MarginType margins;
  bool source_is_pdf;
};

// Observes the print preview webpage. Once it observes the PreviewPageCount
// message, will send a sequence of commands to the print preview dialog and
// change the settings of the preview dialog.
class PrintPreviewObserver : public WebContentsObserver {
 public:
  PrintPreviewObserver(Browser* browser,
                       WebContents* dialog,
                       const base::FilePath& pdf_file_save_path)
      : WebContentsObserver(dialog),
        browser_(browser),
        state_(kWaitingToSendSaveAsPdf),
        failed_setting_("None"),
        pdf_file_save_path_(pdf_file_save_path) {}

  ~PrintPreviewObserver() override {}

  // Sets closure for the observer so that it can end the loop.
  void set_quit_closure(const base::Closure &closure) {
    quit_closure_ = closure;
  }

  // Actually stops the message loop so that the test can proceed.
  void EndLoop() {
    base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
  }

  bool OnMessageReceived(const IPC::Message& message) override {
    IPC_BEGIN_MESSAGE_MAP(PrintPreviewObserver, message)
      IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount,
                          OnDidGetPreviewPageCount)
    IPC_END_MESSAGE_MAP();
    return false;
  }

  // Gets the web contents for the print preview dialog so that the UI and
  // other elements can be accessed.
  WebContents* GetDialog() {
    WebContents* tab = browser_->tab_strip_model()->GetActiveWebContents();
    PrintPreviewDialogController* dialog_controller =
        PrintPreviewDialogController::GetInstance();
    return dialog_controller->GetPrintPreviewForContents(tab);
  }

  // Gets the PrintPreviewUI so that certain elements can be accessed.
  PrintPreviewUI* GetUI() {
    return static_cast<PrintPreviewUI*>(
        GetDialog()->GetWebUI()->GetController());
  }

  // Calls native_layer.onManipulateSettingsForTest() and sends a dictionary
  // value containing the type of setting and the value to set that settings
  // to.
  void ManipulatePreviewSettings() {
    base::DictionaryValue script_argument;

    if (state_ == kWaitingToSendSaveAsPdf) {
      script_argument.SetBoolean("selectSaveAsPdfDestination", true);
      state_ = settings_->source_is_pdf ?
               kWaitingToSendPageNumbers : kWaitingToSendLayoutSettings;
      failed_setting_ = "Save as PDF";
    } else if (state_ == kWaitingToSendLayoutSettings) {
      script_argument.SetBoolean("layoutSettings.portrait",
                                 settings_->is_portrait);
      state_ = kWaitingToSendPageNumbers;
      failed_setting_ = "Layout Settings";
    } else if (state_ == kWaitingToSendPageNumbers) {
      script_argument.SetString("pageRange", settings_->page_numbers);
      state_ = settings_->source_is_pdf ?
               kWaitingForFinalMessage : kWaitingToSendHeadersAndFooters;
      failed_setting_ = "Page Range";
    } else if (state_ == kWaitingToSendHeadersAndFooters) {
      script_argument.SetBoolean("headersAndFooters",
                                 settings_->headers_and_footers);
      state_ = kWaitingToSendBackgroundColorsAndImages;
      failed_setting_ = "Headers and Footers";
    } else if (state_ == kWaitingToSendBackgroundColorsAndImages) {
      script_argument.SetBoolean("backgroundColorsAndImages",
                                 settings_->background_colors_and_images);
      state_ = kWaitingToSendMargins;
      failed_setting_ = "Background Colors and Images";
    } else if (state_ == kWaitingToSendMargins) {
      script_argument.SetInteger("margins", settings_->margins);
      state_ = kWaitingForFinalMessage;
      failed_setting_ = "Margins";
    } else if (state_ == kWaitingForFinalMessage) {
      // Called by |GetUI()->handler_|, it is a callback function that call
      // |EndLoop| when an attempt to save the PDF has been made.
      base::Closure end_loop_closure =
          base::Bind(&PrintPreviewObserver::EndLoop, base::Unretained(this));
      GetUI()->SetPdfSavedClosureForTesting(end_loop_closure);
      ASSERT_FALSE(pdf_file_save_path_.empty());
      GetUI()->SetSelectedFileForTesting(pdf_file_save_path_);
      return;
    }

    ASSERT_FALSE(script_argument.empty());
    GetUI()->web_ui()->CallJavascriptFunction(
        "onManipulateSettingsForTest", script_argument);
  }

  // Saves the print preview settings to be sent to the print preview dialog.
  void SetPrintPreviewSettings(const PrintPreviewSettings& settings) {
    settings_.reset(new PrintPreviewSettings(settings));
  }

  // Returns the setting that could not be set in the preview dialog.
  const std::string& GetFailedSetting() const {
    return failed_setting_;
  }

 private:
  // Listens for messages from the print preview dialog. Specifically, it
  // listens for 'UILoadedForTest' and 'UIFailedLoadingForTest.'
  class UIDoneLoadingMessageHandler : public content::WebUIMessageHandler {
   public:
    explicit UIDoneLoadingMessageHandler(PrintPreviewObserver* observer)
        : observer_(observer) {}

    ~UIDoneLoadingMessageHandler() override {}

    // When a setting has been set succesfully, this is called and the observer
    // is told to send the next setting to be set.
    void HandleDone(const base::ListValue* /* args */) {
      observer_->ManipulatePreviewSettings();
    }

    // Ends the test because a setting was not set successfully. Called when
    // this class hears 'UIFailedLoadingForTest.'
    void HandleFailure(const base::ListValue* /* args */) {
      FAIL() << "Failed to set: " << observer_->GetFailedSetting();
    }

    // Allows this class to listen for the 'UILoadedForTest' and
    // 'UIFailedLoadingForTest' messages. These messages are sent by the print
    // preview dialog. 'UILoadedForTest' is sent when a setting has been
    // successfully set and its effects have been finalized.
    // 'UIFailedLoadingForTest' is sent when the setting could not be set. This
    // causes the browser test to fail.
    void RegisterMessages() override {
      web_ui()->RegisterMessageCallback(
          "UILoadedForTest",
          base::Bind(&UIDoneLoadingMessageHandler::HandleDone,
                     base::Unretained(this)));

      web_ui()->RegisterMessageCallback(
          "UIFailedLoadingForTest",
          base::Bind(&UIDoneLoadingMessageHandler::HandleFailure,
                     base::Unretained(this)));
    }

   private:
    PrintPreviewObserver* const observer_;

    DISALLOW_COPY_AND_ASSIGN(UIDoneLoadingMessageHandler);
  };

  // Called when the observer gets the IPC message stating that the page count
  // is ready.
  void OnDidGetPreviewPageCount(
        const PrintHostMsg_DidGetPreviewPageCount_Params &params) {
    WebContents* web_contents = GetDialog();
    ASSERT_TRUE(web_contents);
    Observe(web_contents);

    PrintPreviewUI* ui = GetUI();
    ASSERT_TRUE(ui);
    ASSERT_TRUE(ui->web_ui());

    // The |ui->web_ui()| owns the message handler.
    ui->web_ui()->AddMessageHandler(new UIDoneLoadingMessageHandler(this));
    ui->web_ui()->CallJavascriptFunction("onEnableManipulateSettingsForTest");
  }

  void DidCloneToNewWebContents(WebContents* old_web_contents,
                                WebContents* new_web_contents) override {
    Observe(new_web_contents);
  }

  Browser* browser_;
  base::Closure quit_closure_;
  scoped_ptr<PrintPreviewSettings> settings_;

  // State of the observer. The state indicates what message to send
  // next. The state advances whenever the message handler calls
  // ManipulatePreviewSettings() on the observer.
  State state_;
  std::string failed_setting_;
  const base::FilePath pdf_file_save_path_;

  DISALLOW_COPY_AND_ASSIGN(PrintPreviewObserver);
};

class PrintPreviewPdfGeneratedBrowserTest : public InProcessBrowserTest {
 public:
  PrintPreviewPdfGeneratedBrowserTest() {}
  ~PrintPreviewPdfGeneratedBrowserTest() override {}

  // Navigates to the given web page, then initiates print preview and waits
  // for all the settings to be set, then save the preview to PDF.
  void NavigateAndPrint(const base::FilePath::StringType& file_name,
                          const PrintPreviewSettings& settings) {
    print_preview_observer_->SetPrintPreviewSettings(settings);
    base::FilePath path(file_name);
    GURL gurl = net::FilePathToFileURL(base::MakeAbsoluteFilePath(path));

    ui_test_utils::NavigateToURL(browser(), gurl);

    base::RunLoop loop;
    print_preview_observer_->set_quit_closure(loop.QuitClosure());
    chrome::Print(browser());
    loop.Run();

    // Need to check whether the save was successful. Ending the loop only
    // means the save was attempted.
    base::File pdf_file(
        pdf_file_save_path_, base::File::FLAG_OPEN | base::File::FLAG_READ);
    ASSERT_TRUE(pdf_file.IsValid());
  }

  // Converts the PDF to a PNG file so that the layout test can do an image
  // diff on this image and a reference image.
  void PdfToPng() {
    int num_pages;
    double max_width_in_points = 0;
    std::vector<uint8_t> bitmap_data;
    double total_height_in_pixels = 0;
    std::string pdf_data;

    ASSERT_TRUE(base::ReadFileToString(pdf_file_save_path_, &pdf_data));
    ASSERT_TRUE(chrome_pdf::GetPDFDocInfo(pdf_data.data(),
                                          pdf_data.size(),
                                          &num_pages,
                                          &max_width_in_points));

    ASSERT_GT(num_pages, 0);
    double max_width_in_pixels =
        ConvertUnitDouble(max_width_in_points, kPointsPerInch, kDpi);

    for (int i = 0; i < num_pages; ++i) {
      double width_in_points, height_in_points;
      ASSERT_TRUE(chrome_pdf::GetPDFPageSizeByIndex(pdf_data.data(),
                                                    pdf_data.size(),
                                                    i,
                                                    &width_in_points,
                                                    &height_in_points));

      double width_in_pixels = ConvertUnitDouble(
          width_in_points, kPointsPerInch, kDpi);
      double height_in_pixels = ConvertUnitDouble(
          height_in_points, kPointsPerInch, kDpi);

      // The image will be rotated if |width_in_pixels| is greater than
      // |height_in_pixels|. This is because the page will be rotated to fit
      // within a piece of paper. Therefore, |width_in_pixels| and
      // |height_in_pixels| have to be swapped or else they won't reflect the
      // dimensions of the rotated page.
      if (width_in_pixels > height_in_pixels)
        std::swap(width_in_pixels, height_in_pixels);

      total_height_in_pixels += height_in_pixels;
      gfx::Rect rect(width_in_pixels, height_in_pixels);
      PdfRenderSettings settings(rect, kDpi, true);

      int int_max = std::numeric_limits<int>::max();
      if (settings.area().width() > int_max / kColorChannels ||
          settings.area().height() > int_max / (kColorChannels *
              settings.area().width())) {
        FAIL() << "The dimensions of the image are too large."
               << "Decrease the DPI or the dimensions of the image.";
      }

      std::vector<uint8_t> page_bitmap_data(
          kColorChannels * settings.area().size().GetArea());

      ASSERT_TRUE(chrome_pdf::RenderPDFPageToBitmap(
          pdf_data.data(),
          pdf_data.size(),
          i,
          page_bitmap_data.data(),
          settings.area().size().width(),
          settings.area().size().height(),
          settings.dpi(),
          true));
      FillPng(&page_bitmap_data,
              width_in_pixels,
              max_width_in_pixels,
              settings.area().size().height());
      bitmap_data.insert(bitmap_data.end(),
                         page_bitmap_data.begin(),
                         page_bitmap_data.end());
    }

    CreatePng(bitmap_data, max_width_in_pixels, total_height_in_pixels);
  }

  // Fills out a bitmap with whitespace so that the image will correctly fit
  // within a PNG that is wider than the bitmap itself.
  void FillPng(std::vector<uint8_t>* bitmap,
               int current_width,
               int desired_width,
               int height) {
    ASSERT_TRUE(bitmap);
    ASSERT_GT(height, 0);
    ASSERT_LE(current_width, desired_width);

    if (current_width == desired_width)
      return;

    int current_width_in_bytes = current_width * kColorChannels;
    int desired_width_in_bytes = desired_width * kColorChannels;

    // The color format is BGRA, so to set the color to white, every pixel is
    // set to 0xFFFFFFFF.
    const uint8_t kColorByte = 255;
    std::vector<uint8_t> filled_bitmap(
        desired_width * kColorChannels * height, kColorByte);
    std::vector<uint8_t>::iterator filled_bitmap_it = filled_bitmap.begin();
    std::vector<uint8_t>::iterator bitmap_it = bitmap->begin();

    for (int i = 0; i < height; ++i) {
      std::copy(
          bitmap_it, bitmap_it + current_width_in_bytes, filled_bitmap_it);
      std::advance(bitmap_it, current_width_in_bytes);
      std::advance(filled_bitmap_it, desired_width_in_bytes);
    }

    bitmap->assign(filled_bitmap.begin(), filled_bitmap.end());
  }

  // Sends the PNG image to the layout test framework for comparison.
  void SendPng() {
    // Send image header and |hash_| to the layout test framework.
    std::cout << "Content-Type: image/png\n";
    std::cout << "ActualHash: " << base::MD5DigestToBase16(hash_) << "\n";
    std::cout << "Content-Length: " << png_output_.size() << "\n";

    std::copy(png_output_.begin(),
              png_output_.end(),
              std::ostream_iterator<unsigned char>(std::cout, ""));

    std::cout << "#EOF\n";
    std::cout.flush();
    std::cerr << "#EOF\n";
    std::cerr.flush();
  }

  // Duplicates the tab that was created when the browser opened. This is done
  // so that the observer can listen to the duplicated tab as soon as possible
  // and start listening for messages related to print preview.
  void DuplicateTab() {
    WebContents* tab =
        browser()->tab_strip_model()->GetActiveWebContents();
    ASSERT_TRUE(tab);

    print_preview_observer_.reset(
        new PrintPreviewObserver(browser(), tab, pdf_file_save_path_));
    chrome::DuplicateTab(browser());

    WebContents* initiator =
        browser()->tab_strip_model()->GetActiveWebContents();
    ASSERT_TRUE(initiator);
    ASSERT_NE(tab, initiator);
  }

  // Resets the test so that another web page can be printed. It also deletes
  // the duplicated tab as it isn't needed anymore.
  void Reset() {
    png_output_.clear();
    ASSERT_EQ(2, browser()->tab_strip_model()->count());
    chrome::CloseTab(browser());
    ASSERT_EQ(1, browser()->tab_strip_model()->count());
  }

  // Creates a temporary directory to store a text file that will be used for
  // stdin to accept input from the layout test framework. A path for the PDF
  // file is also created. The directory and files within it are automatically
  // cleaned up once the test ends.
  void SetupStdinAndSavePath() {
    // Sets the filemode to binary because it will force |std::cout| to send LF
    // rather than CRLF. Sending CRLF will cause an error message for the
    // layout tests.
#if defined(OS_WIN)
    _setmode(_fileno(stdout), _O_BINARY);
    _setmode(_fileno(stderr), _O_BINARY);
#endif
    // Sends a message to the layout test framework indicating indicating
    // that the browser test has completed setting itself up. The layout
    // test will then expect the file path for stdin.
    base::FilePath stdin_path;
    std::cout << "#READY\n";
    std::cout.flush();

    ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
    ASSERT_TRUE(base::CreateTemporaryFileInDir(tmp_dir_.path(), &stdin_path));

    // Redirects |std::cin| to the file |stdin_path|. |in| is not freed because
    // if it goes out of scope, |std::cin.rdbuf| will be freed, causing an
    // error.
    std::ifstream* in = new std::ifstream(stdin_path.value().c_str());
    ASSERT_TRUE(in->is_open());
    std::cin.rdbuf(in->rdbuf());

    pdf_file_save_path_ =
        tmp_dir_.path().Append(FILE_PATH_LITERAL("dummy.pdf"));

    // Send the file path to the layout test framework so that it can
    // communicate with this browser test.
    std::cout << "StdinPath: " << stdin_path.value() << "\n";
    std::cout << "#EOF\n";
    std::cout.flush();
  }

 private:
  // Generates a png from bitmap data and stores it in |png_output_|.
  void CreatePng(const std::vector<uint8_t>& bitmap_data,
                 int width,
                 int height) {
    base::MD5Sum(static_cast<const void*>(bitmap_data.data()),
                 bitmap_data.size(),
                 &hash_);
    gfx::Rect png_rect(width, height);

    // tEXtchecksum looks funny, but that's what the layout test framework
    // expects.
    std::string comment_title("tEXtchecksum\x00");
    gfx::PNGCodec::Comment hash_comment(comment_title,
                                        base::MD5DigestToBase16(hash_));
    std::vector<gfx::PNGCodec::Comment> comments;
    comments.push_back(hash_comment);
    ASSERT_TRUE(gfx::PNGCodec::Encode(bitmap_data.data(),
                                      gfx::PNGCodec::FORMAT_BGRA,
                                      png_rect.size(),
                                      png_rect.size().width() * kColorChannels,
                                      false,
                                      comments,
                                      &png_output_));
  }

  scoped_ptr<PrintPreviewObserver> print_preview_observer_;
  base::FilePath pdf_file_save_path_;

  // Vector for storing the PNG to be sent to the layout test framework.
  // TODO(ivandavid): Eventually change this to uint32_t and make everything
  // work with that. It might be a bit tricky to fix everything to work with
  // uint32_t, but not too tricky.
  std::vector<unsigned char> png_output_;

  // Image hash of the bitmap that is turned into a PNG. The hash is put into
  // the PNG as a comment, as it is needed by the layout test framework.
  base::MD5Digest hash_;

  // Temporary directory for storing the pdf and the file for stdin. It is
  // deleted by the layout tests.
  // TODO(ivandavid): Keep it as a ScopedTempDir and change the layout test
  // framework so that it tells the browser test how many test files there are.
  base::ScopedTempDir tmp_dir_;

  DISALLOW_COPY_AND_ASSIGN(PrintPreviewPdfGeneratedBrowserTest);
};

// This test acts as a driver for the layout test framework.
IN_PROC_BROWSER_TEST_F(PrintPreviewPdfGeneratedBrowserTest,
                       MANUAL_LayoutTestDriver) {
  // What this code is supposed to do:
  // - Setup communication with the layout test framework
  // - Print webpage to a pdf
  // - Convert pdf to a png
  // - Send png to layout test framework, where it doesn an image diff
  //   on the image sent by this test and a reference image.
  //
  // Throughout this code, there will be |std::cout| statements. The layout test
  // framework uses stdout to get data from the browser test and uses stdin
  // to send data to the browser test. Writing "EOF\n" to |std::cout| indicates
  // that whatever block of data that the test was expecting has been completely
  // sent. Sometimes EOF is printed to stderr because the test will expect it
  // from stderr in addition to stdout for certain blocks of data.=
  SetupStdinAndSavePath();

  while (true) {
    std::string input;
    while (input.empty()) {
      std::getline(std::cin, input);
      if (std::cin.eof())
        std::cin.clear();
    }

    // If the layout test framework sends "QUIT" to this test, that means there
    // are no more tests for this instance to run and it should quit.
    if (input == "QUIT")
      break;

    base::FilePath::StringType file_extension = FILE_PATH_LITERAL(".pdf");
    base::FilePath::StringType cmd;
#if defined(OS_POSIX)
    cmd = input;
#elif defined(OS_WIN)
    cmd = base::UTF8ToWide(input);
#endif

    DuplicateTab();
    PrintPreviewSettings settings(
        true,
        "",
        false,
        false,
        DEFAULT_MARGINS,
        cmd.find(file_extension) != base::FilePath::StringType::npos);

    // Splits the command sent by the layout test framework. The first command
    // is always the file path to use for the test. The rest isn't relevant,
    // so it can be ignored. The separator for the commands is an apostrophe.
    std::vector<base::FilePath::StringType> cmd_arguments = base::SplitString(
        cmd, base::FilePath::StringType(1, '\''),
        base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);

    ASSERT_GE(cmd_arguments.size(), 1U);
    base::FilePath::StringType test_name(cmd_arguments[0]);
    NavigateAndPrint(test_name, settings);
    PdfToPng();

    // Message to the layout test framework indicating that it should start
    // waiting for the image data, as there is no more text data to be read.
    // There actually isn't any text data at all, however because the layout
    // test framework requires it, a message has to be sent to stop it from
    // waiting for this message and start waiting for the image data.
    std::cout << "#EOF\n";
    std::cout.flush();

    SendPng();
    Reset();
  }
}

}  // namespace printing


text:
package com.google.j2objc.net;

/**
 * HTTPS handler that uses IosHttpURLConnection.
 *
 * @author Tom Ball
 */
public final class IosHttpsHandler extends IosHttpHandler {

  @Override
  protected int getDefaultPort() {
    return 443;
  }
}


text:
package com.amazonaws.services.route53.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * A complex type that contain the response to a GetHostedZone request.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetHostedZoneResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {

    /**
     *

     * A complex type that contains general information about the specified hosted zone.
     *

     */
    private HostedZone hostedZone;
    /**
     *

     * A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     *

     */
    private DelegationSet delegationSet;
    /**
     *

     * A complex type that contains information about the VPCs that are associated with the specified hosted zone.
     *

     */
    private com.amazonaws.internal.SdkInternalList<VPC> vPCs;

    /**
     *

     * A complex type that contains general information about the specified hosted zone.
     *

     *
     * @param hostedZone
     *        A complex type that contains general information about the specified hosted zone.
     */

    public void setHostedZone(HostedZone hostedZone) {
        this.hostedZone = hostedZone;
    }

    /**
     *

     * A complex type that contains general information about the specified hosted zone.
     *

     *
     * @return A complex type that contains general information about the specified hosted zone.
     */

    public HostedZone getHostedZone() {
        return this.hostedZone;
    }

    /**
     *

     * A complex type that contains general information about the specified hosted zone.
     *

     *
     * @param hostedZone
     *        A complex type that contains general information about the specified hosted zone.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHostedZoneResult withHostedZone(HostedZone hostedZone) {
        setHostedZone(hostedZone);
        return this;
    }

    /**
     *

     * A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     *

     *
     * @param delegationSet
     *        A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     */

    public void setDelegationSet(DelegationSet delegationSet) {
        this.delegationSet = delegationSet;
    }

    /**
     *

     * A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     *

     *
     * @return A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     */

    public DelegationSet getDelegationSet() {
        return this.delegationSet;
    }

    /**
     *

     * A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     *

     *
     * @param delegationSet
     *        A complex type that lists the Amazon Route 53 name servers for the specified hosted zone.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHostedZoneResult withDelegationSet(DelegationSet delegationSet) {
        setDelegationSet(delegationSet);
        return this;
    }

    /**
     *

     * A complex type that contains information about the VPCs that are associated with the specified hosted zone.
     *

     *
     * @return A complex type that contains information about the VPCs that are associated with the specified hosted
     *         zone.
     */

    public java.util.List<VPC> getVPCs() {
        if (vPCs == null) {
            vPCs = new com.amazonaws.internal.SdkInternalList<VPC>();
        }
        return vPCs;
    }

    /**
     *

     * A complex type that contains information about the VPCs that are associated with the specified hosted zone.
     *

     *
     * @param vPCs
     *        A complex type that contains information about the VPCs that are associated with the specified hosted
     *        zone.
     */

    public void setVPCs(java.util.Collection<VPC> vPCs) {
        if (vPCs == null) {
            this.vPCs = null;
            return;
        }

        this.vPCs = new com.amazonaws.internal.SdkInternalList<VPC>(vPCs);
    }

    /**
     *

     * A complex type that contains information about the VPCs that are associated with the specified hosted zone.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setVPCs(java.util.Collection)} or {@link #withVPCs(java.util.Collection)} if you want to override the
     * existing values.
     *

     *
     * @param vPCs
     *        A complex type that contains information about the VPCs that are associated with the specified hosted
     *        zone.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHostedZoneResult withVPCs(VPC... vPCs) {
        if (this.vPCs == null) {
            setVPCs(new com.amazonaws.internal.SdkInternalList<VPC>(vPCs.length));
        }
        for (VPC ele : vPCs) {
            this.vPCs.add(ele);
        }
        return this;
    }

    /**
     *

     * A complex type that contains information about the VPCs that are associated with the specified hosted zone.
     *

     *
     * @param vPCs
     *        A complex type that contains information about the VPCs that are associated with the specified hosted
     *        zone.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public GetHostedZoneResult withVPCs(java.util.Collection<VPC> vPCs) {
        setVPCs(vPCs);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getHostedZone() != null)
            sb.append("HostedZone: ").append(getHostedZone()).append(",");
        if (getDelegationSet() != null)
            sb.append("DelegationSet: ").append(getDelegationSet()).append(",");
        if (getVPCs() != null)
            sb.append("VPCs: ").append(getVPCs());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof GetHostedZoneResult == false)
            return false;
        GetHostedZoneResult other = (GetHostedZoneResult) obj;
        if (other.getHostedZone() == null ^ this.getHostedZone() == null)
            return false;
        if (other.getHostedZone() != null && other.getHostedZone().equals(this.getHostedZone()) == false)
            return false;
        if (other.getDelegationSet() == null ^ this.getDelegationSet() == null)
            return false;
        if (other.getDelegationSet() != null && other.getDelegationSet().equals(this.getDelegationSet()) == false)
            return false;
        if (other.getVPCs() == null ^ this.getVPCs() == null)
            return false;
        if (other.getVPCs() != null && other.getVPCs().equals(this.getVPCs()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getHostedZone() == null) ? 0 : getHostedZone().hashCode());
        hashCode = prime * hashCode + ((getDelegationSet() == null) ? 0 : getDelegationSet().hashCode());
        hashCode = prime * hashCode + ((getVPCs() == null) ? 0 : getVPCs().hashCode());
        return hashCode;
    }

    @Override
    public GetHostedZoneResult clone() {
        try {
            return (GetHostedZoneResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
var INFRAME = (self != top);

function DesktopDeviceInterfaceClass() {

    this.storage = {};
    this.deviceId = '';
    this.getDeviceId();
    this.distributeTranslationData();
    this.sayAutoLogin();
    if (INFRAME) {
        this.getAvailableLanguages();
        window.top.SpellCheck.Initialize();
    }
    this.exitOnLogout = false;
}
var ipcRenderer;
if (!INFRAME) {
    ipcRenderer = require('electron').ipcRenderer; // event emmitter for communication with main electron prozess
    // ipcRenderer.removeAllListeners();
    ipcRenderer.on('IFMessage', function(event, _name, _msgObj) {
        DesktopDeviceInterfaceClass.handleIFMessages(_name, _msgObj);
    });
}

DesktopDeviceInterfaceClass.handleIFMessages = function(_name, _msgObj) {
    if (_msgObj) {
        _msgObj = lz_global_base64_url_decode(_msgObj);
        try {
            _msgObj = JSON.parse(_msgObj);
        } catch (e) {
            jsLog("Error parsing:" + _msgObj.toString());
        }
    }
    switch (_name) {
        case "jsLog":
            console.log('got msg from Main: ' + _msgObj.msg);
            break;
        case "availableLanguages":
            IFManager.IFOnAvailableLanguages(_msgObj.availableLanguages);
            break;
        case "CallbackSpellCheckLanguageWasChanged":
            IFManager.IFOnActiveLanguageChanged(_msgObj.language);
            break;
        case "onDeviceID":
            IFManager.DeviceInterface.deviceId = _msgObj.macaddr;
            break;
        case 'onExit':
            IFManager.IFOnExit();
            break;
        case "onNotificationClicked":
            IFManager.IFOnNotificationClicked(_msgObj.title, _msgObj.bodyText, _msgObj.soundName, _msgObj.sender, _msgObj.receivingChat, _msgObj.type, _msgObj.dontShowThisAgain);
            break;
        case "onSetStatus":
            var status;
            switch (_msgObj.state) {
                case 'online':
                    status = 0;
                    break;
                case 'busy':
                    status = 1;
                    break;
                case 'offline':
                    status = 2;
                    break;
                case 'away':
                    status = 3;
                    break;
                case 'chat':
                    status = 4;
                    break;
                case 'email':
                    status = 5;
                    break;
                default:
            }
            IFManager.IFOnSetStatus(status);
            break;
        case 'onUpdateIsAutoStart':
            IFManager.IFOnUpdateIsAutoStart(_msgObj.active);
            break;
        case 'castError':
            throw new Error(_msgObj.msg);
        default:
            if(typeof(_name) != 'undefined'){
                //throw new Error("Command " + _name + " is not available. Your LiveZilla app does not fully support your LiveZilla server installation.");
            }
    }
};

if (INFRAME) {
    window.addEventListener('message', function(event) {
        var name = event.data[0];
        if(event.data.length > 1){
            var msgObj = event.data[1];
            DesktopDeviceInterfaceClass.handleIFMessages(name, msgObj);
        }else{
            DesktopDeviceInterfaceClass.handleIFMessages(name);
        }
    });
}

DesktopDeviceInterfaceClass.prototype.exitApplication = function() {
    this.sendIFMessage('exitApplication');
};

DesktopDeviceInterfaceClass.prototype.distributeTranslationData = function() {
    if (typeof(detectedLanguage) != 'undefined') {
        var msgObj = {
            'detectedLanguage': detectedLanguage,
            'translationData': translationData
        };
        this.sendIFMessage('translationData', msgObj);
    } else {
        setTimeout(function() {
            if (typeof(detectedLanguage) != 'undefined') {
                var msgObj = {
                    'detectedLanguage': detectedLanguage,
                    'translationData': translationData
                };
                this.sendIFMessage('translationData', msgObj);
            }
        }, 500);
    }
};

DesktopDeviceInterfaceClass.prototype.getAvailableLanguages = function() {
    this.sendIFMessage('getAvailableLanguages');
};

DesktopDeviceInterfaceClass.prototype.getDeviceId = function() {
    this.sendIFMessage('getDeviceId');
};

DesktopDeviceInterfaceClass.prototype.jsLog = function(_logString, _mode) {
    var msgObj = {
        "logString": _logString,
        "mode": _mode
    };
    this.sendIFMessage('jsLog', msgObj);
};

DesktopDeviceInterfaceClass.prototype.setExcludedWords = function() {
    if (typeof(window.top.SpellCheck.ExcludedWords) != 'undefined') {
        LocalConfiguration.ExcludedWords = window.top.SpellCheck.ExcludedWords;
    	LocalConfiguration.SaveValue('usr_excluded_words_', LocalConfiguration.ExcludedWords);
        var msgObj = {
            'excludedWords': window.top.SpellCheck.ExcludedWords,
            'noLongerExcludedWords': window.top.SpellCheck.NoLongerExcludedWords
        };
        this.sendIFMessage('setExcludedWords', msgObj);
    }
};

DesktopDeviceInterfaceClass.prototype.setUserLanguages = function() {
    if (typeof(window.top.SpellCheck.UserLanguages) != 'undefined') {
        LocalConfiguration.UserLanguages = window.top.SpellCheck.UserLanguages;
    	LocalConfiguration.SaveValue('usr_languages_', LocalConfiguration.UserLanguages);
        var msgObj = {
            'userLanguages': window.top.SpellCheck.UserLanguages
        };
        this.sendIFMessage('setUserLanguages', msgObj);
    } else {
        setTimeout(function() {
            if (typeof(window.top.SpellCheck.UserLanguages) != 'undefined' && window.top.SpellCheck.UserLanguages.length > 0) {
                var msgObj = {
                    'userLanguages': window.top.SpellCheck.UserLanguages
                };
                this.sendIFMessage('setUserLanguages', msgObj);
            } else {
                //   throw new Error('failed to setUserLanguages');
            }
        }, 300);
    }
};

DesktopDeviceInterfaceClass.prototype.screenshot = function() {
    this.sendIFMessage('screenshot');
};

DesktopDeviceInterfaceClass.prototype.loadDeviceId = function() {
    return this.deviceId;
};

DesktopDeviceInterfaceClass.prototype.openChatView = function(_url, _serverVersion) {
    console.log(_url);
    // msgObj={'url':_url, 'serverVersion':_serverVersion};
    // this.sendIFMessage('openChatView', msgObj);
};

DesktopDeviceInterfaceClass.prototype.openExternalBrowser = function(_url) {
    var msgObj = {
        'url': _url
    };
    this.sendIFMessage('openExternalBrowser', msgObj);
};

DesktopDeviceInterfaceClass.prototype.openLoginView = function() {
    this.sendIFMessage('openLoginView');
};

DesktopDeviceInterfaceClass.prototype.sayAutoLogin = function() {
    autoLoginEntry = window.localStorage.getItem('auto_login');
    var autoLogin = (autoLoginEntry === null) ? false : (window.localStorage.getItem('auto_login').toString() === '1');
    var msgObj = {
        'autoLogin': autoLogin
    };
    this.sendIFMessage('sayAutoLogin', msgObj);
};

DesktopDeviceInterfaceClass.prototype.sendIFMessage = function(_name, _msgObj) {
    if (_msgObj) {
        _msgObj = JSON.stringify(_msgObj);
        _msgObj = lz_global_base64_url_encode(_msgObj);
        if (INFRAME) {
            window.top.postMessage([_name, _msgObj], '*');
        } else {
            ipcRenderer.send('IFMessage', _name, _msgObj);
        }
    } else {
        if (INFRAME) {
            window.top.postMessage([_name], '*');
        } else {
            ipcRenderer.send('IFMessage', _name);
        }
    }
};

DesktopDeviceInterfaceClass.prototype.setAutoStart = function(_active) {
    var msgObj = {
        'active': _active
    };
    this.sendIFMessage('setAutoStart', msgObj);
};

DesktopDeviceInterfaceClass.prototype.setOperatorStatus = function(_status) {
    var statusString;
    switch (_status) {
        case "0":
            statusString = 'online';
            break;
        case "1":
            statusString = 'busy';
            break;
        case "2":
            statusString = 'offline';
            break;
        case "3":
            statusString = 'away';
            break;
        case "4":
            statusString = 'chat';
            break;
        case "5":
            statusString = 'email';
            break;
        default:
    }
    var msgObj = {
        'state': statusString
    };
    this.sendIFMessage('setOperatorStatus', msgObj);
};

DesktopDeviceInterfaceClass.prototype.setSpellCheck = function(_language) {
    var msgObj = {
        'language': _language
    };
    this.sendIFMessage('setSpellCheck', msgObj);
};

DesktopDeviceInterfaceClass.prototype.showNotification = function(_title, _bodyText, _soundName, _sender, _receivingChat, _type) {
    var msgObj = {
        'notificationTitle': _title,
        'bodyText': _bodyText,
        'soundName': _soundName,
        'sender': _sender,
        'receivingChat': _receivingChat,
        'type': _type
    };
    this.sendIFMessage('showNotification', msgObj);
};

DesktopDeviceInterfaceClass.prototype.toggleDevTools = function() {
    this.sendIFMessage('toggleDevTools');
};


text:
$(document).ready(function(){

    // fix the classes
    $( ".tabs-bottom .ui-tabs-nav, .tabs-bottom .ui-tabs-nav > *" )
      .removeClass( "ui-corner-all ui-corner-top" )
      .addClass( "ui-corner-bottom" );
    // move the nav to the bottom
    $( ".tabs-bottom .ui-tabs-nav" ).appendTo( ".tabs-bottom" );
	var ajaxData1 = {};
	var url1 = "http://webproject.roohy.me/ajax/1/92110465/category/list";
	$.ajax({
		url: url1,
		type: 'post',
		dataType: 'json',
		data: ajaxData1,

        beforeSend : function(){
			var div = document.createElement('div');
			div.className = "ui active inverted dimmer";
			div.id = "loading";

			var div2 = document.createElement('div');
			div2.className = "ui text loader";
			div2.textContent = "Loading";

			div.appendChild(div2);

			var body = document.getElementById('body');
			body.appendChild(div);
		},

		success: function(data, status, xhr){
		    if (data.result == 0){
		       // Request error
		    }else {
                var loading = document.getElementById('loading');
				loading.remove();

				for(var i=0;i<data.categoryList.length;i++){
					if(typeof data.categoryList[i].parent === "number"){
						var num = data.categoryList[i].id;
						var li = document.createElement('li');
						var a = document.createElement('a');
						a.className = 'item';
						a.setAttribute('href',"#tabs-" + num);
						a.textContent = data.categoryList[i].name;
						li.appendChild(a);
						document.getElementById('productsNav').appendChild(li);
						var div = document.createElement('div');
						div.id = "tabs-" + num;
						div.style = "padding-left : 100px";
						document.getElementById('navtabs').appendChild(div);

   					}

				}
				$( ".tabs" ).tabs({
				  collapsible: true
				});

                $('#ui-id-5').click();
				for(var i=0;i<data.categoryList.length;i++){
				    if(typeof data.categoryList[i].parent === "number"){
						createItem(data.categoryList[i].id,data,1);
					}
				}
				function createItem(id,data,page){
					var ajaxData = {
						 "category":id,
						  "search": "",
						  "page": page,
						  "pageSize": 10
					}
					var url = "http://webproject.roohy.me/ajax/1/92110465/product/list";
						$.ajax({
							url: url,
							type: 'post',
							dataType: 'json',
							data: ajaxData,
							success: function(data, status, xhr){
								if (data.result == 0){
								   alert('error');
								}else {
									itemsdiv = document.createElement('div');
									itemsdiv.className = "ui items";
									itemsdiv.id = "uiitems";
									itemsdiv.style.paddingleft = "100px";
									div.appendChild(itemsdiv);

								for(var j=0;j<data.productList.length;j++){
									var temp = data.productList[j];
									var divitem = document.createElement('a');
									divitem.className = "item";
									var divimage = document.createElement('div');
									divimage.className = 'image';
									var image =  document.createElement('img');
									image.src = temp.picUrl;
									var aimage = document.createElement('a');
									aimage.className = 'like ui corner label';
									var i = document.createElement('i');
									i.className = 'like icon';
									aimage.appendChild(i);
									divimage.appendChild(image);
									divimage.appendChild(aimage);										//
									var content = document.createElement('div');
									content.className = 'content';
									var divname = document.createElement('div');
									divname.className = 'name';
									divname.textContent= temp.name;
									var divprice = document.createElement('div');
									divprice.className = 'name';
									divprice.textContent= "قیمت : " + temp.price;
									var acontent = document.createElement('a');
									acontent.className = 'ui blue button';
									acontent.textContent = 'اضافه به سبد';
							/**/		acontent.setAttribute("id","pDoc"+j+id);
							/**/		acontent.setAttribute("pid",temp.id);
								//		acontent.setAttribute("onclick","addCartList($(this))");
									content.appendChild(divname);
									content.appendChild(divprice);
									content.appendChild(acontent);
									divitem.appendChild(divimage);
									divitem.appendChild(content);
									itemsdiv.appendChild(divitem);
									var x = "tabs-" + id;
									document.getElementById(x).appendChild(itemsdiv);
								}

								for(var i=0;i<data.productList.length;i++){
                        			$('#pDoc'+i+id+'').click(function(){
                            			addCartList($(this))
                        			})
                    			}
                    			                        		/**/
								createPagination(id,data);
							}
						}
					});

					function addCartList(e){
				        var ajaxData = {
				            "productId": e.attr('pid')
				        };
				        var url1 = "http://webproject.roohy.me/ajax/1/92110465/cart/add";
				        $.ajax({
				            url: url1,
				            type: 'post',
				            dataType: 'json',
				            data: ajaxData,
				            success: function(data, status, xhr){
				                if (data.result == 0){
				                    alert('error add cart');
				                    // Request error
				                }else {
				                    // success
				                    alert('added...');
				                    getCartList();
				                }
				            }
				        })
    				}

					function createPagination(id,data){
						var div = document.createElement('div');
						div.className = "pagination";
						div.id = "p" + id;
						var ul = document.createElement('ul');
						for(var i=0;i<data.pageSize;i++){
							doFunc(i,ul);
						}
						div.appendChild(ul);
						var s = "tabs-" + id;
						document.getElementById(s).appendChild(div);
					}
					function doFunc(i,ul){
						var li = document.createElement('li');
						var a = document.createElement('a');
						a.className = 'pages';
						var x = i+1;
						a.setAttribute('href','#' + x);
						a.textContent = x;
						function func(){
							goPage(x);
						}
						a.addEventListener('click', func,false);
						li.appendChild(a);
						ul.appendChild(li);
					}
					function goPage(x){
						$('#tabs-' + id + '.ui.items').remove();
						$('#p' + id).remove();
						createItem(id,data,x);

					}
				}
		    }
		}
		// ...
	});

    function getCartList(){
        var ajaxData = {
        };
        var url1 = "http://webproject.roohy.me/ajax/1/92110465/cart/list";
        $.ajax({
            url: url1,
            type: 'post',
            dataType: 'json',
            data: ajaxData,

             beforeSend : function(){
			var div = document.createElement('div');
			div.className = "ui active inverted dimmer";
			div.id = "loading";

			var div2 = document.createElement('div');
			div2.className = "ui text loader";
			div2.textContent = "Loading";

			div.appendChild(div2);

			var body = document.getElementById('body');
			body.appendChild(div);
		    },
            success: function(data, status, xhr){
                if (data.result == 0){
                    alert('error fetch cartList');
                    // Request error
                }else {
                     var loading = document.getElementById('loading');
				loading.remove();
                    // success
                    var dd=document.getElementById('buyCart');
                    while(dd.firstChild.nextSibling)
                        dd.removeChild(dd.firstChild);

                    var d0=document.createElement('div');
                    d0.setAttribute("class","ui segment");
                    d0.setAttribute("style","margin-top:3%; padding: 0px;");

                    var d1=document.createElement('p');
                    d1.setAttribute("style","text-align: center; font-size: 120%;");
                    d1.innerHTML='سبد خرید';
                    d0.appendChild(d1);
                    dd.insertBefore(d0,dd.lastChild);

                    for(var i=0; i<data.cart.length;i++){
                        var f1=document.createElement('div');
                        f1.setAttribute("class","comment ui stacked segment");
                        f1.setAttribute("style","margin: 5px 0");
                        var f30=document.createElement('div');
                        f30.setAttribute("style","float:right; width:60%;");
                        f1.appendChild(f30);
                        var f2=document.createElement('a');
                        f2.setAttribute("class","avatar");
                        f2.setAttribute("href","#");
                        f2.setAttribute("style","margin: 0px; width:30px; text-decoration: none; color:#5a5");
                        var f3=document.createElement('img');
                        f3.setAttribute("src",data.cart[i].picUrl);
                        f3.setAttribute("style"," width:50px; float:right; height:60px;");
                        f2.appendChild(f3);
                        f30.appendChild(f2);
                        var f4=document.createElement('div');
                        f4.setAttribute("class","content");
                        var f6=document.createElement('h4');
                        f6.setAttribute("style","margin:0px 5px; float: right;");
                        f6.innerHTML=data.cart[i].name;
                        f2.appendChild(f6);
                        var f7=document.createElement('div');
                        f7.setAttribute("class","metadata");
                        var f8=document.createElement('span');
                        f8.setAttribute("class","date");
                        f8.innerHTML='';
                        f7.appendChild(f8);
                        f4.appendChild(f7);
                        var f9=document.createElement('div');
                        f9.setAttribute("class","text");
                        f9.innerHTML='قیمت: '+data.cart[i].price;
                        f4.appendChild(f9);
                        var f10=document.createElement('div');
                        f10.setAttribute("class","actions");
                        var f11=document.createElement('button');
                        f11.setAttribute("class","ui red button");
                        f11.setAttribute("style","font-size:50%");
                        f11.setAttribute("id",'product'+i);
                        f11.setAttribute("pid",data.cart[i].id);
                        f11.innerHTML='حذف از سبد';
                        f10.appendChild(f11);
                        f4.appendChild(f10);

                        var f90=document.createElement('div');
                        f90.setAttribute("style","clear:both;");
                        f4.appendChild(f90);

                        f1.appendChild(f4);
                        var ff=document.getElementById('buyCart');
                        ff.insertBefore(f1,dd.lastChild);
                    }

                    for(var i=0;i<data.cart.length;i++){
                        $('#product'+i+'').click(function(){
                            delFromCart($(this))
                        })
                    }
                     setNum();
                }

            }
        })

    }
    getCartList();

    function delFromCart(e){
        var ajaxData = {
            "productId": e.attr('pid')
        };
        var url1 = "http://webproject.roohy.me/ajax/1/92110465/cart/remove";
        $.ajax({
            url: url1,
            type: 'post',
            dataType: 'json',
            data: ajaxData,

             beforeSend : function(){
			var div = document.createElement('div');
			div.className = "ui active inverted dimmer";
			div.id = "loading";

			var div2 = document.createElement('div');
			div2.className = "ui text loader";
			div2.textContent = "Loading";

			div.appendChild(div2);

			var body = document.getElementById('body');
			body.appendChild(div);
		    },
            success: function(data, status, xhr){
                if (data.result == 0){
                    alert('error delete cart');
                    // Request error
                }else {
                    // success
                     var loading = document.getElementById('loading');
				loading.remove();
                    alert('deleted..!');
                    getCartList();
                }
            }
        })
    }

     function setNum(){
        var ajaxData = {
        };
        var url = "http://webproject.roohy.me/ajax/1/92110465/cart/list";
        $.ajax({
            url: url,
            type: 'post',
            dataType: 'json',
            data: ajaxData,

             beforeSend : function(){
			var div = document.createElement('div');
			div.className = "ui active inverted dimmer";
			div.id = "loading";

			var div2 = document.createElement('div');
			div2.className = "ui text loader";
			div2.textContent = "Loading";

			div.appendChild(div2);

			var body = document.getElementById('body');
			body.appendChild(div);
		    },
            success: function(data, status, xhr){
                if (data.result == 0){
                    alert('error fetch cartList');
                    // Request error
                }else {
                     var loading = document.getElementById('loading');
				loading.remove();
                    var numbers = data.cart.length;
                    str = "تعداد :";
                    $('#numBuy').text(str + numbers);
                    $('#productsNav').css('font-family','B roya');

                }
            }

        });
     }

       $('#mysearch').bind('input',function(e) {
           var value = $(this).val();
		var ajaxData = {
          "category":"",
		  search: $(this).val(),
          "page": "",
          "pageSize": ""
		}

		var url = "http://webproject.roohy.me/ajax/1/me/product/list";

		$.ajax({
			url: url,
			type: 'post',
			dataType: 'json',
			data: ajaxData,

			success: function(data, status, xhr){
				if (data.result == 0){
				   // Request error
				}else {
                    if(value != ""){
                        console.log(data.productList[0]);
                        $('.ui.items').hide();
                        $('.pagination').hide();
                        $('#productsNav').hide();
                        var x= $('#uiitemsSearch');
                        if(typeof x !== 'undefined')
                            $('#uiitemsSearch').remove();
                        itemsdiv = document.createElement('div');
                        itemsdiv.className = "ui items";
                        itemsdiv.id = "uiitemsSearch";
                        itemsdiv.style.paddingleft = "100px";
                        document.getElementById('navtabs').appendChild(itemsdiv);

                        var temp = data.productList[0];
                        var divitem = document.createElement('a');
                        divitem.className = "item";
                        var divimage = document.createElement('div');
                        divimage.className = 'image';
                        var image =  document.createElement('img');
                        image.src = temp.picUrl;
                        var aimage = document.createElement('a');
                        aimage.className = 'like ui corner label';
                        var i = document.createElement('i');
                        i.className = 'like icon';
                        aimage.appendChild(i);
                        divimage.appendChild(image);
                        divimage.appendChild(aimage);										//
                        var content = document.createElement('div');
                        content.className = 'content';
                        var divname = document.createElement('div');
                        divname.className = 'name';
                        divname.textContent= temp.name;
                        var divprice = document.createElement('div');
                        divprice.className = 'name';
                        divprice.textContent= "قیمت : " + temp.price;
                        var acontent = document.createElement('a');
                        acontent.className = 'ui blue button';
                        acontent.textContent = 'اضافه به سبد';
                        acontent.setAttribute("pid",temp.id);
                        content.appendChild(divname);
                        content.appendChild(divprice);
                        content.appendChild(acontent);
                        divitem.appendChild(divimage);
                        divitem.appendChild(content);
                        itemsdiv.appendChild(divitem);
                        document.getElementById('navtabs').appendChild(itemsdiv);

                        $('.ui.blue.button').click(function(){
                            var t = $(this).attr('pid');
                            addCartList(t);
                        });
                    }else{
                        $('.ui.items').show();
                        $('.pagination').show();
                        $('#productsNav').show();
                         var x= $('#uiitemsSearch');
                        if(typeof x !== 'undefined')
                            $('#uiitemsSearch').remove();
                    }
                    function addCartList(e){
				        var ajaxData = {
				            "productId": e
				        };
				        var url1 = "http://webproject.roohy.me/ajax/1/92110465/cart/add";
				        $.ajax({
				            url: url1,
				            type: 'post',
				            dataType: 'json',
				            data: ajaxData,
				            success: function(data, status, xhr){
				                if (data.result == 0){
				                    alert('error add cart');
				                    // Request error
				                }else {
				                    // success
				                    alert('added...');
				                    getCartList();
				                }
				            }
				        })
    				}

                    }
				}

			// ...
		});
    });

/*
    $('#addButton').click(function(){
        addCartList();
    });
*/
});


text:
package org.projectfloodlight.openflow.protocol.ver14;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.stat.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.oxs.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import com.google.common.collect.ImmutableList;
import java.util.Set;
import io.netty.buffer.ByteBuf;
import com.google.common.hash.PrimitiveSink;
import com.google.common.hash.Funnel;

class OFBsnGenericCommandReplyVer14 implements OFBsnGenericCommandReply {
    private static final Logger logger = LoggerFactory.getLogger(OFBsnGenericCommandReplyVer14.class);
    // version: 1.4
    final static byte WIRE_VERSION = 5;
    final static int MINIMUM_LENGTH = 20;
    // maximum OF message length: 16 bit, unsigned
    final static int MAXIMUM_LENGTH = 0xFFFF;

        private final static long DEFAULT_XID = 0x0L;
        private final static long DEFAULT_STATUS = 0x0L;
        private final static List<OFBsnTlv> DEFAULT_TLVS = ImmutableList.<OFBsnTlv>of();

    // OF message fields
    private final long xid;
    private final long status;
    private final List<OFBsnTlv> tlvs;
//
    // Immutable default instance
    final static OFBsnGenericCommandReplyVer14 DEFAULT = new OFBsnGenericCommandReplyVer14(
        DEFAULT_XID, DEFAULT_STATUS, DEFAULT_TLVS
    );

    // package private constructor - used by readers, builders, and factory
    OFBsnGenericCommandReplyVer14(long xid, long status, List<OFBsnTlv> tlvs) {
        if(tlvs == null) {
            throw new NullPointerException("OFBsnGenericCommandReplyVer14: property tlvs cannot be null");
        }
        this.xid = U32.normalize(xid);
        this.status = U32.normalize(status);
        this.tlvs = tlvs;
    }

    // Accessors for OF message fields
    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_14;
    }

    @Override
    public OFType getType() {
        return OFType.EXPERIMENTER;
    }

    @Override
    public long getXid() {
        return xid;
    }

    @Override
    public long getExperimenter() {
        return 0x5c16c7L;
    }

    @Override
    public long getSubtype() {
        return 0x48L;
    }

    @Override
    public long getStatus() {
        return status;
    }

    @Override
    public List<OFBsnTlv> getTlvs() {
        return tlvs;
    }

    public OFBsnGenericCommandReply.Builder createBuilder() {
        return new BuilderWithParent(this);
    }

    static class BuilderWithParent implements OFBsnGenericCommandReply.Builder {
        final OFBsnGenericCommandReplyVer14 parentMessage;

        // OF message fields
        private boolean xidSet;
        private long xid;
        private boolean statusSet;
        private long status;
        private boolean tlvsSet;
        private List<OFBsnTlv> tlvs;

        BuilderWithParent(OFBsnGenericCommandReplyVer14 parentMessage) {
            this.parentMessage = parentMessage;
        }

    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_14;
    }

    @Override
    public OFType getType() {
        return OFType.EXPERIMENTER;
    }

    @Override
    public long getXid() {
        return xid;
    }

    @Override
    public OFBsnGenericCommandReply.Builder setXid(long xid) {
        this.xid = xid;
        this.xidSet = true;
        return this;
    }
    @Override
    public long getExperimenter() {
        return 0x5c16c7L;
    }

    @Override
    public long getSubtype() {
        return 0x48L;
    }

    @Override
    public long getStatus() {
        return status;
    }

    @Override
    public OFBsnGenericCommandReply.Builder setStatus(long status) {
        this.status = status;
        this.statusSet = true;
        return this;
    }
    @Override
    public List<OFBsnTlv> getTlvs() {
        return tlvs;
    }

    @Override
    public OFBsnGenericCommandReply.Builder setTlvs(List<OFBsnTlv> tlvs) {
        this.tlvs = tlvs;
        this.tlvsSet = true;
        return this;
    }

        @Override
        public OFBsnGenericCommandReply build() {
                long xid = this.xidSet ? this.xid : parentMessage.xid;
                long status = this.statusSet ? this.status : parentMessage.status;
                List<OFBsnTlv> tlvs = this.tlvsSet ? this.tlvs : parentMessage.tlvs;
                if(tlvs == null)
                    throw new NullPointerException("Property tlvs must not be null");

                //
                return new OFBsnGenericCommandReplyVer14(
                    xid,
                    status,
                    tlvs
                );
        }

    }

    static class Builder implements OFBsnGenericCommandReply.Builder {
        // OF message fields
        private boolean xidSet;
        private long xid;
        private boolean statusSet;
        private long status;
        private boolean tlvsSet;
        private List<OFBsnTlv> tlvs;

    @Override
    public OFVersion getVersion() {
        return OFVersion.OF_14;
    }

    @Override
    public OFType getType() {
        return OFType.EXPERIMENTER;
    }

    @Override
    public long getXid() {
        return xid;
    }

    @Override
    public OFBsnGenericCommandReply.Builder setXid(long xid) {
        this.xid = xid;
        this.xidSet = true;
        return this;
    }
    @Override
    public long getExperimenter() {
        return 0x5c16c7L;
    }

    @Override
    public long getSubtype() {
        return 0x48L;
    }

    @Override
    public long getStatus() {
        return status;
    }

    @Override
    public OFBsnGenericCommandReply.Builder setStatus(long status) {
        this.status = status;
        this.statusSet = true;
        return this;
    }
    @Override
    public List<OFBsnTlv> getTlvs() {
        return tlvs;
    }

    @Override
    public OFBsnGenericCommandReply.Builder setTlvs(List<OFBsnTlv> tlvs) {
        this.tlvs = tlvs;
        this.tlvsSet = true;
        return this;
    }
//
        @Override
        public OFBsnGenericCommandReply build() {
            long xid = this.xidSet ? this.xid : DEFAULT_XID;
            long status = this.statusSet ? this.status : DEFAULT_STATUS;
            List<OFBsnTlv> tlvs = this.tlvsSet ? this.tlvs : DEFAULT_TLVS;
            if(tlvs == null)
                throw new NullPointerException("Property tlvs must not be null");

            return new OFBsnGenericCommandReplyVer14(
                    xid,
                    status,
                    tlvs
                );
        }

    }

    final static Reader READER = new Reader();
    static class Reader implements OFMessageReader<OFBsnGenericCommandReply> {
        @Override
        public OFBsnGenericCommandReply readFrom(ByteBuf bb) throws OFParseError {
            int start = bb.readerIndex();
            // fixed value property version == 5
            byte version = bb.readByte();
            if(version != (byte) 0x5)
                throw new OFParseError("Wrong version: Expected=OFVersion.OF_14(5), got="+version);
            // fixed value property type == 4
            byte type = bb.readByte();
            if(type != (byte) 0x4)
                throw new OFParseError("Wrong type: Expected=OFType.EXPERIMENTER(4), got="+type);
            int length = U16.f(bb.readShort());
            if(length < MINIMUM_LENGTH)
                throw new OFParseError("Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length);
            if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
                // Buffer does not have all data yet
                bb.readerIndex(start);
                return null;
            }
            if(logger.isTraceEnabled())
                logger.trace("readFrom - length={}", length);
            long xid = U32.f(bb.readInt());
            // fixed value property experimenter == 0x5c16c7L
            int experimenter = bb.readInt();
            if(experimenter != 0x5c16c7)
                throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter);
            // fixed value property subtype == 0x48L
            int subtype = bb.readInt();
            if(subtype != 0x48)
                throw new OFParseError("Wrong subtype: Expected=0x48L(0x48L), got="+subtype);
            long status = U32.f(bb.readInt());
            List<OFBsnTlv> tlvs = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFBsnTlvVer14.READER);

            OFBsnGenericCommandReplyVer14 bsnGenericCommandReplyVer14 = new OFBsnGenericCommandReplyVer14(
                    xid,
                      status,
                      tlvs
                    );
            if(logger.isTraceEnabled())
                logger.trace("readFrom - read={}", bsnGenericCommandReplyVer14);
            return bsnGenericCommandReplyVer14;
        }
    }

    public void putTo(PrimitiveSink sink) {
        FUNNEL.funnel(this, sink);
    }

    final static OFBsnGenericCommandReplyVer14Funnel FUNNEL = new OFBsnGenericCommandReplyVer14Funnel();
    static class OFBsnGenericCommandReplyVer14Funnel implements Funnel<OFBsnGenericCommandReplyVer14> {
        private static final long serialVersionUID = 1L;
        @Override
        public void funnel(OFBsnGenericCommandReplyVer14 message, PrimitiveSink sink) {
            // fixed value property version = 5
            sink.putByte((byte) 0x5);
            // fixed value property type = 4
            sink.putByte((byte) 0x4);
            // FIXME: skip funnel of length
            sink.putLong(message.xid);
            // fixed value property experimenter = 0x5c16c7L
            sink.putInt(0x5c16c7);
            // fixed value property subtype = 0x48L
            sink.putInt(0x48);
            sink.putLong(message.status);
            FunnelUtils.putList(message.tlvs, sink);
        }
    }

    public void writeTo(ByteBuf bb) {
        WRITER.write(bb, this);
    }

    final static Writer WRITER = new Writer();
    static class Writer implements OFMessageWriter<OFBsnGenericCommandReplyVer14> {
        @Override
        public void write(ByteBuf bb, OFBsnGenericCommandReplyVer14 message) {
            int startIndex = bb.writerIndex();
            // fixed value property version = 5
            bb.writeByte((byte) 0x5);
            // fixed value property type = 4
            bb.writeByte((byte) 0x4);
            // length is length of variable message, will be updated at the end
            int lengthIndex = bb.writerIndex();
            bb.writeShort(U16.t(0));

            bb.writeInt(U32.t(message.xid));
            // fixed value property experimenter = 0x5c16c7L
            bb.writeInt(0x5c16c7);
            // fixed value property subtype = 0x48L
            bb.writeInt(0x48);
            bb.writeInt(U32.t(message.status));
            ChannelUtils.writeList(bb, message.tlvs);

            // update length field
            int length = bb.writerIndex() - startIndex;
            if (length > MAXIMUM_LENGTH) {
                throw new IllegalArgumentException("OFBsnGenericCommandReplyVer14: message length (" + length + ") exceeds maximum (0xFFFF)");
            }
            bb.setShort(lengthIndex, length);

        }
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder("OFBsnGenericCommandReplyVer14(");
        b.append("xid=").append(xid);
        b.append(", ");
        b.append("status=").append(status);
        b.append(", ");
        b.append("tlvs=").append(tlvs);
        b.append(")");
        return b.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        OFBsnGenericCommandReplyVer14 other = (OFBsnGenericCommandReplyVer14) obj;

        if( xid != other.xid)
            return false;
        if( status != other.status)
            return false;
        if (tlvs == null) {
            if (other.tlvs != null)
                return false;
        } else if (!tlvs.equals(other.tlvs))
            return false;
        return true;
    }

    @Override
    public boolean equalsIgnoreXid(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        OFBsnGenericCommandReplyVer14 other = (OFBsnGenericCommandReplyVer14) obj;

        // ignore XID
        if( status != other.status)
            return false;
        if (tlvs == null) {
            if (other.tlvs != null)
                return false;
        } else if (!tlvs.equals(other.tlvs))
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;

        result = prime *  (int) (xid ^ (xid >>> 32));
        result = prime *  (int) (status ^ (status >>> 32));
        result = prime * result + ((tlvs == null) ? 0 : tlvs.hashCode());
        return result;
    }

    @Override
    public int hashCodeIgnoreXid() {
        final int prime = 31;
        int result = 1;

        // ignore XID
        result = prime *  (int) (status ^ (status >>> 32));
        result = prime * result + ((tlvs == null) ? 0 : tlvs.hashCode());
        return result;
    }

}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>EmberJS Rollback Extended Test</title>
		<link href="../bower_components/qunit/qunit/qunit.css" rel="stylesheet">


text:
package akka.brewery

import scalafx.application.{JFXApp, Platform}
import scalafx.beans.property.ObjectProperty
import scalafx.collections.ObservableBuffer
import scalafx.geometry.Insets
import scalafx.scene.Scene
import scalafx.scene.control._
import scalafx.scene.layout.VBox
import scalafx.scene.text.Text

object BrewMeister extends JFXApp {
  val commandProperty = new ObjectProperty[Command]()
  val stateProperty = new ObjectProperty[State]()
  val eventProperty = new ObjectProperty[Event]()

  Brewery.register(commandProperty, stateProperty, eventProperty)
  sys.addShutdownHook(Brewery.close())

  val brewButton = new Button { text = "Brew" }
  val toolbar = new ToolBar { content = List(brewButton) }

  val recipeLabel = new Label { text = "Receipe:" }
  val recipeList =  new ListView[String] {
    prefHeight = 230
    items = ObservableBuffer[String]()
  }

  val commandLabel = new Label { text = "Commands:" }
  val commandText = new Text { wrappingWidth = 600 }

  val stateLabel = new Label { text = "States:" }
  val stateList = new ListView[String] {
    prefHeight = 240
    items = ObservableBuffer[String]()
  }

  val eventLabel = new Label { text = "Events:" }
  val eventList = new ListView[String] {
    prefHeight = 260
    items = ObservableBuffer[String]()
  }

  val contentPane = new VBox {
    spacing = 6
    padding = Insets(6)
    children = List(recipeLabel, recipeList, commandLabel, commandText, stateLabel, stateList, eventLabel, eventList)
  }

  val appPane = new VBox {
    prefWidth = 660
    spacing = 6
    padding = Insets(6)
    children = List(toolbar, contentPane)
  }

  stage = new JFXApp.PrimaryStage {
    title = "Brew Meister"
    scene = new Scene {
      root = appPane
    }
  }

  brewButton.onAction = _ => {
    commandText.text = ""
    stateList.items.get().clear()
    eventList.items.get().clear()
    val recipe = IPA()
    listRecipe(recipe)
    Platform.runLater(Brewery.brew(recipe))
  }

  commandProperty.onChange { (_, _, command) =>
    Platform.runLater(commandText.text = s"${command.getClass.getSimpleName}, Batch # ${command.batch}, Executed @ ${command.executed}")
  }

  stateProperty.onChange { (_, _, state) =>
    Platform.runLater(stateList.items.get().add(s"${state.getClass.getSimpleName}, Batch # ${state.batch}, Started @ ${state.started}"))
  }

  eventProperty.onChange { (_, _, event) =>
    Platform.runLater(eventList.items.get().add(s"${event.getClass.getSimpleName}, Batch # ${event.batch}, Occurred @ ${event.occurred}"))
  }

  def listRecipe(recipe: Recipe): Unit = {
    val list = recipeList.items.get()
    list.clear()
    list.add(s"Name: ${recipe.name} Style: ${recipe.style}")
    list.add(s"IBU: ${recipe.ibu} Color: ${recipe.color} ABV: ${recipe.abv}")
    list.add(s"Gravity( original: ${recipe.gravity.original} specific: ${recipe.gravity.specific} final: ${recipe.gravity.finished})")
    recipe.adjuncts.foreach { i => list.add(i.toString) }
    recipe.malts.foreach { i => list.add(i.toString) }
    recipe.hops.foreach { i => list.add(i.toString) }
    list.add(s"Yeast( kind: ${recipe.yeast.kind} amount: ${recipe.yeast.amount}${recipe.yeast.as})")
    list.add(s"Water( gallons: ${recipe.water.gallons}g boil size: ${recipe.water.boilSizeInGallons}g boil time: ${recipe.water.boilTimeInMinutes}m batch size: ${recipe.water.batchSizeInGallons}g)")
    list.add(s"Primary Fermentation ( days: ${recipe.primary.days} degrees: ${recipe.primary.degrees})")
    list.add(s"Secondary Fermentation ( days: ${recipe.primary.days} degrees: ${recipe.primary.degrees})")
    list.add(s"Mash: ${recipe.mash}")
    list.add(s"Boil: ${recipe.boil}")
    list.add(s"Cool: ${recipe.cool}")
    list.add(s"Ferment: ${recipe.ferment}")
    list.add(s"Condition: ${recipe.condition}")
    list.add(s"Bottle: ${recipe.bottle}")
    list.add(s"Keg: ${recipe.keg}")
    list.add(s"Cask: ${recipe.cask}")
    ()
  }
}


text:
<?php

/*
 * This file is part of the Park-Manager project.
 *
 * (c) Sebastiaan Stok <s.stok@rollerscapes.net>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace ParkManager\Component\Acl;

interface ResourcePointer
{
    /**
     * @return string
     */
    public function __toString();

    /**
     * Returns the name of the resource (className).
     *
     * @return string
     */
    public function getName(): string;

    /**
     * @return string|null
     */
    public function getId();
}


text:
<?php

namespace PhpSpec\Util;

use PhpSpec\Exception\Fracture\ClassNotFoundException;

class Instantiator
{
    /**
     * @param string $className
     *
     * @return object
     */
    public function instantiate($className)
    {
        if (!class_exists($className)) {
            throw new ClassNotFoundException("Class $className does not exist.", $className);
        }

        $instantiator = new \Doctrine\Instantiator\Instantiator();

        return $instantiator->instantiate($className);
    }
}


text:
/**
 * Manages discipline resource
 *
 * @since:
 */
var express, mongoose, auth, router, Discipline;

express  = require('express');
mongoose = require('mongoose');
auth     = require('../lib/auth');

router     = express.Router();
Discipline = require('../models/discipline');

/**
 * Creates a new discipline in database
 *
 * @params:
 * @returns:
 * @throws:
 *
 * @since:
 * @author:
 */
router.post('/', auth(), function (request, response, next) {
    //TODO implement function
});

/**
 * List all disciplines in database
 *
 * @params:
 * @returns:
 * @throws:
 *
 * @since:
 * @author:
 */
router.get('/', auth(), function (request, response, next) {
    //TODO implement function
});

/**
 * Get discipline info in database
 *
 * @params:
 * @returns:
 * @throws:
 *
 * @since:
 * @author:
 */
router.get('/:disciplineId', auth(), function (request, response, next) {
    //TODO implement function
});

/**
 * Updates discipline info in database
 *
 * @params:
 * @returns:
 * @throws:
 *
 * @since:
 * @author:
 */
router.put('/:disciplineId', auth(), function (request, response, next) {
    //TODO implement function
});

/**
 * Removes discipline from database
 *
 * @params:
 * @returns:
 * @throws:
 *
 * @since:
 * @author:
 */
router.delete('/:disciplineId', auth(), function (request, response, next) {
    //TODO implement function
});

module.exports = router;


text:
<?php

namespace Andrey\crudBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AndreycrudBundle extends Bundle
{
}


text:
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;

namespace RDumont.Frankie.Specs.Steps
{
    [Binding]
    public class PostSteps : StepsBase
    {
        [Then(@"a post with slug ""(.+)"" should be registered")]
        public void Then_a_post_with_slug_should_be_registered(string slug)
        {
            var siteContext = Core.SiteContext.Current;

            var post = siteContext.Posts.FirstOrDefault(p => p.Slug == slug);
            Assert.That(post, Is.Not.Null, "No post registered with slug '{0}'", slug);
        }

        [Then(@"a post called ""(.+)"" should be registered")]
        public void Then_a_post_called_should_be_registered(string postTitle)
        {
            var siteContext = Core.SiteContext.Current;

            var post = siteContext.Posts.FirstOrDefault(p => p.Title == postTitle);
            Assert.That(post, Is.Not.Null, "No post registered with title '{0}'", postTitle);
        }

        [Then(@"the post '(.+)' should have the categories")]
        public void Then_the_post_should_have_the_categories(string slug, Table table)
        {
            var expectedCategories = table.Rows.Select(r => r[0]).ToArray();
            var post = Core.SiteContext.Current.Posts.FirstOrDefault(p => p.Slug == slug);
            Assert.That(post, Is.Not.Null, "No post registered with slug '{0}'", slug);

            Assert.That(post.Category, Is.EqualTo(expectedCategories));
        }
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.skife.jdbi.v2.sqlobject;

import org.h2.jdbcx.JdbcDataSource;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.skife.jdbi.v2.DBI;
import org.skife.jdbi.v2.Handle;
import org.skife.jdbi.v2.Something;
import org.skife.jdbi.v2.sqlobject.subpackage.PrivateImplementationFactory;

import java.util.UUID;

import static org.junit.Assert.assertEquals;

public class TestBeanBinder
{
    private DBI    dbi;
    private Handle handle;

    @Before
    public void setUp() throws Exception
    {
        JdbcDataSource ds = new JdbcDataSource();
        ds.setURL("jdbc:h2:mem:" + UUID.randomUUID());
        dbi = new DBI(ds);
        dbi.registerMapper(new SomethingMapper());
        handle = dbi.open();

        handle.execute("create table something (id int primary key, name varchar(100))");
    }

    @After
    public void tearDown() throws Exception
    {
        handle.execute("drop table something");
        handle.close();
    }

    @Test
    public void testInsert() throws Exception
    {
        Spiffy s = handle.attach(Spiffy.class);
        s.insert(new Something(2, "Bean"));

        String name = handle.createQuery("select name from something where id = 2").mapTo(String.class).first();
        assertEquals("Bean", name);
    }

    @Test
    public void testRead() throws Exception
    {
        Spiffy s = handle.attach(Spiffy.class);
        handle.insert("insert into something (id, name) values (17, 'Phil')");
        Something phil = s.findByEqualsOnBothFields(new Something(17, "Phil"));
        assertEquals("Phil", phil.getName());
    }

    interface Spiffy {

        @SqlUpdate("insert into something (id, name) values (:id, :name)")
        int insert(@BindBean Something s);

        @SqlQuery("select id, name from something where id = :s.id and name = :s.name")
        Something findByEqualsOnBothFields(@BindBean("s") Something s);

        @SqlQuery("select :pi.value")
        String selectPublicInterfaceValue(@BindBean(value = "pi", type = PublicInterface.class) PublicInterface pi);
    }

    @Test
    public void testBindingPrivateTypeUsingPublicInterface() throws Exception
    {
        Spiffy s = handle.attach(Spiffy.class);
        assertEquals("IShouldBind", s.selectPublicInterfaceValue(PrivateImplementationFactory.create()));
    }

    public interface PublicInterface {
        String getValue();
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/imageView"
        android:layout_margin="16dp"
        android:scaleType="centerInside"
        android:layout_width="40dp"
        android:layout_height="50dp"
        app:srcCompat="@mipmap/ic_launcher_round"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageView"
        android:text="TextView"
        android:layout_toLeftOf="@+id/imageView2"
        android:layout_toRightOf="@+id/imageView"
        android:layout_toEndOf="@+id/imageView" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignBottom="@+id/imageView"
        android:gravity="bottom"
        android:text="TextView"
        android:layout_below="@+id/textView2"
        android:layout_toLeftOf="@+id/imageView2"
        android:layout_toRightOf="@+id/imageView"
        android:layout_toEndOf="@+id/imageView" />

</RelativeLayout>


text:
import rendering
import utils

class RefreshJsonCache(utils.Handler):
    """Refreshes the json cache, presumably via an asynchronous task."""
    def get(self):
        if self.subdomain:
            rendering.render_json(self.subdomain)

if __name__ == '__main__':
    utils.run([('/refresh_json_cache', RefreshJsonCache)], debug=True)


text:
require 'supermarket/community_site/sadequate_record'

module Supermarket
  module CommunitySite
    class DeprecatedCookbookRecord
      class << self
        extend SadequateRecord::Table
        table :cookbooks, :CookbookRecord
      end

      extend SadequateRecord::Record
      extend SadequateRecord::BelongsTo

      belongs_to :replacement, :CookbookRecord, :replacement_id

      fields :id, :name, :deprecated, :replacement_id
    end
  end
end


text:
layout: post
title: Getting Stuff Done
date: 2017-03-20 08:28:37.000000000 +02:00
type: post
published: true
status: publish
categories:
- Getting Stuff Done
tags: []
meta: /get-stuff-done/
---

## How Can BlueMail Help Me Get Stuff Done?

Getting Stuff Done is a method of organization that helps to make achieving tasks much more easy. Your inbox is organized by the time an email was received, and while this is important, does not necessarily indicate which emails require more urgency than others. With BlueMail's Getting Stuff Done feature, this becomes much more simple with the addition of the Task List and Reminders.

## What is Snooze? How to Snooze+ an Email?

{: .center}
![Later](/assets/ic_action_later-.png){:width="100px"}

Sometimes you are in a context when handling the mail is not effective, possible or reasonable. You may need to wait to a certain time, be in a certain place, or have certain resources or pre-requisites. For those emails you can defer the handling. BlueMail has ready made time frames set for you: later today, end of day, next day / week/ month, or someday in the future. You can also pick a specific date/time, which is useful when you know exactly when would be the most suitable time to handle this mail.

When you [Snooze+ an email](/mark-an-email-as-later/) it will be added to [Tasks](/what-are-tasks-type-mail/)

You can add an email to tasks / Snooze an email using these methods:

* Using the [Bottom Bar Actions in Mail View](/bottom-bar-options-type-mail/).
* Using [Swipe Options in List View](/swipe-menu-options-type-mail/)

Note: that if you use the [Incoming Filter](/top-bar-left-triangle-menu/) you won't see emails marked as *Snooze+*.

## What are Tasks?

*Tasks* view shows all the Snoozed mails. This view allows you to distinguish all the emails you need to handle ordered from the most urgent ones. You can also see mails whose designated time has elapsed. This allows you to prioritize your time based on urgency as well as importance.

When each such task reaches it's designated time, you get a push notification, also called snooze, as a reminder.

## What are Snooze Notifications or Reminders?

Once you have snoozed some mails, they appear as tasks with due time, sorted by urgency. When each such "task" reaches it's designated time, you get a push notifications, also called snooze, as a reminder, to let you know that this was the right time for you to handle this mail, and make sure you get what you need, in the time that you asked for it.

## What is Done? How to Mark an Email as Done?

{: .center}
![Done](/assets/ic_action_done.png){:width="100px"}

[Mark as Done](/mark-an-email-as-done/) moves the mail to the "Done" tab and marks it like that. It means there is nothing more to do with this mail, but it is still valuable for you to keep.

Using *More...* \| *Global Settings* \| *Auto Mark as Done* setting, you can cause replied messages to be automatically marked as Done. By default this setting is Off.

You can mark an email as Done with those methods:

* Using the [Bottom Bar Actions in Mail View](/bottom-bar-options-type-mail/)
* Using [Swipe Options in List View](/swipe-menu-options-type-mail/)

Note: That if you use the [Incoming Filter](/top-bar-left-triangle-menu/) you won't see emails marked as done.

## An Email is Marked as Done by mistake. How can I Return it to my Inbox?

With BlueMail you can "reopen" mail marked Done, to be Undone and back into inbox. Simply tap on *Inbox* \| *choose Done filter* \| *Swipe the email to the right* \| ***Undone*** and the email will move back to the inbox folder.

## What is the Default to Assign an Email for This Evening? Tomorrow Morning? Later Today?

* Later Today is set to three hours ahead
* This Evening is set to 07:00 PM of today
* Tomorrow Morning is set to 09:00 AM the next day
* Next Week is set to a week ahead
* In a Month is set to a month ahead
* Some Day adds the email to the task list without a certain due date
* Pick Date allows you to choose the date and time

Note: Before 09:00 AM the option for *Tomorrow morning* will be *This Morning*, meaning it will be set to 9:00 today.

You can change the default setting for *Later Today* using *More...* \| *Global Settings* \| *Later Today Default*.

## What are the Filters on the Top Bar Menu?

*Filters* allow you to quickly find messages important to you from your contacts, services, and even messages that you haven't read.

* *All* – Displays all emails in the Inbox inc. Done, Snooze etc.
* *Unread* – Displays unread emails, so you never miss out on any email sent.
* *Starred* – Displays all your starred, flagged, important emails.
* *Incoming* – Similar to the 'All' filter, without the Snoozed and Done emails, so they don't get mixed in with the rest of your emails.

{: .center}
![Picker](/assets/BlueMail_PressKit_Picker-1-1.png){:width="350px"}

Learn how to change the [default filter](/how-do-i-change-the-default-filter/).

## What is the Difference between Snooze+ Filter and Tasks View?

[Snooze](/mark-as-later/) filter and [Tasks](/what-are-tasks-type-mail/) view shows all the Snoozed mails. While *Snooze* filter works like traditional filter on a mailbox, *Tasks* show a dedicated urgency view, with the most pressing emails on top, to let you focus on what matters.

## Where will Snoozed/Done Emails be in Other Mail Clients/Web/PC?

*Snooze+* and *Done* are internal features of BlueMail. We are not moving those emails elsewhere in your folders.

## Sounds Great! How can you Help me Reach a Zero Inbox?

With Getting Stuff Done, achieving a Zero Inbox is easy. It starts when you receive an email. You can either delete it, forward it to someone, or take action. If you are unable to act on the email quickly, simply schedule it for later. BlueMail will send you a notification when it is time to take care of the task. Have a little extra time and want to take care of the email earlier? Visit your Task List and cross it off. In no time, you will have a Zero Inbox!


text:
(function () {
    'use strict';

    angular
        .module('app.sport')
        .controller('SportLineProductController', SportLineProductController);

    /* @ngInject */
    function SportLineProductController(products) {
        /*jshint unused:false*/
        var vm = this;
        vm.products = products;
    }
})();