text:
<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

 Overview
 Library
  Tag
 Help

 FRAMES   NO FRAMES
All Tags

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

html
 Tag hidden
-----------

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

**Render A Hidden Field**

Renders an HTML \<input\> element of type hidden, populated from the specified value or the specified property of the bean associated with our current form. This tag is only valid when nested inside a form tag body.

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

**Tag Information**

Tag Class

org.apache.struts.taglib.html.md.HiddenTag

TagExtraInfo Class

*None*

Body Content

empty

Display Name

*None*

**Attributes**

**Name**

**Required**

**Request-time**

**Type**

**Description**

accesskey

false

true

`java.lang.String`

The keyboard character used to move focus immediately to this element.

alt

false

true

`java.lang.String`

The alternate text for this element.

altKey

false

true

`java.lang.String`

The message resources key of the alternate text for this element.

bundle

false

true

`java.lang.String`

The servlet context attributes key for the MessageResources instance to use. If not specified, defaults to the application resources configured for our action servlet.

**Since:**
Struts 1.2.5

dir

false

true

`java.lang.String`

The direction for weak/neutral text for this element.

**Since:**
Struts 1.3.6

disabled

false

true

`boolean`

Set to `true` if this input field should be disabled.

indexed

false

true

`boolean`

Valid only inside of `logic:iterate` tag. If `true` then name of the.html.md tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag.

lang

false

true

`java.lang.String`

The language code for this element.

**Since:**
Struts 1.3.6

name

false

true

`java.lang.String`

The attribute name of the bean whose properties are consulted when rendering the current value of this input field. If not specified, the bean associated with the form tag we are nested within is utilized.

onblur

false

true

`java.lang.String`

JavaScript event handler executed when this element loses input focus.

onchange

false

true

`java.lang.String`

JavaScript event handler executed when this element loses input focus and its value has changed.

onclick

false

true

`java.lang.String`

JavaScript event handler executed when this element receives a mouse click.

ondblclick

false

true

`java.lang.String`

JavaScript event handler executed when this element receives a mouse double click.

onfocus

false

true

`java.lang.String`

JavaScript event handler executed when this element receives input focus.

onkeydown

false

true

`java.lang.String`

JavaScript event handler executed when this element has focus and a key is depressed.

onkeypress

false

true

`java.lang.String`

JavaScript event handler executed when this element has focus and a key is depressed and released.

onkeyup

false

true

`java.lang.String`

JavaScript event handler executed when this element has focus and a key is released.

onmousedown

false

true

`java.lang.String`

JavaScript event handler executed when this element is under the mouse pointer and a mouse button is depressed.

onmousemove

false

true

`java.lang.String`

JavaScript event handler executed when this element is under the mouse pointer and the pointer is moved.

onmouseout

false

true

`java.lang.String`

JavaScript event handler executed when this element was under the mouse pointer but the pointer was moved outside the element.

onmouseover

false

true

`java.lang.String`

JavaScript event handler executed when this element was not under the mouse pointer but the pointer is moved inside the element.

onmouseup

false

true

`java.lang.String`

JavaScript event handler executed when this element is under the mouse pointer and a mouse button is released.

property

true

true

`java.lang.String`

Name of this input field, and the name of the corresponding bean property if value is not specified. The corresponding bean property (if any) must be of type String.

style

false

true

`java.lang.String`

CSS styles to be applied to this HTML element.

styleClass

false

true

`java.lang.String`

CSS stylesheet class to be applied to this HTML element (renders a "class" attribute).

styleId

false

true

`java.lang.String`

Identifier to be assigned to this HTML element (renders an "id" attribute).

title

false

true

`java.lang.String`

The advisory title for this element.

titleKey

false

true

`java.lang.String`

The message resources key for the advisory title for this element.

value

false

true

`java.lang.String`

Value to which this field should be initialized. [Use the corresponding bean property value]

write

false

true

`boolean`

Should the value of this field also be rendered to the response page to make it visible, in addition to creating an HTML type="hidden" element? By default, only the hidden element is created.

|-------------------------|
| **Variables**           |
| *No Variables Defined.* |

<colgroup>
<col width="50%" />
<col width="50%" />
</colgroup>

 Overview
 Library
  Tag
 Help

 FRAMES   NO FRAMES
