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

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Creating Indexes</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.62.4" />
    <link rel="home" href="index.html" title="Getting Started with Berkeley DB" />
    <link rel="up" href="persist_index.html" title="Chapter 4. Working with Indices" />
    <link rel="previous" href="persist_index.html" title="Chapter 4. Working with Indices" />
    <link rel="next" href="persist_access.html" title="Chapter 5. Saving and Retrieving Objects" />

          Creating Indexes

          Prev
          Chapter 4. Working with Indices
           Next

Creating Indexes

                  To create an index using the DPL, you use Java
                  annotations to declare which feature on the class is used
                  for the primary index, and which features (if any) are to
                  be used as secondary indexes.

                  All entity classes stored in the DPL must have a
                  primary index declared for it.

                  Entity classes can have zero or more secondary
                  indexes declared for them. There is no limit on the
                  number of secondary indexes that you can declare.

Declaring a Primary Indexes

                          You declare a primary key for an entity class by
                          using the <tt class="literal">@PrimaryKey</tt>
                          annotation. This annotation must appear
                          immediately before the data member which
                          represents the class's primary key. For example:

package persist.gettingStarted;

import com.sleepycat.persist.model.Entity;
import com.sleepycat.persist.model.PrimaryKey;

@Entity
public class Vendor {

    private String address;
    private String bizPhoneNumber;
    private String city;
    private String repName;
    private String repPhoneNumber;
    private String state;

    // Primary key is the vendor's name
    // This assumes that the vendor's name is
    // unique in the database.
    @PrimaryKey
    private String vendor;

    ...

                            For this class, the <tt class="literal">vendor</tt> value is set for an individual
                            <tt class="classname">Vendor</tt> class object by
                            the <tt class="methodname">setVendorName()</tt>
                            method. If our example code fails to set this
                            value before storing the object, the data
                            member used to store the primary key is set to a
                            null value. This would result in a runtime
                            error.

                            You can avoid the need to explicitly set a
                            value for a class's primary index by specifying
                            a sequence to be used for the primary key. This
                            results in an unique integer value being used
                            as the primary key for each stored object.

                        You declare a sequence is to be used by specifying
                        the <tt class="literal">sequence</tt> keyword to the
                        <tt class="literal">@PrimaryKey</tt> annotation.
                        For example:

@PrimaryKey(sequence="")
long myPrimaryKey;

                        If you provide the <tt class="literal">sequence</tt> keyword with a name,
                        then the sequence is obtained from that named sequence.  For example:

@PrimaryKey(sequence="Sequence_Namespace")
long myPrimaryKey;

Declaring Secondary Indexes

                        To declare a secondary index, we use the
                        <tt class="literal">@SecondaryKey</tt> annotation. Note
                        that when we do this, we must declare what sort of
                        an index it is; that is, what is its relationship to
                        other data in the data store.

                        The kind of indices that we
                        can declare are:

                                        <tt class="literal">ONE_TO_ONE</tt>

                                        This relationship indicates that
                                        the secondary key is unique to the
                                        object. If an object is stored with a
                                        secondary key that already
                                        exists in the data store, a run
                                        time error is raised.

                                        For example, a person object might
                                        be stored with a primary key of a
                                        social security number (in the US),
                                        with a secondary key of the
                                        person's employee number. Both
                                        values are expected to be unique in
                                        the data store.

                                        <tt class="literal">MANY_TO_ONE</tt>

                                        Indicates that the secondary key
                                        may be used for multiple
                                        objects in the data store. That is,
                                        the key appears more than
                                        once, but for each stored object it
                                        can be used only once.

                                        Consider a data store that relates
                                        managers to employees. A given
                                        manager will have multiple
                                        employees, but each employee is
                                        assumed to have just one manager.
                                        In this case, the manager's
                                        employee number might be a
                                        secondary key, so that you can
                                        quickly locate all the objects
                                        related to that manager's
                                        employees.

                                        <tt class="literal">ONE_TO_MANY</tt>

                                        Indicates that the secondary key
                                        might be used more than once for a
                                        given object. Index keys
                                        themselves are assumed to be
                                        unique, but multiple instances of
                                        the index can be used per object.

                                        For example, employees might have
                                        multiple unique email addresses. In
                                        this case, any given object can be
                                        access by one or more email
                                        addresses. Each such address is
                                        unique in the data store, but each
                                        such address will relate to a
                                        single employee object.

                                        <tt class="literal">MANY_TO_MANY</tt>

                                        There can be multiple keys for
                                        any given object, and for any given
                                        key there can be many related
                                        objects.

                                            For example, suppose your
                                            organization has a shared
                                            resource, such as printers. You
                                            might want to track which
                                            printers a given employee can
                                            use (there might be more than
                                            one). You might also want to
                                            track which employees can use a
                                            specific printer. This
                                            represents a many-to-many
                                            relationship.

                        Note that for <tt class="literal">ONE_TO_ONE</tt> and
                        <tt class="literal">MANY_TO_ONE</tt> relationships, you
                        need a simple data member (not an array or
                        collection) to hold the key. For
                        <tt class="literal">ONE_TO_MANY</tt> and
                        <tt class="literal">MANY_TO_MANY</tt> relationships, you
                        need an array or collection to hold the keys:

@SecondaryKey(relate=ONE_TO_ONE)
private String primaryEmailAddress = new String();

@SecondaryKey(relate=ONE_TO_MANY)
private Set<String> emailAddresses = new HashSet<String>();

Foreign Key Constraints

                            Sometimes a secondary index is related in some
                            way to another entity class that is also
                            contained in the data store. That is, the
                            secondary key might be the primary key for
                            another entity class. If this is the case, you
                            can declare the foreign key constraint to make
                            data integrity easier to accomplish.

                            For example, you might have one class that is
                            used to represent employees.
                            You might have another that is used to
                            represent corporate divisions. When you add or
                            modify an employee record, you might want to
                            ensure that the division to which the employee
                            belongs is known to the data store. You do this
                            by specifying a foreign key constraint.

                            When a foreign key constraint is declared:

                                                 When a new secondary key
                                                 for the object is stored,
                                                 it is checked to make sure
                                                 it exists as a primary
                                                 key for the related
                                                 entity object. If it does
                                                 not, a runtime error
                                                 occurs.

                                                 When a related entity is
                                                 deleted (that is, a
                                                 corporate division is
                                                 removed from the data
                                                 store), some action is
                                                 automatically taken for
                                                 the entities that refer to
                                                 this object (that is, the
                                                 employee objects). Exactly
                                                 what that action is, is
                                                 definable by you. See
                                                 below.

                            When a related entity is deleted from the data
                            store, one of the following actions are taken:

                                                 <tt class="literal">ABORT</tt>

                                                The delete operation is not
                                                allowed. A runtime error is
                                                raised as a result of the
                                                operation. This is the
                                                default behavior.

                                                 <tt class="literal">CASCADE</tt>

                                            All entities related to this
                                            one are deleted as well. For
                                            example, if you deleted a
                                            <tt class="classname">Division</tt>
                                            object, then all
                                            <tt class="classname">Employee</tt>
                                            objects that belonged to the
                                            division are also deleted.

                                                 <tt class="literal">NULLIFY</tt>

                                            All entities related to the
                                            deleted entity are updated so
                                            that the pertinent data member
                                            is nullified. That is, if you
                                            deleted a division, then all
                                            employee objects related to
                                            that division would have their
                                            division key
                                            automatically set to null.

