text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ECommerce.Project;
using Moq;
using System.Collections.Generic;

namespace ECommerceTests
{
    [TestClass]
    public class CheckoutTest
    {
        [TestMethod]
        public void Test_calculatedPrice_ReturnsCalculatedPriceOf0_WhenGivenAnEmptyBasket()
        {
            //Arrange
            List<Item> itemsList = new List<Item>();
            Basket basket = new Basket(itemsList);
            Checkout checkout = new Checkout();

            //Act
            double price = checkout.calculatedPrice(basket);

            //Assert
            Assert.AreEqual(0, price);
        }

        [TestMethod]
        public void Test_calculatedPrice_ReturnsPriceOfItem_WhenGivenABasketWithAnItemInIt()
        {
            //Arrange
            double price1 = 100;
            List<Item> itemsList = new List<Item>();
            Basket basket1 = new Basket(itemsList);
            Checkout checkout = new Checkout();
            Item item1 = new Item();
            item1.price = price1;
            basket1.itemsList.Add(item1);

            //Act
            double priceCheck = checkout.calculatedPrice(basket1);

            //Assert
            Assert.AreEqual(price1, priceCheck);
        }

        [TestMethod]
        public void Test_calculatedPrice_ReturnsTotalPrice_When2ItemsAreAddedToABasketAndGivenToIt()
        {
            //Arrange
            double price1 = 100;
            double price2 = 200;
            double totalPrice = price1 + price2;

            List<Item> itemsList1 = new List<Item>();
            Basket basket1 = new Basket(itemsList1);
            Checkout checkout1 = new Checkout();

            Item item1 = new Item();
            Item item2 = new Item();

            item1.price = price1;
            item2.price = price2;

            basket1.itemsList.Add(item1);
            basket1.itemsList.Add(item2);
            //Act
            double priceCheck = checkout1.calculatedPrice(basket1);

            //Assert
            Assert.AreEqual(totalPrice, priceCheck);
        }
    }
}


text:
// request contains logic to make polling HTTP requests against an endpoint with optional host spoofing.

package test

import (
	"context"
	"net/url"
	"time"

	"k8s.io/client-go/kubernetes"
	"knative.dev/pkg/test/logging"
	"knative.dev/pkg/test/spoof"
)

// RequestOption enables configuration of requests
// when polling for endpoint states.
type RequestOption = spoof.RequestOption

// WithHeader will add the provided headers to the request.
//
// Deprecated: Use the spoof package version
var WithHeader = spoof.WithHeader

// IsOneOfStatusCodes checks that the response code is equal to the given one.
//
// Deprecated: Use the spoof package version
var IsOneOfStatusCodes = spoof.IsOneOfStatusCodes

// IsStatusOK checks that the response code is a 200.
//
// Deprecated: Use the spoof package version
var IsStatusOK = spoof.IsStatusOK

// MatchesAllBodies checks that the *first* response body matches the "expected" body, otherwise failing.
//
// Deprecated: Use the spoof package version
var MatchesAllBodies = spoof.MatchesAllBodies

// MatchesBody checks that the *first* response body matches the "expected" body, otherwise failing.
//
// Deprecated: Use the spoof package version
var MatchesBody = spoof.MatchesBody

// MatchesAllOf combines multiple ResponseCheckers to one ResponseChecker with a logical AND. The
// checkers are executed in order. The first function to trigger an error or a retry will short-circuit
// the other functions (they will not be executed).
//
// This is useful for combining a body with a status check like:
// MatchesAllOf(IsStatusOK, MatchesBody("test"))
//
// The MatchesBody check will only be executed after the IsStatusOK has passed.
//
// Deprecated: Use the spoof package version
var MatchesAllOf = spoof.MatchesAllOf

// WaitForEndpointState will poll an endpoint until inState indicates the state is achieved,
// or default timeout is reached.
// If resolvableDomain is false, it will use kubeClientset to look up the ingress and spoof
// the domain in the request headers, otherwise it will make the request directly to domain.
// desc will be used to name the metric that is emitted to track how long it took for the
// domain to get into the state checked by inState.  Commas in `desc` must be escaped.
func WaitForEndpointState(
	ctx context.Context,
	kubeClient kubernetes.Interface,
	logf logging.FormatLogger,
	url *url.URL,
	inState spoof.ResponseChecker,
	desc string,
	resolvable bool,
	opts ...interface{}) (*spoof.Response, error) {
	return WaitForEndpointStateWithTimeout(ctx, kubeClient, logf, url, inState,
		desc, resolvable, Flags.SpoofRequestTimeout, opts...)
}

// WaitForEndpointStateWithTimeout will poll an endpoint until inState indicates the state is achieved
// or the provided timeout is achieved.
// If resolvableDomain is false, it will use kubeClientset to look up the ingress and spoof
// the domain in the request headers, otherwise it will make the request directly to domain.
// desc will be used to name the metric that is emitted to track how long it took for the
// domain to get into the state checked by inState.  Commas in `desc` must be escaped.
func WaitForEndpointStateWithTimeout(
	ctx context.Context,
	kubeClient kubernetes.Interface,
	logf logging.FormatLogger,
	url *url.URL,
	inState spoof.ResponseChecker,
	desc string,
	resolvable bool,
	timeout time.Duration,
	opts ...interface{}) (*spoof.Response, error) {

	client, rOpts, err := makeSpoofClient(ctx, kubeClient, logf, url, resolvable, timeout, opts...)
	if err != nil {
		return nil, err
	}
	return client.WaitForEndpointState(ctx, url, inState, desc, rOpts...)
}

func makeSpoofClient(
	ctx context.Context,
	kubeClient kubernetes.Interface,
	logf logging.FormatLogger,
	url *url.URL,
	resolvable bool,
	timeout time.Duration,
	opts ...interface{}) (*spoof.SpoofingClient, []spoof.RequestOption, error) {

	var tOpts []spoof.TransportOption
	var rOpts []spoof.RequestOption

	for _, opt := range opts {
		switch o := opt.(type) {
		case spoof.RequestOption:
			rOpts = append(rOpts, o)
		case spoof.TransportOption:
			tOpts = append(tOpts, o)
		}
	}

	client, err := NewSpoofingClient(ctx, kubeClient, logf, url.Hostname(), resolvable, tOpts...)
	if err != nil {
		return nil, nil, err
	}
	client.RequestTimeout = timeout

	return client, rOpts, nil
}

func CheckEndpointState(
	ctx context.Context,
	kubeClient kubernetes.Interface,
	logf logging.FormatLogger,
	url *url.URL,
	inState spoof.ResponseChecker,
	desc string,
	resolvable bool,
	opts ...interface{},
) (*spoof.Response, error) {
	client, rOpts, err := makeSpoofClient(ctx, kubeClient, logf, url, resolvable, Flags.SpoofRequestTimeout, opts...)
	if err != nil {
		return nil, err
	}
	return client.CheckEndpointState(ctx, url, inState, desc, rOpts...)
}

redpajama_set_name: RedPajamaGithub


text:
Phitter!
====================

Because Twitter apps appear to be the "Hello, World!" of modern development, Phitter is an experiment in building a simple command line app in PHP using the Symfony Console component.

