text:
import torch
from torch import Tensor
from torch import nn
from typing import Union, Tuple, List, Iterable, Dict
import os
import json
import logging
import numpy as np
from .tokenizer import WhitespaceTokenizer

logger = logging.getLogger(__name__)

class BoW(nn.Module):
    """Implements a Bag-of-Words (BoW) model to derive sentence embeddings.

    A weighting can be added to allow the generation of tf-idf vectors. The output vector has the size of the vocab.
    """

    def __init__(self, vocab: List[str], word_weights: Dict[str, float] = {}, unknown_word_weight: float = 1, cumulative_term_frequency: bool = True):
        super(BoW, self).__init__()
        vocab = list(set(vocab)) #Ensure vocab is unique
        self.config_keys = ['vocab', 'word_weights', 'unknown_word_weight', 'cumulative_term_frequency']
        self.vocab = vocab
        self.word_weights = word_weights
        self.unknown_word_weight = unknown_word_weight
        self.cumulative_term_frequency = cumulative_term_frequency

        #Maps wordIdx -> word weight
        self.weights = []
        num_unknown_words = 0
        for word in vocab:
            weight = unknown_word_weight
            if word in word_weights:
                weight = word_weights[word]
            elif word.lower() in word_weights:
                weight = word_weights[word.lower()]
            else:
                num_unknown_words += 1
            self.weights.append(weight)

        logger.info("{} out of {} words without a weighting value. Set weight to {}".format(num_unknown_words, len(vocab), unknown_word_weight))

        self.tokenizer = WhitespaceTokenizer(vocab, stop_words=set(), do_lower_case=False)
        self.sentence_embedding_dimension = len(vocab)

    def forward(self, features: Dict[str, Tensor]):
        #Nothing to do, everything is done in get_sentence_features
        return features

    def tokenize(self, texts: List[str]) -> List[int]:
        tokenized =  [self.tokenizer.tokenize(text) for text in texts]
        return self.get_sentence_features(tokenized)

    def get_sentence_embedding_dimension(self):
        return self.sentence_embedding_dimension

    def get_sentence_features(self, tokenized_texts: List[List[int]], pad_seq_length: int = 0):
        vectors = []

        for tokens in tokenized_texts:
            vector = np.zeros(self.get_sentence_embedding_dimension(), dtype=np.float32)
            for token in tokens:
                if self.cumulative_term_frequency:
                    vector[token] += self.weights[token]
                else:
                    vector[token] = self.weights[token]
            vectors.append(vector)

        return {'sentence_embedding': torch.tensor(vectors, dtype=torch.float)}

    def get_config_dict(self):
        return {key: self.__dict__[key] for key in self.config_keys}

    def save(self, output_path):
        with open(os.path.join(output_path, 'config.json'), 'w') as fOut:
            json.dump(self.get_config_dict(), fOut, indent=2)

    @staticmethod
    def load(input_path):
        with open(os.path.join(input_path, 'config.json')) as fIn:
            config = json.load(fIn)

        return BoW(**config)


text:
;( function( $ ){
  $.fn.extend({
    actual : function( method, options ){
      var $hidden, $target, configs, css, tmp, actual, fix, restore;

      // check if the jQuery method exist
      if( !this[ method ]){
        throw '$.actual => The jQuery method "' + method + '" you called does not exist';
      }

      configs = $.extend({
        absolute : false,
        clone : false,
        includeMargin : undefined
      }, options );

      $target = this;

      if( configs.clone === true ){
        fix = function(){
          // this is useful with css3pie
          $target = $target.filter( ':first' ).clone().css({
            position : 'absolute',
            top : -1000
          }).appendTo( 'body' );
        };

        restore = function(){
          // remove DOM element after getting the width
          $target.remove();
        };
      }else{
        fix = function(){
          // get all hidden parents
          $hidden = $target.parents().andSelf().filter( ':hidden' );

          css = configs.absolute === true ?
            { position : 'absolute', visibility: 'hidden', display: 'block' } :
            { visibility: 'hidden', display: 'block' };

          tmp = [];

          // save the origin style props
          // set the hidden el css to be got the actual value later
          $hidden.each( function(){
            var _tmp = {}, name;
            for( name in css ){
              // save current style
              _tmp[ name ] = this.style[ name ];
              // set current style to proper css style
              this.style[ name ] = css[ name ];
            }
            tmp.push( _tmp );
          });
        };

        restore = function(){
          // restore origin style values
          $hidden.each( function( i ){
            var _tmp = tmp[ i ], name;
            for( name in css ){
              this.style[ name ] = _tmp[ name ];
            }
          });
        };
      }

      fix();
      // get the actual value with user specific methed
      // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
      // configs.includeMargin only works for 'outerWidth
      actual = $target[ method ]( configs.includeMargin );

      restore();
      // IMPORTANT, this plugin only return the value of the first element
      return actual;
    }
  });
})( jQuery );

redpajama_set_name: RedPajamaGithub


text:
package com.thoughtworks.go.plugin.api.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation that marks a method to be called when a plugin is unloaded.
 *

 * Intended for use by plugin developers to mark a method of an
 * extension implementation to be called during plugin unload time.
 *

 * The semantics of the method marked with this annotation is as follows.
 *

 *
There should atmost one method in the implementation that should have this annotation.

 *
The method should be public, non-static.

 *
The method should take only one parameter- {@link com.thoughtworks.go.plugin.api.info.PluginContext}. Return values will be ignored.

 *
This annotation will not be inherited along with the method.

 *

 *
 * The framework performs the validation of the semantics mentioned above during the plugin load time - before executing the
 * method marked with {@link Load} annotation. But the callback to this method is only done during the plugin unload time.
 * In summary, semantics checks are done at the plugin load and invocation done during the plugin unload.
 *
 * Please refer to the Go Plugin documentation for more details.
 *
 * @see Go Plugin Documentation
 * @see com.thoughtworks.go.plugin.api.info.PluginContext
 * @see Load
 *
 * @author Go Team
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface UnLoad {
}


text:
@interface FirstViewController ()

@end

@implementation FirstViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}

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

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

- (IBAction)menuButtonPressed:(id)sender
{
    XDKAirMenuController *menu = [XDKAirMenuController sharedMenu];

    if (menu.isMenuOpened)
        [menu closeMenuAnimated];
    else
        [menu openMenuAnimated];
}

@end


text:
using System;
using System.Security.Claims;
using System.Security.Principal;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Moq;

namespace CodeConverters.MvcTest.Mvc
{
    public static class ControllerSetupExtensions
    {
        public static T SetUser<T>(this T controller, string userName) where T : Controller
        {
            controller.EnsureControllerTestContext();
            var principal = new ClaimsPrincipal(new GenericPrincipal(new GenericIdentity(userName), null));
            Mock.Get(controller.ControllerContext.HttpContext).SetupGet(r => r.User).Returns(principal);
            return controller;
        }

        public static T SetCurrentUrl<T>(this T controller, string currentUrl = "http://localhost:123") where T : Controller
        {
            controller.EnsureControllerTestContext();
            Mock.Get(controller.ControllerContext.HttpContext.Request).SetupGet(r => r.Url).Returns(new Uri(currentUrl));
            var requestContext = new RequestContext(controller.ControllerContext.HttpContext, controller.ControllerContext.RouteData);
            controller.Url = new UrlHelper(requestContext);
            return controller;
        }

        private static void EnsureControllerTestContext<T>(this T controller) where T : Controller
        {
            if (controller.ControllerContext != null) return;
            var currentHttpContext = new Mock<HttpContextBase> { DefaultValue = DefaultValue.Mock };
            currentHttpContext.SetupAllProperties();
            controller.ControllerContext = new ControllerContext(currentHttpContext.Object, new RouteData(), controller);
        }
    }
}


text:
<mbean name="dcm4chee.archive:service=Scheduler">
<attribute name="State"/>
</mbean>


text:
package com.graphhopper.reader.dem;

import com.graphhopper.storage.DataAccess;
import com.graphhopper.storage.RAMDirectory;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * @author Peter Karich
 */
public class HeightTileTest {
    @Test
    public void testGetHeight() {
        // data access has same coordinate system as graphical or UI systems have (or the original DEM data has).
        // But HeightTile has lat,lon system ('mathematically')
        int width = 10;
        int height = 20;
        HeightTile instance = new HeightTile(0, 0, width, height, 1e-6, 10, 20);
        DataAccess heights = new RAMDirectory().create("tmp");
        heights.create(2 * width * height);
        instance.setHeights(heights);
        init(heights, width, height, 1);

        // x,y=1,7
        heights.setShort(2 * (17 * width + 1), (short) 70);

        // x,y=2,9
        heights.setShort(2 * (19 * width + 2), (short) 90);

        assertEquals(1, instance.getHeight(5, 5), 1e-3);
        assertEquals(70, instance.getHeight(2.5, 1.5), 1e-3);
        // edge cases for one tile with the boundaries [min,min+degree/width) for lat and lon
        assertEquals(1, instance.getHeight(3, 2), 1e-3);
        assertEquals(70, instance.getHeight(2, 1), 1e-3);

        // edge cases for the whole object
        assertEquals(1, instance.getHeight(+1.0, 2), 1e-3);
        assertEquals(90, instance.getHeight(0.5, 2.5), 1e-3);
        assertEquals(90, instance.getHeight(0.0, 2.5), 1e-3);
        assertEquals(1, instance.getHeight(+0.0, 3), 1e-3);
        assertEquals(1, instance.getHeight(-0.5, 3.5), 1e-3);
        assertEquals(1, instance.getHeight(-0.5, 3.0), 1e-3);
        // fall back to "2,9" if within its boundaries
        assertEquals(90, instance.getHeight(-0.5, 2.5), 1e-3);

        assertEquals(1, instance.getHeight(0, 0), 1e-3);
        assertEquals(1, instance.getHeight(9, 10), 1e-3);
        assertEquals(1, instance.getHeight(10, 9), 1e-3);
        assertEquals(1, instance.getHeight(10, 10), 1e-3);

        // no error
        assertEquals(1, instance.getHeight(10.5, 5), 1e-3);
        assertEquals(1, instance.getHeight(-0.5, 5), 1e-3);
        assertEquals(1, instance.getHeight(1, -0.5), 1e-3);
        assertEquals(1, instance.getHeight(1, 10.5), 1e-3);
    }