                            You declare a foreign key constraint by using
                            the <tt class="literal">relatedEntity</tt> keyword. You
                            declare the foreign key constraint deletion policy using the
                            <tt class="literal">onRelatedEntityDelete</tt> keyword. For
                            example, the following declares a foreign key
                            constraint to <tt class="classname">Division</tt>
                            class objects, and it causes related objects to
                            be deleted if the <tt class="classname">Division</tt>
                            class is deleted:

@SecondaryKey(relate=ONE_TO_ONE, relatedEntity=Division.class,
    onRelatedEntityDelete=CASCADE)
private String division = new String();

          Prev

            Up

           Next

          Chapter 4. Working with Indices

            Home

           Chapter 5. Saving and Retrieving Objects


text:
package com.textocat.textokit.commons.cpe;

import org.apache.uima.UIMAException;
import org.apache.uima.UIMAFramework;
import org.apache.uima.collection.CollectionProcessingEngine;
import org.apache.uima.collection.metadata.CpeDescription;
import org.apache.uima.collection.metadata.CpeDescriptorException;
import org.apache.uima.util.XMLInputSource;

import java.io.IOException;

/**
 * @author Rinat Gareev
 */
public class CpeLauncher {

    public static void main(String[] args) throws IOException, UIMAException,
            CpeDescriptorException {
        if (args.length != 1) {
            System.err.println("Usage: <cpeDescriptorPath>");
            return;
        }
        String cpeDescPath = args[0];

        XMLInputSource cpeDescSource = new XMLInputSource(cpeDescPath);
        CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(cpeDescSource);

        // produce
        CollectionProcessingEngine cpe = UIMAFramework
                .produceCollectionProcessingEngine(cpeDesc);
        cpe.addStatusCallbackListener(new ReportingStatusCallbackListener(cpe));

        // run
        cpe.process();
    }
}

redpajama_set_name: RedPajamaGithub


text:
export default angular.module('app.layout', [])
  .service('SidebarService', require('./sidebar/sidebar.service'))
  .directive('shmckNav', require('./nav/nav'))
  .directive('shmckSidebar', require('./sidebar/sidebar'));


text:
package main

import (
	"crypto/subtle"
	"crypto/tls"
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"os"
	"time"

	"strings"

	"sourcegraph.com/sourcegraph/appdash"
	"sourcegraph.com/sourcegraph/appdash/traceapp"
)

func init() {
	_, err := CLI.AddCommand("serve",
		"start an appdash server",
		"The serve command starts an appdash server.",
		&serveCmd,
	)
	if err != nil {
		log.Fatal(err)
	}
}

// ServeCmd is the command for running Appdash in server mode, where a
// collector server and the web UI are hosted.
type ServeCmd struct {
	CollectorAddr string `long:"collector" description:"collector listen address" default:":7701"`
	HTTPAddr      string `long:"http" description:"HTTP listen address" default:":7700"`
	SampleData    bool   `long:"sample-data" description:"add sample data"`

	StoreFile       string        `short:"f" long:"store-file" description:"persisted store file" default:"/tmp/appdash.gob"`
	PersistInterval time.Duration `short:"p" long:"persist-interval" description:"interval between persisting store to file" default:"2s"`

	Debug bool `short:"d" long:"debug" description:"debug log"`
	Trace bool `long:"trace" description:"trace log"`

	DeleteAfter time.Duration `long:"delete-after" description:"delete traces after a certain age (0 to disable)" default:"30m"`

	TLSCert string `long:"tls-cert" description:"TLS certificate file (if set, enables TLS)"`
	TLSKey  string `long:"tls-key" description:"TLS key file (if set, enables TLS)"`

	BasicAuth string `long:"basic-auth" description:"if set to 'user:passwd', require HTTP Basic Auth for web app"`
}

var serveCmd ServeCmd

// Execute execudes the commands with the given arguments and returns an error,
// if any.
func (c *ServeCmd) Execute(args []string) error {
	var (
		memStore = appdash.NewMemoryStore()
		Store    = appdash.Store(memStore)
		Queryer  = memStore
	)

	if c.StoreFile != "" {
		f, err := os.Open(c.StoreFile)
		if err != nil && !os.IsNotExist(err) {
			return err
		}
		if f != nil {
			if n, err := memStore.ReadFrom(f); err == nil {
				log.Printf("Read %d traces from file %s", n, c.StoreFile)
			} else if err != nil {
				f.Close()
				return err
			}
			if err := f.Close(); err != nil {
				return err
			}
		}
		if c.PersistInterval != 0 {
			go func() {
				if err := appdash.PersistEvery(memStore, c.PersistInterval, c.StoreFile); err != nil {
					log.Fatal(err)
				}
			}()
		}
	}

	if c.DeleteAfter > 0 {
		Store = &appdash.RecentStore{
			MinEvictAge: c.DeleteAfter,
			DeleteStore: memStore,
			Debug:       true,
		}
	}

	app := traceapp.New(nil)
	app.Store = Store
	app.Queryer = Queryer

	var h http.Handler
	if c.BasicAuth != "" {
		parts := strings.SplitN(c.BasicAuth, ":", 2)
		if len(parts) != 2 {
			log.Fatalf("Basic auth must be specified as 'user:passwd'.")
		}
		user, passwd := parts[0], parts[1]
		if user == "" || passwd == "" {
			log.Fatalf("Basic auth user and passwd must both be nonempty.")
		}
		log.Printf("Requiring HTTP Basic auth")
		h = newBasicAuthHandler(user, passwd, app)
	} else {
		h = app
	}

	if c.SampleData {
		sampleData(Store)
	}

	var l net.Listener
	var proto string
	if c.TLSCert != "" || c.TLSKey != "" {
		certBytes, err := ioutil.ReadFile(c.TLSCert)
		if err != nil {
			log.Fatal(err)
		}
		keyBytes, err := ioutil.ReadFile(c.TLSKey)
		if err != nil {
			log.Fatal(err)
		}

		var tc tls.Config
		cert, err := tls.X509KeyPair(certBytes, keyBytes)
		if err != nil {
			log.Fatal(err)
		}
		tc.Certificates = []tls.Certificate{cert}
		l, err = tls.Listen("tcp", c.CollectorAddr, &tc)
		if err != nil {
			log.Fatal(err)
		}
		proto = fmt.Sprintf("TLS cert %s, key %s", c.TLSCert, c.TLSKey)
	} else {
		var err error
		l, err = net.Listen("tcp", c.CollectorAddr)
		if err != nil {
			log.Fatal(err)
		}
		proto = "plaintext TCP (no security)"
	}
	log.Printf("appdash collector listening on %s (%s)", c.CollectorAddr, proto)
	cs := appdash.NewServer(l, appdash.NewLocalCollector(Store))
	cs.Debug = c.Debug
	cs.Trace = c.Trace
	go cs.Start()

	if c.TLSCert != "" || c.TLSKey != "" {
		log.Printf("appdash HTTPS server listening on %s (TLS cert %s, key %s)", c.HTTPAddr, c.TLSCert, c.TLSKey)
		return http.ListenAndServeTLS(c.HTTPAddr, c.TLSCert, c.TLSKey, h)
	}

	log.Printf("appdash HTTP server listening on %s", c.HTTPAddr)
	return http.ListenAndServe(c.HTTPAddr, h)
}

func newBasicAuthHandler(user, passwd string, h http.Handler) http.Handler {
	want := "Basic " + base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", user, passwd)))
	return &basicAuthHandler{h, []byte(want)}
}

type basicAuthHandler struct {
	http.Handler
	want []byte // = "Basic " base64(user ":" passwd) [precomputed]
}

func (h *basicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	// Constant time comparison to avoid timing attack.
	authHdr := r.Header.Get("authorization")
	if len(h.want) == len(authHdr) && subtle.ConstantTimeCompare(h.want, []byte(authHdr)) == 1 {
		h.Handler.ServeHTTP(w, r)
		return
	}
	w.Header().Set("WWW-Authenticate", `Basic realm="appdash"`)
	http.Error(w, "unauthorized", http.StatusUnauthorized)
}


text:
//
//  ZNFizzBuzzTableViewController.m
//  FizzBuzz
//
//  Created by Zdenek Nemec on 5/27/14.
//  Copyright (c) 2014 Zdenek Nemec. All rights reserved.
//

#import "ZNFizzBuzzTableViewController.h"
#import "ZNFizzBuzzClient.h"
#import "ZNFizzBuzzAnswer.h"
#import "MBProgressHUD.h"

@interface ZNFizzBuzzTableViewController ()
@property (strong, nonatomic) NSArray* results;
@end

@implementation ZNFizzBuzzTableViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Setup the refresh control
    UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
    refresh.attributedTitle = [[NSAttributedString alloc] initWithString:@"Pull to Refresh FizzBuzz"];
    [refresh addTarget:self action:@selector(solveFizzBuzz) forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refresh;

    // Solve FizzBuzz
    [self solveFizzBuzz];
}

- (void)solveFizzBuzz
{
    if (!self.refreshControl.refreshing)
        [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];

    __block ZNFizzBuzzTableViewController* blockSelf = self;
    [[ZNFizzBuzzClient sharedFizzBuzzClient] solveFizzBuzzWithCompletion:^(NSError *error, NSArray *result) {

        [MBProgressHUD hideAllHUDsForView:self.navigationController.view animated:YES];
        [blockSelf.refreshControl endRefreshing];

        if (error) {
            NSLog(@"Error solving the FizzBuzz: %@", error.localizedDescription);
            return;
        }

        blockSelf.results = result;
        [blockSelf.tableView reloadData];
    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:YES];
    [MBProgressHUD hideAllHUDsForView:self.navigationController.view animated:YES];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    if (self.results)
        return self.results.count;

    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ResultCell" forIndexPath:indexPath];

    cell.textLabel.text = ((ZNFizzBuzzAnswer *)self.results[indexPath.row]).number;
    cell.detailTextLabel.text = ((ZNFizzBuzzAnswer *)self.results[indexPath.row]).value;

    return cell;
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)trash:(id)sender {
    self.results = nil;
    [self.tableView reloadData];
}

@end


text:
package com.taobao.tddl.optimizer.core.datatype;

import java.math.BigInteger;

/**
 * {@link BigInteger}类型
 *
 * @author jianghang 2014-1-21 下午1:49:09
 * @since 5.0.0
 */
public class BigIntegerType extends CommonType<BigInteger> {

    private static final BigInteger maxValue   = BigInteger.valueOf(Long.MAX_VALUE);
    private static final BigInteger minValue   = BigInteger.valueOf(Long.MIN_VALUE);
    private static final BigInteger zeroValue  = BigInteger.valueOf(0);
    private final Calculator        calculator = new AbstractCalculator() {

                                                   @Override
                                                   public Object doAdd(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return i1.add(i2);
                                                   }

                                                   @Override
                                                   public Object doSub(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return i1.subtract(i2);
                                                   }

                                                   @Override
                                                   public Object doMultiply(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return i1.multiply(i2);
                                                   }

                                                   @Override
                                                   public Object doDivide(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);

                                                       if (i2.equals(BigInteger.ZERO)) {
                                                           return null;
                                                       }

                                                       return i1.divide(i2);
                                                   }

                                                   @Override
                                                   public Object doMod(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);

                                                       if (i2.equals(BigInteger.ZERO)) {
                                                           return null;
                                                       }

                                                       return i1.remainder(i2);
                                                   }

                                                   @Override
                                                   public Object doAnd(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return (i1.compareTo(zeroValue) != 0)
                                                              && (i2.compareTo(zeroValue) != 0);
                                                   }

                                                   @Override
                                                   public Object doOr(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return (i1.compareTo(zeroValue) != 0)
                                                              || (i2.compareTo(zeroValue) != 0);
                                                   }

                                                   @Override
                                                   public Object doNot(Object v1) {
                                                       BigInteger i1 = convertFrom(v1);

                                                       return (i1.compareTo(zeroValue) == 0);
                                                   }

                                                   @Override
                                                   public Object doBitAnd(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return i1.and(i2);
                                                   }

                                                   @Override
                                                   public Object doBitOr(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return i1.or(i2);
                                                   }

                                                   @Override
                                                   public Object doBitNot(Object v1) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       return i1.not();
                                                   }