Current build status: [![Build Status](https://travis-ci.org/Bendihossan/Phitter.png)](https://travis-ci.org/Bendihossan/Phitter)

Basic Usage
====================
Phitter! uses the Symfony Console component to register commands.

Run ``php bin/phitter`` to find out the available commands:
```
Available commands:
home
  home:mentions   Lists latest mentions for this user.
  home:retweets   Lists latest retweets for this user.
  home:timeline   Lists latest tweets from your followers.
  home:tweet      Post a new tweet.
user
  user:show       Lists info for a user.
  user:timeline   Lists latest tweets from a user. Defaults to you.
```

Coming soon!
====================

* More API endpoints
* Tests

Contribute
====================
1. Fork the repository and download the source to your development workspace and run ``bin/composer install``.
2. Copy ``Resources/config/parameters.json.dist`` to ``Resources/config/parameters.json`` and populate with your own Twitter tokens.
3. Checkout a branch for your code
4. Write the logic for your command in ``src/Bendihossan/Phitter/Command``.
5. Register your new command in ``bin/phitter``.
6. Write unit tests for your command.
7. Commit and push your code to GitHub, make a Pull Request to the Phitter! project.

Contact
====================
Contact: [contact@steffanharries.me.uk](mailto:contact@steffanharries.me.uk)


text:
<?php
namespace Hough\Test\Guzzle\Handler;

use Hough\Guzzle\Handler\EasyHandle;
use Hough\Psr7;

/**
 * @covers \Hough\Guzzle\Handler\EasyHandle
 */
class EasyHandleTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @expectedException \BadMethodCallException
     * @expectedExceptionMessage The EasyHandle has been released
     */
    public function testEnsuresHandleExists()
    {
        $easy = new EasyHandle;
        unset($easy->handle);
        $easy->handle;
    }
}


text:
@interface MOBProjectionEPSG6355 : MOBProjection

@end


text:
@interface SubjectDistanceRangesViewTableDataSource : NSObject <UITableViewDataSource>

@end


text:
import { Promise, promisify } from './'
import loadBMFont from 'load-bmfont'
import loadTextureAsync from './load-texture'

const loadBMFontAsync = promisify(loadBMFont)

export default function(path, opt) {
  return Promise.all([
    loadBMFontAsync(`${path}.fnt`),
    loadTextureAsync(`${path}.png`, opt)
  ]).then(results => {
    const [data, texture] = results
    return {
      data, texture
    }
  })
}


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

namespace MetadataModel.DynamicEntity
{
    static class EventDispatcher
    {
        public enum EntityEvent { PreCreate, PostCreate, PreUpdate, PostUpdate, PreDelete, PostDelete }
        static private List<KeyValuePair<string, IEntityChanged>> entitiesChangedListeners = new List<KeyValuePair<string, IEntityChanged>>();

        public static void RegisterEntityChangedListener(string entityName, EntityEvent entityEvent, IEntityChanged entityChanged)
        {
            if (entityChanged == null)
                throw new ArgumentNullException("entityChanged", "Behavior is null");

            if (string.IsNullOrWhiteSpace(entityName))
                throw new ArgumentNullException("entityName", "Entity name invalid");

            if (entitiesChangedListeners.Any(c => c.Key == entityName && c.Value == entityChanged))
                throw new InvalidOperationException("This event listener is already attach to this entity: " + entityName);

            entitiesChangedListeners.Add(new KeyValuePair<string, IEntityChanged>(entityName, entityChanged));
        }

        public static void DispatchEvent(EntityEvent entityEvent, string entityName)
        {
            foreach (var eventListener in entitiesChangedListeners.Where(c => c.Key == entityName))
                eventListener.Value.OnEntityChanged();
        }
    }
}


text:
import logging

_logger = logging.getLogger(__name__)

class VulnerabilitiesRiskAssessor(object):

    def __init__(self, whitelist, vulnerabilities):
        object.__init__(self)

        self.whitelist = whitelist
        self.vulnerabilities = vulnerabilities

    def assess(self):
        """Returns ```True``` if the risk is deemed acceptable
        otherwise returns ```False```.
        """
        _logger.info('Assessment starts')

        for vulnerability in self.vulnerabilities:
            if not self._assess_vulnerability(vulnerability):
                _logger.info('Assessment ends - fail')
                return False

        _logger.info('Assessment ends - pass')

        return True

    def _assess_vulnerability(self, vulnerability):
        """Returns ```True``` if the risk is deemed acceptable for ```vulnerability```
        otherwise returns ```False```.
        """
        _logger.info('Assessing vulnerability %s - start', vulnerability)
        rv = self.__assess_vulnerability(vulnerability)
        _logger.info('Assessing vulnerability %s - finish', vulnerability)
        return rv

    def __assess_vulnerability(self, vulnerability):
        """Returns ```True``` if the risk is deemed acceptable for ```vulnerability```
        otherwise returns ```False```.
        """
        if vulnerability.cve_id in self.whitelist.vulnerabilities_by_cve_id:
            _logger.info('Vulnerability %s in whitelist - pass', vulnerability)
            return True

        if self.whitelist.ignore_severities_at_or_below < vulnerability.severity:
            _logger.info(
                'Vulnerability %s @ severity %s greater than whitelist severity @ %s - fail',
                vulnerability,
                vulnerability.severity,
                self.whitelist.ignore_severities_at_or_below)
            return False
        else:
            _logger.info(
                'Vulnerability %s @ severity %s less than or equal to whitelist severity @ %s - pass',
                vulnerability,
                vulnerability.severity,
                self.whitelist.ignore_severities_at_or_below)
            return True


text:
package net.silverfoxserver.core.socket;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.InetSocketAddress;
import net.silverfoxserver.core.log.Log;
import net.silverfoxserver.core.service.IoHandler;
import net.silverfoxserver.core.util.TimeUtil;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelFuture;
import org.jboss.netty.channel.ChannelFutureListener;

/**
 *
 * @author FUX
 */
public class SocketConnector {

    /**
	 要连接的服务器ip
    */
    private String _connect_serverIp = "127.0.0.1";

    /**
      要连接的服务器的端口
    */
    private int _connect_serverPort = 9339;

     /**

    */
    private GameTcpConnector _tcpClient = null;

    public final String getRemoteEndPoint()
    {
            return _connect_serverIp + ":" + _connect_serverPort;
    }

    /**
	 连接服务器的证书
    */
    private String _connect_serverProof = "www.wdmir.net";

    public final String getProof()
    {
            return this._connect_serverProof;
    }

    /**
	 连接服务器的Socket
    */
    private AppSession _connect_serverSock = null;

    public AppSession getSocket()
    {
        return _connect_serverSock;

    }

    public SocketConnector(String proof)
    {
            this._connect_serverProof = proof;

            this._tcpClient = new GameTcpConnector();
    }

    public final void setHandler(IoHandler value)
    {

        //this._handler = value;

        //
         if(null == this._tcpClient.getPipeline().get("SessionConnectorHandler"))
         {
            this._tcpClient.getPipeline().addLast("SessionConnectorHandler", new SessionConnectorHandler());
         }

        SessionConnectorHandler h = (SessionConnectorHandler)this._tcpClient.getPipeline().get("SessionConnectorHandler");
        h.setExtHandler(value);

    }

    /**

     @param ipAdr
     @param port
    */
    public final void connect(String ipAdr, int port)
    {

            //
            this._connect_serverIp = ipAdr;
            this._connect_serverPort = port;

            try{
                 // Start the connection attempt.
                ChannelFuture future = _tcpClient.connect(new InetSocketAddress(ipAdr, port));

                // Wait until the connection is made successfully.
                Channel channel = future.sync().getChannel();
                _connect_serverSock = new AppSession(channel);

            }
            catch(org.jboss.netty.channel.ChannelException | java.lang.InterruptedException  e)
            {
                 Log.WriteStrByException(SocketConnector.class.getName(), "connect", e.getMessage());

                 //
                 ActionListener connectFuncAct = new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                            //...Perform a task...
                            connectFunction();
                        }
                 };

                 TimeUtil.setTimeout(3000, connectFuncAct);
            }
    }

     public void connectFunction()
     {
         connect(_connect_serverIp,_connect_serverPort);

     }

     /**
      * 重试
      *
      */
     public void retryConnect()
     {
          ActionListener connectFuncAct = (ActionEvent evt) -> {
              //...Perform a task...
              connectFunction();
          };

          TimeUtil.setTimeout(3000, connectFuncAct);

     }

    public void Write(byte[] value) {
        //throw new UnsupportedOperationException("Not supported yet.");

        ChannelBuffer buffer = ChannelBuffers.buffer(value.length);
        buffer.writeBytes(value);
        this.getSocket().getChannel().write(buffer);
    }

}