    @Test
    public void testGetHeightForNegativeTile() {
        int width = 10;
        HeightTile instance = new HeightTile(-20, -20, width, width, 1e-6, 10, 10);
        DataAccess heights = new RAMDirectory().create("tmp");
        heights.create(2 * 10 * 10);
        instance.setHeights(heights);
        init(heights, width, width, 1);

        // x,y=1,7
        heights.setShort(2 * (7 * width + 1), (short) 70);

        // x,y=2,9
        heights.setShort(2 * (9 * width + 2), (short) 90);

        assertEquals(1, instance.getHeight(-15, -15), 1e-3);
        assertEquals(70, instance.getHeight(-17.5, -18.5), 1e-3);
        // edge cases for one tile with the boundaries [min,min+degree/width) for lat and lon
        assertEquals(1, instance.getHeight(-17, -18), 1e-3);
        assertEquals(70, instance.getHeight(-18, -19), 1e-3);
    }

    @Test
    public void testInterpolate() {
        HeightTile instance = new HeightTile(0, 0, 2, 2, 1e-6, 10, 10).setInterpolate(true);
        DataAccess heights = new RAMDirectory().create("tmp");
        heights.create(2 * 2 * 2);
        instance.setHeights(heights);
        double topLeft = 0;
        double topRight = 1;
        double bottomLeft = 2;
        double bottomRight = 3;
        set(heights, 2, 0, 0, (short) topLeft);
        set(heights, 2, 1, 0, (short) topRight);
        set(heights, 2, 0, 1, (short) bottomLeft);
        set(heights, 2, 1, 1, (short) bottomRight);

        // corners
        assertEquals(bottomLeft, instance.getHeight(0, 0), 1e-3);
        assertEquals(topLeft, instance.getHeight(10, 0), 1e-3);
        assertEquals(bottomRight, instance.getHeight(0, 10), 1e-3);
        assertEquals(topRight, instance.getHeight(10, 10), 1e-3);

        // midpoints
        assertEquals(avg(topLeft, topRight), instance.getHeight(10, 5), 1e-3);
        assertEquals(avg(bottomLeft, bottomRight), instance.getHeight(0, 5), 1e-3);
        assertEquals(avg(topLeft, bottomLeft), instance.getHeight(5, 0), 1e-3);
        assertEquals(avg(topRight, bottomRight, topLeft, bottomLeft), instance.getHeight(5, 5), 1e-3);

        // missing data uses whatever remains
        set(heights, 2, 1, 0, Short.MIN_VALUE);
        set(heights, 2, 0, 1, Short.MIN_VALUE);
        set(heights, 2, 1, 1, Short.MIN_VALUE);
        assertEquals(topLeft, instance.getHeight(0, 0), 1e-3);
        assertEquals(topLeft, instance.getHeight(10, 0), 1e-3);
        assertEquals(topLeft, instance.getHeight(0, 10), 1e-3);
        assertEquals(topLeft, instance.getHeight(10, 10), 1e-3);

        // when all data missing, returns NaN
        set(heights, 2, 0, 0, Short.MIN_VALUE);
        assertEquals(Double.NaN, instance.getHeight(5, 5), 1e-3);
    }

    private void init(DataAccess da, int width, int height, int i) {
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                set(da, width, x, y, (short) 1);
            }
        }
    }

    private void set(DataAccess da, int width, int x, int y, short height) {
        da.setShort(2 * (y * width + x), height);
    }

    private double avg(double... ns) {
        double sum = 0;
        for (double n : ns) {
            sum += n;
        }
        return sum / ns.length;
    }
}


text:
package goja.kits.io;

import com.google.common.base.Preconditions;
import goja.StringPool;
import com.google.common.base.Throwables;
import com.google.common.collect.Maps;
import com.google.common.io.ByteSource;
import com.google.common.io.Resources;
import goja.kits.reflect.ClassKit;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import java.util.Properties;

public class ResourceKit {

    private ResourceKit() {
    }

    public static Map<String, String> readProperties(String resourceName) {
        Properties properties = new Properties();
        URL resource = Resources.getResource(resourceName);
        try {
            properties.load(new InputStreamReader(resource.openStream(), StringPool.UTF_8));
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
        return Maps.fromProperties(properties);
    }

    public static void loadFileInProperties(String file_path, Properties properties) {
        URL url = Resources.getResource(file_path);
        if (url == null) {
            throw new IllegalArgumentException("Parameter of file can not be blank");
        }

        ByteSource byteSource = Resources.asByteSource(url);
        try {
            properties.load(byteSource.openStream());
        } catch (IOException e) {
            throw new IllegalArgumentException("Properties file can not be loading: " + url);
        }
    }

    /**
     * Pseudo URL prefix for loading from the class path: "classpath:"
     */
    public static final String CLASSPATH_URL_PREFIX = "classpath:";

    /**
     * URL prefix for loading from the file system: "file:"
     */
    public static final String FILE_URL_PREFIX = "file:";

    /**
     * URL protocol for a file in the file system: "file"
     */
    public static final String URL_PROTOCOL_FILE = "file";

    /**
     * URL protocol for an entry from a jar file: "jar"
     */
    public static final String URL_PROTOCOL_JAR = "jar";

    /**
     * URL protocol for an entry from a zip file: "zip"
     */
    public static final String URL_PROTOCOL_ZIP = "zip";

    /**
     * URL protocol for an entry from a JBoss jar file: "vfszip"
     */
    public static final String URL_PROTOCOL_VFSZIP = "vfszip";

    /**
     * URL protocol for an entry from a WebSphere jar file: "wsjar"
     */
    public static final String URL_PROTOCOL_WSJAR = "wsjar";

    /**
     * Separator between JAR URL and file path within the JAR
     */
    public static final String JAR_URL_SEPARATOR = "!/";

    /**
     * Return whether the given resource location is a URL:
     * either a special "classpath" pseudo URL or a standard URL.
     *
     * @param resourceLocation the location String to check
     * @return whether the location qualifies as a URL
     * @see #CLASSPATH_URL_PREFIX
     * @see java.net.URL
     */
    public static boolean isUrl(String resourceLocation) {
        if (resourceLocation == null) {
            return false;
        }
        if (resourceLocation.startsWith(CLASSPATH_URL_PREFIX)) {
            return true;
        }
        try {
            new URL(resourceLocation);
            return true;
        } catch (MalformedURLException ex) {
            return false;
        }
    }

    /**
     * Resolve the given resource location to a {@code java.net.URL}.
     *
Does not check whether the URL actually exists; simply returns
     * the URL that the given location would correspond to.
     *
     * @param resourceLocation the resource location to resolve: either a
     *                         "classpath:" pseudo URL, a "file:" URL, or a plain file path
     * @return a corresponding URL object
     * @throws FileNotFoundException if the resource cannot be resolved to a URL
     */
    public static URL getURL(String resourceLocation) throws FileNotFoundException {
        Preconditions.checkNotNull(resourceLocation, "Resource location must not be null");
        if (resourceLocation.startsWith(CLASSPATH_URL_PREFIX)) {
            String path = resourceLocation.substring(CLASSPATH_URL_PREFIX.length());
            URL url = ClassKit.getDefaultClassLoader().getResource(path);
            if (url == null) {
                String description = "class path resource [" + path + "]";
                throw new FileNotFoundException(
                        description + " cannot be resolved to URL because it does not exist");
            }
            return url;
        }
        try {
            // try URL
            return new URL(resourceLocation);
        } catch (MalformedURLException ex) {
            // no URL -> treat as file path
            try {
                return new File(resourceLocation).toURI().toURL();
            } catch (MalformedURLException ex2) {
                throw new FileNotFoundException("Resource location [" + resourceLocation +
                        "] is neither a URL not a well-formed file path");
            }
        }
    }

    /**
     * Resolve the given resource location to a {@code java.io.File},
     * i.e. to a file in the file system.
     *
Does not check whether the file actually exists; simply returns
     * the File that the given location would correspond to.
     *
     * @param resourceLocation the resource location to resolve: either a
     *                         "classpath:" pseudo URL, a "file:" URL, or a plain file path
     * @return a corresponding File object
     * @throws FileNotFoundException if the resource cannot be resolved to
     *                               a file in the file system
     */
    public static File getFile(String resourceLocation) throws FileNotFoundException {
        Preconditions.checkNotNull(resourceLocation, "Resource location must not be null");
        if (resourceLocation.startsWith(CLASSPATH_URL_PREFIX)) {
            String path = resourceLocation.substring(CLASSPATH_URL_PREFIX.length());
            String description = "class path resource [" + path + "]";
            URL url = ClassKit.getDefaultClassLoader().getResource(path);
            if (url == null) {
                throw new FileNotFoundException(
                        description + " cannot be resolved to absolute file path " +
                                "because it does not reside in the file system"
                );
            }
            return getFile(url, description);
        }
        try {
            // try URL
            return getFile(new URL(resourceLocation));
        } catch (MalformedURLException ex) {
            // no URL -> treat as file path
            return new File(resourceLocation);
        }
    }

    /**
     * Resolve the given resource URL to a {@code java.io.File},
     * i.e. to a file in the file system.
     *
     * @param resourceUrl the resource URL to resolve
     * @return a corresponding File object
     * @throws FileNotFoundException if the URL cannot be resolved to
     *                               a file in the file system
     */
    public static File getFile(URL resourceUrl) throws FileNotFoundException {
        return getFile(resourceUrl, "URL");
    }

    /**
     * Resolve the given resource URL to a {@code java.io.File},
     * i.e. to a file in the file system.
     *
     * @param resourceUrl the resource URL to resolve
     * @param description a description of the original resource that
     *                    the URL was created for (for example, a class path location)
     * @return a corresponding File object
     * @throws FileNotFoundException if the URL cannot be resolved to
     *                               a file in the file system
     */
    public static File getFile(URL resourceUrl, String description) throws FileNotFoundException {
        Preconditions.checkNotNull(resourceUrl, "Resource URL must not be null");
        if (!URL_PROTOCOL_FILE.equals(resourceUrl.getProtocol())) {
            throw new FileNotFoundException(
                    description + " cannot be resolved to absolute file path " +
                            "because it does not reside in the file system: " + resourceUrl
            );
        }
        try {
            return new File(toURI(resourceUrl).getSchemeSpecificPart());
        } catch (URISyntaxException ex) {
            // Fallback for URLs that are not valid URIs (should hardly ever happen).
            return new File(resourceUrl.getFile());
        }
    }

    /**
     * Resolve the given resource URI to a {@code java.io.File},
     * i.e. to a file in the file system.
     *
     * @param resourceUri the resource URI to resolve
     * @return a corresponding File object
     * @throws FileNotFoundException if the URL cannot be resolved to
     *                               a file in the file system
     */
    public static File getFile(URI resourceUri) throws FileNotFoundException {
        return getFile(resourceUri, "URI");
    }

    /**
     * Resolve the given resource URI to a {@code java.io.File},
     * i.e. to a file in the file system.
     *
     * @param resourceUri the resource URI to resolve
     * @param description a description of the original resource that
     *                    the URI was created for (for example, a class path location)
     * @return a corresponding File object
     * @throws FileNotFoundException if the URL cannot be resolved to
     *                               a file in the file system
     */
    public static File getFile(URI resourceUri, String description) throws FileNotFoundException {
        Preconditions.checkNotNull(resourceUri, "Resource URI must not be null");
        if (!URL_PROTOCOL_FILE.equals(resourceUri.getScheme())) {
            throw new FileNotFoundException(
                    description + " cannot be resolved to absolute file path " +
                            "because it does not reside in the file system: " + resourceUri
            );
        }
        return new File(resourceUri.getSchemeSpecificPart());
    }

    /**
     * Determine whether the given URL points to a resource in the file system,
     * that is, has protocol "file" or "vfs".
     *
     * @param url the URL to check
     * @return whether the URL has been identified as a file system URL
     */
    public static boolean isFileURL(URL url) {
        String protocol = url.getProtocol();
        return (URL_PROTOCOL_FILE.equals(protocol));
    }

    /**
     * Determine whether the given URL points to a resource in a jar file,
     * that is, has protocol "jar", "zip", "wsjar" or "code-source".
     *
"zip" and "wsjar" are used by WebLogic Server and WebSphere, respectively,
     * but can be treated like jar files.
     *
     * @param url the URL to check
     * @return whether the URL has been identified as a JAR URL
     */
    public static boolean isJarURL(URL url) {
        String up = url.getProtocol();
        return (URL_PROTOCOL_JAR.equals(up) || URL_PROTOCOL_ZIP.equals(up) || URL_PROTOCOL_WSJAR.equals(up));
    }

    /**
     * Extract the URL for the actual jar file from the given URL
     * (which may point to a resource in a jar file or to a jar file itself).
     *
     * @param jarUrl the original URL
     * @return the URL for the actual jar file
     * @throws MalformedURLException if no valid jar file URL could be extracted
     */
    public static URL extractJarFileURL(URL jarUrl) throws MalformedURLException {
        String urlFile = jarUrl.getFile();
        int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR);
        if (separatorIndex != -1) {
            String jarFile = urlFile.substring(0, separatorIndex);
            try {
                return new URL(jarFile);
            } catch (MalformedURLException ex) {
                // Probably no protocol in original jar URL, like "jar:C:/mypath/myjar.jar".
                // This usually indicates that the jar file resides in the file system.
                if (!jarFile.startsWith("/")) {
                    jarFile = "/" + jarFile;
                }
                return new URL(FILE_URL_PREFIX + jarFile);
            }
        } else {
            return jarUrl;
        }
    }