                                                   @Override
                                                   public Object doXor(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return (i1.compareTo(zeroValue) != 0)
                                                              ^ (i2.compareTo(zeroValue) != 0);
                                                   }

                                                   @Override
                                                   public Object doBitXor(Object v1, Object v2) {
                                                       BigInteger i1 = convertFrom(v1);
                                                       BigInteger i2 = convertFrom(v2);
                                                       return i1.xor(i2);
                                                   }
                                               };

    @Override
    public int encodeToBytes(Object value, byte[] dst, int offset) {
        return DataEncoder.encode(this.convertFrom(value), dst, offset);
    }

    @Override
    public int getLength(Object value) {
        if (value == null) {
            return 1;
        } else {
            return DataEncoder.calculateEncodedLength(convertFrom(value));
        }
    }

    @Override
    public DecodeResult decodeFromBytes(byte[] bytes, int offset) {
        BigInteger[] vs = new BigInteger[1];
        int lenght = DataDecoder.decode(bytes, offset, vs);
        return new DecodeResult(vs[0], lenght);
    }

    @Override
    public BigInteger incr(Object value) {
        return convertFrom(value).add(BigInteger.ONE);
    }

    @Override
    public BigInteger decr(Object value) {
        return convertFrom(value).subtract(BigInteger.ONE);
    }

    @Override
    public BigInteger getMaxValue() {
        return maxValue;
    }

    @Override
    public BigInteger getMinValue() {
        return minValue;
    }

    @Override
    public Calculator getCalculator() {
        return calculator;
    }

    @Override
    public int getSqlType() {
        return java.sql.Types.DECIMAL;
    }

}


text:
title: Programowanie naprawdę jest niesamowite
author: Gutek
layout: post
permalink: /2013/02/11/programowanie-naprawde-jest-niesamowite/
categories:
  - pro
tags:
  - inne
  - programowanie
---
To będzie krótki post, ale kurka, wczoraj jadąc samochodem mnie naprawdę uderzyło. Pracuje nad swoim własnym mały projektem. Nie jestem specjalistą od UI itp. nic nie rysuje, tylko piszę kod.

I to jest niesamowite, że kilka linijek kodu czy to DSL czy też normlany kod *języka programowania*, może zamienić się w coś wizualnego. Coś, co cieszy oczy.

Na przykład, dzisiaj po netcie chodzi link do [chmurki][1]. Jak zobaczycie źródło to znajdziecie jedynie jeden malutki obrazek, reszta ta pure code.

Czy to nie jest niesamowite? Jaki inny zawód może się czymś takim pochwalić? Żaden!

Nie wiem, ale mnie to podnosi na duchu, daje siłę by dalej pisać i dalej tworzyć. Dzięki temu co mnie wczoraj tak uderzyło a w końcu robię to od lat, nagle nabrałem nowych sił, znalazłem motywację. Bo kurczę, to jest naprawdę piękne! :)

 [1]: http://www.clicktorelease.com/code/css3dclouds/


text:
#include "board.h"
#include <string.h>
#include "sensorhub.h"
#include "sensacq_i2c.h"
#include "common.h"

/*****************************************************************************
 * Private types/enumerations/variables
 ****************************************************************************/

/* I2CM transfer record */
static I2CM_XFER_T  i2cmXferRec;
static uint8_t g_i2cmTxBuf[4];