text:
/***** GENERIC METHODS FOR INHERITENCE ******/

//gets a main and sub classes, and sets the prototype correctly, with extra useful methods
function extend(SubClass, MainClass) {
    SubClass.prototype.__proto__ = MainClass.prototype;
    SubClass.extendClass = extendClass;
    SubClass.defineMethod = defineMethod;
    SubClass.defineProperty = defineProperty;
    return SubClass;
}

//gets a sub class, and sets the calling context class as the main one for the sub prototype
function extendClass(SubClass) {
    if (!SubClass) {
        return subClass.call(this);
    }
    return extend(SubClass, this);
}

//creates a new class and sets the current calling context class as the main class for it.
function subClass() {
    var SubClass = function () {
      this.parentConstructor.apply(this, arguments);
    };
    return extendClass.call(this, SubClass);
}

//allows to define named methods directly in the prototype of the class
function defineMethod(methodCallback, methodName) {

    if (typeof methodCallback !== 'function') {
        throw 'Method should be a function';
    }

    if (!methodName && !methodCallback.name) {
        throw 'You should provide a name to the method either in definition or as a second parameter name';
    }

    methodName = methodCallback.name || methodName;

    this.prototype[methodName] = methodCallback;

    return this;

};

//allows to define a property with setter and getter
function defineProperty(property, getter, setter, descriptors){
  descriptors = descriptors || {};
  descriptors.get = descriptors.get || getter || undefined;
  descriptors.set = descriptors.set || setter || undefined;
  Object.defineProperty(this.prototype, property, descriptors);
  return this;
}

/**** THE MAIN OOP CLASS ****/

var OOP;

(function(){

  OOP = function OOP() {

  };

  // Allows to call parent constructor from sub constructors. i.e. this.parentConstructor()
  OOP.prototype.parentConstructor = function () {

      //get arguments list
      var args = Array.prototype.slice.call(arguments);
      args.unshift('constructor');

      return this.parentMethod.apply(this, args);

  };

  // Allows to call a parent method from sub classes after they are overridden. i.e. this.parentMethod(methodName, param1, param2, ...);
  OOP.prototype.parentMethod = function (method) {
      if (!method) {
          throw 'What method to call in parent?';
      }

      //get arguments list
      var args = Array.prototype.slice.call(arguments);
      args.shift();

      //checks if a method is an instuctor in current object stack
      function isConstructor(method){
        var parent = this;
        do {
          if(parent.constructor===method){
            return true;
          }
          parent = parent.__proto__;
        } while(parent);
        return false;
      }

      //find overriding calling method
      var callingMethod = arguments.callee.caller;
      while(callingMethod){
        if(callingMethod.name===method || method==='constructor' && isConstructor.call(this, callingMethod)){
          break;
        }
        callingMethod = callingMethod.caller;
      }
      if(!callingMethod) {
        throw 'Calling parent method from outside method context';
      }

      //find called method
      var found = false, parent = this, calledMethod;
      if(typeof callingMethod !== 'function'){
        throw 'Calling parent method from a normal context!';
      }
      while(parent){
        if(parent.hasOwnProperty(method) || method==='constructor'){
          if(found && (method==='constructor' && callingMethod !== parent.constructor || method!=='constructor')){
            calledMethod = method==='constructor' ? parent.constructor : parent[method];
            break;
          } else if( parent[method] === callingMethod || method==='constructor' && callingMethod === parent.constructor) {
            found = true;
          }
        }
        parent = parent.__proto__;
      }

      //if no called method found
      if(!calledMethod){
        throw 'Method ' + method + ' not found in parent levels!';
      }

      //call the parent method
      return calledMethod.apply(this, args);
  };

  // Allows to call parent method directly without the name. Named methods should be used to define methods.
  // Defnition example: MainClass.prototype.talk = function talk(param1){ ... }
  // Calling example: SubClass.prototype.talk = function talk(param1, param2){ this.propagateCall(param1); ... }; //this will call the parent talk method with param1 passed
  OOP.prototype.propagateCall = function () {
      var method = arguments.callee.caller.name;
      if(!method){
        throw 'Can not propagate method call for unnamed methods. Use named functions to use this method.';
      }
      var args = Array.prototype.slice.call(arguments || []);
      args.unshift(method);
      return this.parentMethod.apply(this, args);
  };

  // Add inheritence methods
  OOP.extendClass = extendClass;
  OOP.extend = extend;

})();

//end
module.exports = OOP;


text:
namespace mjolnir
{
template class GlobalPairInteraction<OpenMPSimulatorTraits<double, UnlimitedBoundary>       , ExcludedVolumePotential<double>>;
template class GlobalPairInteraction<OpenMPSimulatorTraits<float,  UnlimitedBoundary>       , ExcludedVolumePotential<float >>;
template class GlobalPairInteraction<OpenMPSimulatorTraits<double, CuboidalPeriodicBoundary>, ExcludedVolumePotential<double>>;
template class GlobalPairInteraction<OpenMPSimulatorTraits<float,  CuboidalPeriodicBoundary>, ExcludedVolumePotential<float >>;
} // mjolnir


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.Janendra</groupId>
    <artifactId>sample-project</artifactId>
    <packaging>jar</packaging>
    <version>1.0.0-SNAPSHOT</version>
    <name>Test Sample</name>
    <url>http://maven.apache.org</url>

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.Janendra</groupId>
                <artifactId>custom-properties</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>gitInfo</goal>
                            <goal>hostInfo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Build-Time>${maven.build.timestamp}</Build-Time>
                            <Built-By>${user.name}</Built-By>
                            <Version>${project.version}</Version>
                            <Git-Branch>${gitBranch}</Git-Branch>
                            <Commit-Author>${lastCommitAuthor}</Commit-Author>
                            <Commit-Id>${lastCommitId}</Commit-Id>
                            <Commit-Time>${lastCommitTimeStamp}</Commit-Time>
                            <Built-On>${hostName} : ${hostIP}</Built-On>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <scm>
        <connection>https://github.com/Janendra/customproperties.git</connection>
    </scm>
</project>


text:
Given a binary tree, return all root-to-leaf paths.

For example, given the following binary tree:
```
   1
 /   \
2     3
 \
  5
```
All root-to-leaf paths are:
```
["1->2->5", "1->3"]
```

queue + bfs

```python
# Definition for a binary tree node.
# class TreeNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution(object):
    def binaryTreePaths(self, root):
        """
        :type root: TreeNode
        :rtype: List[str]
        """
        from collections import deque
        if not root:
            return []
        res, stack = [], deque([(root, "")])
        while stack:
            node, ls = stack.popleft()
            if not node.left and not node.right:
                res.append(ls+str(node.val))
            if node.left:
                stack.append((node.left, ls+str(node.val)+'->'))
            if node.right:
                stack.append((node.right, ls+str(node.val)+'->'))

        return res
```

DFS + stack

```python
# Definition for a binary tree node.
# class TreeNode(object):
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution(object):
    def binaryTreePaths(self, root):
        """
        :type root: TreeNode
        :rtype: List[str]
        """
        if not root:
            return []
        res, stack = [], [(root, "")]
        while stack:
            node, ls = stack.pop()
            if not node.left and not node.right:
                res.append(ls+str(node.val))
            if node.right:
                stack.append((node.right, ls+str(node.val)+'->'))
            if node.left:
                stack.append((node.left, ls+str(node.val)+'->'))
        return res
```


text:
Projekt Gruppe6

Dokumentation:

Vorstellung unserer Seite:

Unser Projekt trägt den Namen "Gather". Auf unserer Webseite ist es möglich sich eine Datensammlung von Social Media Plattformen ohne Login anzuschauen.
In einer Suchleiste ist es möglich einen Namen einer Person öffentlichen Lebens einzugeben und die Suche zu starten. Der User erhält dann einen Newsfeed
mit den aktuellen Social Media Posts.