    /**
     * Create a URI instance for the given URL,
     * replacing spaces with "%20" URI encoding first.
     *
Furthermore, this method works on JDK 1.4 as well,
     * in contrast to the {@code URL.toURI()} method.
     *
     * @param url the URL to convert into a URI instance
     * @return the URI instance
     * @throws URISyntaxException if the URL wasn't a valid URI
     * @see java.net.URL#toURI()
     */
    public static URI toURI(URL url) throws URISyntaxException {
        return toURI(url.toString());
    }

    /**
     * Create a URI instance for the given location String,
     * replacing spaces with "%20" URI encoding first.
     *
     * @param location the location String to convert into a URI instance
     * @return the URI instance
     * @throws URISyntaxException if the location wasn't a valid URI
     */
    public static URI toURI(String location) throws URISyntaxException {
        return new URI(StringUtils.replace(location, " ", "%20"));
    }

    /**
     * Set the {@link URLConnection#setUseCaches "useCaches"} flag on the
     * given connection, preferring {@code false} but leaving the
     * flag at {@code true} for JNLP based resources.
     *
     * @param con the URLConnection to set the flag on
     */
    public static void useCachesIfNecessary(URLConnection con) {
        con.setUseCaches(con.getClass().getSimpleName().startsWith("JNLP"));
    }
}


text:
package registry

import (
	"net/http"

	"golang.org/x/net/context"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/watch"
	"k8s.io/kubernetes/pkg/api/rest"
)

type decoratedWatcher struct {
	w         watch.Interface
	decorator rest.ObjectFunc
	cancel    context.CancelFunc
	resultCh  chan watch.Event
}

func newDecoratedWatcher(w watch.Interface, decorator rest.ObjectFunc) *decoratedWatcher {
	ctx, cancel := context.WithCancel(context.Background())
	d := &decoratedWatcher{
		w:         w,
		decorator: decorator,
		cancel:    cancel,
		resultCh:  make(chan watch.Event),
	}
	go d.run(ctx)
	return d
}

func (d *decoratedWatcher) run(ctx context.Context) {
	var recv, send watch.Event
	for {
		select {
		case recv = <-d.w.ResultChan():
			switch recv.Type {
			case watch.Added, watch.Modified, watch.Deleted:
				err := d.decorator(recv.Object)
				if err != nil {
					send = makeStatusErrorEvent(err)
					break
				}
				send = recv
			case watch.Error:
				send = recv
			}
			select {
			case d.resultCh <- send:
				if send.Type == watch.Error {
					d.cancel()
				}
			case <-ctx.Done():
			}
		case <-ctx.Done():
			d.w.Stop()
			close(d.resultCh)
			return
		}
	}
}

func (d *decoratedWatcher) Stop() {
	d.cancel()
}

func (d *decoratedWatcher) ResultChan() <-chan watch.Event {
	return d.resultCh
}

func makeStatusErrorEvent(err error) watch.Event {
	status := &metav1.Status{
		Status:  metav1.StatusFailure,
		Message: err.Error(),
		Code:    http.StatusInternalServerError,
		Reason:  metav1.StatusReasonInternalError,
	}
	return watch.Event{
		Type:   watch.Error,
		Object: status,
	}
}


text:
title: QR and Micro QR Barcode
type: docs
weight: 30
url: /java/qr-and-micro-qr-barcode/
---

## **Create a QR or Micro QR Barcode**
QR barcode is a two-dimensional barcode symbology developed in Japan. QR barcode has the following features:

- High capacity encoding of data, up to 7000 numeric digits or 4000 alphanumeric data
- Dirt and damage resistant, a maximum 30% of codewords can be restored
- Readable from all directions