#if defined(I2CM_DMA_BASED)
/* DMA descriptors must be aligned to 16 bytes */
#if defined(__CC_ARM)
__align(16) static DMA_CHDESC_T dmaI2CMDesc;
#endif /* defined (__CC_ARM) */

/* IAR support */
#if defined(__ICCARM__)
#pragma data_alignment=16
static DMA_CHDESC_T dmaI2CMDesc;
#endif /* defined (__ICCARM__) */

#if defined( __GNUC__ )
static DMA_CHDESC_T dmaI2CMDesc __attribute__ ((aligned(16)));
#endif /* defined (__GNUC__) */
#endif /* defined(I2CM_DMA_BASED) */

/*****************************************************************************
 * Public types/enumerations/variables
 ****************************************************************************/
extern uint8_t timeStampExtender;

/*****************************************************************************
 * Private functions
 ****************************************************************************/

/* Setup I2C */
static void setupI2CMaster(void)
{
	/* Enable I2C clock and reset I2C peripheral */
	Chip_I2C_Init(I2C_SENSOR_BUS);

	/* Setup clock rate for I2C */
	Chip_I2C_SetClockDiv(I2C_SENSOR_BUS, I2C_MASTER_CLOCK_DIV);

	/* Setup I2CM transfer rate */
	Chip_I2CM_SetBusSpeed(I2C_SENSOR_BUS, I2C_MCLOCK_SPEED);

	/* Enable I2C master interface */
	Chip_I2CM_Enable(I2C_SENSOR_BUS);

#if defined(I2CM_DMA_BASED)
	/* Setup I2C0 slave channel for the following configuration:
	   - Peripheral DMA request
	   - Single transfer
	   - High channel priority */
	Chip_DMA_EnableChannel(LPC_DMA, I2C_SENSOR_BUS_DMAID);
	Chip_DMA_EnableIntChannel(LPC_DMA, I2C_SENSOR_BUS_DMAID);
	Chip_DMA_SetupChannelConfig(LPC_DMA, I2C_SENSOR_BUS_DMAID,
		(DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(0)));
#endif
}

#ifdef I2CM_IRQ_BASED
/* Function to wait for I2CM transfer completion */
static void WaitForI2cXferComplete(I2CM_XFER_T *xferRecPtr)
{
	/* Are we still transferring data ? */
	while (xferRecPtr->status == I2CM_STATUS_BUSY) {
		/* Sleep until next interrupt */
		__WFI();
	}
}
#endif

#if defined(I2CM_DMA_BASED)
/* Setup and start a DMA transfer */
static setupI2CDMAXfer(void *buff, uint8_t bytes, bool tx)
{
	/* Enable DMA for I2C controller */
	I2C_SENSOR_BUS->MSTCTL = I2C_MSTCTL_MSTDMA;

	/* Master to slave */
	if (tx) {
		dmaI2CMDesc.source = DMA_ADDR(buff) + bytes - 1;
		dmaI2CMDesc.dest = DMA_ADDR(&I2C_SENSOR_BUS->MSTDAT);
		dmaI2CMDesc.next = DMA_ADDR(0);
		dmaI2CMDesc.xfercfg = DMA_XFERCFG_CFGVALID | DMA_XFERCFG_SETINTA |
						 DMA_XFERCFG_SWTRIG | DMA_XFERCFG_WIDTH_8 | DMA_XFERCFG_SRCINC_1 |
						 DMA_XFERCFG_DSTINC_0 | DMA_XFERCFG_XFERCOUNT(bytes);
	}
	else {
		dmaI2CMDesc.source = DMA_ADDR(&I2C_SENSOR_BUS->MSTDAT);
		dmaI2CMDesc.dest = DMA_ADDR(buff) + bytes - 1;
		dmaI2CMDesc.next = DMA_ADDR(0);
		dmaI2CMDesc.xfercfg = DMA_XFERCFG_CFGVALID | DMA_XFERCFG_SETINTA |
						 DMA_XFERCFG_SWTRIG | DMA_XFERCFG_WIDTH_8 | DMA_XFERCFG_SRCINC_0 |
						 DMA_XFERCFG_DSTINC_1 | DMA_XFERCFG_XFERCOUNT(bytes);
	}

	/* Setup transfer descriptor and validate it */
	Chip_DMA_SetupTranChannel(LPC_DMA, I2C_SENSOR_BUS_DMAID, &dmaI2CMDesc);

	/* Setup data transfer */
	Chip_DMA_SetupChannelTransfer(LPC_DMA, I2C_SENSOR_BUS_DMAID, dmaI2CMDesc.xfercfg);

	Chip_DMA_SetValidChannel(LPC_DMA, I2C_SENSOR_BUS_DMAID);
}
#endif

/*****************************************************************************
 * Public functions
 ****************************************************************************/

/* DMA error handler and notification for I2C */
void dev_i2cm_dma_callback(bool error)
{
	/* ##KW## What do we do here for errors? */
	if (error) {
		/* Nothing to do here. I2C will terminate the trasnfer. */
		;
	}

	I2C_SENSOR_BUS->MSTCTL = 0;
}

/**
 * @brief	Handle I2C1 interrupt by calling I2CM interrupt transfer handler
 * @return	Nothing
 */