Features der Seite:

Unsere Seite bietet ein schlichtes elegantes Design, welches dank eines responsive Designs auch auf mobilen Endgeräten fehlerfrei funktioniert.
Die angezeigten Daten unserer Webseite werden direkt von den Social Media Plattformen nachgeladen, sodass man immer auf den neusten Stand bleibt
und wir keine Daten zwichenspeichern müssen. Zur beschleunigung der Geschwindigkeit unserer Webseite werden Informationen direkt im Hintergrund geladen,
sodass dem User lange Ladezeiten erspart beiben. Den erhaltenen Newsfeed kann man einfach durchscrollen und bereits gelesene Posts ausblenden.
Auch bei erneuter Suche einer Person muss unsere Webseite nicht neugeladen werden. Es ist jedoch möglich auch direkte Links zu bestimmten Personen
an seine Freunde weiter zu schicken.

Verwendete APIs:

- AJAX/XMLHttpRequest
- Facebook Graph Api
- Web Worker
- History Api
- Media Query (Responsive Design)

Informationen zur unserer Demo:

Um unsere Demo in einem geeigneten Rahmen zu halten, haben wir beschlossen die Suchmöglichkeiten der Personen auf Angela Merkel und Cristiano Ronaldo
einzuschränken. Des Weiteren werden nur Posts aus der Social Media Plattform Facebook angezeigt.


text:
package org.olat.core.gui.components.form.flexible.impl.elements;

import org.apache.commons.lang.StringEscapeUtils;
import org.olat.core.gui.GUIInterna;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.ComponentRenderer;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormJSHelper;
import org.olat.core.gui.render.RenderResult;
import org.olat.core.gui.render.Renderer;
import org.olat.core.gui.render.RenderingState;
import org.olat.core.gui.render.StringOutput;
import org.olat.core.gui.render.URLBuilder;
import org.olat.core.gui.translator.Translator;

/**
 * Description:

 * TODO: patrickb Class Description for SingleSelectionSelectboxRenderer
 *

 * Initial Date: 02.01.2007

 *
 * @author patrickb
 */
class SelectboxRenderer implements ComponentRenderer {

	/**
	 * @see org.olat.core.gui.components.ComponentRenderer#render(org.olat.core.gui.render.Renderer, org.olat.core.gui.render.StringOutput,
	 *      org.olat.core.gui.components.Component, org.olat.core.gui.render.URLBuilder, org.olat.core.gui.translator.Translator, org.olat.core.gui.render.RenderResult,
	 *      java.lang.String[])
	 */
	@Override
	@SuppressWarnings("unused")
	public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {

		SelectboxComponent ssec = (SelectboxComponent) source;

		if (GUIInterna.isLoadPerformanceMode()) {
			// Just make sure the replayID mapping is known
			ssec.getRootForm().getReplayableDispatchID(source);
		}

		String subStrName = "name=\"" + ssec.getGroupingName() + "\"";
		String[] options = ssec.getOptions();
		String[] values = ssec.getValues();
		String[] cssClasses = ssec.getCssClasses();

		// read write

		/*
		 * opening <select ... >
		 */
		sb.append("<select ");
		if (!ssec.isEnabled()) {
			sb.append(" disabled=\"disabled\" ");
		}
		sb.append("id=\"");
		sb.append(ssec.getFormDispatchId());
		sb.append("\" ");
		sb.append(subStrName);// the name
		if (ssec.isMultiSelect()) {
			sb.append(" multiple ");
			sb.append(" size=\"3\" ");
		}
		// add ONCHANGE Action to select
		if (ssec.getAction() == FormEvent.ONCHANGE) {
			sb.append(FormJSHelper.getRawJSFor(ssec.getRootForm(), ssec.getSelectionElementFormDisId(), ssec.getAction()));
		}

		sb.append(">");
		/*
		 * the options <option ...>value</option>
		 */
		int cnt = options.length;
		for (int i = 0; i < cnt; i++) {
			boolean selected = ssec.isSelected(i);
			sb.append("<option value=\"");
			sb.append(StringEscapeUtils.escapeHtml(options[i]));
			sb.append("\" ");
			if (selected) sb.append("selected=\"selected\" ");
			if (ssec.getAction() != FormEvent.ONCHANGE) {
				// all other events go to the option
				sb.append(FormJSHelper.getRawJSFor(ssec.getRootForm(), ssec.getSelectionElementFormDisId(), ssec.getAction()));
			}
			if (cssClasses != null) {
				sb.append(" class=\"");
				sb.append(cssClasses[i]);
				sb.append("\"");
			}
			sb.append(">");
			sb.append(StringEscapeUtils.escapeHtml(values[i]));
			sb.append("</option>");
		}
		/*
		 * closing </select>
		 */
		sb.append("</select>");

		if (source.isEnabled()) {
			// add set dirty form only if enabled
			sb.append(FormJSHelper.getJSStartWithVarDeclaration(ssec.getFormDispatchId()));
			sb.append(FormJSHelper.getSetFlexiFormDirty(ssec.getRootForm(), ssec.getFormDispatchId()));
			sb.append(FormJSHelper.getJSEnd());
		}

	}

	/**
	 * @see org.olat.core.gui.components.ComponentRenderer#renderBodyOnLoadJSFunctionCall(org.olat.core.gui.render.Renderer, org.olat.core.gui.render.StringOutput,
	 *      org.olat.core.gui.components.Component, org.olat.core.gui.render.RenderingState)
	 */
	@Override
	public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) {
		// TODO Auto-generated method stub

	}

	/**
	 * @see org.olat.core.gui.components.ComponentRenderer#renderHeaderIncludes(org.olat.core.gui.render.Renderer, org.olat.core.gui.render.StringOutput,
	 *      org.olat.core.gui.components.Component, org.olat.core.gui.render.URLBuilder, org.olat.core.gui.translator.Translator, org.olat.core.gui.render.RenderingState)
	 */
	@Override
	public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) {
		// TODO Auto-generated method stub

	}

}


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

<TITLE>
CDADatatypeParserUtil
</TITLE>

<META NAME="date" CONTENT="2012-04-16">

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

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

gov.nih.nci.cbiit.cmts.cda

Class CDADatatypeParserUtil

java.lang.Object
  gov.nih.nci.cbiit.cmts.cda.CDADatatypeParserUtil

public class CDADatatypeParserUtil
extends java.lang.Object

Created by IntelliJ IDEA.
 User: umkis
 Date: Oct 19, 2010
 Time: 4:11:21 PM
 To change this template use File | Settings | File Templates.

Constructor Summary

CDADatatypeParserUtil()

Method Summary

static java.util.List<java.lang.String>
findSubclassListWithTypeName(java.lang.String className)

static gov.nih.nci.caadapter.hl7.datatype.Datatype
getDatatype(java.lang.String name)

static gov.nih.nci.caadapter.hl7.datatype.Datatype
getDatatype(java.lang.String name,
            java.lang.String dir)

static CDADatatypeParser
getDatatypeParser(java.lang.String dir)

static boolean
isAbstractDatatypeWithName(java.lang.String typeName)

Methods inherited from class java.lang.Object

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

Constructor Detail

CDADatatypeParserUtil

public CDADatatypeParserUtil()

Method Detail

getDatatypeParser

public static CDADatatypeParser getDatatypeParser(java.lang.String dir)

getDatatype

public static gov.nih.nci.caadapter.hl7.datatype.Datatype getDatatype(java.lang.String name)

getDatatype

public static gov.nih.nci.caadapter.hl7.datatype.Datatype getDatatype(java.lang.String name,
                                                                      java.lang.String dir)

findSubclassListWithTypeName

public static java.util.List<java.lang.String> findSubclassListWithTypeName(java.lang.String className)

isAbstractDatatypeWithName