All Tags

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

*Output Generated by [Tag Library Documentation Generator](http://taglibrarydoc.dev.java.net/). Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.*


text:
var fs = require('fs');
var path = require('path');
var thrift = require('thrift');
var ThriftTest = require('./gen-nodejs/ThriftTest');
var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
var ThriftTestHandlerPromise = require('./test_handler_promise').ThriftTestHandler;

var program = require('commander');

program
  .option('-p, --protocol <protocol>', 'Set thift protocol (binary|json) [protocol]')
  .option('-t, --transport <transport>', 'Set thift transport (buffered|framed) [transport]')
  .option('--ssl', 'use ssl transport')
  .option('--promise', 'test with promise style functions')
  .parse(process.argv);

var transport =  thrift.TBufferedTransport;
if (program.transport === "framed") {
  transport = thrift.TFramedTransport;
}

var protocol = thrift.TBinaryProtocol;
if (program.protocol === "json") {
  protocol = thrift.TJSONProtocol;
}

var handler = ThriftTestHandler;
if (program.promise) {
  handler = ThriftTestHandlerPromise;
}

var SvcOpt = {
    handler: handler,
    processor: ThriftTest,
    protocol: protocol,
    transport: transport
};
var serverOpt = { services: { "/test": SvcOpt } };
if (program.ssl) {
  serverOpt.tls = {
    key: fs.readFileSync(path.resolve(__dirname, 'server.key')),
    cert: fs.readFileSync(path.resolve(__dirname, 'server.crt'))
  };
}
thrift.createWebServer(serverOpt).listen(9090);

redpajama_set_name: RedPajamaGithub


text:
/*
import * as React from 'react'
import Password from '.'
import {action, storiesOf} from '../../stories/storybook'

const props = {
  errorMessage: null,
  hasPGPKeyOnServer: false,
  hasRandomPW: true,
  newPasswordConfirmError: '',
  newPasswordError: '',
  onCancel: action('onCancel'),
  onChangeNewPassword: action('onChangeNewPassword'),
  onChangeNewPasswordConfirm: action('onChangeNewPasswordConfirm'),
  onChangeShowPassword: action('onChangeShowPassword'),
  onSave: action('onSave'),
  onUpdatePGPSettings: action('onUpdatePGPSettings'),
  showTyping: false,
  waitingForResponse: false,
}

// TODO a lot of this seems like it doesn't work
const load = () => {
  storiesOf('Settings/Password', module)
    .add('Normal', () => <Password {...props} />)
    .add('Normal - Change password', () => <Password {...props} hasRandomPW={false} />)
    .add('Normal - Has PGP on server', () => <Password {...props} hasPGPKeyOnServer={true} />)
    .add('Normal - Show Typing', () => <Password {...props} showTyping={true} />)
    .add('Error - New Password Requirements', () => (
      <Password {...props} newPasswordError="Your new password must have minimum 12 characters." />
    ))
    .add('Error - New Password Mismatch', () => (
      <Password {...props} newPasswordConfirmError="Password confirmation does not match." />
    ))
}

export default load
*/

export default {}


text:
package com.sillelien.dollar.api.collections;

import com.sillelien.dollar.api.var;
import org.jetbrains.annotations.Nullable;

public final class Range {
    private final var start;
    private final var finish;

    public Range(var start, var finish) {
        this.start = start;
        this.finish = finish;
    }

    @Override
    public int hashCode() {
        int result = start.hashCode();
        result = 31 * result + finish.hashCode();
        return result;
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (this == o) { return true; }
        if (o == null || getClass() != o.getClass()) { return false; }

        Range range = (Range) o;

        if (!finish.equals(range.finish)) { return false; }
        return start.equals(range.start);

    }

    public boolean isEmpty() {
        return false;
    }

    public var lowerEndpoint() {
        return start;
    }

    public var upperEndpoint() {
        return finish;
    }
}


text:
::
:: Copyright (c) 2008-2014 the Urho3D project.
::
:: Permission is hereby granted, free of charge, to any person obtaining a copy
:: of this software and associated documentation files (the "Software"), to deal
:: in the Software without restriction, including without limitation the rights
:: to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
:: copies of the Software, and to permit persons to whom the Software is
:: furnished to do so, subject to the following conditions:
::
:: The above copyright notice and this permission notice shall be included in
:: all copies or substantial portions of the Software.
::
:: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
:: IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
:: FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
:: AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
:: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
:: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
:: THE SOFTWARE.
::

@echo off
pushd %~dp0

:: Clean all the CMake cache
if exist Build\CMakeCache.txt. del /F Build\CMakeCache.txt
if exist android-Build\CMakeCache.txt. del /F android-Build\CMakeCache.txt
if exist Source\Android\CMakeCache.txt. del /F Source\Android\CMakeCache.txt

:: Clean CMakeFiles directories
if exist Build\CMakeFiles. rd /S /Q Build\CMakeFiles
if exist android-Build\CMakeFiles. rd /S /Q android-Build\CMakeFiles
if exist Source\Android\CMakeFiles. rd /S /Q Source\Android\CMakeFiles

popd


text:
"""
This module implements simple helper functions for working with:

- Virtual Machine Disks
- First Class Disks
"""

from pyVmomi import vim

def get_obj(content, vimtype, name):
    """
    Retrieves the managed object for the name and type specified

    Sample Usage:

    get_obj(content, [vim.Datastore], "Datastore Name")
    """
    obj = None
    container = content.viewManager.CreateContainerView(
        content.rootFolder, vimtype, True)
    for c in container.view:
        if c.name == name:
            obj = c
            break
    if not obj:
        raise RuntimeError("Managed Object " + name + " not found.")
    return obj

def retrieve_fcd(content, datastore, vdisk):
    """
    Retrieves the managed object for the first class disk specified

    Sample Usage:

    retrieve_fcd(content, datastore, "First Class Disk Name")
    """
    # Set vStorageObjectManager
    storage = content.vStorageObjectManager

    # Retrieve First Class Disks
    disk = None
    for d in storage.ListVStorageObject(datastore):
        disk_info = storage.RetrieveVStorageObject(d, datastore)
        if disk_info.config.name == vdisk:
            disk = disk_info
            break
    if not disk:
        raise RuntimeError("First Class Disk not found.")
    return disk

def retrieve_fcd_snapshot(content, datastore, vdisk, snapshot):
    """
    Retrieves the managed object for the fcd snapshot specified

    Sample Usage:

    retrieve_fcd_snapshot(content, datastore, vdisk, "Snapshot Name")
    """
    # Set vStorageObjectManager
    storage = content.vStorageObjectManager

    # Retrieve Snapshot
    snap = None
    snaps = storage.RetrieveSnapshotInfo(vdisk.config.id, datastore)
    for s in snaps.snapshots:
        if s.description == snapshot:
            snap = s.id
            break
    if not snap:
        raise RuntimeError("Snapshot not found.")
    return snap


text:
package edu.harvard.iq.dataverse.harvest.server.xoai;

import com.lyncode.xml.exceptions.XmlWriteException;
import com.lyncode.xoai.model.oaipmh.Metadata;
import com.lyncode.xoai.xml.XmlWriter;

/**
 *
 * @author Leonid Andreev
 */
public class Xmetadata extends Metadata {

    public Xmetadata(String value) {
        super(value);
    }

    @Override
    public void write(XmlWriter writer) throws XmlWriteException {
        // Do nothing!
        // - rather than writing Metadata as an XML writer stram, we will write
        // the pre-exported *and pre-validated* content as a byte stream, directly.
    }

}


text:
#include <iostream>

#include "InlineExampleFC.h"
#include <adios2.h>

adios2::IO *adiosIO;
adios2::Engine reader;

extern "C" {

void FC_GLOBAL(open_reader, OPEN_READER)(adios2::IO *io)
{
    adiosIO = io;
    reader = adiosIO->Open("reader", adios2::Mode::Read);
}

void FC_GLOBAL(analyze_data, ANALYZE_DATA)()
{
    // grab the desired variable
    auto u = adiosIO->InquireVariable<float>("data2D");
    if (!u)
    {
        std::cerr << "variable data2D not found!" << std::endl;
        return;
    }
    auto shape = u.Shape();

    // begin step on the reader
    reader.BeginStep();

    // get the data pointer and do some stuff with it
    float *data = nullptr;
    reader.Get(u, &data);
    std::cout << "c++ output: " << std::endl;
    for (size_t i = 0; i < shape[1]; i++)
    {
        for (size_t j = 0; j < shape[0]; j++)
        {
            std::cout << data[shape[0] * i + j] << "\t";
        }
        std::cout << std::endl;
    }

    // end step for the reader, signaling that we're done using the data
    reader.EndStep();
}

void FC_GLOBAL(close_reader, CLOSE_READER)() { reader.Close(); }
}


text:
package adminport

import (
	"errors"
	c "github.com/couchbase/indexing/secondary/common"
)

// errors codes

// ErrorRegisteringRequest
var ErrorRegisteringRequest = errors.New("adminport.registeringRequest")

// ErrorMessageUnknown
var ErrorMessageUnknown = errors.New("adminport.unknownMessage")

// ErrorPathNotFound
var ErrorPathNotFound = errors.New("adminport.pathNotFound")

// ErrorRequest
var ErrorRequest = errors.New("adminport.request")

// ErrorDecodeRequest
var ErrorDecodeRequest = errors.New("adminport.decodeRequest")

// ErrorEncodeResponse
var ErrorEncodeResponse = errors.New("adminport.encodeResponse")

// ErrorDecodeResponse
var ErrorDecodeResponse = errors.New("adminport.decodeResponse")

// ErrorInternal
var ErrorInternal = errors.New("adminport.internal")

// MessageMarshaller API abstracts the underlying messaging format. For instance,
// in case of protobuf defined structures, respective structure definition
// should implement following method receivers.
type MessageMarshaller interface {
	// Name of the message
	Name() string

	// Content type to be used by the transport layer.
	ContentType() string

	// Encode function shall marshal message to byte array.
	Encode() (data []byte, err error)

	// Decode function shall unmarshal byte array back to message.
	Decode(data []byte) (err error)
}

// Request API for server application to handle incoming request.
type Request interface {
	// Get message from request packet.
	GetMessage() MessageMarshaller

	// Send a response message back to the client.
	Send(MessageMarshaller) error

	// Send error back to the client.
	SendError(error) error
}

// Server API for adminport
type Server interface {
	// Register a request message that shall be supported by adminport-server
	Register(msg MessageMarshaller) error

	// Unregister a previously registered request message
	Unregister(msg MessageMarshaller) error

	// Start server routine and wait for incoming request, Register() and
	// Unregister() APIs cannot be called after starting the server.
	Start() error

	// GetStatistics returns server statistics.
	GetStatistics() c.Statistics

	// Stop server routine. TODO: server routine shall quite only after
	// outstanding requests are serviced.
	Stop()
}

// Client API for a remote adminport
type Client interface {
	// Request shall post a `request` message to server, wait for response and
	// decode response into `response` argument. `response` argument must be a
	// pointer to an object implementing `MessageMarshaller` interface.
	Request(request, response MessageMarshaller) (err error)

	// RequestStats shall get Statistics
	RequestStats(response MessageMarshaller) (err error)
}


text:
.. _sensor:

Sensor Drivers
##############

The sensor subsystem exposes an API to uniformly access sensor devices.
Common operations are: reading data and executing code when specific
conditions are met.

Basic Operation
***************

Channels
========

Fundamentally, a channel is a quantity that a sensor device can measure.

Sensors can have multiple channels, either to represent different axes of
the same physical property (e.g. acceleration); or because they can measure
different properties altogether (ambient temperature, pressure and
humidity).  Complex sensors cover both cases, so a single device can expose
three acceleration channels and a temperature one.

It is imperative that all sensors that support a given channel express
results in the same unit of measurement.  The following is a list of all
supported channels, along with their description and units of measurement:

.. doxygenenum:: sensor_channel

Values
======

Sensor devices return results as :c:type:`struct sensor_value`.  This
representation avoids use of floating point values as they may not be
supported on certain setups.

.. doxygenstruct:: sensor_value
    :members:

Fetching Values
===============

Getting a reading from a sensor requires two operations.  First, an
application instructs the driver to fetch a sample of all its channels.
Then, individual channels may be read.  In the case of channels with
multiple axes, they can be read in a single operation by supplying
the corresponding :literal:`_XYZ` channel type and a buffer of 3
:c:type:`struct sensor_value` objects.  This approach ensures consistency
of channels between reads and efficiency of communication by issuing a
single transaction on the underlying bus.

Below is an example illustrating the usage of the BME280 sensor, which
measures ambient temperature and atmospheric pressure.  Note that
:c:func:`sensor_sample_fetch` is only called once, as it reads and
compensates data for both channels.

.. literalinclude:: ../../samples/sensor/bme280/src/main.c
   :language: c
   :lines: 12-
   :linenos:

The example assumes that the returned values have type :c:type:`struct
sensor_value`, which is the case for BME280.  A real application
supporting multiple sensors should inspect the :c:data:`type` field of
the :c:data:`temp` and :c:data:`press` values and use the other fields
of the structure accordingly.

Configuration and Attributes
****************************

Setting the communication bus and address is considered the most basic
configuration for sensor devices.  This setting is done at compile time, via
the configuration menu.  If the sensor supports interrupts, the interrupt
lines and triggering parameters described below are also configured at
compile time.

Alongside these communication parameters, sensor chips typically expose
multiple parameters that control the accuracy and frequency of measurement.
In compliance with Zephyr's design goals, most of these values are
statically configured at compile time.

However, certain parameters could require runtime configuration, for
example, threshold values for interrupts.  These values are configured via
attributes.  The example in the following section showcases a sensor with an
interrupt line that is triggered when the temperature crosses a threshold.
The threshold is configured at runtime using an attribute.

Triggers
********

:dfn:`Triggers` in Zephyr refer to the interrupt lines of the sensor chips.
Many sensor chips support one or more triggers. Some examples of triggers
include: new data is ready for reading, a channel value has crossed a
threshold, or the device has sensed motion.

To configure a trigger, an application needs to supply a :c:type:`struct
sensor_trigger` and a handler function.  The structure contains the trigger
type and the channel on which the trigger must be configured.

Because most sensors are connected via SPI or I2C busses, it is not possible
to communicate with them from the interrupt execution context.  The
execution of the trigger handler is deferred to a fiber, so that data
fetching operations are possible.  A driver can spawn its own fiber to fetch
data, thus ensuring minimum latency. Alternatively, multiple sensor drivers
can share a system-wide fiber. The shared fiber approach increases the
latency of handling interrupts but uses less memory. You can configure which
approach to follow for each driver. Most drivers can entirely disable
triggers resulting in a smaller footprint.

The following example contains a trigger fired whenever temperature crosses
the 26 degree Celsius threshold. It also samples the temperature every
second. A real application would ideally disable periodic sampling in the
interest of saving power. Since the application has direct access to the
kernel config symbols, no trigger is registered when triggering was disabled
by the driver's configuration.

.. literalinclude:: ../../samples/sensor/mcp9808/src/main.c
   :language: c
   :lines: 12-
   :linenos:


text:
package com.github.jnthnclt.os.lab.core.guts;

import com.github.jnthnclt.os.lab.core.guts.LABFiles.AppendedFile;
import java.io.File;
import org.testng.Assert;
import org.testng.annotations.Test;

public class LABFilesTest {
    @Test
    public void testAdd() throws Exception {

//        LABFiles labFiles = new LABFiles();
//
//        Assert.assertTrue(labFiles.isEmpty());
//        labFiles.delete(new File("foo"));
//        Assert.assertFalse(labFiles.isEmpty());
//
//        labFiles.take((appendedFiles, removedFiles) -> {
//            Assert.assertTrue(appendedFiles.isEmpty());
//            Assert.assertTrue(!removedFiles.isEmpty());
//            Assert.assertEquals(removedFiles.size(), 1);
//            return true;
//        });
//
//        Assert.assertTrue(labFiles.isEmpty());
//
//        labFiles.add(new byte[]{1},1234, new File("bar"));
//        Assert.assertFalse(labFiles.isEmpty());
//
//        labFiles.take((appendedFiles, removedFiles) -> {
//            Assert.assertTrue(!appendedFiles.isEmpty());
//            Assert.assertTrue(removedFiles.isEmpty());
//            Assert.assertEquals(appendedFiles.size(), 1);
//
//            AppendedFile remove = appendedFiles.remove();
//            Assert.assertEquals(remove.appendVersion, 1234);
//            return true;
//        });
    }

}


text:
'use strict';

const Watcher = require('./watcher').Watcher;

class BluetoothLEWatcher extends Watcher {
    constructor() {
        super('{bb7bb05e-5972-42b5-94fc-76eaa7084d49}', [
            "System.Devices.Aep.CanPair",
        ]);
    }
}

module.exports = BluetoothLEWatcher;


text:
<?php

declare(strict_types=1);

namespace Sonata\Component\Order;

use Sonata\Component\Delivery\BaseServiceDelivery;
use Sonata\Component\Payment\TransactionInterface;
use Sonata\Twig\Status\StatusClassRendererInterface;

/**
 * @author Hugo Briand <briand@ekino.com>
 */
class OrderStatusRenderer implements StatusClassRendererInterface
{
    public function handlesObject($object, $statusName = null)
    {
        return ($object instanceof OrderInterface || $object instanceof OrderElementInterface)
            && \in_array($statusName, ['delivery', 'payment', null], true);
    }

    public function getStatusClass($object, $statusName = null, $default = '')
    {
        switch ($statusName) {
            case 'delivery':
                switch ($object->getDeliveryStatus()) {
                    case BaseServiceDelivery::STATUS_COMPLETED:
                    case BaseServiceDelivery::STATUS_SENT:
                    case BaseServiceDelivery::STATUS_RETURNED:
                        return 'success';
                    case BaseServiceDelivery::STATUS_OPEN:
                    case BaseServiceDelivery::STATUS_PENDING:
                        return 'info';
                    default:
                        return $default;
                }

                break;
            case 'payment':
                switch ($object->getPaymentStatus()) {
                    case TransactionInterface::STATUS_OPEN:
                    case TransactionInterface::STATUS_VALIDATED:
                    case TransactionInterface::STATE_OK:
                        return 'success';
                    case TransactionInterface::STATUS_PENDING:
                        return 'info';
                    default:
                        return $default;
                }

                break;
            default:
                switch ($object->getStatus()) {
                    case OrderInterface::STATUS_OPEN:
                    case OrderInterface::STATUS_VALIDATED:
                        return 'success';
                    case OrderInterface::STATUS_PENDING:
                        return 'info';
                    default:
                        return $default;
                }

                break;
        }
    }
}


text:
package ru.nyrk.bootmvc.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import ru.nyrk.bootmvc.service.CityService;
import ru.nyrk.bootmvc.service.CityServiceImpl;

/**
 * @author sbt-nyrkov-oa
 * @ created 06.05.2016
 * @ $Author$
 * @ $Revision$
 */
@Controller
@RequestMapping("/city")
public class CityController {

    @Autowired
    private CityService cityService;

    @RequestMapping(path = {"/", "/list"})
    String list(Model model){
        model.addAttribute("citys", cityService.listAll());
        return "city/list";
    }

    @RequestMapping(path = {"/{name}"})
    String show(@PathVariable("name") String name, Model model){
        model.addAttribute("city", cityService.findByName(name));
        return "city/show";
    }
}


text:
class AssignmentsController < ApplicationController
  before_action :set_assignment, only: [:show, :edit, :update, :destroy]
  before_action :create_new_form, only: [:new, :create]
  before_action :create_edit_form, only: [:edit, :update]

  def index
    @assignments = Assignment.all
  end

  def show
  end

  def new
  end

  def edit
  end

  def create
    @assignment_form.submit(assignment_params)

    respond_to do |format|
      if @assignment_form.save
        format.html { redirect_to @assignment_form, notice: "Assignment: #{@assignment_form.name} was successfully created." }
      else
        format.html { render :new }
      end
    end
  end

  def update
    @assignment_form.submit(assignment_params)

    respond_to do |format|
      if @assignment_form.save
        format.html { redirect_to @assignment_form, notice: "Assignment: #{@assignment_form.name} was successfully updated." }
      else
        format.html { render :edit }
      end
    end
  end

  def destroy
    name = @assignment.name

    @assignment.destroy
    respond_to do |format|
      format.html { redirect_to assignments_url, notice: "Assignment: #{name} was successfully destroyed." }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_assignment
      @assignment = Assignment.find(params[:id])
    end

    def create_new_form
      assignment = Assignment.new
      @assignment_form = AssignmentForm.new(assignment)
    end

    def create_edit_form
      @assignment_form = AssignmentForm.new(@assignment)
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def assignment_params
      params.require(:assignment).permit(:name, tasks_attributes: [:id, :name, :_destroy])
    end
end


text:
package cmd

import (
	"fmt"
	"os"

	"github.com/spf13/cobra"
	"github.com/spf13/viper"

	"github.com/justjake/encabulator/rekey"
)

var mapNameToRekey = map[string](func() *rekey.KeyEnsurer){
	"yubikey": rekey.Yubikey,
	"goldkey": rekey.Goldkey,
	"id":      rekey.DefaultIdentity,
}
var names = keys(mapNameToRekey)

// rekeyCmd represents the rekey command
var rekeyCmd = &cobra.Command{
	Use:   "rekey",
	Short: "Ensure that your SSH keys are loaded into ssh-agent",
	Long: `Checks ssh-agent for the given types of keys. If those keys are not
loaded into ssh-agent, rekey will ask you to add them.

Rekey is handy when working with hardware tokens with short caching lifetimes.
Add rekey to your aliases to ensure your commands always have the SSH keys that
they need.
`,
	Example: `  encabulator rekey --type=id && ssh foo@example.com
  encabulator rekey && git pull`,
	ValidArgs: names,
	// check to see if arguments are copacetic
	PreRunE: func(cmd *cobra.Command, args []string) error {
		// no args
		if len(args) > 0 {
			return fmt.Errorf("Unknown arguments %v", args)
		}

		// type must be valid
		name := viper.GetString("rekey.Type")
		if _, ok := mapNameToRekey[name]; !ok {
			return fmt.Errorf("Unknown type %s.", name)
		}

		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		kill := viper.GetBool("rekey.KillAgent")
		name := viper.GetString("rekey.Type")

		loader := mapNameToRekey[name]()
		if kill {
			loader = rekey.EnsureRestartingAgent(loader)
		}

		err := loader.EnsureLoaded()
		if err != nil {
			fmt.Printf("Error: %s\n", err)
			os.Exit(1)
		}
	},
}

func keys(m map[string]func() *rekey.KeyEnsurer) []string {
	keys := make([]string, 0, len(m))
	for k := range m {
		keys = append(keys, k)
	}
	return keys
}

func init() {
	RootCmd.AddCommand(rekeyCmd)
	viper.SetDefault("rekey.Type", "yubikey")
	viper.SetDefault("rekey.Kill", true)

	// --type: type of flag
	rekeyCmd.Flags().StringP("type", "t", viper.GetString("rekey.Type"), fmt.Sprintf("Type of key to load. One of %v.", names))
	viper.BindPFlag("rekey.Type", rekeyCmd.Flags().Lookup("type"))

	// --kill: kill agent before attempting to load keys
	rekeyCmd.Flags().BoolP("kill", "k", viper.GetBool("rekey.Kill"), "Kill ssh-agent before loading any keys. This is useful on macOS.")
	viper.BindPFlag("rekey.KillAgent", rekeyCmd.Flags().Lookup("kill"))
}


text:
Mark L. McAuliffe

Mark L. McAuliffe

Computer Sciences Department
University of Wisconsin - Madison
1210 W. Dayton St.
Madison, WI 53706
mcauliff@cs.wisc.edu

 Research Interests:

Design and implementation of object-oriented database systems.

 Publications:

M.J. Carey, D.J. DeWitt, M.J. Franklin, N.E. Hall, M.L. McAuliffe,
J.F. Naughton, D.T. Schuh, M.H. Solomon, C.K. Tan, O.G. Tsatalos, S.J.
White and M.J. Zwilling.   Shoring
Up Persistent Applications.  Proc. ACM SIGMOD, May, 1994.

Mark L. McAuliffe and Marvin H. Solomon.   A
Trace-Based Simulation of Pointer Swizzling Techniques.
Proceedings of IEEE Data Engineering, March, 1995.

Mark L. McAuliffe, Michael J. Carey, and Marvin H. Solomon.   Towards
Effective and Efficient Free Space Management.
To appear: Proceedings of 1996 ACM SIGMOD Conference, June,
1996.