text:
'use strict';
var path = require('path'),
  open = require('opener');

module.exports = function (grunt){
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    dateString: new Date().toISOString().replace(/\..*Z/, ''),
    concurrent: {
      dev: {
        tasks: ['nodemon', 'node-inspector', 'watch'],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    nodemon: {
      dev: {
        script: 'bin/www',
        options: {
          nodeArgs: ['--debug'],
          ignore: ['node_modules/**', 'public/**'],
          env: {
            PORT: '3000'
          },
          // omit this property if you aren't serving HTML files and
          // don't want to open a browser tab on start
          callback: function (nodemon){
            nodemon.on('log', function (event){
              console.log(event.colour);
            });

            // opens browser on initial server start
            nodemon.on('config:update', function (){
              // Delay before server listens on port
              //setTimeout(function () {
              //  open('http://127.0.0.1:3000');
              //}, 1000);
            });

            // refreshes browser when server reboots
            nodemon.on('restart', function (){
              // Delay before server listens on port
              setTimeout(function (){
                require('fs').writeFileSync('.rebooted', 'rebooted');
              }, 1000);
            });
          }
        }
      }
    },
    'node-inspector': {
      custom: {
        options: {
          'web-port': 8080,
          'web-host': '127.0.0.1',
          'debug-port': 5858,
          'save-live-edit': true,
          'no-preload': false,
          'stack-trace-limit': 50,
          'hidden': ['node_modules']
        }
      }
    },
    watch: {
      js_html: {
        files: ['public/**'],
        options: {
          livereload: true
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-concurrent');
  grunt.loadNpmTasks('grunt-nodemon');
  grunt.loadNpmTasks('grunt-node-inspector');

  grunt.registerTask('default', ['concurrent']);
};


text:
package org.fastcatsearch.http.action.management.servers;

import java.util.List;

import org.fastcatsearch.cluster.ClusterUtils;
import org.fastcatsearch.cluster.Node;
import org.fastcatsearch.cluster.NodeService;
import org.fastcatsearch.control.JobService;
import org.fastcatsearch.env.SettingManager;
import org.fastcatsearch.http.ActionAuthority;
import org.fastcatsearch.http.ActionAuthorityLevel;
import org.fastcatsearch.http.ActionMapping;
import org.fastcatsearch.http.action.ActionRequest;
import org.fastcatsearch.http.action.ActionResponse;
import org.fastcatsearch.http.action.AuthAction;
import org.fastcatsearch.job.cluster.NodeListUpdateJob;
import org.fastcatsearch.service.ServiceManager;
import org.fastcatsearch.settings.NodeListSettings;
import org.fastcatsearch.settings.NodeListSettings.NodeSettings;
import org.fastcatsearch.util.ResponseWriter;

@ActionMapping(value = "/management/servers/update", authority = ActionAuthority.Servers, authorityLevel = ActionAuthorityLevel.WRITABLE)
public class UpdateServerInfoAction extends AuthAction {

	@Override
	public void doAuthAction(ActionRequest request, ActionResponse response) throws Exception {

		boolean isSuccess = false;

		try {

			String mode = request.getParameter("mode");

			int serverIndex = request.getIntParameter("serverIndex",0);
			String nodeId = request.getParameter("id");
			String name = request.getParameter("name");
			String address = request.getParameter("host");
			String dataAddress = request.getParameter("dataHost");
			int port = request.getIntParameter("port",0);
			boolean enable = "true".equals(request.getParameter("enable"));

			SettingManager settingManager = environment.settingManager();
			NodeListSettings nodeListSettings = settingManager.getNodeListSettings();
			List<NodeSettings> nodeSettingList = nodeListSettings.getNodeList();

			NodeSettings settings =  new NodeSettings();
			settings.setId(nodeId);
			settings.setName(name);
			settings.setAddress(address);
			settings.setDataAddress(dataAddress);
			settings.setPort(port);
			settings.setEnabled(enable);

			if(serverIndex!=-1) {
				//런타임상황의 노드번호와 세팅의노드번호가 다름.
				//따라서 노드들을 모두 순회 하면서 아이디매칭이 필요.
				serverIndex = nodeListSettings.findNodeById(nodeId);
			}

			if(serverIndex==-1) {
				nodeSettingList.add(settings);
			} else {
				nodeSettingList.set(serverIndex,settings);
			}

			if("delete".equals(mode)) {
				nodeSettingList.remove(serverIndex);
			}

			JobService jobService = JobService.getInstance();

			NodeListUpdateJob job = new NodeListUpdateJob();
			job.setArgs(nodeListSettings);
			jobService.offer(job).take();

			NodeService nodeService = ServiceManager.getInstance().getService(NodeService.class);
			List<Node> nodeList = nodeService.getNodeArrayList();

			ClusterUtils.sendJobToNodeList(job, nodeService, nodeList, true);

			isSuccess = true;

		} catch (Exception e) {
			logger.error("",e);
			isSuccess = false;
		}

		ResponseWriter responseWriter = getDefaultResponseWriter(response.getWriter());
		responseWriter.object();
		responseWriter.key("success").value(isSuccess);
		responseWriter.endObject();
		responseWriter.done();
	}
}

redpajama_set_name: RedPajamaGithub


text: This directory will remain empty until log files are written to by services within the virtual machine.


text:
ExtensionsToolbarButton::ExtensionsToolbarButton(
    Browser* browser,
    ExtensionsToolbarContainer* extensions_container)
    : ToolbarButton(this),
      browser_(browser),
      extensions_container_(extensions_container) {
  std::unique_ptr<views::MenuButtonController> menu_button_controller =
      std::make_unique<views::MenuButtonController>(
          this, this,
          std::make_unique<views::Button::DefaultButtonControllerDelegate>(
              this));
  menu_button_controller_ = menu_button_controller.get();
  SetButtonController(std::move(menu_button_controller));
  SetTooltipText(l10n_util::GetStringUTF16(IDS_TOOLTIP_EXTENSIONS_BUTTON));
  button_controller()->set_notify_action(
      views::ButtonController::NotifyAction::kOnPress);
  GetViewAccessibility().OverrideHasPopup(ax::mojom::HasPopup::kMenu);
}

ExtensionsToolbarButton::~ExtensionsToolbarButton() = default;

void ExtensionsToolbarButton::UpdateIcon() {
  SetImage(views::Button::STATE_NORMAL,
           gfx::CreateVectorIcon(vector_icons::kExtensionIcon, GetIconSize(),
                                 extensions_container_->GetIconColor()));
}

gfx::Size ExtensionsToolbarButton::CalculatePreferredSize() const {
  return extensions_container_->GetToolbarActionSize();
}

gfx::Size ExtensionsToolbarButton::GetMinimumSize() const {
  const int icon_size = GetIconSize();
  gfx::Size min_size(icon_size, icon_size);
  min_size.SetToMin(GetPreferredSize());
  return min_size;
}

void ExtensionsToolbarButton::OnBoundsChanged(
    const gfx::Rect& previous_bounds) {
  // Because this button is in a container and doesn't necessarily take up the
  // whole height of the toolbar, the standard insets calculation does not
  // apply. Instead calculate the insets as the difference between the icon
  // size and the preferred button size.

  const gfx::Size current_size = size();
  if (current_size.IsEmpty())
    return;
  const int icon_size = GetIconSize();
  gfx::Insets new_insets;
  if (icon_size < current_size.width()) {
    const int diff = current_size.width() - icon_size;
    new_insets.set_left(diff / 2);
    new_insets.set_right((diff + 1) / 2);
  }
  if (icon_size < current_size.height()) {
    const int diff = current_size.height() - icon_size;
    new_insets.set_top(diff / 2);
    new_insets.set_bottom((diff + 1) / 2);
  }
  SetLayoutInsets(new_insets);
}

const char* ExtensionsToolbarButton::GetClassName() const {
  return "ExtensionsToolbarButton";
}

void ExtensionsToolbarButton::ButtonPressed(views::Button* sender,
                                            const ui::Event& event) {
  if (ExtensionsMenuView::IsShowing()) {
    ExtensionsMenuView::Hide();
    return;
  }
  pressed_lock_ = menu_button_controller_->TakeLock();
  base::RecordAction(base::UserMetricsAction("Extensions.Toolbar.MenuOpened"));
  ExtensionsMenuView::ShowBubble(this, browser_, extensions_container_)
      ->AddObserver(this);
}

void ExtensionsToolbarButton::OnWidgetDestroying(views::Widget* widget) {
  widget->RemoveObserver(this);
  pressed_lock_.reset();
}

int ExtensionsToolbarButton::GetIconSize() const {
  const bool touch_ui = ui::TouchUiController::Get()->touch_ui();
  return (touch_ui && !browser_->app_controller()) ? kDefaultTouchableIconSize
                                                   : kDefaultIconSize;
}


text:
package wherehows.models.table;

public class DatasetComment {

  public int id;
  public int datasetId;
  public String text;
  public String authorName;
  public String authorUserName;
  public String authorEmail;
  public long created;
  public long modified;
  public String type;
  public Boolean isAuthor;
}


text:
/*
 * @test
 * @bug 6641309
 * @summary Wrong Cookie separator used in HttpURLConnection
 */

import java.net.*;
import java.util.*;
import java.io.*;
import com.sun.net.httpserver.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ExecutorService;

public class B6641309
{
    com.sun.net.httpserver.HttpServer httpServer;
    ExecutorService executorService;

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

    public B6641309()
    {
        try {
            startHttpServer();
            doClient();
        } catch (IOException ioe) {
            System.err.println(ioe);
        }
    }

    void doClient() {
        CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));
        try {
            InetSocketAddress address = httpServer.getAddress();

            // GET Request
            URL url = new URL("http://localhost:" + address.getPort() + "/test/");
            CookieHandler ch = CookieHandler.getDefault();
            Map<String,List<String>> header = new HashMap<String,List<String>>();
            List<String> values = new LinkedList<String>();
            values.add("Test1Cookie=TEST1; path=/test/");
            values.add("Test2Cookie=TEST2; path=/test/");
            header.put("Set-Cookie", values);

            // preload the CookieHandler with a cookie for our URL
            // so that it will be sent during the first request
            ch.put(url.toURI(), header);
            HttpURLConnection uc = (HttpURLConnection)url.openConnection();
            int resp = uc.getResponseCode();
            if (resp != 200)
                throw new RuntimeException("Failed: Response code from GET is not 200");

            System.out.println("Response code from GET = 200 OK");

        } catch (IOException e) {
            e.printStackTrace();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        } finally {
            httpServer.stop(1);
            executorService.shutdown();
        }
    }

    /**
     * Http Server
     */
    public void startHttpServer() throws IOException {
        httpServer = com.sun.net.httpserver.HttpServer.create(new InetSocketAddress(0), 0);

        // create HttpServer context
        HttpContext ctx = httpServer.createContext("/test/", new MyHandler());

        executorService = Executors.newCachedThreadPool();
        httpServer.setExecutor(executorService);
        httpServer.start();
    }

    class MyHandler implements HttpHandler {
        public void handle(HttpExchange t) throws IOException {
            InputStream is = t.getRequestBody();
            Headers reqHeaders = t.getRequestHeaders();
            int i = 0;
            // Read till end of stream
            do {
                i = is.read();
            } while (i != -1);
            is.close();

            List<String> cookies = reqHeaders.get("Cookie");
            if (cookies != null) {
                for (String str : cookies) {
                    // The separator between the 2 cookies should be
                    // a semi-colon AND a space
                    if (str.equals("Test1Cookie=TEST1; Test2Cookie=TEST2"))
                        t.sendResponseHeaders(200, -1);
                }
            }
            t.sendResponseHeaders(400, -1);
            t.close();
        }
    }
}


text:
package com.simpligility.maven.plugins.android.sample;

import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecutionResult;
import io.takari.maven.testing.executor.MavenRuntime;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;

import java.io.File;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.simpligility.maven.plugins.android.PluginInfo;

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions({"3.2.3"})
public class BuildConfigInjectionSampleIT {

  @Rule
  public final TestResources resources = new TestResources();

  public final MavenRuntime mavenRuntime;

  public BuildConfigInjectionSampleIT(MavenRuntimeBuilder builder) throws Exception {
    this.mavenRuntime = builder.build();
  }

  @Test
  public void buildDeployAndRun() throws Exception {
    File basedir = resources.getBasedir( "buildConfigInjection" );
    MavenExecutionResult result = mavenRuntime
          .forProject(basedir)
          .execute( "clean", PluginInfo.getQualifiedGoal( "undeploy" ),
              "install", PluginInfo.getQualifiedGoal( "deploy" ),
              PluginInfo.getQualifiedGoal( "run" ) );

    result.assertErrorFreeLog();
    result.assertLogText( "Successfully installed" );
    result.assertLogText( "Attempting to start com.simpligility.android.helloflashlightinjection/com.simpligility.android.helloflashlightinjection.HelloFlashlight" );
  }

}


text:
package com.example.conor.a1rmtracker;

import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

/**
 * Generic class for managing tables
 * Created by Conor on 27/11/16.
 */
public abstract class TableManager {
    protected SQLiteDatabase db;
    protected DatabaseHelper dbHelper;

    public TableManager(Context ctx){
        dbHelper = new DatabaseHelper(ctx);
    }

    public TableManager openWriteable() throws SQLException{
        db = dbHelper.getWritableDatabase();
        return this;
    }

    public TableManager openReadable() throws SQLException{
        db = dbHelper.getReadableDatabase();
        return this;
    }

    public void close() throws SQLException{
        dbHelper.close();
    }
}


text:
"use strict"

var GPS = (function(){

    var instance;

    return function Construct_singletone () {
        if (instance) {
            return instance;
        }
        if (this && this.constructor === Construct_singletone) {
            instance = this;
        } else {
            return new Construct_singletone();
        }

    window.opt = new Options();

    this.map;

    this.startGPS = function(){
        // Select firs map, it`s always exist
        this.map = mapsInstance[0].map;
        this.map.locate();
     }

    this.onGPS = function(e){
        // console.log(e);
        var gpsVals = {
            "latlng": [e.latlng.lat, e.latlng.lng],
            "accuracy": e.accuracy,
            "altitude": e.altitude,
            "altitudeAccuracy": e.altitudeAccuracy,
            "heading": e.heading,
            "speed": e.speed,
            "timestamp": e.timestamp,
        }
        opt.setOption("gps", "gpsData", gpsVals);
     }

    this.errorGPS = function(e){
        console.log(e);
        noty({text: loc("gps:error"), type:"alert"});
     }

    this.stopGPS = function(){
        if (this.map){
            this.map.stopLocate();
        }
     }

 }}());

var Locations = (function(){

    var instance;

    return function Construct_singletone () {
        if (instance) {
            return instance;
        }
        if (this && this.constructor === Construct_singletone) {
            instance = this;
        } else {
            return new Construct_singletone();
        }

    window.opt = new Options();

    this.createForm = function(){

     }

 }}());

var FastMoving = (function(){

    var instance;

    return function Construct_singletone () {
        if (instance) {
            return instance;
        }
        if (this && this.constructor === Construct_singletone) {
            instance = this;
        } else {
            return new Construct_singletone();
        }

    var _this = this;

    window.opt = new Options();

    this.moveToPoint = function(pointId, pointData){
        console.log(pointId, pointData)
        mapsInstance[0].moveAllMaps(pointData.latlng);
     }

    this.moveToPointMenu = function(){
        var arr = opt._createMenuArrFromBase("points");
        console.log(arr)
        $.each(arr, function(g, group){
            $.each(group, function(i, v){
                arr[g][i] = opt.getOption("points", i);
                arr[g][i].callback = function(){_this.moveToPoint(i, arr[g][i])};
            })
        })
        var menu = new AccordionMenu(arr);
     }

    this.updatePoint = function(data) {
        if (opt.getOption("points", data.id)){
            if (!confirm(loc("editPoints:confirmRewritePoint", data.id))) { return }
        }

        var pointVals = opt.getOption("points", data.id) || {};

        $.each(data, function(i, v){
            pointVals[i] = v;
        })

        pointVals.latlng = pointVals.latlng.split(",");

        opt.setOption("points", data.id, pointVals)
        console.log(data.id, opt.getOption("points", data.id));
     }

    this.deletePoint = function(data) {
        if (opt.getOption("points", data.id)){
            if (confirm(loc("editPoints:confirmDeletePoint", data.id))) {
                opt.deleteOption("points", data.id);
                console.log(data.id + "deleted")
            }
        }
     }

    this.editPoint = function(pointId, pointData){

        pointId = typeof pointId === "string" ? pointId : "";
        var vals = pointData ? pointData : opt.getOption("points", pointId) ? opt.getOption("points", pointId) : {};
        vals.id = vals.id ? vals.id : pointId;

        // Groups suggestions
        var points = opt.getOption("points");
        var groups = $.unique($.pluck(points, "group"));
        groups.sort();

        var arr = [
            { "type": "formEditPoint_id",        "name": "id", "val": vals.id || 10000*Math.random()|0, "loc": "editPoints:formEditPoint_id", "description": "id"},
            { "type": "formEditPoint_title",     "name": "title", "val": vals.title, "loc": "editPoints:formEditPoint_title", "description": "title" },
            { "type": "formEditPoint_latlng",    "name": "latlng", "val": vals.latlng || opt.getOption("current", "mapCenterLatLng"), "loc": "editPoints:formEditPoint_latlng", "description": "latlng" },
            { "type": "formEditPoint_group",     "name": "group", "val": vals.group, "options": groups, "loc": "editPoints:formEditPoint_group", "description": "group" },
            { "type": "formEditPoint_submit", "loc": "editPoints:formEditPoint_submit", callback: function(form){
                if (!form.checkFormFlag){
                    alert(loc("editPoints:errorCheckForm"));
                    return;
                } else {
                    fastmoving.updatePoint(form.data);
                    form.hideForm();
                }
            }},
            { "type": "formEditPoint_delete", "loc": "editPoints:formEditPoint_delete", callback: function(form){
                fastmoving.deletePoint(form.data);
                form.hideForm();
            }},
            { "type": "formEditPoint_cancel", "loc": "editPoints:formEditPoint_cancel", callback: function(form){
                form.hideForm();
            }},
        ];

        console.log(arr)

        var eform = new FoundationForm(arr, "formEditPoint");
     }

    this.editPointMenu = function(){
        var arr = opt._createMenuArrFromBase("points");
        console.log(arr)
        $.each(arr, function(g, group){
            $.each(group, function(i, v){
                arr[g][i] = opt.getOption("points", i);
                arr[g][i].callback = function(){_this.editPoint(i, arr[g][i])};
            })
        })
        var menu = new AccordionMenu(arr);
     }

 }}());


text:
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to handle dynamic and static libraries in Linux)
[#]: via: (https://opensource.com/article/20/6/linux-libraries)
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)

How to handle dynamic and static libraries in Linux
======
Knowing how Linux uses libraries, including the difference between
static and dynamic linking, can help you fix dependency problems.
![Hand putting a Linux file folder into a drawer][1]

Linux, in a way, is a series of static and dynamic libraries that depend on each other. For new users of Linux-based systems, the whole handling of libraries can be a mystery. But with experience, the massive amount of shared code built into the operating system can be an advantage when writing new applications.

To help you get in touch with this topic, I prepared a small [application example][2] that shows the most common methods that work on common Linux distributions (these have not been tested on other systems). To follow along with this hands-on tutorial using the example application, open a command prompt and type:

```
$ git clone <https://github.com/hANSIc99/library\_sample>
$ cd library_sample/
$ make
cc -c main.c -Wall -Werror
cc -c libmy_static_a.c -o libmy_static_a.o -Wall -Werror
cc -c libmy_static_b.c -o libmy_static_b.o -Wall -Werror
ar -rsv libmy_static.a libmy_static_a.o libmy_static_b.o
ar: creating libmy_static.a
a - libmy_static_a.o
a - libmy_static_b.o
cc -c -fPIC libmy_shared.c -o libmy_shared.o
cc -shared -o libmy_shared.so libmy_shared.o
$ make clean
rm *.o
```

After executing these commands, these files should be added to the directory (run `ls` to see them):

```
my_app
libmy_static.a
libmy_shared.so
```

### About static linking

When your application links against a static library, the library's code becomes part of the resulting executable. This is performed only once at linking time, and these static libraries usually end with a `.a` extension.

A static library is an archive ([ar][3]) of object files. The object files are usually in the ELF format. ELF is short for [Executable and Linkable Format][4], which is compatible with many operating systems.

The output of the `file` command tells you that the static library `libmy_static.a` is the `ar` archive type:

```
$ file libmy_static.a
libmy_static.a: current ar archive
```

With `ar -t`, you can look into this archive; it shows two object files:

```
$ ar -t libmy_static.a
libmy_static_a.o
libmy_static_b.o
```

You can extract the archive's files with `ar -x <archive-file>`. The extracted files are object files in ELF format:

```
$ ar -x libmy_static.a
$ file libmy_static_a.o
libmy_static_a.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
```

### About dynamic linking

Dynamic linking means the use of shared libraries. Shared libraries usually end with `.so` (short for "shared object").

Shared libraries are the most common way to manage dependencies on Linux systems. These shared resources are loaded into memory before the application starts, and when several processes require the same library, it will be loaded only once on the system. This feature saves on memory usage by the application.

Another thing to note is that when a bug is fixed in a shared library, every application that references this library will profit from it. This also means that if the bug remains undetected, each referencing application will suffer from it (if the application uses the affected parts).

It can be very hard for beginners when an application requires a specific version of the library, but the linker only knows the location of an incompatible version. In this case, you must help the linker find the path to the correct version.

Although this is not an everyday issue, understanding dynamic linking will surely help you in fixing such problems.

Fortunately, the mechanics for this are quite straightforward.

To detect which libraries are required for an application to start, you can use `ldd`, which will print out the shared libraries used by a given file:

```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffd1299c000)
        libmy_shared.so => not found
        libc.so.6 => /lib64/libc.so.6 (0x00007f56b869b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f56b8881000)
```

Note that the library `libmy_shared.so` is part of the repository but is not found. This is because the dynamic linker, which is responsible for loading all dependencies into memory before executing the application, cannot find this library in the standard locations it searches.

Errors associated with linkers finding incompatible versions of common libraries (like `bzip2`, for example) can be quite confusing for a new user. One way around this is to add the repository folder to the environment variable `LD_LIBRARY_PATH` to tell the linker where to look for the correct version. In this case, the right version is in this folder, so you can export it:

```
$ LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH
```

Now the dynamic linker knows where to find the library, and the application can be executed. You can rerun `ldd` to invoke the dynamic linker, which inspects the application's dependencies and loads them into memory. The memory address is shown after the object path:

```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffd385f7000)
        libmy_shared.so => /home/stephan/library_sample/libmy_shared.so (0x00007f3fad401000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f3fad21d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3fad408000)
```

To find out which linker is invoked, you can use `file`:

```
$ file my_app
my_app: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=26c677b771122b4c99f0fd9ee001e6c743550fa6, for GNU/Linux 3.2.0, not stripped
```

The linker `/lib64/ld-linux-x86–64.so.2` is a symbolic link to `ld-2.30.so`, which is the default linker for my Linux distribution:

```
$ file /lib64/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2: symbolic link to ld-2.31.so
```

Looking back to the output of `ldd`, you can also see (next to `libmy_shared.so`) that each dependency ends with a number (e.g., `/lib64/libc.so.6`). The usual naming scheme of shared objects is:

```
`**lib** XYZ.so **.<MAJOR>** . **<MINOR>**`
```

On my system, `libc.so.6` is also a symbolic link to the shared object `libc-2.30.so` in the same folder:

```
$ file /lib64/libc.so.6
/lib64/libc.so.6: symbolic link to libc-2.31.so
```

If you are facing the issue that an application will not start because the loaded library has the wrong version, it is very likely that you can fix this issue by inspecting and rearranging the symbolic links or specifying the correct search path (see "The dynamic loader: ld.so" below).

For more information, look on the [`ldd` man page][5].

#### Dynamic loading

Dynamic loading means that a library (e.g., a `.so` file) is loaded during a program's runtime. This is done using a certain programming scheme.

Dynamic loading is applied when an application uses plugins that can be modified during runtime.

See the [`dlopen` man page][6] for more information.

#### The dynamic loader: ld.so

On Linux, you mostly are dealing with shared objects, so there must be a mechanism that detects an application's dependencies and loads them into memory.

`ld.so` looks for shared objects in these places in the following order:

  1. The relative or absolute path in the application (hardcoded with the `-rpath` compiler option on GCC)
  2. In the environment variable `LD_LIBRARY_PATH`
  3. In the file `/etc/ld.so.cache`

Keep in mind that adding a library to the systems library archive `/usr/lib64` requires administrator privileges. You could copy `libmy_shared.so` manually to the library archive and make the application work without setting `LD_LIBRARY_PATH`:

```
unset LD_LIBRARY_PATH
sudo cp libmy_shared.so /usr/lib64/
```

When you run `ldd`, you can see the path to the library archive shows up now:

```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffe82fab000)
        libmy_shared.so => /lib64/libmy_shared.so (0x00007f0a963e0000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f0a96216000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0a96401000)
```

### Customize the shared library at compile time

If you want your application to use your shared libraries, you can specify an absolute or relative path during compile time.

Modify the makefile (line 10) and recompile the program by invoking `make -B` . Then, the output of `ldd` shows `libmy_shared.so` is listed with its absolute path.

Change this:

```
`CFLAGS =-Wall -Werror -Wl,-rpath,$(shell pwd)`
```

To this (be sure to edit the username):

```
`CFLAGS =/home/stephan/library_sample/libmy_shared.so`
```

Then recompile:

```
`$ make`
```

Confirm it is using the absolute path you set, which you can see on line 2 of the output:

```
$ ldd my_app
    linux-vdso.so.1 (0x00007ffe143ed000)
        libmy_shared.so => /lib64/libmy_shared.so (0x00007fe50926d000)
        /home/stephan/library_sample/libmy_shared.so (0x00007fe509268000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe50909e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe50928e000)
```

This is a good example, but how would this work if you were making a library for others to use? New library locations can be registered by writing them to `/etc/ld.so.conf` or creating a `<library-name>.conf` file containing the location under `/etc/ld.so.conf.d/`. Afterward, `ldconfig` must be executed to rewrite the `ld.so.cache` file. This step is sometimes necessary after you install a program that brings some special shared libraries with it.

See the [`ld.so` man page][7] for more information.

### How to handle multiple architectures

Usually, there are different libraries for the 32-bit and 64-bit versions of applications. The following list shows their standard locations for different Linux distributions:

**Red Hat family**

  * 32 bit: `/usr/lib`
  * 64 bit: `/usr/lib64`

**Debian family**

  * 32 bit: `/usr/lib/i386-linux-gnu`
  * 64 bit: `/usr/lib/x86_64-linux-gnu`

**Arch Linux family**

  * 32 bit: `/usr/lib32`
  * 64 bit: `/usr/lib64`

[**FreeBSD**][8] (technical not a Linux distribution)

  * 32bit: `/usr/lib32`
  * 64bit: `/usr/lib`

Knowing where to look for these key libraries can make broken library links a problem of the past.

While it may be confusing at first, understanding dependency management in Linux libraries is a way to feel in control of the operating system. Run through these steps with other applications to become familiar with common libraries, and continue to learn how to fix any library challenges that could come up along your way.

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

via: https://opensource.com/article/20/6/linux-libraries

作者:[Stephan Avenwedde][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)

本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

[a]: https://opensource.com/users/hansic99
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://github.com/hANSIc99/library_sample
[3]: https://en.wikipedia.org/wiki/Ar_%28Unix%29
[4]: https://linuxhint.com/understanding_elf_file_format/
[5]: https://www.man7.org/linux/man-pages/man1/ldd.1.html
[6]: https://www.man7.org/linux/man-pages/man3/dlopen.3.html
[7]: https://www.man7.org/linux/man-pages/man8/ld.so.8.html
[8]: https://opensource.com/article/20/5/furybsd-linux


text:
package org.drools.verifier.api.reporting;

import java.util.Set;

public class ValueForActionIsSetTwiceIssue
        extends Issue {

    private String firstItem;
    private String secondItem;

    public ValueForActionIsSetTwiceIssue() {
    }

    public ValueForActionIsSetTwiceIssue(final Severity severity,
                                         final CheckType checkType,
                                         final String firstItem,
                                         final String secondItem,
                                         final Set<Integer> rowNumbers) {
        super(severity,
              checkType,
              rowNumbers);

        this.firstItem = firstItem;
        this.secondItem = secondItem;
    }

    public void setFirstItem(final String firstItem) {
        this.firstItem = firstItem;
    }

    public void setSecondItem(final String secondItem) {
        this.secondItem = secondItem;
    }

    public String getFirstItem() {
        return firstItem;
    }

    public String getSecondItem() {
        return secondItem;
    }
}


text:
DELAY=5
PRIORITY=-19

source /mnt/context.sh

cp -f /mnt/onegate_publisher.sh /root/onegate_publisher.sh
chmod +x /root/onegate_publisher.sh
cd /root
nohup nice -n $PRIORITY /root/onegate_publisher.sh $ONEGATE_ENDPOINT/vm `cat /mnt/token.txt` $VMID $DELAY > /dev/null 2> /dev/null &


text:
require 'bulutfon_sdk/rest/base_request'

module BulutfonSDK
  module REST
    class Group < BaseRequest

      def initialize(*args)
        super(*args)
        @resource = 'groups'
      end

      def all( params = {} )
        prepare_request( 'get', @resource,params)
      end

      def get( id )
        prepare_request( 'get', "#{@resource}/#{id}")
      end

    end
  end
end


text:
Daemon threads have the problem that they are not stack-managed by the
JVM at all. This means that:

  * The threads are instantly aborted at JVM shutdown.
  * `finally` blocks are completely ignored and not executed.
  * JVM shutdown hooks registered on the thread will not be executed.

However, with normal threads and `threadPool.shutdownNow()`, the
following happens:

  * The interrupted flag is set on all the threads in the pool, which
    means that the next blocking operation throws
    `InterruptedException` on all the threads. The thread gets a
    chance to do orderly clean-up before it re-throws the
    `InterruptedException` or re-sets the interrupted flag.
  * When the exception propagates up the stack, all the `finally`
    blocks are executed.
  * Shutdown hooks will be run that are registered on the thread,

In other words, with the following code, `"Hello, World!"` is never
printed:

```java
public class Main {
  public static void main(String... args) {
    Thread t = new Thread(new MyRunnable());
    t.setDaemon(true);
    t.start();
    // Note: program ends, which means that the daemon thread `t`
    // will be stopped
  }
}

class MyRunnable implements Runnable {
  @Override
  public void run() {
    try {
      Thread.sleep(10000000);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    } finally {
      System.out.println("Hello, World!");
    }
  }
}
```

This is not so bad if your background threads only do things like
logging or setting flags on other threads. However, you may need to
do things like log reporting, connection pooling,
and other such things that rely on sane shutdown behavior (closing
files and sockets, sending "disconnect" messages, reporting leader
re-election), and that shutdown behavior never happens if you use
daemon threads.

Sources:

  * <http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html>
  * <http://stackoverflow.com/questions/8663107/how-does-the-jvm-terminate-daemon-threads-or-how-to-write-daemon-threads-that-t>


text:
import collection from './collections/KbCollection';
import field from './fields/KbField';
import form from './forms/KbForm';
import suppliers from './data/KbSupplier';
import view from './views/KbView';

const kb = {
  collection,
  field,
  form,
  suppliers,
  view
};

export default kb;


text:
<?php
namespace Ice\Action;

use Ice\App;
use Ice\Core\Action;
use Ice\Helper\Directory;
use Ice\Render\Php;

class Vendor_CKEditor_Browse extends Action
{

    protected static function config()
    {
        return [
            'access' => ['roles' => ['ROLE_ICE_ADMIN'], 'request' => null, 'env' => null, 'message' => 'Action: Access denied!'],
            'cache' => ['ttl' => -1, 'count' => 1000],
            'actions' => [],
            'input' => [],
            'output' => []
        ];
    }

    public function run(array $input)
    {

        $files = [];
        foreach (new \DirectoryIterator(Directory::get(MODULE_DIR . '/web/ckeditor/')) as $fileInfo) {
            if ($fileInfo->isDot()) continue;
            $files[] = '/ckeditor/' . $fileInfo->getFilename();
        }
        $view = Php::getInstance()->fetch('Ice\Action\Vendor_CKEditor_Browse', ['files' => $files]);
        App::getResponse()->setContent($view);

    }
}


text:
gocciola
========

NLTE radiative transfer in plane-parallel and spherical geometry

This is the code I developed during my PhD.


text:
<?php

use yii\db\Migration;
use app\models\Airline;

class m160627_081721_adding_demo_airlines extends Migration
{
    public function up()
    {
        $demoAirline1 = new Airline();
        $demoAirline1->name = 'easyJet';
        $demoAirline1->icao = 'EZY';
        $demoAirline1->save();

        $demoAirline2 = new Airline();
        $demoAirline2->name = 'Ryanair';
        $demoAirline2->icao = 'RYR';
        $demoAirline2->save();

        $demoAirline3 = new Airline();
        $demoAirline3->name = 'Germanwings';
        $demoAirline3->icao = 'GWI';
        $demoAirline3->save();
    }

    public function down()
    {
        $demoAirline1 = Airline::findByICAO('EZY');
        $demoAirline1->delete();
        $demoAirline2 = Airline::findByICAO('RYR');
        $demoAirline2->delete();
        $demoAirline3 = Airline::findByICAO('GWI');
        $demoAirline3->delete();
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>Angular Timer, a simple, inter-operable AngularJS directive</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
    <link href="bower_components/bootstrap/docs/assets/css/bootstrap.css" rel="stylesheet"/>
    <link href="bower_components/bootstrap/docs/assets/css/bootstrap-responsive.css" rel="stylesheet"/>
    <link href="docs/css/docs.css" rel="stylesheet"/>
    <link href="docs/css/prettify.css" rel="stylesheet"/>

<ng-include src="'navbar.html'" onload='linkAnchors();'></ng-include>

        Introduction

        Directives in AngularJS is a powerful way of building
        reusable UI components. This simple project will serve as a sample/reference implementation
        demonstrating its flexibilities by making it inter-operable across runtime (AngularJS, plain simple
        JavaScript & jQuery)

        For basic understanding of how directives work in AngularJS, please head to this developer guide.

        Basic Example

            This simple directive <timer /> will start the timer with the default option of
            ticking every 1 millisecond

            <timer></timer>

        <button class="btn" onclick="startTimer('basic-timer')" type="button">Start</button>
        <button class="btn" onclick="stopTimer('basic-timer')" type="button">Stop</button>

        Timer with hours, minutes & seconds

            This markup <timer interval="1000">{{hours}} hours, {{minutes}}
            minutes, {{seconds}} seconds.</timer> will run the clock timer ticking every second

            <timer interval="1000">{{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>

        <button class="btn" onclick="stopResumeTimer('clock-timer', this)" type="button">Stop</button>

        Timer with leading zero

            This markup <timer interval="1000">{{hhours}} hours, {{mminutes}}
            minutes, {{sseconds}} seconds.</timer> will run the clock timer ticking every second with an additional zero at the beginning if unit is smaller than 10

            <timer interval="1000">{{hhours}} hours, {{mminutes}} minutes, {{sseconds}} seconds.</timer>

        <button class="btn" onclick="stopResumeTimer('clock-timer-leading-zero', this)" type="button">Stop</button>

        Timer initialised with some predefined start time.

            Following is the timer clock setting for the days, hours, minutes & seconds elapsed since January 1, 2013 (GMT-6)

(01 Jan 2013 06:00:00 GMT = 1357020000000 milliseconds)

            <timer start-time="1357020000000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>

            <timer start-time="1357020000000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>

        <button class="btn" onclick="stopResumeTimer('timer-with-start-time', this)" type="button">Stop</button>

        Timer initialised with some predefined end time.

            Following is the countdown timer setting for the days, hours, minutes & seconds to January 1, 2015 (GMT-6)

(01 Jan 2015 06:00:00 GMT = 1420070400000 milliseconds)

            <timer end-time="1420070400000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>

            <timer end-time="1420070400000">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>

        Progressbar Timer

            Timer directive along with Twitter Bootstrap's Progressbar will set the timer
            on Progressbar control.

        <timer interval="1000"><div class="progress
            progress-striped active"> <div class="bar" style="width: {{seconds}}%;"></div>
            </div></timer>

            <timer>

            </timer>

        <button class="btn" onclick="startTimer('progressbar-timer')" type="button">Start</button>
        <button class="btn" onclick="stopTimer('progressbar-timer')" type="button">Stop</button>

        Countdown Timer

            The countdown timer <timer interval="1000" countdown="100">{{countdown}}</timer>
            will start its countdown from 100 until it reaches 0 by ticking every second

            <timer countdown="100" interval="1000">{{countdown}}</timer>

        <button class="btn" onclick="addCDSeconds('countdown-timer', 10)" type="button">Add 10 Seconds</button>

        Timer with autostart = false

            Click on the start button to start the timer. <timer autostart="false" interval="1000">{{seconds}}</timer>

            <timer autostart="false" interval="1000">{{seconds}}</timer>

        <button class="btn" onclick="stopResumeTimer('auto-start-false-timer', this)" type="button">Start</button>

Plural / Singular units

            Two stopped countdown timers to illustrate how to handle pluralization of time units.

            <timer autostart="false" countdown="90061">{{days}} day{{daysS}}, {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer>

            <timer autostart="false" countdown="90061">{{days}} day{{daysS}}, {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer>

        <timer autostart="false" countdown="190061">{{days}} day{{daysS}}, {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer>

            <timer autostart="false" countdown="190061">{{days}} day{{daysS}}, {{hours}} hour{{hoursS}}, {{minutes}} minute{{minutesS}}, {{seconds}} second{{secondsS}}.</timer>

Countdown time display according to specified max-time-unit

            This markup will display countdown time in minute and seconds only.  This attribute can be applied to regular clock timer as well.

            <timer countdown="10041" max-time-unit="'minute'" interval="1000">{{mminutes}} minute{{minutesS}}, {{sseconds}} second{{secondsS}}</timer>

countdown Time with max time unit option - year

            <timer countdown="100410000" max-time-unit="'year'" interval="1000">{{yyears}} year{{yearsS}}, {{mmonths}} month{{monthsS}}, {{ddays}} day{{daysS}}, {{hhours}} hour{{hoursS}}, {{mminutes}} minute{{minutesS}}, {{sseconds}} second{{secondsS}}</timer>

countdown Time with max time unit option - minute

            <timer countdown="10041" max-time-unit="'minute'" interval="1000"> {{mminutes}} minute{{minutesS}}, {{sseconds}} second{{secondsS}}</timer>

countdown Time with max time unit option - second

            <timer countdown="10041" max-time-unit="'second'" interval="1000"> {{mminutes}} minute{{minutesS}}, {{sseconds}} second{{secondsS}}</timer>

countdown Time without max time unit option - minute

            <timer countdown="10041" interval="1000"> {{ddays}} day{{daysS}}, {{hhours}} hour{{hoursS}}, {{mminutes}} minute{{minutesS}}, {{sseconds}} second{{secondsS}}</timer>

Countdown Finished Callback

            A countdown timer that updates a value once the callback is reached

            <timer countdown="3" interval="1000" finish-callback="callbackTimer.finished()">{{seconds}} second{{secondsS}}</timer>

            <timer countdown="3" interval="1000" finish-callback="callbackTimer.finished()">{{seconds}} second{{secondsS}} </timer>

        Timer: {{callbackTimer.status}}
        Callbacks: {{callbackTimer.callbackCount}}

        Markup

        Timer directive can be declared using following options. By default, it will display milliseconds inside
        span tag. It can also take template string to display user-defined formats.

            <timer interval="1000" />

            <timer interval="1000">{{hours}} hours, {{minutes}} minutes,
                {{seconds}} seconds, {{millis}} milliseconds.</timer>

        Attributes

                Name

                Required

                Default value

                interval

                false

                1 millisecond

                autostart

                Formerly called 'auto-start'. Please see this issue

                false

                true

                countdown

                false

                start-time

                false

            starts the timer with predefined time (in milliseconds).

                end-time

                false

            Sets the countdown based on predefined end time (in milliseconds).

                max-time-unit

                false

             no default value.   But you can give value,  'minute', 'second', or 'hour'.

        Methods

        Following DOM methods can be invoked to timer. Prepend to timer- for scope based
        events when calling from AngularJS controllers.

                Method name

                Description

                start

                Starts the timer

                stop

                Stops the timer

                clear

                Same as stop. But, without the event being triggered

                resume

                Resumes the timer. Will NOT reset the start time

                addCDSeconds

                Add seconds to running countdown

        Events

                Event name

                Description

                timer-tick

                Tick event that gets emitted for every timer tick for specified interval. Please refer to Polling Timer
                example for its usage.

                timer-stopped

                Tick event that gets emitted when the timer stops. Please refer to Single Timer
                example for its usage.

        Install using Bower

        bower install angular-timer

        Contributions welcome!

        We welcome any or all kinds of contributions! Please submit pull requests or create issues to contribute to this
        project :)

        © Siddique Hameed 2013


text:
package annis.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

@SuppressWarnings("serial")
public class AnnisNode implements Serializable
{

  // this class is send to the front end
  // node object in database
  private long id;
  private long corpus; // FIXME: Corpus object with annotations or move to
  // graph?
  private long textId;
  private long left;
  private long right;
  private String spannedText;
  private Long tokenIndex;
  private long leftToken;
  private long rightToken;
  private Set<Annotation> nodeAnnotations;
  // annotation graph
  private AnnotationGraph graph;
  // node position in annotation graph
  private Set<Edge> incomingEdges;
  private Set<Edge> outgoingEdges;
  private String name;
  private String namespace;
  // node constraints
  private boolean partOfEdge;
  private boolean root;
  private boolean token;
  private Set<Annotation> edgeAnnotations;
  private Long matchedNodeInQuery;

  public static class Range implements Serializable
  {

    private int min;
    private int max;

    public Range(int _min, int _max)
    {
      min = _min;
      max = _max;
    }

    public int getMin()
    {
      return min;
    }

    public int getMax()
    {
      return max;
    }

    @Override
    public int hashCode()
    {
      return new HashCodeBuilder().append(min).append(max).toHashCode();
    }

    @Override
    public boolean equals(Object obj)
    {
      if (obj instanceof Range)
      {
        Range other = (Range) obj;

        return new EqualsBuilder().append(min, other.min).append(max, other.max).
          isEquals();
      }
      return false;
    }
  };

  public AnnisNode()
  {
    nodeAnnotations = new TreeSet<Annotation>();
    edgeAnnotations = new TreeSet<Annotation>();
    incomingEdges = new HashSet<Edge>();
    outgoingEdges = new HashSet<Edge>();
  }

  public AnnisNode(long id)
  {
    this();
    this.id = id;
  }

  public AnnisNode(long id, long corpusRef, long textRef, long left,
    long right, String namespace, String name, long tokenIndex,
    String span, long leftToken, long rightToken)
  {
    this(id);

    this.corpus = corpusRef;
    this.textId = textRef;
    this.left = left;
    this.right = right;
    this.leftToken = leftToken;
    this.rightToken = rightToken;

    setNamespace(namespace);
    setName(name);
    setTokenIndex(tokenIndex);

    setSpannedText(span);
  }

  public static String qName(String namespace, String name)
  {
    return name == null ? null : (namespace == null ? name : namespace
      + ":" + name);
  }

  public void setSpannedText(String spannedText)
  {
    this.spannedText = spannedText;
  }

  public void clearSpannedText()
  {
    this.spannedText = null;
  }

  @Override
  public String toString()
  {
    StringBuffer sb = new StringBuffer();

    sb.append("node ");
    sb.append(id);

    if (name != null)
    {
      sb.append("; named '");
      sb.append(qName(namespace, name));
      sb.append("'");
    }

    if (token)
    {
      sb.append("; is a token");
    }

    if (spannedText != null)
    {
      sb.append("; spans=\"");
      sb.append(spannedText);
      sb.append("\"");
    }

    if (isRoot())
    {
      sb.append("; root node");
    }

    if (!nodeAnnotations.isEmpty())
    {
      sb.append("; node labels: ");
      sb.append(nodeAnnotations);
    }

    if (!edgeAnnotations.isEmpty())
    {
      sb.append("; edge labes: ");
      sb.append(edgeAnnotations);
    }

    return sb.toString();
  }

  public boolean addIncomingEdge(Edge edge)
  {
    return incomingEdges.add(edge);
  }

  public boolean addOutgoingEdge(Edge edge)
  {
    return outgoingEdges.add(edge);
  }

  public boolean addEdgeAnnotation(Annotation annotation)
  {
    return edgeAnnotations.add(annotation);
  }

  public boolean addNodeAnnotation(Annotation annotation)
  {
    return nodeAnnotations.add(annotation);
  }

  public String getQualifiedName()
  {
    return qName(namespace, name);
  }

  @Override
  public boolean equals(Object obj)
  {
    if (obj == null)
    {
      return false;
    }
    if (getClass() != obj.getClass())
    {
      return false;
    }
    final AnnisNode other = (AnnisNode) obj;
    if (this.id != other.id)
    {
      return false;
    }
    if (this.corpus != other.corpus)
    {
      return false;
    }
    if (this.textId != other.textId)
    {
      return false;
    }
    if (this.left != other.left)
    {
      return false;
    }
    if (this.right != other.right)
    {
      return false;
    }
    if ((this.spannedText == null) ? (other.spannedText != null)
      : !this.spannedText.equals(other.spannedText))
    {
      return false;
    }
    if (this.leftToken != other.leftToken)
    {
      return false;
    }
    if (this.nodeAnnotations != other.nodeAnnotations
      && (this.nodeAnnotations == null || !this.nodeAnnotations.equals(
      other.nodeAnnotations)))
    {
      return false;
    }
    if ((this.name == null) ? (other.name != null) : !this.name.equals(
      other.name))
    {
      return false;
    }
    if ((this.namespace == null) ? (other.namespace != null)
      : !this.namespace.equals(other.namespace))
    {
      return false;
    }
    if (this.partOfEdge != other.partOfEdge)
    {
      return false;
    }
    if (this.root != other.root)
    {
      return false;
    }
    if (this.token != other.token)
    {
      return false;
    }

    if (this.edgeAnnotations != other.edgeAnnotations
      && (this.edgeAnnotations == null || !this.edgeAnnotations.equals(
      other.edgeAnnotations)))
    {
      return false;
    }

    return true;
  }

  @Override
  public int hashCode()
  {
    return (int) id;
  }

  // /// Getter / Setter
  public Set<Annotation> getEdgeAnnotations()
  {
    return edgeAnnotations;
  }

  public void setEdgeAnnotations(Set<Annotation> edgeAnnotations)
  {
    this.edgeAnnotations = edgeAnnotations;
  }

  public boolean isRoot()
  {
    return root;
  }

  public void setRoot(boolean root)
  {
    this.root = root;
  }

  public String getName()
  {
    return name;
  }

  public void setName(String name)
  {
    this.name = name;
  }

  public String getNamespace()
  {
    return namespace;
  }

  public void setNamespace(String namespace)
  {
    this.namespace = namespace;
  }

  public String getSpannedText()
  {
    return spannedText;
  }

  public Set<Annotation> getNodeAnnotations()
  {
    return nodeAnnotations;
  }

  public void setNodeAnnotations(Set<Annotation> nodeAnnotations)
  {
    this.nodeAnnotations = nodeAnnotations;
  }

  public long getId()
  {
    return id;
  }

  public boolean isToken()
  {
    return token;
  }

  public void setToken(boolean token)
  {
    this.token = token;
  }

  public boolean isPartOfEdge()
  {
    return partOfEdge;
  }

  public void setPartOfEdge(boolean partOfEdge)
  {
    this.partOfEdge = partOfEdge;
  }

  public long getCorpus()
  {
    return corpus;
  }

  public void setCorpus(long corpus)
  {
    this.corpus = corpus;
  }

  public long getTextId()
  {
    return textId;
  }

  public void setTextId(long textIndex)
  {
    this.textId = textIndex;
  }

  public long getLeft()
  {
    return left;
  }

  public void setLeft(long left)
  {
    this.left = left;
  }

  public long getRight()
  {
    return right;
  }

  public void setRight(long right)
  {
    this.right = right;
  }

  public Long getTokenIndex()
  {
    return tokenIndex;
  }

  public void setTokenIndex(Long tokenIndex)
  {
    this.tokenIndex = tokenIndex;
    // FIXME: vermengung von node und constraint semantik
    setToken(tokenIndex != null);
  }

  public long getLeftToken()
  {
    return leftToken;
  }

  public void setLeftToken(long leftToken)
  {
    this.leftToken = leftToken;
  }

  public long getRightToken()
  {
    return rightToken;
  }

  public void setRightToken(long rightToken)
  {
    this.rightToken = rightToken;
  }

  public Set<Edge> getIncomingEdges()
  {
    return incomingEdges;
  }

  public void setIncomingEdges(Set<Edge> incomingEdges)
  {
    this.incomingEdges = incomingEdges;
  }

  public Set<Edge> getOutgoingEdges()
  {
    return outgoingEdges;
  }

  public void setOutgoingEdges(Set<Edge> outgoingEdges)
  {
    this.outgoingEdges = outgoingEdges;
  }

  public AnnotationGraph getGraph()
  {
    return graph;
  }

  public void setGraph(AnnotationGraph graph)
  {
    this.graph = graph;
  }

  public Long getMatchedNodeInQuery()
  {
    return matchedNodeInQuery;
  }

  public void setMatchedNodeInQuery(Long matchedNodeInQuery)
  {
    this.matchedNodeInQuery = matchedNodeInQuery;
  }

}


text:
require 'test_helper'

class PayexTest < Test::Unit::TestCase
  def setup
    @gateway = PayexGateway.new(
                 :account => 'account',
                 :encryption_key => 'encryption_key'
               )

    @credit_card = credit_card
    @amount = 1000

    @options = {
      :order_id => '1234',
    }
  end

  def test_successful_purchase
    @gateway.expects(:ssl_post).times(2).returns(successful_initialize_response, successful_purchase_response)

    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_instance_of MultiResponse, response
    assert_success response

    assert_equal '2623681', response.authorization
    assert response.test?
  end

  def test_failed_purchase
    @gateway.expects(:ssl_post).times(2).returns(successful_initialize_response, failed_purchase_response)

    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_failure response
    assert response.test?
  end

  def test_successful_authorize
    @gateway.expects(:ssl_post).times(2).returns(successful_initialize_response, successful_authorize_response)
    assert response = @gateway.authorize(@amount, @credit_card, @options)
    assert_success response
    assert response.authorization
    assert_equal 'OK', response.message
    assert_equal '2624653', response.authorization
    assert response.test?
  end

  def test_successful_capture
    @gateway.expects(:ssl_post).returns(successful_capture_response)
    assert response = @gateway.capture(@amount, 'fakeauth')
    assert_success response
    assert_equal '2624655', response.authorization
    assert response.test?
  end

  def test_failed_capture
    @gateway.expects(:ssl_post).returns(failed_capture_response)
    assert response = @gateway.capture(@amount, '1')
    assert_failure response
    assert_not_equal 'OK', response.message
    assert_not_equal 'RecordNotFound', response.params[:status_errorcode]
    assert response.test?
  end

  def test_successful_void
    @gateway.expects(:ssl_post).returns(successful_void_response)

    assert response = @gateway.void('fakeauth')
    assert_success response
    assert_equal '2624825', response.authorization
    assert response.test?
  end

  def test_unsuccessful_void
    @gateway.expects(:ssl_post).returns(unsuccessful_void_response)
    assert response = @gateway.void("1")
    assert_failure response
    assert_not_equal 'OK', response.message
    assert_match /1/, response.message
    assert response.test?
  end

  def test_successful_refund
    @gateway.expects(:ssl_post).returns(successful_refund_response)
    assert response = @gateway.refund(@amount - 200, 'fakeauth', order_id: '123')
    assert_success response
    assert_equal '2624828', response.authorization
    assert response.test?
  end

  def test_unsuccessful_refund
    @gateway.expects(:ssl_post).returns(unsuccessful_refund_response)
    assert response = @gateway.refund(@amount, "1", order_id: '123')
    assert_failure response
    assert_not_equal 'OK', response.message
    assert_match /1/, response.message
    assert response.test?
  end

  def test_successful_store
    @gateway.expects(:ssl_post).times(3).returns(successful_store_response, successful_initialize_response, successful_purchase_response)
    assert response = @gateway.store(@credit_card, @options.merge({merchant_ref: '9876'}))
    assert_success response
    assert_equal 'OK', response.message
    assert_equal 'bcea4ac8d1f44640bff7a8c93caa249c', response.authorization
    assert response.test?
  end

  def test_successful_unstore
    @gateway.expects(:ssl_post).returns(successful_unstore_response)
    assert response = @gateway.unstore('fakeauth')
    assert_success response
    assert_equal 'OK', response.message
    assert response.test?
  end

  def test_successful_purchase_with_stored_card
    @gateway.expects(:ssl_post).returns(successful_autopay_response)
    assert response = @gateway.purchase(@amount, 'fakeauth', @options.merge({order_id: '5678'}))
    assert_success response
    assert_equal 'OK', response.message
    assert_equal '2624657', response.authorization
    assert response.test?
  end

  private

  def successful_initialize_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Initialize8Response xmlns="http://external.payex.com/PxOrder/">
            <Initialize8Result><?xml version="1.0" encoding="utf-8" ?><payex><id>09ef982cf2584d58bf4363dacd2ef127</id><date>2013-11-06 14:19:23</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><orderRef>53681e74064a4621b93a6fcceba20c00</orderRef><sessionRef>7424a69d355c4cafa853ff49553b786f</sessionRef><redirectUrl>https://test-confined.payex.com/PxOrderCC.aspx?orderRef=53681e74064a4621b93a6fcceba20c00</redirectUrl></payex></Initialize8Result>
          </Initialize8Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  # Place raw successful response from gateway here
  def successful_purchase_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <PurchaseCCResponse xmlns="http://confined.payex.com/PxOrder/">
            <PurchaseCCResult><?xml version="1.0" encoding="utf-8" ?><payex><id>45eca449c8b54b54ac8811d4c26f638d</id><date>2013-11-06 14:19:35</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><transactionRef>750dc1438350481086abd0438bde0c23</transactionRef><transactionNumber>2623681</transactionNumber><orderId>1234</orderId><productId>4321</productId><paymentMethod>VISA</paymentMethod><productNumber>4321</productNumber><BankHash>00000001-4581-0903-5682-000000000000</BankHash><AuthenticatedStatus>None</AuthenticatedStatus><AuthenticatedWith>N</AuthenticatedWith></payex></PurchaseCCResult>
          </PurchaseCCResponse>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def failed_purchase_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <PurchaseCCResponse xmlns="http://confined.payex.com/PxOrder/">
            <PurchaseCCResult><?xml version="1.0" encoding="utf-8" ?><payex><id>131faa4301f74e91bf29e9749ad8f2a6</id><date>2013-11-06 14:40:18</date><status>ValidationError_InvalidParameter<errorCode>ValidationError_InvalidParameter</errorCode><description>Invalid parameter:expireDate
      Parameter name: expireDate</description><paramName>expireDate</paramName><thirdPartyError /></status></payex></PurchaseCCResult>
          </PurchaseCCResponse>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_authorize_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <PurchaseCCResponse xmlns="http://confined.payex.com/PxOrder/">
            <PurchaseCCResult><?xml version="1.0" encoding="utf-8" ?><payex><id>41ebf6488fdb42a79baf49d2ef9e7dc6</id><date>2013-11-06 14:43:01</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>3</transactionStatus><transactionRef>89cbf30161f442228cbca16ff7f886d4</transactionRef><transactionNumber>2624653</transactionNumber><orderId>1234</orderId><productId>4321</productId><paymentMethod>VISA</paymentMethod><productNumber>4321</productNumber><BankHash>00000001-4581-0903-5682-000000000000</BankHash><AuthenticatedStatus>None</AuthenticatedStatus><AuthenticatedWith>N</AuthenticatedWith></payex></PurchaseCCResult>
          </PurchaseCCResponse>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_capture_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Capture5Response xmlns="http://external.payex.com/PxOrder/">
            <Capture5Result><?xml version="1.0" encoding="utf-8" ?><payex><id>efe1a4572c9b4ed5a656d648bf7f9207</id><date>2013-11-06 14:43:03</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><transactionStatus>6</transactionStatus><transactionNumber>2624655</transactionNumber><originalTransactionNumber>2624653</originalTransactionNumber></payex></Capture5Result>
          </Capture5Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def failed_capture_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Capture5Response xmlns="http://external.payex.com/PxOrder/">
            <Capture5Result><?xml version="1.0" encoding="utf-8" ?><payex><id>19706b063aad458aa9783563a4e5bbff</id><date>2013-11-06 14:53:34</date><status>ValidationError_Generic<description>1</description><errorCode>NoRecordFound</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status></payex></Capture5Result>
          </Capture5Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_void_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Cancel2Response xmlns="http://external.payex.com/PxOrder/">
            <Cancel2Result><?xml version="1.0" encoding="utf-8" ?><payex><id>219b3a4b4ae0478482c75eba06d5a0dd</id><date>2013-11-06 14:56:48</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><transactionStatus>4</transactionStatus><transactionNumber>2624825</transactionNumber><originalTransactionNumber>2624824</originalTransactionNumber></payex></Cancel2Result>
          </Cancel2Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def unsuccessful_void_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Cancel2Response xmlns="http://external.payex.com/PxOrder/">
            <Cancel2Result><?xml version="1.0" encoding="utf-8" ?><payex><id>220b395b966a43eb9d0c70109f6dadd3</id><date>2013-11-06 15:02:24</date><status>ValidationError_Generic<description>1</description><errorCode>Error_Generic</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status></payex></Cancel2Result>
          </Cancel2Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_refund_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Credit5Response xmlns="http://external.payex.com/PxOrder/">
            <Credit5Result><?xml version="1.0" encoding="utf-8" ?><payex><id>a1e70daf3ed842ddb72e58a28f5cbc11</id><date>2013-11-06 14:57:54</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><transactionStatus>2</transactionStatus><transactionNumber>2624828</transactionNumber><originalTransactionNumber>2624827</originalTransactionNumber></payex></Credit5Result>
          </Credit5Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def unsuccessful_refund_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <Credit5Response xmlns="http://external.payex.com/PxOrder/">
            <Credit5Result><?xml version="1.0" encoding="utf-8" ?><payex><id>e82613f6c59d4e08a7163cd91c2b3ce5</id><date>2013-11-06 15:02:23</date><status>ValidationError_Generic<description>1</description><errorCode>Error_Generic</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status></payex></Credit5Result>
          </Credit5Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_store_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <CreateAgreement3Response xmlns="http://external.payex.com/PxAgreement/">
            <CreateAgreement3Result><?xml version="1.0" encoding="utf-8" ?><payex><id>3c8063b7fcb64a449b715fe711f0a03f</id><date>2013-11-06 14:43:04</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><agreementRef>bcea4ac8d1f44640bff7a8c93caa249c</agreementRef></payex></CreateAgreement3Result>
          </CreateAgreement3Response>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_unstore_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <DeleteAgreementResponse xmlns="http://external.payex.com/PxAgreement/">
            <DeleteAgreementResult><?xml version="1.0" encoding="utf-8" ?><payex><id>7935ca4c24c3467cb36c48a270557194</id><date>2013-11-06 15:06:54</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><agreementRef>7e9c6342dc20459691d1abb027a3c8c0</agreementRef></payex></DeleteAgreementResult>
          </DeleteAgreementResponse>
        </soap:Body>
      </soap:Envelope>
    }
  end

  def successful_autopay_response
    %q{<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
          <AutoPay3Response xmlns="http://external.payex.com/PxAgreement/">
            <AutoPay3Result><?xml version="1.0" encoding="utf-8" ?><payex><id>37a7164c16804af199b7d6aade0aa580</id><date>2013-11-06 14:43:09</date><status>OK<description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /><thirdPartySubError /></status><transactionStatus>3</transactionStatus><transactionRef>de2984e302da40b498afe5aced8cea7e</transactionRef><transactionNumber>2624657</transactionNumber><paymentMethod>VISA</paymentMethod><captureTokens><stan>1337</stan><terminalId>666</terminalId><transactionTime>11/6/2013 2:43:09 PM</transactionTime></captureTokens><pending>false</pending></payex></AutoPay3Result>
          </AutoPay3Response>
        </soap:Body>
      </soap:Envelope>
    }
  end
end


text:
package com.example.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeEvent;

/**
 * Created by kslisenko on 11/23/14.
 */
public class MyServletContextAttributeListener implements javax.servlet.ServletContextAttributeListener {

    @Override
    public void attributeAdded(ServletContextAttributeEvent servletContextAttributeEvent) {
        ServletContext context = servletContextAttributeEvent.getServletContext();
        System.out.println(">>>>Attribute added '" + servletContextAttributeEvent.getName() + "', value = '" + servletContextAttributeEvent.getValue() + "'");
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent servletContextAttributeEvent) {
        ServletContext context = servletContextAttributeEvent.getServletContext();
        System.out.println(">>>>Attribute removed '" + servletContextAttributeEvent.getName() + "', value = '" + servletContextAttributeEvent.getValue() + "'");
    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent servletContextAttributeEvent) {
        ServletContext context = servletContextAttributeEvent.getServletContext();
        System.out.println(">>>>Attribute replaced '" + servletContextAttributeEvent.getName() + "', value = '" + servletContextAttributeEvent.getValue() + "'");
    }
}