void I2C_SENSOR_BUS_IRQHandler(void)
{
#if defined(I2CM_DMA_BASED)
	uint32_t cState;
#endif
	uint32_t state = Chip_I2C_GetPendingInt(I2C_SENSOR_BUS);

	/* Error handling */
	if (state & (I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR)) {
		Chip_I2CM_ClearStatus(I2C_SENSOR_BUS, I2C_STAT_MSTRARBLOSS | I2C_STAT_MSTSTSTPERR);
	}

	if (state & I2C_INTENSET_MSTPENDING) {
#if defined(I2CM_DMA_BASED)
		/* DMA may still be active, but the transfer might of completed due to
		  a NAK or error. Handle the error here before queueing up the DMA
		  transfer. */
		cState = Chip_I2CM_GetMasterState(I2C_SENSOR_BUS);
		if (cState == I2C_STAT_MSTCODE_RXREADY) {
			if (i2cmXferRec.rxSz > I2C_SENSOR_BUS_DMABYTELIM) {
				/* Master receive */
				setupI2CDMAXfer((void *) i2cmXferRec.rxBuff, i2cmXferRec.rxSz, false);
				i2cmXferRec.rxSz = 0;
			} else {
				Chip_I2CM_XferHandler(I2C_SENSOR_BUS, &i2cmXferRec);
			}
		}
		else if (cState == I2C_STAT_MSTCODE_TXREADY) {
			if (i2cmXferRec.txSz > I2C_SENSOR_BUS_DMABYTELIM) {
				/* Master transmit */
				setupI2CDMAXfer((void *) i2cmXferRec.txBuff, i2cmXferRec.txSz, true);
				i2cmXferRec.txSz = 0;
			} else {
				/* Transistion to read state */
				Chip_I2CM_XferHandler(I2C_SENSOR_BUS, &i2cmXferRec);
			}
		} else {
			/* Not in a transfer state, so handle using the normal I2C handler */
			Chip_I2CM_XferHandler(I2C_SENSOR_BUS, &i2cmXferRec);
		}
#else
		Chip_I2CM_XferHandler(I2C_SENSOR_BUS, &i2cmXferRec);
#endif
	}

	/* If transfer is no longer in progress, disable interrupts */
	if (i2cmXferRec.status != I2CM_STATUS_BUSY) {
		Chip_I2C_DisableInt(I2C_SENSOR_BUS, I2C_INTENSET_MSTPENDING |
			I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
	}
}

/**
 * @brief	Initialize I2C bus connected sensors
 * @return	True if initalized
 */
osp_bool_t dev_i2c_init(void)
{
	static bool init = false;

	if (init == false) {
		/* Setup I2C and master */
		setupI2CMaster();

#ifdef I2CM_IRQ_BASED
		NVIC_SetPriority(I2C_SENSOR_BUS_IRQn, SENSOR_I2C_PRIORITY);
		/* Enable the interrupt for the I2C */
		NVIC_EnableIRQ(I2C_SENSOR_BUS_IRQn);
#endif
		init = true;
	}
	return init;
}

/**
 * @brief	adaptation of the Bosch API functions to the
 *		BOARD specific function
 * @return	Nothing
 */
void dev_i2c_delay(unsigned int msec)
{
	/* Will WFI for the entire sleep duration. If an interrupt
	   occurs that wakes the device, the sleep handler will
	   automatically re-enter WFI until the duration has expired. */
	os_dly_wait(MSEC_TO_TICS(msec)); /* Allow startup time for sensors */
}

/**
 * @brief	adaptation of the Bosch API functions to the BOARD specific function
 * @return	Nothing
 */
char dev_i2c_write(unsigned char dev_addr, unsigned char reg_addr,
		unsigned char *reg_data, unsigned char cnt)
{
	/* Setup I2C transfer record */
	g_i2cmTxBuf[0] = reg_addr;
	if (cnt == 1) {
		g_i2cmTxBuf[1] = reg_data[0];
	} else {
		memcpy(&g_i2cmTxBuf[1], reg_data, cnt);
	}

	memset(&i2cmXferRec, 0, sizeof(I2CM_XFER_T));

	i2cmXferRec.slaveAddr = dev_addr;
	i2cmXferRec.status = 0;
	i2cmXferRec.txSz = cnt + 1;
	i2cmXferRec.rxSz = 0;
	i2cmXferRec.txBuff = &g_i2cmTxBuf[0];
	i2cmXferRec.rxBuff = 0;

#ifdef I2CM_IRQ_BASED
	Chip_I2CM_Xfer(I2C_SENSOR_BUS, &i2cmXferRec);
	/* Enable Master Interrupts */
	Chip_I2C_EnableInt(I2C_SENSOR_BUS, I2C_INTENSET_MSTPENDING |
		I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
	/* Wait for transfer completion */
	WaitForI2cXferComplete(&i2cmXferRec);
#else
	Chip_I2CM_XferBlocking(I2C_SENSOR_BUS, &i2cmXferRec);
#endif

	return LPC_OK;
}

/**
 * @brief	adaptation of the Bosch API functions to the
 *              BOARD specific function
 * @return	Nothing
 */
char dev_i2c_read(unsigned char dev_addr, unsigned char reg_addr,
		unsigned char *reg_data, unsigned char cnt)
{
	memset(&i2cmXferRec, 0, sizeof(I2CM_XFER_T));
	/* Setup I2C transfer record */
	i2cmXferRec.slaveAddr = dev_addr;
	i2cmXferRec.status = 0;
	i2cmXferRec.txSz = 1;
	i2cmXferRec.rxSz = cnt;
	i2cmXferRec.txBuff = &reg_addr;
	i2cmXferRec.rxBuff = reg_data;

#ifdef I2CM_IRQ_BASED
	Chip_I2CM_Xfer(I2C_SENSOR_BUS, &i2cmXferRec);
	/* Enable Master Interrupts */
	Chip_I2C_EnableInt(I2C_SENSOR_BUS, I2C_INTENSET_MSTPENDING |
			I2C_INTENSET_MSTRARBLOSS | I2C_INTENSET_MSTSTSTPERR);
	/* Wait for transfer completion */
	WaitForI2cXferComplete(&i2cmXferRec);
#else
	Chip_I2CM_XferBlocking(I2C_SENSOR_BUS, &i2cmXferRec);
#endif

	return LPC_OK;
}


text:
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    stylus: {
      compile: {
        options: {
          paths: ['asset/style','node_modules/grunt-contrib-stylus/node_modules'],
          compress: false,
          urlfunc: 'embedurl'
        },
        files: {
          'asset/style/master.css': 'asset/style/master.styl'
        }
      }
    },
    connect: {
      server: {
        options: {
          port: 4000,
          base: '_site/',
          keepalive: true
        }
      }
    },
    copy: {
      css : {
        files: {
          // Copy the stylus-generated style file to
          // the _site/ folder
          '_site/asset/style/master.css': 'asset/style/master.css'
        }
      }
    },
    shell: {
      jekyll: {
        command: 'rm -rf _site/*; jekyll',
        stdout: true
      },
      server: {
        command: 'http-server "./" -p "4000"',
        stdout: true
      }
    },
    watch: {
      stylus: {
        files: ['asset/style/*.styl', 'asset/style/**/*.styl'],
        tasks: ['stylus']
      },
      cp: {
        files: ['asset/style/**/*.styl'],
        tasks: ['copy']
      },
      jekyllSources: {
        files: [
          // capture all except css - add your own
          '*.html', '*.yml', 'asset/script/**.js',
          '_posts/**', '_includes/**'
        ],
        tasks: ['shell:jekyll']
      }
    },
    parallel: {
      assets: {
        grunt: true,
        tasks: ['shell:server', 'watch:stylus', 'copy:css', 'watch:jekyllSources']
      }
    }
  });

  // Load plugin
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-csso');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-parallel');
  grunt.loadNpmTasks('grunt-aws');

  // Default task
  grunt.registerTask('default', ['parallel']);
  // Deploy task
  grunt.registerTask('deploy', ['']);
};


text:
from django import template

from ..models import Sponsor

register = template.Library()

@register.inclusion_tag('sponsors/templatetags/featured_sponsor_rotation.html')
def featured_sponsor_rotation():
    """
    Retrieve featured Sponsors for rotation
    """
    return {'sponsors': Sponsor.objects.featured()}


text:
<?php

namespace Sds\DoctrineExtensions\Test\Serializer\TestAsset\Document;

use Doctrine\Common\Collections\ArrayCollection;

//Annotation imports
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Sds\DoctrineExtensions\Annotation\Annotations as Sds;

/**
 * @ODM\Document
 * @Sds\Serializer\ClassName
 */
class CakeRefLazy {

    /**
     * @ODM\Id(strategy="UUID")
     */
    protected $id;

    /**
     * @ODM\ReferenceMany(targetDocument="Ingredient")
     * @Sds\Serializer\RefLazy
     */
    protected $ingredients;

    /**
     * @ODM\ReferenceOne(targetDocument="Flavour")
     * @Sds\Serializer\RefLazy
     */
    protected $flavour;

    public function __construct()
    {
        $this->ingredients = new ArrayCollection();
    }

    public function getId() {
        return $this->id;
    }

    public function getIngredients()
    {
        return $this->ingredients;
    }

    public function setIngredients(array $ingredients){
        $this->ingredients = $ingredients;
    }

    public function addIngredient(Ingredient $ingredient)
    {
        $this->ingredients[] = $ingredient;
    }

    public function getFlavour() {
        return $this->flavour;
    }

    public function setFlavour($flavour) {
        $this->flavour = $flavour;
    }
}


text:
package com.sequenceiq.cloudbreak.cloud.mock;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.MediaType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.cloud.InstanceConnector;
import com.sequenceiq.cloudbreak.cloud.context.AuthenticatedContext;
import com.sequenceiq.cloudbreak.cloud.model.CloudInstance;
import com.sequenceiq.cloudbreak.cloud.model.CloudResource;
import com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus;
import com.sequenceiq.cloudbreak.cloud.model.InstanceStatus;

@Service
public class MockInstanceConnector implements InstanceConnector {