Added a [QR ](https://apireference.aspose.com/barcode/java/com.aspose.barcode.generation/BarcodeParameters#getQR--)property in [BarcodeGenerator](https://apireference.aspose.com/barcode/java/com.aspose.barcode.generation/BarcodeGenerator) Class as [BarcodeParameter](https://apireference.aspose.com/barcode/java/com.aspose.barcode.generation/BarcodeParameters). This new property works as a QR / MicroQR selector. Select ForceQR (default) for standard QR symbols, Auto for MicroQR.

The following QR parameters can be set:

1. **QrECIEncoding** – Extended Channel Interpretation Identifiers. It is used to tell the barcode reader details about the used references for encoding the data in the symbol. The current implementation consists of all well-known charset encodings. Currently, it is used only for QR 2D barcode.
1. **QrEncodeMode** - QR symbology type of BarCode's encoding mode. The default mode is Auto.
1. **QrEncodeType** - QR / MicroQR selector mode. Select ForceQR for standard QR symbols, Auto for MicroQR.
1. **QrErrorLevel** - Level of Reed-Solomon error correction for QR barcode. From low to high: LevelL, LevelM, LevelQ, LevelH.
1. **QrVersion** - Version of QR Code. From Version1 to Version40 for QR code and from M1 to M4 for MicroQr. The default value is QRVersion.Auto.

[Enum QREncodeType](https://apireference.aspose.com/barcode/java/com.aspose.barcode/QREncodeType):

1. **Auto** - mode starts barcode version negotiation from MicroQR V1
1. **ForceQR** – mode starts barcode version negotiation from QR V1
1. **ForceMicroQR** - mode starts barcode version negotiation from MicroQR V1 to V4. If data cannot be encoded into MicroQR, an exception is thrown.

Added changes to Enum [QREncodeMode](https://apireference.aspose.com/barcode/java/com.aspose.barcode/QREncodeMode):

1. **Auto** - encode CodeText as is non-Unicode charset. If there is any Unicode character, the CodeText will be encoded with the value which is set in CodeTextEncoding.
1. **Bytes** - encode CodeText as plain bytes. If it detects any Unicode character, the character will be encoded as two bytes, lower byte first;
1. **Utf8BOM** - encode CodeText with UTF8 encoding with first ByteOfMark character;
1. **Utf16BEBOM** - encode CodeText with UTF8 encoding with first ByteOfMark character. It can be problems with some barcode scanners;
1. **ECIEncoding** - encode CodeText with the value set in the ECIEncoding property. It can be problems with some old (pre-2006) barcode scanners.
1. **ExtendedCodetext** - encode CodeText in Extended Channel mode which supports FNC1 first position, FNC1 second position, and multi ECI modes.
### **Encoding of a QR and Micro QR Barcode**
The micro QR code is a smaller version of the QR code standard for applications where symbol size is limited. There are 4 different versions (sizes) of Micro QR codes: the smallest is 11×11 modules; the largest can hold 35 numeric characters.
### **Error correction**
QR barcode can withstand certain damage and can still be decoded normally. This is decided by QR barcode's error correction level during encoding. There are four levels of error correction, from low to high:

- **LevelL**. Allows recovery of 7% of the code text
- **LevelM**. Allows recovery of 15% of the code text
- **LevelQ**. Allows recovery of 25% of the code text
- **LevelH**. Allows recovery of 30% of the code text
### **How to Encode QR Code**
Instantiate a BarcodeGenerator class object and set its EncodeType to QR, then set its CodeText property, QREncodeMode to auto, QREncodeType to ForceQR and set error correction level for the data you want to encode. The code example given below demonstrates how to generate a QR barcode.

{{< gist "aspose-com-gists" "9dea2dd38be50330a824dd05da062a97" "Examples-src-main-java-com-aspose-barcode-examples-TwoD_barcodes-basic_features-CreatingAQRBarcode-EncodeQRCode.java" >}}
### **How to set QR version**
Aspose.BarCode allows developers to set a version of QR barcode while generating the barcode. A property **QR.Version** has been introduced in the **BarcodeGenerator** class to achieve the goal. The following code example demonstrates how to set the QR version before generating a barcode image.

{{< gist "aspose-com-gists" "9dea2dd38be50330a824dd05da062a97" "Examples-src-main-java-com-aspose-barcode-examples-TwoD_barcodes-basic_features-CreatingAQRBarcode-set_QR_version.java" >}}
### **How to Encode MicroQR Code**
Instantiate a BarcodeGenerator class object and set its EncodeType to QR, then set its CodeText property, QREncodeMode to auto, QREncodeType to auto and set error correction level for the data you want to encode. The following code snippet shows you how to generate a MicroQR barcode.

{{< gist "aspose-com-gists" "9dea2dd38be50330a824dd05da062a97" "Examples-src-main-java-com-aspose-barcode-examples-TwoD_barcodes-basic_features-CreatingAQRBarcode-EncodeMicroQRCode.java" >}}

## **QR Code Encoding in the ECI Mode**
ECI (Extended Channel Interpretation) enables QR Code to encode multiple character sets (e.g. Arabic, Cyrillic, Greek, Hebrew) and other data interpretations or industry-specific requirements to be represented, into one QR Code symbol.

Added the new property ECIEncoding to [BarcodeGenerator](https://apireference.aspose.com/barcode/java/com.aspose.barcode.generation/BarcodeGenerator) class. It is used to tell the barcode reader details about the used references for encoding the data in the symbol by the Extended Channel Interpretation Identifiers. The current implementation consists of all well-known charset encodings. Currently, it is used only for QR 2D barcode.

Enum ECIEncodings:

1. **ISO_8859_1** - ISO/IEC 8859-1 Latin alphabet No. 1 encoding. ECI Id:"\000003".
1. **ISO_8859_2** - ISO/IEC 8859-2 Latin alphabet No. 2 encoding. ECI Id:"\000004".
1. **ISO_8859_3** - ISO/IEC 8859-3 Latin alphabet No. 3 encoding. ECI Id:"\000005".
1. **ISO_8859_4** - ISO/IEC 8859-4 Latin alphabet No. 4 encoding. ECI Id:"\000006".
1. **ISO_8859_5** - ISO/IEC 8859-5 Latin/Cyrillic alphabet encoding. ECI Id:"\000007".
1. **ISO_8859_6** - ISO/IEC 8859-6 Latin/Arabic alphabet encoding. ECI Id:"\000008".
1. **ISO_8859_7** - ISO/IEC 8859-7 Latin/Greek alphabet encoding. ECI Id:"\000009".
1. **ISO_8859_8** - ISO/IEC 8859-8 Latin/Hebrew alphabet encoding. ECI Id:"\000010".
1. **ISO_8859_9** - ISO/IEC 8859-9 Latin alphabet No. 5 encoding. ECI Id:"\000011".
1. **ISO_8859_10** - ISO/IEC 8859-10 Latin alphabet No. 6 encoding. ECI Id:"\000012".
1. **ISO_8859_11** - ISO/IEC 8859-11 Latin/Thai alphabet encoding. ECI Id:"\000013".
1. **ISO_8859_13** - ISO/IEC 8859-13 Latin alphabet No. 7 (Baltic Rim) encoding. ECI Id:"\000015".
1. **ISO_8859_14** - ISO/IEC 8859-14 Latin alphabet No. 8 (Celtic) encoding. ECI Id:"\000016".
1. **ISO_8859_15** - ISO/IEC 8859-15 Latin alphabet No. 9 encoding. ECI Id:"\000017".
1. **ISO_8859_16** - ISO/IEC 8859-16 Latin alphabet No. 10 encoding. ECI Id:"\000018".
1. **Shift_JIS** - Shift JIS (JIS X 0208 Annex 1 + JIS X 0201) encoding. ECI Id:"\000020".
1. **Win1250** - Windows 1250 Latin 2 (Central Europe) encoding. ECI Id:"\000021".
1. **Win1251** - Windows 1251 Cyrillic encoding. ECI Id:"\000022".
1. **Win1252** - Windows 1252 Latin 1 encoding. ECI Id:"\000023".
1. **Win1256** - Windows 1256 Arabic encoding. ECI Id:"\000024".
1. **UTF16BE** - ISO/IEC 10646 UCS-2 (High order byte first) encoding. ECI Id:"\000025".
1. **UTF8** - ISO/IEC 10646 UTF-8 encoding. ECI Id:"\000026".
1. **US_ASCII** - ISO/IEC 646:1991 International Reference Version of ISO 7-bit coded character set encoding. ECI Id:"\000027".
1. **Big5** - Big 5 (Taiwan) Chinese Character Set encoding. ECI Id:"\000028".
1. **GB18030** - GB (PRC) Chinese Character Set encoding. ECI Id:"\000029".
1. **EUC_KR** - Korean Character Set encoding. ECI Id:"\000030".
### **QR Code Encoding in the ECI Mode**
Instantiate a [BarcodeGenerator](https://apireference.aspose.com/barcode/java/com.aspose.barcode.generation/BarcodeGenerator) class object and set its EncodeType to QR, and set its CodeText property, QREncodeMode to ECIEncoding, QREncodeType to ForceQR, ECIEncoding to UTF8 and set error correction level for the data you want to encode. The following code example demonstrates how to generate a QR barcode.
#### **C#**
{{< gist "aspose-com-gists" "9dea2dd38be50330a824dd05da062a97" "Examples-src-main-java-com-aspose-barcode-examples-TwoD_barcodes-basic_features-CreatingAQRBarcode-EncodeQRCodEInECIMode.java" >}}


text:
module Qiq
  describe Note do
    before(:each) do
      # POST notes.json
      stub_request(:post, "#{Qiq::SERVER}/notes.json").
        with(body: hash_including({content: "Content"})).
        to_return(body: {id: 123, content: "Content", tags: []}.to_json)
    end

    let(:note) { Note.create({id: 123, content: "Content", tags: []}) }

    let(:tag) { Tag.new({id: 456, name: "bougle"}) }

    describe "#add_tag" do
      before(:each) do
        # POST notes/123/tags.json
        stub_request(:post, "#{Qiq::SERVER}/notes/123/tags.json").
          with(body: hash_including({tag_id: 456}))
        # GET notes/123.json
        stub_request(:get, "#{Qiq::SERVER}/notes/123.json").
          to_return(body: {id: 123, content: "Content", tags: [tag]}.to_json)

        note.add_tag(tag)
      end

      it "requests POST /notes/:id/tags.json" do
        expect(WebMock).to have_requested(:post, "#{Qiq::SERVER}/notes/123/tags.json").
          with(body: hash_including({tag_id: 456}))
      end

      it "update the note's tag attribute" do
        expect(note.tags).to eq [tag]
      end
    end
  end
end


text:
<?php
namespace Application\AdminBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\HttpFoundation\Request;

class UserController extends Controller
{

    /**
     * Get profile service used to get full profile info.
     *
     * @ApiDoc(
     *     section="User",
     *     resource=true,
     *     description="Get profile",
     *     requirements={
     *         {"name"="id", "dataType"="integer", "required"=true, "description"="user id"}
     *     },
     *     statusCodes={
     *         200="Returned when successful.",
     *         400="Returned when parameters are invalid.",
     *         401="Returned when the user is not authorized.",
     *         500="Returned when the server makes a booboo."
     *     }
     * )
     *
     *
     */
    public function getUserAction($data)
    {
        //$user = $this->get('security.token_storage')->getToken()->getUser();

        $data->getUsername();
        return $data;
    }

    /**
     * Get profile service used to get full profile info.
     *
     * @ApiDoc(
     *     section="User",
     *     resource=true,
     *     description="Get profile",
     *     requirements={
     *         {"name"="id", "dataType"="integer", "required"=true, "description"="user id"}
     *     },
     *     statusCodes={
     *         200="Returned when successful.",
     *         400="Returned when parameters are invalid.",
     *         401="Returned when the user is not authorized.",
     *         500="Returned when the server makes a booboo."
     *     }
     * )
     *
     *
     */
    public function updateUserAction($data)
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();

        //$data->getUsername();
        return $data;
    }

    /**
     * Register service used to add a new user.
     *
     * @ApiDoc(
     *     section="User",
     *     resource=true,
     *     description="Register profile",
     *     parameters={
     *         {"name"="firstName", "dataType"="string", "required"=false, "description"="user first name"},
     *         {"name"="lastName", "dataType"="string", "required"=false, "description"="user last name"},
     *         {"name"="email", "dataType"="string", "required"=true, "description"="user email address"},
     *         {"name"="phone", "dataType"="string", "required"=true, "description"="user phone number"},
     *         {"name"="password", "dataType"="string", "required"=true, "description"="user password"},
     *         {"name"="confirmPassword", "dataType"="string", "required"=true, "description"="user confirm password"},
     *         {"name"="storeId", "dataType"="integer", "required"=false, "description"="store id"},
     *     },
     *     statusCodes={
     *         200="Returned when successful.",
     *         400="Returned when parameters are invalid.",
     *         401="Returned when the user is not authorized.",
     *         500="Returned when the server makes a booboo."
     *     }
     * )
     *
     *
     */
    public function addUserAction($data , Request $request)
    {
        return $data;
    }

    /**
     * Get service used to get all the users.
     *
     * @ApiDoc(
     *     section="User",
     *     resource=true,
     *     description="Get the users",
     *     statusCodes={
     *         200="Returned when successful.",
     *         400="Returned when parameters are invalid.",
     *         401="Returned when the user is not authorized.",
     *         500="Returned when the server makes a booboo."
     *     }
     * )
     *
     *
     */
    public function getUsersAction($data , Request $request)
    {
        return $data;
    }
}


text:
package uz.support.v14.letter;

import android.content.Context;
import android.content.Intent;
import android.os.Handler;

import java.util.ArrayList;
import java.util.List;

import uz.support.v14.letter.error.LetterException;
import uz.support.v14.letter.service.FetchService;

public class LetterManager {

    private static LetterManager instance;

    public static LetterManager init(Context context) {
        if (context == null) {
            throw new LetterException("Context is null");
        }
        if (instance == null) {
            instance = new LetterManager(context);
        }
        return instance;
    }

    public static LetterManager getInstance() {
        if (instance == null) {
            throw new LetterException("LetterManager is not initial");
        }
        return instance;
    }

    public static Context getContext() {
        return instance.ctx;
    }

    private final List<LetterContainer<?, ?>> letters;
    private final Context ctx;
    private final Handler mainHandler;

    private LetterManager(Context context) {
        this.letters = new ArrayList<>();
        this.ctx = context;
        this.mainHandler = new Handler(context.getMainLooper());
    }

    public void push(LetterContainer<?, ?> letter) {
        synchronized (this) {
            letters.add(letter);
        }
        mainHandler.post(POST_LETTER);
    }

    public List<LetterContainer<?, ?>> pollLetters() {
        synchronized (this) {
            List<LetterContainer<?, ?>> result = letters;
            letters.clear();
            return result;
        }
    }

    private final Runnable POST_LETTER = new Runnable() {

        @Override
        public void run() {
            if (letters != null) {
                ctx.startService(new Intent(ctx, FetchService.class));
            }
        }
    };
}


text:
package httpclient;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * httpClient工具类
 *
 * @author why
 * @date 2016-09-08
 */
public class HttpClientUtil {
  private static Log log = LogFactory.getLog(HttpClientUtil.class);
  //编码格式。发送编码格式统一用UTF-8
  private final static String DEFAULT_ENCODING = "UTF-8";

  public static String getString(String url, Map<String, String> params) throws URISyntaxException {
    // 创建默认的httpClient实例.
    CloseableHttpClient httpclient = HttpClients.createDefault();
    URI puri = new URI(url);
    // 创建httpget
    URIBuilder uriBuilder = new URIBuilder()
            .setScheme(puri.getScheme())
            .setHost(puri.getHost())
            .setPort(puri.getPort())
            .setPath(puri.getPath());

    RequestConfig requestConfig = getRequestConfig();

    if (params != null)
      for (Map.Entry<String, String> entry : params.entrySet()) {
        uriBuilder.setParameter(entry.getKey(), entry.getValue());
      }
    HttpGet httpget = new HttpGet(uriBuilder.build());
    try {
      httpget.setConfig(requestConfig);
      System.out.println("executing request " + httpget.getURI());
      CloseableHttpResponse response = httpclient.execute(httpget);
      printResponse(response);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      // 关闭连接,释放资源
      try {
        httpclient.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    return null;
  }

  private static RequestConfig getRequestConfig() {
    return RequestConfig.custom()
            .setSocketTimeout(100)
            .setConnectTimeout(100)
            .setConnectionRequestTimeout(100)
            .build();
  }

  public static byte[] getBytes(String url, Map<String, String> params) throws URISyntaxException {
    // 创建默认的httpClient实例.
    CloseableHttpClient httpclient = HttpClients.createDefault();
    URI puri = new URI(url);
    // 创建httpget
    URIBuilder uriBuilder = new URIBuilder()
            .setScheme(puri.getScheme())
            .setHost(puri.getHost())
            .setPort(puri.getPort())
            .setPath(puri.getPath());

    RequestConfig requestConfig = getRequestConfig();

    if (params != null)
      for (Map.Entry<String, String> entry : params.entrySet()) {
        uriBuilder.setParameter(entry.getKey(), entry.getValue());
      }
    HttpGet httpget = new HttpGet(uriBuilder.build());
    try {
      httpget.setConfig(requestConfig);
      System.out.println("executing request " + httpget.getURI());
      CloseableHttpResponse response = httpclient.execute(httpget);
      return byteResponse(response);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      // 关闭连接,释放资源
      try {
        httpclient.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    return null;
  }

  public static String postString(String url, Map<String, String> params) {
    // 创建默认的httpClient实例.
    CloseableHttpClient httpclient = HttpClients.createDefault();
    // 创建httppost
    HttpPost httppost = new HttpPost(url);

    // 创建参数队列
    List<BasicNameValuePair> formparams = new ArrayList<BasicNameValuePair>();
    for (Map.Entry<String, String> entry : params.entrySet()) {
      formparams.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
    }
    UrlEncodedFormEntity uefEntity;

    RequestConfig requestConfig = getRequestConfig();

    try {
      uefEntity = new UrlEncodedFormEntity(formparams, DEFAULT_ENCODING);
      httppost.setEntity(uefEntity);
      httppost.setConfig(requestConfig);
      System.out.println("executing request " + httppost.getURI());
      CloseableHttpResponse response = httpclient.execute(httppost);
      String responseString = printResponse(response);
      return responseString;
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      // 关闭连接,释放资源
      try {
        httpclient.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    return null;
  }

  private static byte[] byteResponse(CloseableHttpResponse response) throws IOException {
    try {
      org.apache.http.HttpEntity entity = response.getEntity();
      if (entity != null) {
        byte[] responsebyte = EntityUtils.toByteArray(entity);
        System.out.println("--------------------------------------");
        System.out.println("Response content: " + responsebyte);
        System.out.println("--------------------------------------");
        return responsebyte;
      }
    } finally {
      response.close();
    }
    return null;
  }

  private static String printResponse(CloseableHttpResponse response) throws IOException {
    try {
      org.apache.http.HttpEntity entity = response.getEntity();
      if (entity != null) {
        String responseString = EntityUtils.toString(entity, DEFAULT_ENCODING);
        System.out.println("--------------------------------------");
        System.out.println("Response content: " + responseString);
        System.out.println("--------------------------------------");
        return responseString;
      }
    } finally {
      response.close();
    }
    return null;
  }
}


text:
using System;
using Chinchilla.Sample.Workflow.Messages;

namespace Chinchilla.Sample.Workflow.Processor
{
    public class ProcessorService
    {
        private readonly IBus bus;

        private ISubscription subscriber;

        private IPublisher<ProcessingJobUpdatedMessage> publisher;

        public ProcessorService()
        {
            bus = Depot.Connect("localhost/workflow");
        }

        public void Start()
        {
            publisher = bus.CreatePublisher<ProcessingJobUpdatedMessage>();

            subscriber = bus.Subscribe<MoveToNextWorkflowStateMessage>(m =>
            {
                Console.WriteLine("[Processor] Processing {0}", m.JobId);
                ProcessJob(m.JobId);
            });
        }

        private void ProcessJob(string jobId)
        {
            publisher.Publish(new ProcessingJobUpdatedMessage
            {
                ProcessingJobId = jobId,
                WorkflowState = "Completed",
                LogMessage = "The job was successfully completed, hooray!"
            });
        }

        public void Stop()
        {
            publisher.Dispose();
            subscriber.Dispose();
            bus.Dispose();
        }
    }
}


text:
package de.jcup.egradle.codeassist.dsl;

public interface ModifiableProperty extends Property {

    public void setType(Type returnType);

    public void setParent(Type parentType);

    public void setDocumented(boolean partOfGradleDSLDocumentation);

    public void setDescription(String description);
}


text:
namespace CodeBuilder.WinForm
{
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param typeName="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated displayName

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the displayName editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
            this.splitContainer = new System.Windows.Forms.SplitContainer();
            this.treeView = new System.Windows.Forms.TreeView();
            this.treeViewContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.exportPDMCtxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.exportDataSourceCtxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.ctxSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.clearCtxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.treeNodeImageList = new System.Windows.Forms.ImageList(this.components);
            this.resultGbx = new System.Windows.Forms.GroupBox();
            this.errorFileCountLbl = new System.Windows.Forms.Label();
            this.errorFilesLbl = new System.Windows.Forms.Label();
            this.genFileCountLbl = new System.Windows.Forms.Label();
            this.genFilesLbl = new System.Windows.Forms.Label();
            this.completedLbl = new System.Windows.Forms.Label();
            this.totalFileCountLbl = new System.Windows.Forms.Label();
            this.totalFilesLbl = new System.Windows.Forms.Label();
            this.currentGenFileNameLbl = new System.Windows.Forms.Label();
            this.currentGenFileLbl = new System.Windows.Forms.Label();
            this.genProgressBar = new System.Windows.Forms.ProgressBar();
            this.genItemsGbx = new System.Windows.Forms.GroupBox();
            this.genSettingsCtxMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.openGenSettingsCtxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.saveGenSettingCtxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.genSettingsCtxSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.generateCtxMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.templateListBox = new System.Windows.Forms.ListBox();
            this.databaseNameLbl = new System.Windows.Forms.Label();
            this.databaseLbl = new System.Windows.Forms.Label();
            this.templateEngineCombox = new System.Windows.Forms.ComboBox();
            this.templateEngineLbl = new System.Windows.Forms.Label();
            this.isStandardizeNameChkbox = new System.Windows.Forms.CheckBox();
            this.isOmitTablePrefixChkbox = new System.Windows.Forms.CheckBox();
            this.codeFileEncodingCombox = new System.Windows.Forms.ComboBox();
            this.codeFileEncodingLbl = new System.Windows.Forms.Label();
            this.languageCombx = new System.Windows.Forms.ComboBox();
            this.languageLbl = new System.Windows.Forms.Label();
            this.templateLbl = new System.Windows.Forms.Label();
            this.versionTxtBox = new System.Windows.Forms.TextBox();
            this.versionLbl = new System.Windows.Forms.Label();
            this.authorTxtBox = new System.Windows.Forms.TextBox();
            this.authorLbl = new System.Windows.Forms.Label();
            this.tablePrefixTxtBox = new System.Windows.Forms.TextBox();
            this.tablePrefixLbl = new System.Windows.Forms.Label();
            this.packageTxtBox = new System.Windows.Forms.TextBox();
            this.packageLabel = new System.Windows.Forms.Label();
            this.saveSettingsBtn = new System.Windows.Forms.Button();
            this.generateBtn = new System.Windows.Forms.Button();
            this.mainMenuStrip = new System.Windows.Forms.MenuStrip();
            this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
            this.fileExportPdmMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.fileExportDataSourceMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.fileSeparator2MenuItem = new System.Windows.Forms.ToolStripSeparator();
            this.fileOpenMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.fileSaveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.fileSeparator1MenuItem = new System.Windows.Forms.ToolStripSeparator();
            this.fileExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolsMenu = new System.Windows.Forms.ToolStripMenuItem();
            this.toolsDSConfigMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolsTemplatesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolsSeparator1MenuItem = new System.Windows.Forms.ToolStripSeparator();
            this.toolsOptionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpMenu = new System.Windows.Forms.ToolStripMenuItem();
            this.helpF1MenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpFeedbackMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpSeparator1MenuItem = new System.Windows.Forms.ToolStripSeparator();
            this.helpAboutMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.mainStatusStrip = new System.Windows.Forms.StatusStrip();
            this.statusBarReady = new System.Windows.Forms.ToolStripStatusLabel();
            this.statusBarDatabase = new System.Windows.Forms.ToolStripStatusLabel();
            this.statusBarLanguage = new System.Windows.Forms.ToolStripStatusLabel();
            this.statusBarEncoding = new System.Windows.Forms.ToolStripStatusLabel();
            this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
            this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            this.toolTip = new System.Windows.Forms.ToolTip(this.components);
            this.codeGeneration = new CodeBuilder.WinForm.UI.CodeGeneration(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
            this.splitContainer.Panel1.SuspendLayout();
            this.splitContainer.Panel2.SuspendLayout();
            this.splitContainer.SuspendLayout();
            this.treeViewContextMenu.SuspendLayout();
            this.resultGbx.SuspendLayout();
            this.genItemsGbx.SuspendLayout();
            this.genSettingsCtxMenuStrip.SuspendLayout();
            this.mainMenuStrip.SuspendLayout();
            this.mainStatusStrip.SuspendLayout();
            this.SuspendLayout();
            //
            // splitContainer
            //
            resources.ApplyResources(this.splitContainer, "splitContainer");
            this.splitContainer.Name = "splitContainer";
            //
            // splitContainer.Panel1
            //
            this.splitContainer.Panel1.Controls.Add(this.treeView);
            resources.ApplyResources(this.splitContainer.Panel1, "splitContainer.Panel1");
            //
            // splitContainer.Panel2
            //
            this.splitContainer.Panel2.Controls.Add(this.resultGbx);
            this.splitContainer.Panel2.Controls.Add(this.genItemsGbx);
            resources.ApplyResources(this.splitContainer.Panel2, "splitContainer.Panel2");
            //
            // treeView
            //
            this.treeView.CheckBoxes = true;
            this.treeView.ContextMenuStrip = this.treeViewContextMenu;
            resources.ApplyResources(this.treeView, "treeView");
            this.treeView.ImageList = this.treeNodeImageList;
            this.treeView.Name = "treeView";
            this.treeView.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterCheck);
            this.treeView.AfterCollapse += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterCollapse);
            this.treeView.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterExpand);
            this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
            //
            // treeViewContextMenu
            //
            this.treeViewContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.exportPDMCtxMenuItem,
            this.exportDataSourceCtxMenuItem,
            this.ctxSeparator2,
            this.clearCtxMenuItem});
            this.treeViewContextMenu.Name = "treeViewContextMenu";
            resources.ApplyResources(this.treeViewContextMenu, "treeViewContextMenu");
            //
            // exportPDMCtxMenuItem
            //
            this.exportPDMCtxMenuItem.Name = "exportPDMCtxMenuItem";
            resources.ApplyResources(this.exportPDMCtxMenuItem, "exportPDMCtxMenuItem");
            this.exportPDMCtxMenuItem.Click += new System.EventHandler(this.exportPDMCtxMenuItem_Click);
            //
            // exportDataSourceCtxMenuItem
            //
            this.exportDataSourceCtxMenuItem.Name = "exportDataSourceCtxMenuItem";
            resources.ApplyResources(this.exportDataSourceCtxMenuItem, "exportDataSourceCtxMenuItem");
            this.exportDataSourceCtxMenuItem.MouseHover += new System.EventHandler(this.exportDataSourceCtxMenuItem_MouseHover);
            //
            // ctxSeparator2
            //
            this.ctxSeparator2.Name = "ctxSeparator2";
            resources.ApplyResources(this.ctxSeparator2, "ctxSeparator2");
            //
            // clearCtxMenuItem
            //
            resources.ApplyResources(this.clearCtxMenuItem, "clearCtxMenuItem");
            this.clearCtxMenuItem.Name = "clearCtxMenuItem";
            this.clearCtxMenuItem.Click += new System.EventHandler(this.clearCtxMenuItem_Click);
            //
            // treeNodeImageList
            //
            this.treeNodeImageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("treeNodeImageList.ImageStream")));
            this.treeNodeImageList.TransparentColor = System.Drawing.Color.Transparent;
            this.treeNodeImageList.Images.SetKeyName(0, "folderClosed.gif");
            this.treeNodeImageList.Images.SetKeyName(1, "folderOpen.gif");
            this.treeNodeImageList.Images.SetKeyName(2, "leaf.gif");
            //
            // resultGbx
            //
            resources.ApplyResources(this.resultGbx, "resultGbx");
            this.resultGbx.Controls.Add(this.errorFileCountLbl);
            this.resultGbx.Controls.Add(this.errorFilesLbl);
            this.resultGbx.Controls.Add(this.genFileCountLbl);
            this.resultGbx.Controls.Add(this.genFilesLbl);
            this.resultGbx.Controls.Add(this.completedLbl);
            this.resultGbx.Controls.Add(this.totalFileCountLbl);
            this.resultGbx.Controls.Add(this.totalFilesLbl);
            this.resultGbx.Controls.Add(this.currentGenFileNameLbl);
            this.resultGbx.Controls.Add(this.currentGenFileLbl);
            this.resultGbx.Controls.Add(this.genProgressBar);
            this.resultGbx.Name = "resultGbx";
            this.resultGbx.TabStop = false;
            //
            // errorFileCountLbl
            //
            resources.ApplyResources(this.errorFileCountLbl, "errorFileCountLbl");
            this.errorFileCountLbl.Name = "errorFileCountLbl";
            //
            // errorFilesLbl
            //
            resources.ApplyResources(this.errorFilesLbl, "errorFilesLbl");
            this.errorFilesLbl.Name = "errorFilesLbl";
            //
            // genFileCountLbl
            //
            resources.ApplyResources(this.genFileCountLbl, "genFileCountLbl");
            this.genFileCountLbl.Name = "genFileCountLbl";
            //
            // genFilesLbl
            //
            resources.ApplyResources(this.genFilesLbl, "genFilesLbl");
            this.genFilesLbl.Name = "genFilesLbl";
            //
            // completedLbl
            //
            resources.ApplyResources(this.completedLbl, "completedLbl");
            this.completedLbl.Name = "completedLbl";
            //
            // totalFileCountLbl
            //
            resources.ApplyResources(this.totalFileCountLbl, "totalFileCountLbl");
            this.totalFileCountLbl.Name = "totalFileCountLbl";
            //
            // totalFilesLbl
            //
            resources.ApplyResources(this.totalFilesLbl, "totalFilesLbl");
            this.totalFilesLbl.Name = "totalFilesLbl";
            //
            // currentGenFileNameLbl
            //
            resources.ApplyResources(this.currentGenFileNameLbl, "currentGenFileNameLbl");
            this.currentGenFileNameLbl.Cursor = System.Windows.Forms.Cursors.Default;
            this.currentGenFileNameLbl.Name = "currentGenFileNameLbl";
            this.currentGenFileNameLbl.Click += new System.EventHandler(this.currentGenFileNameLbl_Click);
            //
            // currentGenFileLbl
            //
            resources.ApplyResources(this.currentGenFileLbl, "currentGenFileLbl");
            this.currentGenFileLbl.Name = "currentGenFileLbl";
            //
            // genProgressBar
            //
            resources.ApplyResources(this.genProgressBar, "genProgressBar");
            this.genProgressBar.Name = "genProgressBar";
            //
            // genItemsGbx
            //
            resources.ApplyResources(this.genItemsGbx, "genItemsGbx");
            this.genItemsGbx.ContextMenuStrip = this.genSettingsCtxMenuStrip;
            this.genItemsGbx.Controls.Add(this.templateListBox);
            this.genItemsGbx.Controls.Add(this.databaseNameLbl);
            this.genItemsGbx.Controls.Add(this.databaseLbl);
            this.genItemsGbx.Controls.Add(this.templateEngineCombox);
            this.genItemsGbx.Controls.Add(this.templateEngineLbl);
            this.genItemsGbx.Controls.Add(this.isStandardizeNameChkbox);
            this.genItemsGbx.Controls.Add(this.isOmitTablePrefixChkbox);
            this.genItemsGbx.Controls.Add(this.codeFileEncodingCombox);
            this.genItemsGbx.Controls.Add(this.codeFileEncodingLbl);
            this.genItemsGbx.Controls.Add(this.languageCombx);
            this.genItemsGbx.Controls.Add(this.languageLbl);
            this.genItemsGbx.Controls.Add(this.templateLbl);
            this.genItemsGbx.Controls.Add(this.versionTxtBox);
            this.genItemsGbx.Controls.Add(this.versionLbl);
            this.genItemsGbx.Controls.Add(this.authorTxtBox);
            this.genItemsGbx.Controls.Add(this.authorLbl);
            this.genItemsGbx.Controls.Add(this.tablePrefixTxtBox);
            this.genItemsGbx.Controls.Add(this.tablePrefixLbl);
            this.genItemsGbx.Controls.Add(this.packageTxtBox);
            this.genItemsGbx.Controls.Add(this.packageLabel);
            this.genItemsGbx.Controls.Add(this.saveSettingsBtn);
            this.genItemsGbx.Controls.Add(this.generateBtn);
            this.genItemsGbx.Name = "genItemsGbx";
            this.genItemsGbx.TabStop = false;
            //
            // genSettingsCtxMenuStrip
            //
            this.genSettingsCtxMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.openGenSettingsCtxMenuItem,
            this.saveGenSettingCtxMenuItem,
            this.genSettingsCtxSeparator1,
            this.generateCtxMenuItem});
            this.genSettingsCtxMenuStrip.Name = "genSettingsCtxMenuStrip";
            resources.ApplyResources(this.genSettingsCtxMenuStrip, "genSettingsCtxMenuStrip");
            //
            // openGenSettingsCtxMenuItem
            //
            this.openGenSettingsCtxMenuItem.Name = "openGenSettingsCtxMenuItem";
            resources.ApplyResources(this.openGenSettingsCtxMenuItem, "openGenSettingsCtxMenuItem");
            this.openGenSettingsCtxMenuItem.Click += new System.EventHandler(this.openGenSettingsCtxMenuItem_Click);
            //
            // saveGenSettingCtxMenuItem
            //
            this.saveGenSettingCtxMenuItem.Name = "saveGenSettingCtxMenuItem";
            resources.ApplyResources(this.saveGenSettingCtxMenuItem, "saveGenSettingCtxMenuItem");
            this.saveGenSettingCtxMenuItem.Click += new System.EventHandler(this.saveGenSettingCtxMenuItem_Click);
            //
            // genSettingsCtxSeparator1
            //
            this.genSettingsCtxSeparator1.Name = "genSettingsCtxSeparator1";
            resources.ApplyResources(this.genSettingsCtxSeparator1, "genSettingsCtxSeparator1");
            //
            // generateCtxMenuItem
            //
            this.generateCtxMenuItem.Name = "generateCtxMenuItem";
            resources.ApplyResources(this.generateCtxMenuItem, "generateCtxMenuItem");
            this.generateCtxMenuItem.Click += new System.EventHandler(this.generateCtxMenuItem_Click);
            //
            // templateListBox
            //
            resources.ApplyResources(this.templateListBox, "templateListBox");
            this.templateListBox.FormattingEnabled = true;
            this.templateListBox.Name = "templateListBox";
            this.templateListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
            //
            // databaseNameLbl
            //
            resources.ApplyResources(this.databaseNameLbl, "databaseNameLbl");
            this.databaseNameLbl.Name = "databaseNameLbl";
            //
            // databaseLbl
            //
            resources.ApplyResources(this.databaseLbl, "databaseLbl");
            this.databaseLbl.Name = "databaseLbl";
            //
            // templateEngineCombox
            //
            this.templateEngineCombox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.templateEngineCombox.FormattingEnabled = true;
            resources.ApplyResources(this.templateEngineCombox, "templateEngineCombox");
            this.templateEngineCombox.Name = "templateEngineCombox";
            this.templateEngineCombox.SelectedIndexChanged += new System.EventHandler(this.templateEngineCombox_SelectedIndexChanged);
            //
            // templateEngineLbl
            //
            resources.ApplyResources(this.templateEngineLbl, "templateEngineLbl");
            this.templateEngineLbl.Name = "templateEngineLbl";
            //
            // isStandardizeNameChkbox
            //
            resources.ApplyResources(this.isStandardizeNameChkbox, "isStandardizeNameChkbox");
            this.isStandardizeNameChkbox.Name = "isStandardizeNameChkbox";
            this.isStandardizeNameChkbox.UseVisualStyleBackColor = true;
            //
            // isOmitTablePrefixChkbox
            //
            resources.ApplyResources(this.isOmitTablePrefixChkbox, "isOmitTablePrefixChkbox");
            this.isOmitTablePrefixChkbox.Name = "isOmitTablePrefixChkbox";
            this.isOmitTablePrefixChkbox.UseVisualStyleBackColor = true;
            //
            // codeFileEncodingCombox
            //
            this.codeFileEncodingCombox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.codeFileEncodingCombox.FormattingEnabled = true;
            resources.ApplyResources(this.codeFileEncodingCombox, "codeFileEncodingCombox");
            this.codeFileEncodingCombox.Name = "codeFileEncodingCombox";
            this.codeFileEncodingCombox.SelectedIndexChanged += new System.EventHandler(this.codeFileEncodingCombox_SelectedIndexChanged);
            //
            // codeFileEncodingLbl
            //
            resources.ApplyResources(this.codeFileEncodingLbl, "codeFileEncodingLbl");
            this.codeFileEncodingLbl.Name = "codeFileEncodingLbl";
            //
            // languageCombx
            //
            resources.ApplyResources(this.languageCombx, "languageCombx");
            this.languageCombx.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.languageCombx.FormattingEnabled = true;
            this.languageCombx.Name = "languageCombx";
            this.languageCombx.SelectedIndexChanged += new System.EventHandler(this.languageCombx_SelectedIndexChanged);
            //
            // languageLbl
            //
            resources.ApplyResources(this.languageLbl, "languageLbl");
            this.languageLbl.Name = "languageLbl";
            //
            // templateLbl
            //
            resources.ApplyResources(this.templateLbl, "templateLbl");
            this.templateLbl.Name = "templateLbl";
            //
            // versionTxtBox
            //
            resources.ApplyResources(this.versionTxtBox, "versionTxtBox");
            this.versionTxtBox.Name = "versionTxtBox";
            //
            // versionLbl
            //
            resources.ApplyResources(this.versionLbl, "versionLbl");
            this.versionLbl.Name = "versionLbl";
            //
            // authorTxtBox
            //
            resources.ApplyResources(this.authorTxtBox, "authorTxtBox");
            this.authorTxtBox.Name = "authorTxtBox";
            //
            // authorLbl
            //
            resources.ApplyResources(this.authorLbl, "authorLbl");
            this.authorLbl.Name = "authorLbl";
            //
            // tablePrefixTxtBox
            //
            resources.ApplyResources(this.tablePrefixTxtBox, "tablePrefixTxtBox");
            this.tablePrefixTxtBox.Name = "tablePrefixTxtBox";
            //
            // tablePrefixLbl
            //
            resources.ApplyResources(this.tablePrefixLbl, "tablePrefixLbl");
            this.tablePrefixLbl.Name = "tablePrefixLbl";
            //
            // packageTxtBox
            //
            resources.ApplyResources(this.packageTxtBox, "packageTxtBox");
            this.packageTxtBox.Name = "packageTxtBox";
            //
            // packageLabel
            //
            resources.ApplyResources(this.packageLabel, "packageLabel");
            this.packageLabel.Name = "packageLabel";
            //
            // saveSettingsBtn
            //
            resources.ApplyResources(this.saveSettingsBtn, "saveSettingsBtn");
            this.saveSettingsBtn.Name = "saveSettingsBtn";
            this.saveSettingsBtn.UseVisualStyleBackColor = true;
            this.saveSettingsBtn.Click += new System.EventHandler(this.saveSettingsBtn_Click);
            //
            // generateBtn
            //
            resources.ApplyResources(this.generateBtn, "generateBtn");
            this.generateBtn.Name = "generateBtn";
            this.generateBtn.UseVisualStyleBackColor = true;
            this.generateBtn.Click += new System.EventHandler(this.generateBtn_Click);
            //
            // mainMenuStrip
            //
            this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileMenu,
            this.toolsMenu,
            this.helpMenu});
            resources.ApplyResources(this.mainMenuStrip, "mainMenuStrip");
            this.mainMenuStrip.Name = "mainMenuStrip";
            //
            // fileMenu
            //
            this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileExportPdmMenuItem,
            this.fileExportDataSourceMenuItem,
            this.fileSeparator2MenuItem,
            this.fileOpenMenuItem,
            this.fileSaveMenuItem,
            this.fileSeparator1MenuItem,
            this.fileExitMenuItem});
            this.fileMenu.Name = "fileMenu";
            resources.ApplyResources(this.fileMenu, "fileMenu");
            //
            // fileExportPdmMenuItem
            //
            this.fileExportPdmMenuItem.Name = "fileExportPdmMenuItem";
            resources.ApplyResources(this.fileExportPdmMenuItem, "fileExportPdmMenuItem");
            this.fileExportPdmMenuItem.Click += new System.EventHandler(this.fileExportPdmMenuItem_Click);
            //
            // fileExportDataSourceMenuItem
            //
            this.fileExportDataSourceMenuItem.Name = "fileExportDataSourceMenuItem";
            resources.ApplyResources(this.fileExportDataSourceMenuItem, "fileExportDataSourceMenuItem");
            this.fileExportDataSourceMenuItem.MouseHover += new System.EventHandler(this.fileExportDataSourceMenuItem_MouseHover);
            //
            // fileSeparator2MenuItem
            //
            this.fileSeparator2MenuItem.Name = "fileSeparator2MenuItem";
            resources.ApplyResources(this.fileSeparator2MenuItem, "fileSeparator2MenuItem");
            //
            // fileOpenMenuItem
            //
            this.fileOpenMenuItem.Name = "fileOpenMenuItem";
            resources.ApplyResources(this.fileOpenMenuItem, "fileOpenMenuItem");
            this.fileOpenMenuItem.Click += new System.EventHandler(this.fileOpenMenuItem_Click);
            //
            // fileSaveMenuItem
            //
            this.fileSaveMenuItem.Name = "fileSaveMenuItem";
            resources.ApplyResources(this.fileSaveMenuItem, "fileSaveMenuItem");
            this.fileSaveMenuItem.Click += new System.EventHandler(this.fileSaveMenuItem_Click);
            //
            // fileSeparator1MenuItem
            //
            this.fileSeparator1MenuItem.Name = "fileSeparator1MenuItem";
            resources.ApplyResources(this.fileSeparator1MenuItem, "fileSeparator1MenuItem");
            //
            // fileExitMenuItem
            //
            this.fileExitMenuItem.Name = "fileExitMenuItem";
            resources.ApplyResources(this.fileExitMenuItem, "fileExitMenuItem");
            this.fileExitMenuItem.Click += new System.EventHandler(this.fileExitMenuItem_Click);
            //
            // toolsMenu
            //
            this.toolsMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolsDSConfigMenuItem,
            this.toolsTemplatesMenuItem,
            this.toolsSeparator1MenuItem,
            this.toolsOptionsMenuItem});
            this.toolsMenu.Name = "toolsMenu";
            resources.ApplyResources(this.toolsMenu, "toolsMenu");
            //
            // toolsDSConfigMenuItem
            //
            this.toolsDSConfigMenuItem.Name = "toolsDSConfigMenuItem";
            resources.ApplyResources(this.toolsDSConfigMenuItem, "toolsDSConfigMenuItem");
            this.toolsDSConfigMenuItem.Click += new System.EventHandler(this.toolsDSConfigMenuItem_Click);
            //
            // toolsTemplatesMenuItem
            //
            this.toolsTemplatesMenuItem.Name = "toolsTemplatesMenuItem";
            resources.ApplyResources(this.toolsTemplatesMenuItem, "toolsTemplatesMenuItem");
            this.toolsTemplatesMenuItem.Click += new System.EventHandler(this.toolsTemplatesMenuItem_Click);
            //
            // toolsSeparator1MenuItem
            //
            this.toolsSeparator1MenuItem.Name = "toolsSeparator1MenuItem";
            resources.ApplyResources(this.toolsSeparator1MenuItem, "toolsSeparator1MenuItem");
            //
            // toolsOptionsMenuItem
            //
            this.toolsOptionsMenuItem.Name = "toolsOptionsMenuItem";
            resources.ApplyResources(this.toolsOptionsMenuItem, "toolsOptionsMenuItem");
            this.toolsOptionsMenuItem.Click += new System.EventHandler(this.toolsOptionsMenuItem_Click);
            //
            // helpMenu
            //
            this.helpMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.helpF1MenuItem,
            this.helpFeedbackMenuItem,
            this.helpSeparator1MenuItem,
            this.helpAboutMenuItem});
            this.helpMenu.Name = "helpMenu";
            resources.ApplyResources(this.helpMenu, "helpMenu");
            this.helpMenu.TextDirection = System.Windows.Forms.ToolStripTextDirection.Horizontal;
            //
            // helpF1MenuItem
            //
            this.helpF1MenuItem.Name = "helpF1MenuItem";
            resources.ApplyResources(this.helpF1MenuItem, "helpF1MenuItem");
            this.helpF1MenuItem.Click += new System.EventHandler(this.helpF1MenuItem_Click);
            //
            // helpFeedbackMenuItem
            //
            this.helpFeedbackMenuItem.Name = "helpFeedbackMenuItem";
            resources.ApplyResources(this.helpFeedbackMenuItem, "helpFeedbackMenuItem");
            this.helpFeedbackMenuItem.Click += new System.EventHandler(this.helpFeedbackMenuItem_Click);
            //
            // helpSeparator1MenuItem
            //
            this.helpSeparator1MenuItem.Name = "helpSeparator1MenuItem";
            resources.ApplyResources(this.helpSeparator1MenuItem, "helpSeparator1MenuItem");
            //
            // helpAboutMenuItem
            //
            this.helpAboutMenuItem.Name = "helpAboutMenuItem";
            resources.ApplyResources(this.helpAboutMenuItem, "helpAboutMenuItem");
            this.helpAboutMenuItem.Click += new System.EventHandler(this.helpAboutMenuItem_Click);
            //
            // mainStatusStrip
            //
            this.mainStatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.statusBarReady,
            this.statusBarDatabase,
            this.statusBarLanguage,
            this.statusBarEncoding});
            resources.ApplyResources(this.mainStatusStrip, "mainStatusStrip");
            this.mainStatusStrip.Name = "mainStatusStrip";
            //
            // statusBarReady
            //
            resources.ApplyResources(this.statusBarReady, "statusBarReady");
            this.statusBarReady.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
            this.statusBarReady.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
            this.statusBarReady.Name = "statusBarReady";
            this.statusBarReady.Spring = true;
            //
            // statusBarDatabase
            //
            resources.ApplyResources(this.statusBarDatabase, "statusBarDatabase");
            this.statusBarDatabase.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
            this.statusBarDatabase.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
            this.statusBarDatabase.Name = "statusBarDatabase";
            //
            // statusBarLanguage
            //
            resources.ApplyResources(this.statusBarLanguage, "statusBarLanguage");
            this.statusBarLanguage.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
            this.statusBarLanguage.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
            this.statusBarLanguage.Name = "statusBarLanguage";
            //
            // statusBarEncoding
            //
            resources.ApplyResources(this.statusBarEncoding, "statusBarEncoding");
            this.statusBarEncoding.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
            | System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
            this.statusBarEncoding.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
            this.statusBarEncoding.Margin = new System.Windows.Forms.Padding(0, 3, 0, 0);
            this.statusBarEncoding.Name = "statusBarEncoding";
            //
            // codeGeneration
            //
            this.codeGeneration.ProgressChanged += new CodeBuilder.WinForm.UI.GenerationProgressChangedEventHandler(this.codeGeneration_ProgressChanged);
            this.codeGeneration.Completed += new CodeBuilder.WinForm.UI.GenerationCompletedEventHandler(this.codeGeneration_Completed);
            //
            // MainForm
            //
            resources.ApplyResources(this, "$this");
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.splitContainer);
            this.Controls.Add(this.mainStatusStrip);
            this.Controls.Add(this.mainMenuStrip);
            this.MainMenuStrip = this.mainMenuStrip;
            this.Name = "MainForm";
            this.splitContainer.Panel1.ResumeLayout(false);
            this.splitContainer.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
            this.splitContainer.ResumeLayout(false);
            this.treeViewContextMenu.ResumeLayout(false);
            this.resultGbx.ResumeLayout(false);
            this.genItemsGbx.ResumeLayout(false);
            this.genItemsGbx.PerformLayout();
            this.genSettingsCtxMenuStrip.ResumeLayout(false);
            this.mainMenuStrip.ResumeLayout(false);
            this.mainMenuStrip.PerformLayout();
            this.mainStatusStrip.ResumeLayout(false);
            this.mainStatusStrip.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip mainMenuStrip;
        private System.Windows.Forms.ToolStripMenuItem toolsMenu;
        private System.Windows.Forms.ToolStripMenuItem toolsOptionsMenuItem;
        private System.Windows.Forms.ToolStripMenuItem helpMenu;
        private System.Windows.Forms.ToolStripMenuItem helpF1MenuItem;
        private System.Windows.Forms.ToolStripMenuItem helpAboutMenuItem;
        private System.Windows.Forms.StatusStrip mainStatusStrip;
        private System.Windows.Forms.ToolStripSeparator helpSeparator1MenuItem;
        private System.Windows.Forms.ToolStripMenuItem fileMenu;
        private System.Windows.Forms.ToolStripMenuItem fileExportPdmMenuItem;
        private System.Windows.Forms.ToolStripMenuItem fileExportDataSourceMenuItem;
        private System.Windows.Forms.ToolStripSeparator fileSeparator1MenuItem;
        private System.Windows.Forms.ToolStripMenuItem fileExitMenuItem;
        private System.Windows.Forms.ToolStripSeparator toolsSeparator1MenuItem;
        private System.Windows.Forms.ToolStripMenuItem toolsDSConfigMenuItem;
        private System.Windows.Forms.OpenFileDialog openFileDialog;
        private System.Windows.Forms.SplitContainer splitContainer;
        private System.Windows.Forms.TreeView treeView;
        private System.Windows.Forms.GroupBox genItemsGbx;
        private System.Windows.Forms.GroupBox resultGbx;
        private System.Windows.Forms.ToolStripMenuItem toolsTemplatesMenuItem;
        private System.Windows.Forms.ToolStripStatusLabel statusBarReady;
        private System.Windows.Forms.ToolStripStatusLabel statusBarDatabase;
        private System.Windows.Forms.ToolStripStatusLabel statusBarLanguage;
        private System.Windows.Forms.ToolStripStatusLabel statusBarEncoding;
        private System.Windows.Forms.ToolStripMenuItem fileOpenMenuItem;
        private System.Windows.Forms.ToolStripSeparator fileSeparator2MenuItem;
        private System.Windows.Forms.ImageList treeNodeImageList;
        private System.Windows.Forms.Button generateBtn;
        private System.Windows.Forms.ContextMenuStrip treeViewContextMenu;
        private System.Windows.Forms.ToolStripMenuItem exportPDMCtxMenuItem;
        private System.Windows.Forms.ToolStripMenuItem exportDataSourceCtxMenuItem;
        private System.Windows.Forms.ToolStripSeparator ctxSeparator2;
        private System.Windows.Forms.ToolStripMenuItem clearCtxMenuItem;
        private System.Windows.Forms.ContextMenuStrip genSettingsCtxMenuStrip;
        private System.Windows.Forms.ToolStripMenuItem openGenSettingsCtxMenuItem;
        private System.Windows.Forms.ToolStripMenuItem saveGenSettingCtxMenuItem;
        private System.Windows.Forms.SaveFileDialog saveFileDialog;
        private System.Windows.Forms.Button saveSettingsBtn;
        private System.Windows.Forms.ToolStripMenuItem fileSaveMenuItem;
        private System.Windows.Forms.ToolStripSeparator genSettingsCtxSeparator1;
        private System.Windows.Forms.ToolStripMenuItem generateCtxMenuItem;
        private System.Windows.Forms.TextBox packageTxtBox;
        private System.Windows.Forms.Label packageLabel;
        private System.Windows.Forms.TextBox versionTxtBox;
        private System.Windows.Forms.Label versionLbl;
        private System.Windows.Forms.TextBox authorTxtBox;
        private System.Windows.Forms.Label authorLbl;
        private System.Windows.Forms.TextBox tablePrefixTxtBox;
        private System.Windows.Forms.Label tablePrefixLbl;
        private System.Windows.Forms.Label templateLbl;
        private System.Windows.Forms.ComboBox codeFileEncodingCombox;
        private System.Windows.Forms.Label codeFileEncodingLbl;
        private System.Windows.Forms.ComboBox languageCombx;
        private System.Windows.Forms.Label languageLbl;
        private System.Windows.Forms.CheckBox isStandardizeNameChkbox;
        private System.Windows.Forms.CheckBox isOmitTablePrefixChkbox;
        private System.Windows.Forms.ProgressBar genProgressBar;
        private System.Windows.Forms.Label currentGenFileLbl;
        private System.Windows.Forms.Label completedLbl;
        private System.Windows.Forms.Label totalFileCountLbl;
        private System.Windows.Forms.Label totalFilesLbl;
        private System.Windows.Forms.Label currentGenFileNameLbl;
        private System.Windows.Forms.Label genFileCountLbl;
        private System.Windows.Forms.Label genFilesLbl;
        private System.Windows.Forms.Label errorFileCountLbl;
        private System.Windows.Forms.Label errorFilesLbl;
        private System.Windows.Forms.ComboBox templateEngineCombox;
        private System.Windows.Forms.Label templateEngineLbl;
        private System.Windows.Forms.Label databaseNameLbl;
        private System.Windows.Forms.Label databaseLbl;
        private System.Windows.Forms.ToolStripMenuItem helpFeedbackMenuItem;
        private System.Windows.Forms.ListBox templateListBox;
        private UI.CodeGeneration codeGeneration;
        private System.Windows.Forms.ToolTip toolTip;
    }
}