public static boolean isAbstractDatatypeWithName(java.lang.String typeName)

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
<?php

namespace Concrete\Core\Application\UserInterface\ContextMenu;

use HtmlObject\Element;

interface MenuInterface extends \JsonSerializable
{

    /**
     * @return Element
     */
    function getMenuElement();

}


text:
A Puppet module for managing the SpiderOak backup tool

# Module usage

* [Class: spideroak](manifests/init.pp)
* [Define: spideroak::cron](manifests/cron.pp)
* [Define: spideroak::device](manifests/device.pp)

# Dependencies

See [metadata.json](metadata.json).

# Operating system support

This module has been tested on

* Debian 7
* Ubuntu 12.04
* Ubuntu 14.04
* Fedora 21

For details see [params.pp](manifests/params.pp).


text:
class Test {
  public static final int FOO = 0;
  public static final int BAR = 2;
  void foo() {
    System.out.println(FOO);
  }
}


text:
package test.matcher;

import java.util.Date;

import org.hamcrest.CoreMatchers;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.core.IsAnything;

import hu.interconnect.hr.backend.api.dto.HaviJelenletiIvResponseDTO;
import hu.interconnect.hr.backend.api.dto.JelenletiAdatDTO;

public class HaviJelenletiIvResponseDTOMatcher extends AbstractTypeSafeDiagnosingMatcher<HaviJelenletiIvResponseDTO> {

	private Matcher<Date> honap = new IsAnything<>();

	private Matcher<Integer> tsz = new IsAnything<>();

	private Matcher<Iterable<? extends JelenletiAdatDTO>> jelenletiAdatok = new IsAnything<>();

	private Matcher<Boolean> honapSzerkesztheto = new IsAnything<>();

	public HaviJelenletiIvResponseDTOMatcher honap(Date honap) {
		this.honap = CoreMatchers.is(honap);
		return this;
	}

	public HaviJelenletiIvResponseDTOMatcher tsz(Integer tsz) {
		this.tsz = CoreMatchers.is(tsz);
		return this;
	}

	public HaviJelenletiIvResponseDTOMatcher jelenletiAdatok(Matcher<Iterable<? extends JelenletiAdatDTO>> jelenletiAdatok) {
		this.jelenletiAdatok = CoreMatchers.is(jelenletiAdatok);
		return this;
	}

	public HaviJelenletiIvResponseDTOMatcher honapSzerkesztheto(boolean honapSzerkesztheto) {
		this.honapSzerkesztheto = CoreMatchers.is(honapSzerkesztheto);
		return this;
	}

	@Override
	protected boolean matchesSafely(HaviJelenletiIvResponseDTO item, Description mismatchDescription) {
		return matches(honap, item.honap, "honap value: ", mismatchDescription) &&
				matches(tsz, item.tsz, "tsz value: ", mismatchDescription) &&
				matches(jelenletiAdatok, item.jelenletiAdatok, "jelenletiAdatok value: ", mismatchDescription) &&
				matches(honapSzerkesztheto, item.honapSzerkesztheto, "honapSzerkesztheto value: ", mismatchDescription);
	}

	@Override
	public void describeTo(Description description) {
		description.appendText(HaviJelenletiIvResponseDTO.class.getSimpleName())
        	.appendText(", honap: ").appendDescriptionOf(honap)
        	.appendText(", tsz: ").appendDescriptionOf(tsz)
        	.appendText(", jelenletiAdatok: ").appendDescriptionOf(jelenletiAdatok)
        	.appendText(", honapSzerkesztheto: ").appendDescriptionOf(honapSzerkesztheto);
	}
}


text:
"""A function to begin dataset downloads in a separate thread."""

import sys
from time import time
from threading import Thread, Lock
import wx
from retriever.lib.tools import final_cleanup

class DownloadThread(Thread):
    def __init__(self, engine, script):
        Thread.__init__(self)
        self.engine = engine
        self.engine.disconnect()
        self.script = script
        self.daemon = True
        self.output_lock = Lock()
        self.output = []
        self.done = False

    def run(self):
        try:
            self.engine.connect()
            self.download_script()
            self.done = True
            self.engine.disconnect()
        except:
            self.engine.disconnect()
            raise
            return

    def finished(self):
        return self.done

    def download_script(self):
        engine = self.engine
        script = self.script
        worker = self

        start = time()

        class download_stdout:
            def write(self, s):
                if s and s != '\n':
                    worker.output_lock.acquire()
                    worker.output.append(s)
                    worker.output_lock.release()

        sys.stdout = download_stdout()

        print "Connecting to database..."

        # Connect
        try:
            engine.get_cursor()
        except Exception as e:
            print "Error: There was an error with your database connection.
" + e.__str__() + ""
            return

        # Download script
        error = False

        print "Downloading. . ."
        try:
            script.download(engine)
        except Exception as e:
            error = True
            print "Error: " + e.__str__() + ""

        if not error:
            finish = time()

            time_diff = finish - start

            if time_diff > 3600:
                h = time_diff // 3600
                time_diff %= 3600
            else:
                h = 0
            if time_diff > 60:
                m = time_diff // 60
                time_diff %= 60
            else:
                m = 0
            s = "%.2f" % (time_diff)
            if len(s.split('.')[0]) < 2:
                s = "0" + s

            print "Done! Elapsed time: %02d:%02d:%s" % (h, m, s)


text:
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Ess20140828DeleteScheduledTaskRequest(RestApi):
	def __init__(self,domain='ess.aliyuncs.com',port=80):
		RestApi.__init__(self,domain, port)
		self.ScheduledTaskId = None

	def getapiname(self):
		return 'ess.aliyuncs.com.DeleteScheduledTask.2014-08-28'


text:
function Get-WPFTextBoxText
{
<#
	.SYNOPSIS
		Function to get the text from the TextBox Control

	.DESCRIPTION
		Function to get the text from the TextBox Control

	.PARAMETER TextBox
		Specifies the TextBox Control

	.EXAMPLE
		PS C:\> Get-WPFTextBoxText -TextBox $TextBox1

	.NOTES
		Francois-Xavier Cat
		lazywinadmin.com
		@lazywinadm
		github.com/lazywinadmin
#>

	PARAM ([System.Windows.Controls.TextBox]
		$TextBox)
	$TextBox.Text
}


text:
package com.helger.jaxb.builder;

@Deprecated
public final class MockExternalArchiveReaderBuilder extends
                                                    JAXBReaderBuilder <com.helger.jaxb.mock.external.MockJAXBArchive, MockExternalArchiveReaderBuilder>
{
  public MockExternalArchiveReaderBuilder ()
  {
    super (new ExternalArchiveDocumentType ());
  }
}


text:
@interface BluetoothPageTVC ()<CBCentralManagerDelegate>
@property (strong, nonatomic) CBCentralManager *centralManager;
@property (strong, nonatomic) NSMutableArray *peripherals; // of CBPerhipheral
@end

@implementation BluetoothPageTVC

- (NSMutableArray *)peripherals
{
    if (!_peripherals) _peripherals = [[NSMutableArray alloc] init];
    return _peripherals;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}

#pragma mark - Table view data source

- (void)viewDidAppear:(BOOL)animated
{
    self.centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [self.centralManager stopScan];
    self.centralManager = nil;
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
    if (self.centralManager && self.centralManager.state == CBCentralManagerStatePoweredOn) {
        [self.centralManager scanForPeripheralsWithServices:nil
                                                    options:nil];
    }
}

- (void)centralManager:(CBCentralManager *)central
 didDiscoverPeripheral:(CBPeripheral *)peripheral
     advertisementData:(NSDictionary *)advertisementData
                  RSSI:(NSNumber *)RSSI
{
    [self.peripherals addObject:peripheral];
    [self.tableView reloadData];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.peripherals.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Bluetooth Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    CBPeripheral *peripheral = [self.peripherals objectAtIndex:indexPath.row];

    cell.textLabel.text = peripheral.name;
    cell.detailTextLabel.text = peripheral.identifier.UUIDString;

    return cell;
}