    private static final Logger LOGGER = LoggerFactory.getLogger(MockInstanceConnector.class);

    private static final String CB_FINGERPRINT = "ce:50:66:23:96:08:04:ea:01:62:9b:18:f9:ee:ac:aa (RSA)";

    @Inject
    private MockUrlFactory mockUrlFactory;

    @Override
    public List<CloudVmInstanceStatus> start(AuthenticatedContext authenticatedContext, List<CloudResource> resources, List<CloudInstance> vms) {
        LOGGER.info("start instances on mock spi");
        CloudVmInstanceStatus[] vmInstanceStatuses = mockUrlFactory.get(authenticatedContext, "/spi/start_instances")
                .post(Entity.entity(vms, MediaType.APPLICATION_JSON_TYPE), CloudVmInstanceStatus[].class);
        return Arrays.asList(vmInstanceStatuses);
    }

    @Override
    public List<CloudVmInstanceStatus> stop(AuthenticatedContext authenticatedContext, List<CloudResource> resources, List<CloudInstance> vms) {
        LOGGER.info("stop instances on mock spi");
        CloudVmInstanceStatus[] vmInstanceStatuses = mockUrlFactory.get(authenticatedContext, "/spi/stop_instances")
                .post(Entity.entity(vms, MediaType.APPLICATION_JSON_TYPE), CloudVmInstanceStatus[].class);
        return Arrays.asList(vmInstanceStatuses);
    }

    @Override
    public List<CloudVmInstanceStatus> reboot(AuthenticatedContext authenticatedContext, List<CloudResource> resources, List<CloudInstance> vms) {
        LOGGER.info("reboot instance statuses to mock spi");
        mockUrlFactory.get(authenticatedContext, "/spi/reboot_instances").post(null, String.class);
        return Collections.emptyList();
    }

    @Override
    @Retryable(include = ResponseProcessingException.class)
    public List<CloudVmInstanceStatus> check(AuthenticatedContext authenticatedContext, List<CloudInstance> vms) {
        try {
            LOGGER.debug("Collect instance statuses from mock spi");
            CloudVmInstanceStatus[] cloudVmInstanceStatusArray = mockUrlFactory.get(authenticatedContext, "/spi/cloud_instance_statuses")
                    .post(Entity.entity(vms, MediaType.APPLICATION_JSON_TYPE), CloudVmInstanceStatus[].class);
            LOGGER.debug("Collected instance statuses: " + Arrays.toString(cloudVmInstanceStatusArray));
            List<CloudVmInstanceStatus> cloudVmInstanceStatuses = new ArrayList<>();
            for (CloudInstance instance : vms) {
                Optional<CloudVmInstanceStatus> vmInstanceStatusFromApi = Arrays.stream(cloudVmInstanceStatusArray)
                        .filter(instanceStatus -> instanceStatus.getCloudInstance().getTemplate().getPrivateId().equals(instance.getTemplate().getPrivateId()))
                        .findFirst();
                InstanceStatus instanceStatus = InstanceStatus.TERMINATED;
                if (vmInstanceStatusFromApi.isPresent()) {
                    instanceStatus = vmInstanceStatusFromApi.get().getStatus();
                }
                CloudVmInstanceStatus cloudVmInstanceStatus = new CloudVmInstanceStatus(instance, instanceStatus);
                cloudVmInstanceStatuses.add(cloudVmInstanceStatus);
            }
            return cloudVmInstanceStatuses;
        } catch (NotFoundException e) {
            LOGGER.info("Cannot find on the provider with resource id: {}", authenticatedContext.getCloudContext().getName());
            return vms.stream().map(it -> new CloudVmInstanceStatus(it, InstanceStatus.TERMINATED, "Cannot find on the provider")).collect(Collectors.toList());
        }
    }

    @Override
    public String getConsoleOutput(AuthenticatedContext authenticatedContext, CloudInstance vm) {
        return CB_FINGERPRINT;
    }
}


text:
layout: kanji
v4: 13
v6: 13
kanji: 月
keyword: month
elements: month, moon, month, flesh, part of the body
strokes: 4
image: E69C88
on-yomi: ゲツ、ガツ
kun-yomi: つき
permalink: /rtk/月/
prev: 日
next: 田
---

1) [cerulean] 19-5-2008(157): A month is longer than a day.

2) [elktapestry] 21-3-2007(60): Am I the only one who sees this as someone sticking their ass in the air "mooning" someone (two cheeks of the butt and the legs coming off of it)? The Moon meaning connects well to the meaning of month, considering that months were traditionally measured by the phases of the moon. Also, the mooning "ass" part of it connects well to Hesig's seemingly unconnected "flesh" or "part of the body" meaning (when used in primitive form).

3) [gaijingo] 16-6-2006(15): Month - every MOON cycle, werewolves eat FLESH, and other PARTs OF THE BODY.

4) [Tsuki56] 6-6-2009(12): Once a month, the moon is full.

5) [LiviaCH] 5-8-2008(8): A month is longer than a day.


text:
Flux2-client is the web app for the second version of Flux.

## Getting started

These instructions will get you a copy of the project on your local machine for development and testing purposes.

### Prerequisites