text:
namespace Cinema.Data.Models
{
    using System.ComponentModel.DataAnnotations;

    public class Ticket
    {
        public int Id { get; set; }

        [Range(typeof(decimal), "0.00", "79228162514264337593543950335")]
        public decimal Price { get; set; }

        [Required]
        public int CustomerId { get; set; }

        [Required]
        public Customer Customer { get; set; }

        [Required]
        public int ProjectionId { get; set; }

        [Required]
        public Projection Projection { get; set; }
    }
}


text:
extends: _layouts.post
section: content
title:  Industrial Soap Company
date: 2016-09-27
categories: [WordPress,WooCommerce]
cover_image: /assets/img/industrialsoap.png
thumbnail_image: /assets/img/industrialsoap-thumbnail.png
production_url: https://industrialsoap.com/
draft: false
built_at: "Matchbox Design Group"
---
The Industrial Soap Company site is an e-commerce site built with [WordPress](https://wordpress.org/) and [WooCommerce](https://woocommerce.com/). I was responsible for the majority of the store product and ordering functionality. Each customer on the site has access to different products at different prices defined in their contract. This required a large amount of WooCommerce customization to restrict access to certain products. Along with building a table of all available products. Where customers could order multiple products at a time. I built sync to keep the contract prices and products in sync. Along with an inventory, sync to keep the stock levels up to date.