@end


text:
package org.elasticsearch.xpack.watcher.trigger.schedule.support;

import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;

import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;

import static org.elasticsearch.common.util.set.Sets.newHashSet;
import static org.elasticsearch.xpack.watcher.support.Strings.join;

public class WeekTimes implements Times {

    public static final EnumSet<DayOfWeek> DEFAULT_DAYS = EnumSet.of(DayOfWeek.MONDAY);
    public static final DayTimes[] DEFAULT_TIMES = new DayTimes[] { new DayTimes() };

    private final EnumSet<DayOfWeek> days;
    private final DayTimes[] times;

    public WeekTimes() {
        this(DEFAULT_DAYS, DEFAULT_TIMES);
    }

    public WeekTimes(DayOfWeek day, DayTimes times) {
        this(day, new DayTimes[] { times });
    }

    public WeekTimes(DayOfWeek day, DayTimes[] times) {
        this(EnumSet.of(day), times);
    }

    public WeekTimes(EnumSet<DayOfWeek> days, DayTimes[] times) {
        this.days = days.isEmpty() ? DEFAULT_DAYS : days;
        this.times = times.length == 0 ? DEFAULT_TIMES : times;
    }

    public EnumSet<DayOfWeek> days() {
        return days;
    }

    public DayTimes[] times() {
        return times;
    }

    public Set<String> crons() {
        Set<String> crons = new HashSet<>();
        for (DayTimes times : this.times) {
            String hrsStr = join(",", times.hour);
            String minsStr = join(",", times.minute);
            String daysStr = DayOfWeek.cronPart(this.days);
            crons.add("0 " + minsStr + " " + hrsStr + " ? * " + daysStr);
        }
        return crons;
    }

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

        WeekTimes that = (WeekTimes) o;

        if (!days.equals(that.days)) return false;

        // we don't care about order
        if (!newHashSet(times).equals(newHashSet(that.times))) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = days.hashCode();
        result = 31 * result + Arrays.hashCode(times);
        return result;
    }

    @Override
    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
        builder.startObject();
        builder.field(DAY_FIELD.getPreferredName(), days);
        builder.startArray(TIME_FIELD.getPreferredName());
        for (DayTimes dayTimes : times) {
            dayTimes.toXContent(builder, params);
        }
        builder.endArray();
        return builder.endObject();
    }

    public static Builder builder() {
        return new Builder();
    }

    public static WeekTimes parse(XContentParser parser, XContentParser.Token token) throws IOException, ElasticsearchParseException {
        if (token != XContentParser.Token.START_OBJECT) {
            throw new ElasticsearchParseException("could not parse week times. expected an object, but found [{}]", token);
        }
        Set<DayOfWeek> daysSet = new HashSet<>();
        Set<DayTimes> timesSet = new HashSet<>();
        String currentFieldName = null;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
                currentFieldName = parser.currentName();
            } else if (DAY_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
                if (token.isValue()) {
                    daysSet.add(parseDayValue(parser, token));
                } else if (token == XContentParser.Token.START_ARRAY) {
                    while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                        daysSet.add(parseDayValue(parser, token));
                    }
                } else {
                    throw new ElasticsearchParseException("invalid week day value for [{}] field. expected string/number value or an " +
                            "array of string/number values, but found [{}]", currentFieldName, token);
                }
            } else if (TIME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
                if (token != XContentParser.Token.START_ARRAY) {
                    try {
                        timesSet.add(DayTimes.parse(parser, token));
                    } catch (ElasticsearchParseException pe) {
                        throw new ElasticsearchParseException("invalid time value for field [{}] - [{}]", pe, currentFieldName, token);
                    }
                } else {
                    while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                        try {
                            timesSet.add(DayTimes.parse(parser, token));
                        } catch (ElasticsearchParseException pe) {
                            throw new ElasticsearchParseException("invalid time value for field [{}] - [{}]", pe, currentFieldName, token);
                        }
                    }
                }
            }
        }
        EnumSet<DayOfWeek> days = daysSet.isEmpty() ? EnumSet.of(DayOfWeek.MONDAY) : EnumSet.copyOf(daysSet);
        DayTimes[] times = timesSet.isEmpty() ? new DayTimes[] { new DayTimes(0, 0) } : timesSet.toArray(new DayTimes[timesSet.size()]);
        return new WeekTimes(days, times);
    }

    static DayOfWeek parseDayValue(XContentParser parser, XContentParser.Token token) throws IOException {
        if (token == XContentParser.Token.VALUE_STRING) {
            return DayOfWeek.resolve(parser.text());
        }
        if (token == XContentParser.Token.VALUE_NUMBER) {
            return DayOfWeek.resolve(parser.intValue());
        }
        throw new ElasticsearchParseException("invalid weekly day value. expected a string or a number value, but found [" + token + "]");
    }

    public static class Builder {

        private final Set<DayOfWeek> days = new HashSet<>();
        private final Set<DayTimes> times = new HashSet<>();

        private Builder() {
        }

        public Builder on(DayOfWeek... days) {
            Collections.addAll(this.days, days);
            return this;
        }

        public Builder at(int hour, int minute) {
            times.add(new DayTimes(hour, minute));
            return this;
        }

        public Builder atRoundHour(int... hours) {
            times.add(new DayTimes(hours, new int[] { 0 }));
            return this;
        }

        public Builder atNoon() {
            times.add(DayTimes.NOON);
            return this;
        }

        public Builder atMidnight() {
            times.add(DayTimes.MIDNIGHT);
            return this;
        }

        public WeekTimes build() {
            EnumSet<DayOfWeek> dow = days.isEmpty() ? WeekTimes.DEFAULT_DAYS : EnumSet.copyOf(days);
            return new WeekTimes(dow, times.toArray(new DayTimes[times.size()]));
        }

    }
}


text:
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

abstract class Test {
  public List<Integer> gerFirstTriangles() {
    return flatMap((y -> (map((z1 -> (1)))))).collect(Collectors.toList());
  }

  abstract <R> R         flatMap(Function<Integer, R> mapper);
  abstract <R> Stream<R> map    (Function<Integer, R> mapper);
}


text:
package utils

import com.datastax.spark.connector.cql.CassandraConnector
import org.apache.spark.SparkConf

object CassandraSettings {

  /**
    * Set up the keyspace and tables used for storing messages
    * @param conf
    */
  def setUp(conf: SparkConf): Unit = {
    CassandraConnector(conf).withSessionDo { session =>
      session.execute("CREATE KEYSPACE IF NOT EXISTS forums WITH REPLICATION = {'class': 'SimpleStrategy', 'replication_factor': 3}")

      session.execute(
        """
        CREATE TABLE IF NOT EXISTS forums.threads (
          title text,
          link text,
          date timestamp,
          messages frozen <list<map<text, text>>>,
          PRIMARY KEY (title)
        )"""
      )
    }
  }
}


text:
ros::Publisher ros1_pub;

void ros2ChatterCallback(const std_interfaces::msg::String::ConstSharedPtr & ros2_msg)
{
  printf("  I heard from ROS 2: [%s]\n", ros2_msg->data.c_str());

  std_msgs::String ros1_msg;
  ros1_msg.data = ros2_msg->data;
  printf("  Passing along to ROS 1: [%s]\n", ros1_msg.data.c_str());
  ros1_pub.publish(ros1_msg);
}

publisher::Publisher::SharedPtr ros2_pub;