* [Yarn](https://yarnpkg.com/lang/en/docs/install/)
* NodeJS 7

### Installing

After cloning the repository locally, install the project dependencies.

```
yarn install
```

The *flux2-client* communicate with *flux2-server* using webSockets.
Look at */src/index.html* and change the server URL if necessary.

Now you can run the app :

```
yarn dev
```

## Production deployment
This app is made to have an auto deployment on master push. The app will be started as a test on travis-ci, which will then trigger the auto-deployment to a dokku server.

To push on the Dokku server, travis has to get the private ssh key of a dokku user :

```
# generate new keys
ssh-keygen -f deploy_key

# Use deploy_key.pub to create a new user on dokku that can push to this new repository
cat deploy_key.pub | ssh dokku@dokku.uttnetgroup.net dokku ssh-keys:add flux2-travis

# Login on travis and encryp key
travis login
travis encrypt-file deploy_key --add

# Clean unencrypted keys
rm deploy_key deploy_key.pub

# Add and commit encrypted deploy_key
git add deploy_key.enc
```

On the dokku app, you have to use the buildpack `heroku-buildpack-static`

```
dokku config:set flux2-client BUILDPACK_URL=https://github.com/hone/heroku-buildpack-static
```

You can also configure the Flux API server by setting an env variable on travis
```
FLUX_API_URI_PROD = https://api.flux.uttnetgroup.fr
FLUX_API_URI_DEV = https://api.flux-dev.uttnetgroup.fr
```

## Built with

- [React.js](https://facebook.github.io/react/) - A javascript library for building user interfaces
- [Material ui](https://material-ui-1dab0.firebaseapp.com/#/layout/responsive-ui) - A set of React Components that implement Google's material design
- [Yarn](https://yarnpkg.com/) - Javascript package manager
- [WebPack](https://webpack.js.org/concepts/) - A module bundler for modern Javascript applications.
- [Babel](https://babeljs.io/) - A Javascript transpiler
- [Sails socket client](http://sailsjs.com/documentation/reference/web-sockets/socket-client) - Client library of the Sails.js framework

## Assets

### Sounds

- Notification - [link](https://www.freesound.org/people/elmasmalo1/sounds/377017/)

## Licence

This project is licensed under the MIT License - see the LICENSE file for details


text:
(function($){
	function buildRibbon(target){
		var opts = $.data(target, 'ribbon').options;

		$(target).addClass('ribbon').tabs(opts);
		var tabs = $(target).tabs('tabs');
		for(var i=0; i<tabs.length; i++){
			tabs[i].addClass('ribbon-tab');
		}
	}

	function bindEvents(target){
		var opts = $.data(target, 'ribbon').options;

		$(target).find('.l-btn').unbind('.ribbon').bind('click.ribbon', function(e){
			var bopts = $(this).linkbutton('options');
			opts.onClick.call(target, bopts.name, this);
		});
		$(target).find('.m-btn').each(function(){
			var m = $($(this).menubutton('options').menu);
			if (m.length){
				var mopts = m.menu('options');
				var onClick = mopts.onClick;
				mopts.onClick = function(item){
					onClick.call(this, item);
					if (mopts.timer){
						clearTimeout(mopts.timer);
					}
					mopts.timer = setTimeout(function(){
						opts.onClick.call(target, item.name, m[0]);
					},0);
				}
			}
		});
	}

	function loadData(target, data){
		var opts = $.data(target, 'ribbon').options;
		var r = $(target);
		for(var i=r.ribbon('tabs').length-1; i>=0; i--){
			r.ribbon('close', i);
		}
		if (data){
			opts.data = data;
		}
		opts.data.tabs = opts.data.tabs || [];
		for(var i=0; i<opts.data.tabs.length; i++){
			var tab = opts.data.tabs[i];
			r.ribbon('add', $.extend({}, tab, {
				bodyCls:'ribbon-tab'
			}));

			var p = r.ribbon('getTab', i);
			buildGroups(tab.groups, p);
		}
		if (opts.data.selected == undefined){
			opts.data.selected = 0;
		}
		r.ribbon('select', opts.data.selected);

		bindEvents(target);

		function buildGroups(groups, p){
			groups = groups || [];
			for(var i=0; i<groups.length; i++){
				var group = groups[i];
				group.dir = group.dir || 'h';
				var g = $('

').appendTo(p);
				$('

').appendTo(p);
				$('

').html(group.title||'').appendTo(g);
				group.tools = group.tools || [];
				$.map(group.tools, function(tool){
					var type = tool.type || 'linkbutton';
					if (type == 'toolbar'){
						var toolbar = $('

').appendTo(g);
						toolbar.css(tool.style||{});
						if (group.dir == 'v'){
							toolbar.css('clear', 'both');
						}
						var dir = tool.dir || 'h';
						$.map(tool.tools, function(tool){
							buildTool(tool, toolbar, dir);
						});
						toolbar.append('

');
					} else {
						buildTool(tool, g, group.dir);
					}
				});
				g.find('.ribbon-group-title')._outerWidth(g.outerWidth()-2);
			}

			function buildTool(options, p, dir){
				var type = options.type || 'linkbutton';
				options.plain = options.plain || true;
				if (options.menuItems){
					var m = $('

').appendTo('body');
					m.menu();
					$.map(options.menuItems, function(item){
						m.menu('appendItem', item);
					});
					options.menu = m;
				}
				var btn = $('').appendTo(p);
				btn[type](options);
				if (dir == 'v'){
					btn.css('clear','both');
				}
			}
		}
	}

	$.fn.ribbon = function(options, param){
		if (typeof options == 'string'){
			var method = $.fn.ribbon.methods[options];
			if (method){
				return method(this, param);
			} else {
				return this.tabs(options, param);
			}
		}

		options = options || {};
		return this.each(function(){
			var state = $.data(this, 'ribbon');
			if (state){
				$.extend(state.options, options);
			} else {
				state = $.data(this, 'ribbon', {
					options: $.extend({}, $.fn.ribbon.defaults, $.fn.ribbon.parseOptions(this), options)
				});
			}
			buildRibbon(this);
			bindEvents(this);
			if (state.options.data){
				loadData(this, state.options.data);
			}
		});
	};

	$.fn.ribbon.methods = {
		options: function(jq){
			return $.data(jq[0], 'ribbon').options;
		},
		loadData: function(jq, data){
			return jq.each(function(){
				loadData(this, data);
			});
		}
	};

	$.fn.ribbon.parseOptions = function(target){
		return $.extend({}, $.fn.tabs.parseOptions(target), {

		});
	};

	$.fn.ribbon.defaults = $.extend({}, $.fn.tabs.defaults, {
		onClick:function(name, target){}
	});

	////////////////////////////////
	$.parser.plugins.push('ribbon');
})(jQuery);


text:
using Microsoft.TeamFoundation.Controls;
using Microsoft.VisualStudio.Shell;
using PropertyChanged;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Run00.GitWorkItems.Providers
{
	[ImplementPropertyChanged]
	public class AccountProvider
	{
		public string RepositoryPath { get; set; }

		public Uri RepositoryUrl { get; set; }

		public string AccountName { get; set; }

		public string RepositoryName { get; set; }

		public AccountProvider([Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
		{
			serviceProvider
				.GetService<ITeamExplorer>()
				.GetPropertyValue<object>("TeamExplorerManager")
				.GetPropertyValue<object>("ViewModel")
				.AddEventHandler("PropertyChanged", (PropertyChangedEventHandler)((s, e) =>
				{
					OnTeamExplorerManagerViewModelChanged(s, e);
				}));
		}

		private void OnTeamExplorerManagerViewModelChanged(object sender, PropertyChangedEventArgs e)
		{
			var statusSercice = sender
				.GetPropertyValue<object>("CurrentContextInfoProvider")
				.GetPropertyValue<object>("Instance")
				.GetPropertyValue<object>("StatusService")
				.AddEventHandler("RepositoryPathChanged", (EventHandler)((s, a) =>
				{
					OnRepositoryPathChanged(s, a);
				}));

			if (statusSercice == null)
				return;

			UpdateRepositoryInfo(statusSercice);
		}

		private void OnRepositoryPathChanged(object sender, EventArgs e)
		{
			UpdateRepositoryInfo(sender);
		}

		private void UpdateRepositoryInfo(object statusService)
		{
			RepositoryPath = statusService.GetPropertyValue<string>("RepositoryPath");
			RepositoryUrl = null;
			AccountName = null;
			RepositoryName = null;

			if (string.IsNullOrWhiteSpace(RepositoryPath))
				return;

			var filePath = Path.Combine(RepositoryPath, @".git\config");
			if (File.Exists(filePath) == false)
				return;

			var ini = ReadIni(filePath);
			var url = ini["remote \"origin\""]["url"];

			if (string.IsNullOrWhiteSpace(url))
				return;

			Uri uri;
			Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uri);
			if (uri == null)
				return;

			RepositoryUrl = uri;

			var account = uri.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
			AccountName = account.First();
			RepositoryName = account.Skip(1).First();
		}

		private Dictionary<string, Dictionary<string, string>> ReadIni(string filePath)
		{
			string data = File.ReadAllText(filePath);
			string pattern = @"
				^                           # Beginning of the line
				((?:\[)                     # Section Start
						 (?<Section>[^\]]*)     # Actual Section text into Section Group
				 (?:\])                     # Section End then EOL/EOB
				 (?:[\r\n]{0,}|\Z))         # Match but don't capture the CRLF or EOB
				 (                          # Begin capture groups (Key Value Pairs)
					(?!\[)                    # Stop capture groups if a [ is found; new section
					(?<Key>[^=]*?)            # Any text before the =, matched few as possible
					(?:=)                     # Get the = now
					(?<Value>[^\r\n]*)        # Get everything that is not an Line Changes
					(?:[\r\n]{0,4})           # MBDC \r\n
					)+                        # End Capture groups";

			return (
				from Match m in Regex.Matches(data, pattern, RegexOptions.IgnorePatternWhitespace | RegexOptions.Multiline)
				select new
				{
					Section = m.Groups["Section"].Value.Trim(),

					kvps = (
						from cpKey in m.Groups["Key"].Captures.Cast<Capture>().Select((a, i) => new { Value=a.Value.Trim(), i })
						join cpValue in m.Groups["Value"].Captures.Cast<Capture>().Select((b, i) => new { b.Value, i }) on cpKey.i equals cpValue.i
						select new KeyValuePair<string, string>(cpKey.Value, cpValue.Value)).ToDictionary(kvp => kvp.Key, kvp => kvp.Value)

				}).ToDictionary(itm => itm.Section, itm => itm.kvps);

			//InIFile["WindowSettings"]["Window Name"];
		}

	}
}


text:
<problems count="1">
 <sa-cases>0</sa-cases>
 <problem>
  <address.xpath>/bpws:process</address.xpath>
  <bundle.clazz>class org.eclipse.bpel.validator.unsupported.Process</bundle.clazz>
  <bundleName>org.eclipse.bpel.validator.unsupported.messages</bundleName>
  <charEnd>13</charEnd>
  <charStart>1</charStart>
  <columnNumber>1</columnNumber>
  <fixMessage>You cannot validate a BPEL process in namespace "http://some.unknown.namespace"</fixMessage>
  <lineNumber>1</lineNumber>
  <location>process</location>
  <message>Validation is not supported for <bpws:process> "Simple"  in namespace "http://some.unknown.namespace"</message>
  <message.args>["bpws:process","Simple","http://some.unknown.namespace"]</message.args>
  <message.id>BPELC__UNSUPPORTED_VALIDATION</message.id>
  <node><bpws:process "Simple"></node>
  <ruleName>Process.ReportUnsupportedProcessVariant.5</ruleName>
  <severity>2</severity>
 </problem>

</problems>


text:
***

##### 1~99

1 . two sum
2 . add two numbers
3 . longest substring without repeating characters
4 . median of two sorted arrays
5 . longest palindromic substring
6 . zigzag conversion
7 . reverse integer
8 . string to integer
9 . palindrome number
10 . regular expression matching
11 . container with most water
12 . integer to roman
13 . roman to integer
14 . longest common prefix
15 . 3 sum
16 . 3 sum closest
17 . letter combinations of a phone number
18 . 4 sum
19 . remove nth node from end of list
20 . valid parentheses
21 . merge two sorted lists
22 . generate parentheses
23 . merge k sorted lists
24 . swap nodes in pairs
25 . reverse nodes in k group
26 . remove duplicates from sorted array
27 . remove element
28 . implement strStr()
29 . divide two integers
30 . substring with concatenation of all words
31 . next permutation
32 . longest valid parentheses
33 . search in rotated sorted array(hard?)
34 . search for a range
35 . search insert position
36 . valid Sudoku
37 . Sudoku solver
38 . count and say
39 . combination sum
40 . combination sum II
41 . first missing positive
42 . trapping rain water
43 . multiply strings
44 . wildcard matching
45 . jump game II
46 . permutations
47 . permutations II
48 . rotate image
50 . pow(x, n)
51 . n queens
52 . n queens II
53 . maximum subarray
54 . spiral matrix
55 . jump game
56 . merge intervals
57 . insert interval
58 . length of last word
59 . spiral matrix II
61 . rotate list
62 . unique paths
64 . minimum path sum
65 . valid number
66 . plus one
67 . add binary
69 . sqrt(x)
70 . climbing stairs
73 . set matrix zeroes
74 . search a 2D matrix
78 . subsets
80 . remove duplicates from sorted array II
81 . search in rotated sorted array II
83 . remove duplicates from sorted list
88 . merge sorted array

***

##### 100~199

100 . same tree
104 . maximum depth of binary tree
118 . Pascal's triangle
119 . Pascal's triangle II
120 . triangle
125 . valid palindrome
135 . candy
136 . single number
141 . linked list cycle
144 . binary tree preorder traversal
145 . binary tree postorder traversal
151 . reverse words in a string
155 . min stack
168 . Excel sheet column title
169 . majority element
171 . Excel sheet column number
172 . factorial trailing zeroes
189 . rotate array
190 . reverse bits
191 . number of 1 bits
198 . house robber

***

##### 200~299

202 . happy number
203 . remove linked list elements
204 . count primes
205 . isomorphic strings
206 . reverse linked list
213 . house robber II
217 . contains duplicate
219 . contains duplicate II
221 . maximal square
223 . rectangle area
226 . invert binary tree
231 . power of two
233 . number of digit one
234 . palindrome linked list
237 . delete node in a linked list
239 . sliding window maximum
240 . search a 2D matrix II
242 . valid anagram
257 . binary tree paths
258 . add digits
263 . ugly number
264 . ugly number II
268 . missing number
278 . first bad version
287 . find the duplicate number
283 . move zeroes
290 . word pattern
292 . nim game
295 . find median from data stream
299 . bulls and cows

***

##### 300~399

303 . range sum query
322 . coin change
326 . power of three
328 . odd even linked list
338 . counting bits
342 . power of four
343 . integer break
344 . reverse string
345 . reverse vowels of a string
349 . intersection of two arrays
350 . intersection of two arrays II


text:
using System;
using System.Linq.Expressions;

namespace LinqToDB.Mapping
{
	/// <summary>
	/// Configure setter and getter methods for dynamic columns.
	/// </summary>
	/// <remarks>
	/// Expected signatures for getter and setter:
	/// <code>
	/// // should return true and value of property, if property value found in storage
	/// // should return false if property value not found in storage
	/// static object Getter(Entity object, string propertyName, object defaultValue);
	/// // or
	/// object this.Getter(string propertyName, object defaultValue);
	/// // where defaultValue is default value for property type for current MappingSchema
	///
	/// static void Setter(Entity object, string propertyName, object value)
	/// or
	/// void this.Setter(string propertyName, object value)
	/// </code>
	/// </remarks>
	/// <seealso cref="Attribute" />
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
	public class DynamicColumnAccessorAttribute : Attribute, IConfigurationProvider
	{
		/// <summary>
		/// Gets or sets mapping schema configuration name, for which this attribute should be taken into account.
		/// <see cref="ProviderName"/> for standard names.
		/// Attributes with <c>null</c> or empty string <see cref="Configuration"/> value applied to all configurations (if no attribute found for current configuration).
		/// </summary>
		public string? Configuration              { get; set; }

		/// <summary>
		/// Gets or sets name of dynamic properties property setter method.
		/// </summary>
		public string? SetterMethod               { get; set; }

		/// <summary>
		/// Gets or sets name of dynamic properties property getter method.
		/// </summary>
		public string? GetterMethod               { get; set; }

		/// <summary>
		/// Gets or sets name of dynamic properties property setter expression method or property. Method or property
		/// must be static.
		/// </summary>
		public string? SetterExpressionMethod     { get; set; }

		/// <summary>
		/// Gets or sets name of dynamic properties property getter expression method or property. Method or property
		/// must be static.
		/// </summary>
		public string? GetterExpressionMethod     { get; set; }

		/// <summary>
		/// Gets or sets name of dynamic properties property set expression.
		/// </summary>
		public LambdaExpression? SetterExpression { get; set; }

		/// <summary>
		/// Gets or sets name of dynamic properties property get expression.
		/// </summary>
		public LambdaExpression? GetterExpression { get; set; }

		protected internal void Validate()
		{
			var setters = 0;
			var getters = 0;
			if (SetterMethod           != null) setters++;
			if (SetterExpressionMethod != null) setters++;
			if (SetterExpression       != null) setters++;
			if (GetterMethod           != null) getters++;
			if (GetterExpressionMethod != null) getters++;
			if (GetterExpression       != null) getters++;

			if (setters != 1 || getters != 1)
				throw new LinqToDBException($"{nameof(DynamicColumnAccessorAttribute)} should have exactly one setter and getter configured.");
		}
	}
}