void ros1ChatterCallback(const ros::MessageEvent<std_msgs::String const> & ros1_msg_event)
{
  const boost::shared_ptr<ros::M_string>& connection_header = ros1_msg_event.getConnectionHeaderPtr();
  std::string key = "callerid";
  if (connection_header->find(key) != connection_header->end()) {
    if (connection_header->at(key) == "/ros_bridge") {
      printf("    I heard from ROS 1 from myself\n");
      return;
    }
    printf("I heard from ROS 1 from: [%s]\n", connection_header->at(key).c_str());
  }

  const boost::shared_ptr<std_msgs::String const> & ros1_msg = ros1_msg_event.getConstMessage();
  printf("I heard from ROS 1: [%s]\n", ros1_msg->data.c_str());

  auto ros2_msg = std::make_shared<std_interfaces::msg::String>();
  ros2_msg->data = ros1_msg->data;
  printf("Passing along to ROS 2: [%s]\n", ros2_msg->data.c_str());
  ros2_pub->publish(ros2_msg);
}

int main(int argc, char * argv[])
{
  // ROS 1 node and publisher
  ros::init(argc, argv, "ros_bridge");
  ros::NodeHandle ros1_node;
  ros1_pub = ros1_node.advertise<std_msgs::String>("chatter", 10);

  // ROS 2 node and publisher
  rclcpp::init(argc, argv);
  auto ros2_node = rclcpp::node::Node::make_shared("ros_bridge");
  ros2_pub = ros2_node->create_publisher<std_interfaces::msg::String>("chatter", 10);

  // ROS 1 subscriber
  ros::Subscriber ros1_sub = ros1_node.subscribe("chatter", 10, ros1ChatterCallback);

  // ROS 2 subscriber
  auto ros2_sub = ros2_node->create_subscription<std_interfaces::msg::String>(
    "chatter", 10, ros2ChatterCallback, nullptr, true);

  // ROS 1 asynchronous spinner
  ros::AsyncSpinner async_spinner(1);
  async_spinner.start();

  // ROS 2 spinning loop
  rclcpp::executors::SingleThreadedExecutor executor;
  while (ros1_node.ok() && rclcpp::utilities::ok()) {
    executor.spin_node_once(ros2_node, true);
  }

  return 0;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>Qt 4.8: iterator Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />

  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />

      Home

    Qt Reference Documentation

Qt HOME

DEV

          DOC

BLOG

Qt 4.8

ALL VERSIONS

API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

Examples

Examples

Tutorials

Demos

QML Examples

          Search index:

          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />

 Close

All | API | Articles | Examples

 results:

            </fieldset>
          </form>

            API Lookup

Class index

Function index

Modules

Namespaces

Global Declarations

QML elements

            Qt Topics

Programming with Qt

Device UIs & Qt Quick

UI Design with Qt

Supported Platforms

Qt and Key Technologies

How-To's and Best Practices

            Examples

Examples

Tutorials

Demos

QML Examples

Home

Modules

QtCore

iterator

A

A

A

                Print

Contents

Public Types

Public Functions

Detailed Description

iterator Class Reference

(QList::iterator)

The QList::iterator class provides an STL-style non-const iterator for QList and QQueue. More...

 #include <QList>

List of all members, including inherited members

Public Types

 typedef 	iterator_category

Public Functions

 	iterator ()

 	iterator ( const iterator & other )

 bool 	operator!= ( const iterator & other ) const

 bool 	operator!= ( const const_iterator & other ) const

 T & 	operator* () const

 iterator 	operator+ ( int j ) const

 iterator & 	operator++ ()

 iterator 	operator++ ( int )

 iterator & 	operator+= ( int j )

 iterator 	operator- ( int j ) const

 int 	operator- ( iterator other ) const

 iterator & 	operator-- ()

 iterator 	operator-- ( int )

 iterator & 	operator-= ( int j )

 T * 	operator-> () const

 bool 	operator< ( const iterator & other ) const

 bool 	operator< ( const const_iterator & other ) const

 bool 	operator<= ( const iterator & other ) const

 bool 	operator<= ( const const_iterator & other ) const

 bool 	operator== ( const iterator & other ) const

 bool 	operator== ( const const_iterator & other ) const

 bool 	operator> ( const iterator & other ) const

 bool 	operator> ( const const_iterator & other ) const

 bool 	operator>= ( const iterator & other ) const

 bool 	operator>= ( const const_iterator & other ) const

 T & 	operator[] ( int j ) const

Detailed Description

The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.

QList features both STL-style iterators and Java-style iterators. The STL-style iterators are more low-level and more cumbersome to use; on the other hand, they are slightly faster and, for developers who already know STL, have the advantage of familiarity.

QList<T>::iterator allows you to iterate over a QList<T> (or QQueue<T>) and to modify the list item associated with the iterator. If you want to iterate over a const QList, use QList::const_iterator instead. It is generally good practice to use QList::const_iterator on a non-const QList as well, unless you need to change the QList through the iterator. Const iterators are slightly faster, and can improve code readability.

The default QList::iterator constructor creates an uninitialized iterator. You must initialize it using a QList function like QList::begin(), QList::end(), or QList::insert() before you can start iterating. Here's a typical loop that prints all the items stored in a list:

 QList<QString> list;
 list.append("January");
 list.append("February");
 ...
 list.append("December");

 QList<QString>::iterator i;
 for (i = list.begin(); i != list.end(); ++i)
     cout << *i << endl;

Let's see a few examples of things we can do with a QList::iterator that we cannot do with a QList::const_iterator. Here's an example that increments every value stored in a QList<int> by 2:

 QList<int>::iterator i;
 for (i = list.begin(); i != list.end(); ++i)
     *i += 2;

Most QList functions accept an integer index rather than an iterator. For that reason, iterators are rarely useful in connection with QList. One place where STL-style iterators do make sense is as arguments to generic algorithms.

For example, here's how to delete all the widgets stored in a QList<QWidget *>:

 QList<QWidget *> list;
 ...
 qDeleteAll(list.begin(), list.end());

Multiple iterators can be used on the same list. However, be aware that any non-const function call performed on the QList will render all existing iterators undefined. If you need to keep iterators over a long period of time, we recommend that you use QLinkedList rather than QList.

See also QList::const_iterator and QMutableListIterator.

Member Type Documentation

typedef iterator::iterator_category

A synonym for std::random_access_iterator_tag indicating this iterator is a random access iterator.

Member Function Documentation

iterator::iterator ()

Constructs an uninitialized iterator.

Functions like operator*() and operator++() should not be called on an uninitialized iterator. Use operator=() to assign a value to it before using it.

See also QList::begin() and QList::end().

iterator::iterator ( const iterator & other )

Constructs a copy of other.

bool iterator::operator!= ( const iterator & other ) const

Returns true if other points to a different item than this iterator; otherwise returns false.

See also operator==().

bool iterator::operator!= ( const const_iterator & other ) const

Returns true if other points to a different item than this iterator; otherwise returns false.

See also operator==().

T & iterator::operator* () const

Returns a modifiable reference to the current item.

You can change the value of an item by using operator*() on the left side of an assignment, for example:

 if (*it == "Hello")
     *it = "Bonjour";

See also operator->().

iterator iterator::operator+ ( int j ) const

Returns an iterator to the item at j positions forward from this iterator. (If j is negative, the iterator goes backward.)

See also operator-() and operator+=().

iterator & iterator::operator++ ()

The prefix ++ operator (<tt>++it</tt>) advances the iterator to the next item in the list and returns an iterator to the new current item.

Calling this function on QList::end() leads to undefined results.

See also operator--().

iterator iterator::operator++ ( int )

This is an overloaded function.

The postfix ++ operator (<tt>it++</tt>) advances the iterator to the next item in the list and returns an iterator to the previously current item.

iterator & iterator::operator+= ( int j )

Advances the iterator by j items. (If j is negative, the iterator goes backward.)

See also operator-=() and operator+().

iterator iterator::operator- ( int j ) const

Returns an iterator to the item at j positions backward from this iterator. (If j is negative, the iterator goes forward.)

See also operator+() and operator-=().

int iterator::operator- ( iterator other ) const

Returns the number of items between the item pointed to by other and the item pointed to by this iterator.

iterator & iterator::operator-- ()

The prefix -- operator (<tt>--it</tt>) makes the preceding item current and returns an iterator to the new current item.

Calling this function on QList::begin() leads to undefined results.

See also operator++().

iterator iterator::operator-- ( int )

This is an overloaded function.

The postfix -- operator (<tt>it--</tt>) makes the preceding item current and returns an iterator to the previously current item.

iterator & iterator::operator-= ( int j )

Makes the iterator go back by j items. (If j is negative, the iterator goes forward.)

See also operator+=() and operator-().

T * iterator::operator-> () const

Returns a pointer to the current item.

See also operator*().

bool iterator::operator< ( const iterator & other ) const

Returns true if the item pointed to by this iterator is less than the item pointed to by the other iterator.

bool iterator::operator< ( const const_iterator & other ) const

Returns true if the item pointed to by this iterator is less than the item pointed to by the other iterator.

bool iterator::operator<= ( const iterator & other ) const

Returns true if the item pointed to by this iterator is less than or equal to the item pointed to by the other iterator.

bool iterator::operator<= ( const const_iterator & other ) const

Returns true if the item pointed to by this iterator is less than or equal to the item pointed to by the other iterator.

bool iterator::operator== ( const iterator & other ) const

Returns true if other points to the same item as this iterator; otherwise returns false.

See also operator!=().

bool iterator::operator== ( const const_iterator & other ) const

Returns true if other points to the same item as this iterator; otherwise returns false.

See also operator!=().

bool iterator::operator> ( const iterator & other ) const

Returns true if the item pointed to by this iterator is greater than the item pointed to by the other iterator.

bool iterator::operator> ( const const_iterator & other ) const

Returns true if the item pointed to by this iterator is greater than the item pointed to by the other iterator.

bool iterator::operator>= ( const iterator & other ) const

Returns true if the item pointed to by this iterator is greater than or equal to the item pointed to by the other iterator.

bool iterator::operator>= ( const const_iterator & other ) const

Returns true if the item pointed to by this iterator is greater than or equal to the item pointed to by the other iterator.

T & iterator::operator[] ( int j ) const

Returns a modifiable reference to the item at position *this + j.

This function is provided to make QList iterators behave like C++ pointers.

See also operator+().

      <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.

      The documentation provided herein is licensed under the terms of the
      GNU Free Documentation
      License version 1.3 as published by the Free Software Foundation.

      Documentation sources may be obtained from
      www.qt-project.org.

      Digia, Qt and their respective logos are trademarks of Digia Plc
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. Privacy Policy


text:
import React from 'react'
import PropTypes from 'prop-types'
import { Form, Input, Modal, Button } from 'antd'
import { createOkHander } from 'utils/form'
import { l } from 'utils/localization'
import { HorizontalFormGenerator } from 'components/Helper/FormGenerator'
const FormItem = Form.Item
import { dialogHelperFns, dialogBtns } from 'utils/dialogDefault'

const ChangePasswordDialog = React.createClass({
    getInitialState(){
      return {
          visible: false
      }
    },
    showChangePassword (e) {
      if (e) e.stopPropagation();
      this.setState({
        visible: true,
      })
      if (this.props.onShowDialog) this.props.onShowDialog()
    },
    render() {
      return (
        <div className={this.props.navClassName}>
          <Button onClick={this.showChangePassword}>{l("Change password")}</Button>
          <Modal
            title={l('Change your password')}
            visible={this.state.visible}
            onOk={this.okHandler}
            onCancel={this.hideModelHandler}
            {...this.props}
          >
            {this.props.children}
          </Modal>
        </div>
      )
    },
    ...dialogHelperFns,
  }
)

const ChangePasswordForm = React.createClass({
    render() {
      const formProps = {
        name: "changePassword",
        fields: [
          {
            id: "pwd1",
            label: "New password",
            input: "password",
          },{
            id: "pwd2",
            label: "Password confirmation",
            input: "password",
          }
        ],
        ...this.props,
      }
      return (
        <HorizontalFormGenerator {...formProps} />
      )
    },
  }
)

const modal = ({
  onOk,
  form: {
    getFieldDecorator,
    validateFieldsAndScroll,
    getFieldsValue,
  },
  appSettings,
  ...modalProps,
}) => {
  const modalOpts = {
    ...modalProps,
    ...dialogBtns(),
    okHandler: createOkHander(validateFieldsAndScroll, getFieldsValue, onOk),
  }
  const formProps = {
    getFieldDecorator,
    validateFieldsAndScroll,
    getFieldsValue,
    appSettings,
  }
  return (
    <ChangePasswordDialog {...modalOpts}>
      <ChangePasswordForm {...formProps}/>
    </ChangePasswordDialog>
  )
}

modal.propTypes = {
  form: PropTypes.object.isRequired,
  onOk: PropTypes.func.isRequired,
  appSettings: PropTypes.object.isRequired,
}

export default Form.create()(modal)


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
    <type>org.netbeans.modules.apisupport.project</type>
    <configuration>
        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
            <code-name-base>nbpio.project</code-name-base>
            <suite-component/>
            <module-dependencies>
                <dependency>
                    <code-name-base>org.netbeans.api.templates</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>1.6.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.netbeans.libs.json_simple</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <release-version>1</release-version>
                        <specification-version>0.11.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.netbeans.libs.swingx</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <release-version>1</release-version>
                        <implementation-version/>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.netbeans.modules.cnd.makeproject</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <release-version>2</release-version>
                        <implementation-version/>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.netbeans.modules.dlight.nativeexecution</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <implementation-version/>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <release-version>1</release-version>
                        <specification-version>1.65.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <release-version>1</release-version>
                        <specification-version>1.86.1.8</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.awt</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>7.65.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.dialogs</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>7.41.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.filesystems</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>9.8.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.io</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>1.48.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.modules</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>7.47.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.util</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>9.5.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.util.lookup</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>8.32.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.util.ui</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>9.4.1</specification-version>
                    </run-dependency>
                </dependency>
                <dependency>
                    <code-name-base>org.openide.windows</code-name-base>
                    <build-prerequisite/>
                    <compile-dependency/>
                    <run-dependency>
                        <specification-version>6.74.1</specification-version>
                    </run-dependency>
                </dependency>
            </module-dependencies>
            <test-dependencies>
                <test-type>
                    <name>unit</name>
                    <test-dependency>
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
                        <compile-dependency/>
                    </test-dependency>
                </test-type>
            </test-dependencies>
            <public-packages/>
        </data>
    </configuration>
</project>


text:
package GtsSoftware.actividad;

import java.io.Serializable;

public class ActividadBeanData implements Serializable{

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private Integer codigo;
	private String nombre;
	private String descripcion;
	private String tipo;
	private Integer idProgramacion;
	private Integer idActividad;

	public Integer getIdActividad() {
		return idActividad;
	}

	public void setIdActividad(Integer idActividad) {
		this.idActividad = idActividad;
	}

	public Integer getIdProgramacion() {
		return idProgramacion;
	}

	public void setIdProgramacion(Integer idProgramacion) {
		this.idProgramacion = idProgramacion;
	}

	public Integer getCodigo() {
		return codigo;
	}

	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	public String getTipo() {
		return tipo;
	}

	public void setTipo(String tipo) {
		this.tipo = tipo;
	}

}


text:
layout: index.hbs
labels:
  current-version: Versión Actual
  download: Descargar
  download-for: Descargar para
  other-downloads: Outras Descargas
  other-lts-downloads: Outras Descargas LTS
  other-current-downloads: Outras Descargas Actuales
  current: Actual
  lts: LTS
  tagline-current: Últimas Características
  tagline-lts: Recomendado para a maioría
  changelog: Cambios
  api: Documentación do API
  version-schedule-prompt: Ou revise á
  version-schedule-prompt-link-text: Axenda de LTS.
---

Node.js® é un entorno de execución para JavaScript construído co [motor de JavaScript V8 de Chrome](https://v8.dev/).