text:
import logging
import numpy
import optparse
import random
import time

from libprotector_interface import KMS, CCN, User

class ComponentsExperiment(object):
    def __init__(self, filename, repetitions, keysize, nr_components):
        self.repetitions = repetitions
        self.keysize = keysize
        self.nr_components = nr_components

        k = KMS()
        k.initKMS(keysize)
        k.addUser()
        proxy_key = k.getProxyKey(0)
        user_key  = k.getClientKey(0)
        prime_q = k.getPrimeQ()

        self.user = User(keysize)
        self.user.setClientKey(user_key)
        self.user.setPrimeQ(prime_q)
        self.user.setNumberG("2")

        self.c = CCN(keysize)
        self.c.setProxyKey(proxy_key)
        self.c.setPrimeQ(prime_q)
        self.c.setNumberG("2")

        self.res = [0, 0]

        self.list_names = self.parse_file(filename)

    def parse_file(self, filename):
        data = file(filename).read().split('\n')

        l = []
        for d in data:

            components = d.split('/')
            for c in components:
                if c != '':
                    l.append(c)

        return l

    def run(self):
        for i in range(0, self.repetitions):
            n = self.generate_name(self.nr_components)
            self.test_name(n)
        self.res[0]/=self.repetitions
        self.res[1]/=self.repetitions

    def generate_name(self, nr_components, protector=False):
        return [random.choice(self.list_names) for i in range(0, nr_components)]

    def test_name(self, name):

        for component in name:
            start_time = time.time()
            name_td = self.user.userTD(component)
            end_time = time.time()

            self.res[0] += end_time-start_time

            start_time = time.time()
            ccn_name_td = self.c.CCNTD(name_td)
            end_time = time.time()

            self.res[1] += end_time-start_time

    def get_results(self):
        return self.res

if __name__ == '__main__':

    parser = optparse.OptionParser()
    parser.add_option("-t", "--trace_file",
                      dest="trace_filename",
                      default=None,
                      help="select the trace file")
    parser.add_option("-r", "--repetitions",
                      dest="repetitions",
                      type=int,
                      help="number of times to repeat the experiment"
    )
    parser.add_option("-c", "--components",
                      dest="nr_components",
                      type=int,
                      help="number of components to evaluate"
                      )
    parser.add_option("-k", "--keysize",
                      dest="keysize",
                      type=int,
                      help="security parameter, keysize"
    )
    parser.add_option("-d", "--debug",
                      dest="debug",
                      default=False,
                      action="store_true",
                      help=""
    )
    (options, args) = parser.parse_args()

    if options.debug:
        root = loaagging.getLogger()
        root.setLevel(logging.DEBUG)

    ce = ComponentsExperiment(options.trace_filename, options.repetitions, options.keysize, options.nr_components)
    ce.run()

    res = ce.get_results()

    print options.nr_components, res[0], res[1],

    #HOW TO RUN THIS EXPERIMENT:
    #for i in `seq 1 20`; do python components.py  --trace_file unibas-icn-names-2014-08-teaser.txt -r 1 -k 512 -c $i | xargs echo -n " "; python components.py  --trace_file unibas-icn-names-2014-08-teaser.txt -r 1 -k 1024 -c $i | xargs echo -n " "; echo -n " "; python components.py  --trace_file unibas-icn-names-2014-08-teaser.txt -r 1 -k 2048 -c $i; done


text:
/* Modernizr 2.7.1 (Custom Build) | MIT & BSD
 * Build: http://modernizr.com/download/#-audio-localstorage-inlinesvg-prefixed-testprop-testallprops-domprefixes-notification
 */
;

window.Modernizr = (function( window, document, undefined ) {

    var version = '2.7.1',

    Modernizr = {},

    docElement = document.documentElement,

    mod = 'modernizr',
    modElem = document.createElement(mod),
    mStyle = modElem.style,

    inputElem  ,

    toString = {}.toString,    omPrefixes = 'Webkit Moz O ms',

    cssomPrefixes = omPrefixes.split(' '),

    domPrefixes = omPrefixes.toLowerCase().split(' '),

    ns = {'svg': 'http://www.w3.org/2000/svg'},

    tests = {},
    inputs = {},
    attrs = {},

    classes = [],

    slice = classes.slice,

    featureName,

    _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;

    if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
      hasOwnProp = function (object, property) {
        return _hasOwnProperty.call(object, property);
      };
    }
    else {
      hasOwnProp = function (object, property) {
        return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
      };
    }

    if (!Function.prototype.bind) {
      Function.prototype.bind = function bind(that) {

        var target = this;

        if (typeof target != "function") {
            throw new TypeError();
        }

        var args = slice.call(arguments, 1),
            bound = function () {

            if (this instanceof bound) {

              var F = function(){};
              F.prototype = target.prototype;
              var self = new F();

              var result = target.apply(
                  self,
                  args.concat(slice.call(arguments))
              );
              if (Object(result) === result) {
                  return result;
              }
              return self;

            } else {

              return target.apply(
                  that,
                  args.concat(slice.call(arguments))
              );

            }

        };

        return bound;
      };
    }

    function setCss( str ) {
        mStyle.cssText = str;
    }

    function setCssAll( str1, str2 ) {
        return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
    }

    function is( obj, type ) {
        return typeof obj === type;
    }

    function contains( str, substr ) {
        return !!~('' + str).indexOf(substr);
    }

    function testProps( props, prefixed ) {
        for ( var i in props ) {
            var prop = props[i];
            if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
                return prefixed == 'pfx' ? prop : true;
            }
        }
        return false;
    }

    function testDOMProps( props, obj, elem ) {
        for ( var i in props ) {
            var item = obj[props[i]];
            if ( item !== undefined) {

                            if (elem === false) return props[i];

                            if (is(item, 'function') && 'bind' in item){
                                return item.bind(elem || obj);
                }

                            return item;
            }
        }
        return false;
    }

    function testPropsAll( prop, prefixed, elem ) {

        var ucProp  = prop.charAt(0).toUpperCase() + prop.slice(1),
            props   = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');

            if(is(prefixed, "string") || is(prefixed, "undefined")) {
          return testProps(props, prefixed);

            } else {
          props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
          return testDOMProps(props, prefixed, elem);
        }
    }
    tests['audio'] = function() {
        var elem = document.createElement('audio'),
            bool = false;

        try {
            if ( bool = !!elem.canPlayType ) {
                bool      = new Boolean(bool);
                bool.ogg  = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
                bool.mp3  = elem.canPlayType('audio/mpeg;')               .replace(/^no$/,'');

                                                    bool.wav  = elem.canPlayType('audio/wav; codecs="1"')     .replace(/^no$/,'');
                bool.m4a  = ( elem.canPlayType('audio/x-m4a;')            ||
                              elem.canPlayType('audio/aac;'))             .replace(/^no$/,'');
            }
        } catch(e) { }

        return bool;
    };

    tests['localstorage'] = function() {
        try {
            localStorage.setItem(mod, mod);
            localStorage.removeItem(mod);
            return true;
        } catch(e) {
            return false;
        }
    };

    tests['inlinesvg'] = function() {
      var div = document.createElement('div');
      div.innerHTML = '<svg/>';
      return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
    };    for ( var feature in tests ) {
        if ( hasOwnProp(tests, feature) ) {
                                    featureName  = feature.toLowerCase();
            Modernizr[featureName] = tests[feature]();

            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
        }
    }

     Modernizr.addTest = function ( feature, test ) {
       if ( typeof feature == 'object' ) {
         for ( var key in feature ) {
           if ( hasOwnProp( feature, key ) ) {
             Modernizr.addTest( key, feature[ key ] );
           }
         }
       } else {

         feature = feature.toLowerCase();

         if ( Modernizr[feature] !== undefined ) {
                                              return Modernizr;
         }

         test = typeof test == 'function' ? test() : test;

         if (typeof enableClasses !== "undefined" && enableClasses) {
           docElement.className += ' ' + (test ? '' : 'no-') + feature;
         }
         Modernizr[feature] = test;

       }

       return Modernizr;
     };

    setCss('');
    modElem = inputElem = null;

    Modernizr._version      = version;

    Modernizr._domPrefixes  = domPrefixes;
    Modernizr._cssomPrefixes  = cssomPrefixes;

    Modernizr.testProp      = function(prop){
        return testProps([prop]);
    };

    Modernizr.testAllProps  = testPropsAll;

    Modernizr.prefixed      = function(prop, obj, elem){
      if(!obj) {
        return testPropsAll(prop, 'pfx');
      } else {
            return testPropsAll(prop, obj, elem);
      }
    };

    return Modernizr;

})(this, this.document);

Modernizr.addTest('notification', !!Modernizr.prefixed('Notification', window));;

redpajama_set_name: RedPajamaGithub


text:
Made for PROCJAM 2015

[http://www.kchapelier.com/ode](http://www.kchapelier.com/ode)


text:
/*
http://www.cgsoso.com/forum-211-1.html

CG搜搜 Unity3d 每日Unity3d插件免费更新 更有VIP资源!

CGSOSO 主打游戏开发,影视设计等CG资源素材。

插件如若商用,请务必官网购买!

daily assets update for try.

U should buy the asset from home store if u use it in your project!
*/

namespace BestHTTP
{
    /// <summary>
    /// Possible states of a Http Connection.
    /// The ideal lifecycle of a connection that has KeepAlive is the following: Initial => [Processing => WaitForRecycle => Free] => Closed.
    /// </summary>
    internal enum HTTPConnectionStates
    {
        /// <summary>
        /// This Connection instance is just created.
        /// </summary>
        Initial,

        /// <summary>
        /// This Connection is processing a request
        /// </summary>
        Processing,

        /// <summary>
        /// The request redirected.
        /// </summary>
        Redirected,

        /// <summary>
        /// The connection is upgraded from http.
        /// </summary>
        Upgraded,

        /// <summary>
        /// Wait for the upgraded protocol to shut down.
        /// </summary>
        WaitForProtocolShutdown,

        /// <summary>
        /// The Connection is finished processing the request, it's waiting now to deliver it's result.
        /// </summary>
        WaitForRecycle,

        /// <summary>
        /// The request result's delivered, it's now up to processing again.
        /// </summary>
        Free,

        /// <summary>
        /// A request from outside of the plugin to abort the connection.
        /// </summary>
        AbortRequested,

        /// <summary>
        /// The request is not finished in the given time.
        /// </summary>
        TimedOut,

        /// <summary>
        /// If it's not a KeepAlive connection, or something happend, then we close this connection and remove from the pool.
        /// </summary>
        Closed
    }
}


text:
package tasks;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

class TaskSharedStuff {
    static final Executor defaultExecutor;

    static {
        defaultExecutor = Executors.newCachedThreadPool();
    }

}


text:
/* Commentary:
 *
 */

/* Change log:
 *
 */

#include <dtkLog/dtkLog.h>

#include <dtkCore/dtkCorePluginManager.h>

#include "dtkCreatorMainWindow.h"

#include <QtWidgets>

int main(int argc, char **argv)
{

#if defined (Q_OS_UNIX)
    // unset QT_PLUGIN_PATH, otherwise, kde plugins can change the qmetatype ids
    setenv("QT_PLUGIN_PATH", "", 1);
#endif
    QApplication application(argc, argv);
    application.setApplicationName("dtkCreator");
    application.setOrganizationName("inria");
    application.setOrganizationDomain("fr");
    application.setApplicationVersion("0.9.9");

    QSettings settings("inria", "dtk");
    settings.beginGroup("creator");

    if (settings.contains("log_level"))
        dtkLogger::instance().setLevel(settings.value("log_level").toString());
    else
        dtkLogger::instance().setLevel(dtkLog::Trace);

    dtkLogger::instance().attachFile(dtkLogPath(&application));

    // dtkCorePluginManager::instance()->initialize();

    dtkCreatorMainWindow mainwindow;
    mainwindow.show();
    mainwindow.raise();

    int status = application.exec();

    // dtkCorePluginManager::instance()->uninitialize();

    return status;
}


text:
<!DOCTYPE html>

<title>Brian Starke</title>
<link href="//netdna.bootstrapcdn.com/bootswatch/2.3.2/flatly/bootstrap.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/styles/main.css">

brianstarke

          Stuff I Built

Embedded Checkout

Cross Portal Search

Anti-Fraud Engine

Inventory Search

Dogfort

          Where I Built It

Stuff I Built in no particular order

Embedded Checkout Bread Finance

Merchants hate it when a service provider takes you away from their page to perform a transaction.  At Bread, we provided a straightforward API
to easily integrate any storefront experience with Bread Financing.  The button can look like our default button, but is completely customizable for those who preferred a whitelabeled solution.
screenshot

Go
ReactJS
PostgreSQL

Disaster Alerts in Google Search / Android Google

Cellular providers have been required by law to (finally) start pushing out timely public safety alerts to phones.  These alerts are usually in all caps and accompanied by an obscenely scary noise.  Using the data that the Public Alerts team is already ingesting, we wanted to supplant (or at least suppliment) these alerts with something less panic-inducing, and more information forward.  Our mission was to replace "FLOOD WARNING" with a map and detailed (decapitalized) information such as time, duration, depth, likelihood... all the stuff that matters when you need it most.

My particular contribution to this project was to take the alert text from sources like the National Weather Service and extract out the most relevant parts and recombine them to form a useful and informative snippet.  For example, on a Tornado warning I'd focus more on directional and temporal aspects rather than rainfall amounts.  This was done by tokenizing the text and weighting certain n-grams based on the alert type.  I also worked on the UI for both the Web, and Android.

These alerts were intended originally for only for Maps on the Android platform, but once demo'd we were asked to put them in Google Web Search, iOS Maps, and Google Now.

screenshot

Go
Python
C++
Javascript

Anti-Fraud Engine Bread Finance

Not only do fraudulent transactions cost the company money, but in many cases a failure to properly identify the individual to whom you are writing a loan to can cause some serious legal stickiness.
This fraud engine collected all sorts of data throughout the checkout process like IP Address, Device ID, Geolocation, and velocity.  In addition to that, we also ran verification checks on the addresses provided, the mobile number, and checked a ton of fraud databases.

All of these pieces of discrete data are collected throughout the process, and then just before you are able to complete a check out the fraud engine would generate signals out of all the data and run against a custom built rule set.  The decisioning is completely concurrent and as fast as it's slowest rule.  Given that most complicated rule can really only be a string comparison, we are able to evaluate over a thousand rules on a huge amount of data in under 200ms.  It was pretty sweet.

Go

Cross Portal Search Admeld

Between Users, Ad Network Accounts, Creatives, Orders and a whole other mess of other things... finding a particular
piece of information quickly was a trial for internal Admeld users.  Cross Portal Search (affectionately known as 'Corporal
Smurf' after a post-dentist talk with the CTO) was a data-type agnostic search engine to find whatever you
were looking for.

This search engine indexed all the important metadata about every piece of data in our system to allow quick recall
from virtually anything you wanted to search on.  This was built in Java using Lucene, although if Elasticsearch were
around at the time it would have made my job a lot easier.  This is a nice segway in to the next item...

Java
Lucene
MySQL

Inventory Search isocket

isocket's core mission is to make it easier for Publishers and Advertisers to find each other and do business directly.
Central to that goal is the ability to find inventory available on a particular site by virtually any number of vectors, such as comScore demographics, ad placement, price, IAB category... even weather - although no one has ever used that.

screenshot

Node.js
Javascript
Elasticsearch
Java
Thrift

Content Categorizer / Search Monitor110

As User Generated Content came on to the web, Monitor110 ingested content in to it's multi-stage processing service.
Using a homegrown Bayesian categorization engine, articles are tagged with relevant stock tickers or category.  Daily
re-training of the engine actually refined the queries such that after a period of time we would see articles
popping up in a topic that we had not put in a single training term for.

The best example of this was during the time of the first iPhone.  Rumors were circulating that Apple was releasing a
phone and the internet chatter had dubbed it the 'Jesus Phone'.  Within a few days, articles mentioning 'Jesus Phone' and no other Apple-esque terms started appearing in the APPL ticker.  We all ran away terrified as the now-sentient system threatened to blog mean things about us.

Java
Lucene
ActiveMQ
MySQL

RTB Analytics Admeld

Insight in to how a Publisher was making money off Admeld's RTB platform was essential to selling the concept of RTB, as
well as providing any shred of market intelligence to a typically black-boxed world.

The RTB Analytics platform leveraged our already existing (and ever growing) Hadoop-based data aggregation system.  By
slicing different types of data in to pivotable chunks, we were able to present clear and dynamic visualizations of how
a Publisher was making money.  (Screenshot hopefully coming).

Ruby
Sinatra
jQuery
Hadoop
Vertica
Javascript

Web Automation Admeld

Web Automation grew out of two essential needs :

Providing Publishers all the data they needed in one place.

Insight in to what the Ad Networks were doing to enable our Ad Servers to make more informed decisions.

We built a system that would log in to various ad network reporting systems (very few had APIs) and scrape out relevant
impression and payment data.  This data would be used alongside our own reporting information to uncover discrepancies.  As
an example :

We would request to serve an Ad from both Ad Network A and Ad Network B.  Ad Network A
would tell us they pay $1 per impression, while Ad Network B would report they only paid $0.90.  We would serve A.  After scraping numbers from their reporting system and comparing them against our own numbers, we would see that Ad Network A would underreport the impressions - either for nefarious reasons or just lack of technical sophistication.  We
would know that we served 100, but they would report 80.  This meant that we're getting paid only $80 for 100 impressions while
serving from Ad Network B (who reported more accurately) would have netted us $90.  The Ad Server would then work off
our own internally derived CPM and favor the true higher price.  Ad Network names have been removed to protect the innocent.

The system was built in a time before really cool stuff like Agouti existed, so we
rolled our own solution.  A service would fire up individually addressable instances of Firefox, which had ports open to allow us to
inject our own Javascript in to the page.  Every page the browser visited would then contain our own admeld.js which had methods we
could call from the main Java scraping service.  (i.e. pullTableColumns would exist as a Java method which then call the corresponding
Javascript function through the JSSH port).

With this framework now in place, I built a runner that would use Groovy scripts that were custom built for each reporting platform.  User
credentials were injected in, and the service would return simple JSON results from the scrape.  We were essentially API-afying a site
and normalizing their data to fit in to our system in a clear and IAB standards-compliant way.  It was easily one of our biggest wins,
and often cited as a key reason Google aquired Admeld.

Firefox
Java
Groovy
MySQL
Javascript

Bezerk and Smoosh Admeld

Why "map" when you can Bezerk?  Why "reduce" when you can Smoosh?  In order for Admeld's ad servers to make intelligent decisions,
we needed to know what they were doing.

Ad Server clusters in multiple co-locations dumped billions of lines of log data.  More often than not, a single request would
span multiple servers.  Small (local) Hadoop clusters would grab 15 minute increments of log data from all the servers, and then
combine these lines together in to a coherent RequestChain object which would represent only the relevant (non-duplicated) data points about that particular request.  These newly smooshed objects would then stream in to the central Hadoop cluster for some serious
crunching.  At any given time, we were no more than 15 minutes off real-time with our reporting.  This was huge, as most Publishers
were accostomed to only getting this data every few days, or sometimes even a whole month.  Combined with the Web Automation system,
we were able to have a complete view of what was going on in what was quickly becoming a very very large ecosystem.

Hadoop
Java
MySQL

Power Outage/Gas Supply Maps During Hurricane Sandy Google

During Hurricane Sandy, the NYC branch of the Google Crisis Response team had a rare opportunity to operate in an area where we were actively responding as well.  Since we were able to work closely with NYC Department of Emergency Management and the NYC Mayors office, we were able to get access to power outage data we normally were never allowed to use and plot it on our Crisis Map.

There was a more interesting data point we were able to capture as well.  There were a lot of software engineers who no longer had to go to work for the week and were forming up under IRC and Twitter as "Hurricane Hackers" to try to help out in any way they could.  I was able to engage that community and Google provided resources to help them, and they in turn were able to hack together a gas supply data set that I was then able to plot on the Crisis Map.  While probably not in any way the most difficult thing I've worked on, it's the only thing I've ever built that I saw on CNN while I was coding it.

screenshot

article

Go
Node.js
Javascript
Appengine

Magicbus isocket

Evented io / pubsub backend.  TODO: FILL ME IN

C++
Thrift
Java
Node.js
Javascript
RabbitMQ
Redis
Go

Firemeld / Firemeld for Chrome Admeld

extension

product page

Firefox
Chrome
Javascript
jQuery

Dogfort Side Project

Anti-social networking.  As my circle of eng friends from Admeld got thrown to the diaspora, we could no longer all communicate
via shared Skype session or on corporate GTalk.  Also, most chat platforms were pretty weak on showing images and video.  We tried
our own private sub-reddit, and a number of other things and finally Dogfort was born.  It had a few key essential features:

Invite Only

One-click image/video sharing from anywhere

Group chat

Abundant shaming for reposting an image

Built under cover of darkness, and usually while a little drunk - Dogfort has been through many iterations.  Direct contact with Dogfort users provide a clean and efficient feedback loop for incorporating new features.  Today's version has a voting system, comments, and a Chrome extension to allow for quick posting.  Built using AngularJS on the frontend and Node.js on the back, Dogfort
also gives me an awesome playground to try out new technologies before advocating for them in my paying gig.

screenshot

AngularJS
Javascript
Node.js
MongoDB
Heroku
Express
Firebase

This Resume Of Sorts Side Project

Not sure how it's going yet.

HTML
Bootstrap

Where I Built It in a rather particular order

Bread Finance
Principal Engineer / Architect / Quartermaster

New York NY Aug 2014 -> Present

Bread makes it easy to pay over time for the things you love.
link

iSocket (acquired by Rubicon Project)
Senior Software Engineer

Burlingame CA, New York NY Mar 2013 -> Aug 2014

iSocket simplifies the direct sales process. Their technology automates the manual steps like order execution and monitoring, helping premium publishers and advertisers do more business directly.

link

Google
Software Engineer V

Mountain View CA, New York NY Dec 2011 -> March 2013

Google.org Crisis Response Team

When disaster strikes, people turn to the internet for information. We help ensure the right information is there in these times of need by building tools to collect and share emergency information, and by supporting first responders in using technology to help improve and save lives.

link

screenshot

Google Public Alerts

Being prepared is just as important as knowing what to do in a crisis. Public Alerts provide a warning before disasters cause damage, so searching for "Hurricane info" in Miami when there is an alert for the East coast would trigger a Public Alert and give you time to prepare.

link

screenshot

Admeld (Acquired by Google)
Senior Software Engineer

New York NY Aug 2008 -> Dec 2011

Since 2008, Admeld has led the industry in helping premium publishers maximize their ad revenue and simplify their operations. Admeld pioneered the private ad exchange and built technology that made it easy for publishers to identify new opportunities and control how every impression is sold.

link

Monitor110
Lead Engineer

New York NY Mar 2005 -> Jul 2008

Monitor110 gathered information from over 130 million sources of various types, ranked by financial market knowledge through a proprietary algorithm that takes 50 factors into account. Users could choose between top sources preselected for their market sector and subscribe to sources of their own. Static sites can be monitored for changes with good granularity. Premium subscription and other deep web sources, blogs, forums, news and regulatory filings are among the sources included. The end results are delivered through proprietary RSS reader with email, IM and SMS alerts as appropriate.

article

post-mortem

screenshot

Nat'l Reading Styles Institute
Consultant, Software Engineer

New York NY Oct 2001 -> Mar 2005

NRSI is a research-based educational organization dedicated to improving literacy.

link (I swear I didn't build this terrible site)

SUSS MicroTec
Senior Software Engineer / Electrical Engineer

Ste Jeorie FRANCE, Vonnigen GERMANY, Waterbury VT Aug 2000 -> Oct 2001

SUSS MicroTec is a leading supplier of process equipment for microstructuring in the semiconductor industry and related markets. Their portfolio covers a comprehensive range of products and solutions for backend lithography, wafer bonding and photomask processing, complemented by micro-optical components.

link

International Business Machines
Software Engineer

Binghamton NY, Essex Junction VT Sep 1999 -> Oct 2001

IBM microelectronics delivers application-optimized semiconductor technologies designed to take performance, integration and power efficiency to the next level in solutions spanning mobile and wired, from consumer products to robots that do
really well on Jeopardy.

link


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>FIX, curated coffee components</title>

    <link href="reset.css" rel="stylesheet">
    <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,600" type="text/css" rel="stylesheet">
    <link href="main.css" rel="stylesheet">

          Fine Coffee Kits

          Browse Kits
          Browse Products

Hello Dreamforce 2015!

AeroPress Coffee Maker

$29.99

Add to Cart

MSR Reactor 2.5L Stove System

$159.99

Add to Cart

Bunum Wo AA, Papua New Guinea

$21.99

Add to Cart

Chemex Classic 6-cup Coffee Maker

$39.99

Add to Cart

Complete Brewing Kits

The Chemex Kit

$396.96

Add to Cart

The Pour Over Kit

$171.96

Add to Cart

The Camper's Kit

$272.95

Add to Cart

The French Press Kit

$219.94

Add to Cart

The Cold Brew Kit

$133.96

Add to Cart

        Fine Coffee Kits

About

Support

Contact Us

            Follow on
            Twitter

            Like Us on
            Facebook

            Follow on
            Instagram


text:
using namespace DVGui;

//***********************************************************************************
//    Local namespace stuff
//***********************************************************************************

namespace {

struct BusyCursorOverride {
  BusyCursorOverride() { QApplication::setOverrideCursor(Qt::WaitCursor); }
  ~BusyCursorOverride() { QApplication::restoreOverrideCursor(); }
};

//---------------------------------------------------------------------------

struct ExportOverwriteCB : public IoCmd::OverwriteCallbacks {
  bool overwriteRequest(const TFilePath &fp) {
    int ret = DVGui::MsgBox(
        QObject::tr("Warning: file %1 already exists.").arg(toQString(fp)),
        QObject::tr("Continue Exporting"), QObject::tr("Stop Exporting"), 1);
    return (ret == 1);
  }
};

//---------------------------------------------------------------------------

struct ExportProgressCB : public IoCmd::ProgressCallbacks {
  QString m_processedName;
  ProgressDialog m_pb;

public:
  ExportProgressCB() : m_pb("", QObject::tr("Cancel"), 0, 0) { m_pb.show(); }
  static QString msg() {
    return QObject::tr("Exporting level of %1 frames in %2");
  }

  void setProcessedName(const QString &name) { m_processedName = name; }
  void setRange(int min, int max) {
    m_pb.setMaximum(max);
    buildString();
  }
  void setValue(int val) { m_pb.setValue(val); }
  bool canceled() const { return m_pb.wasCanceled(); }
  void buildString() {
    m_pb.setLabelText(
        msg().arg(QString::number(m_pb.maximum())).arg(m_processedName));
  }
};

}  // namespace

//***********************************************************************************
//    Special image processing
//***********************************************************************************

namespace {

struct VectorThicknessTransformer {
  const TVectorImageP &m_vi;

  VectorThicknessTransformer(const TVectorImageP &vi,
                             double thickTransform[2][2], double param)
      : m_vi(vi), m_mutexLocker(vi->getMutex()) {
    // Build thickness transform
    assert(0.0 <= param && param <= 1.0);

    double thickPoly[2] = {tcg::numeric_ops::lerp(thickTransform[0][0],
                                                  thickTransform[1][0], param),
                           tcg::numeric_ops::lerp(thickTransform[0][1],
                                                  thickTransform[1][1], param)};

    if (thickPoly[0] == 0.0 && thickPoly[1] == 1.0) return;

    // Iterate each stroke
    UINT s, sCount = m_vi->getStrokeCount();
    for (s = 0; s != sCount; ++s) {
      TStroke *stroke = m_vi->getStroke(s);

      // Discriminate completely thin strokes
      if (stroke->getMaxThickness() > 0.0) {
        // Backup and alter the thickness of each control point
        m_thicknessesBackup.push_back(StrokeThicknesses(s));
        StrokeThicknesses &thickBackup = m_thicknessesBackup.back();

        int cp, cpCount = stroke->getControlPointCount();
        for (cp = 0; cp != cpCount; ++cp) {
          TThickPoint point = stroke->getControlPoint(cp);

          thickBackup.m_thicknesses.push_back(point.thick);

          point.thick =
              std::max(tcg::poly_ops::evaluate(thickPoly, 1, point.thick), 0.0);

          stroke->setControlPoint(cp, point);
        }
      }
    }
  }

  ~VectorThicknessTransformer() {
    // Iterate altered strokes
    std::deque<StrokeThicknesses>::const_iterator tbt,
        tbEnd = m_thicknessesBackup.end();

    for (tbt = m_thicknessesBackup.begin(); tbt != tbEnd; ++tbt) {
      TStroke *stroke = m_vi->getStroke(tbt->m_strokeIdx);

      assert(stroke->getControlPointCount() == tbt->m_thicknesses.size());

      // Restore each altered control point
      int cp, cpCount = stroke->getControlPointCount();
      std::vector<double>::const_iterator tt = tbt->m_thicknesses.begin();

      for (cp = 0; cp != cpCount; ++cp, ++tt) {
        TThickPoint point = stroke->getControlPoint(cp);
        point.thick       = *tt;

        stroke->setControlPoint(cp, point);
      }
    }
  }

private:
  struct StrokeThicknesses {
    int m_strokeIdx;
    std::vector<double> m_thicknesses;

  public:
    StrokeThicknesses(int strokeIdx) : m_strokeIdx(strokeIdx) {}
  };

private:
  std::deque<StrokeThicknesses> m_thicknessesBackup;
  QMutexLocker m_mutexLocker;
};

//---------------------------------------------------------------------------

inline void flattenTones(const TRasterCM32P &cmout, const TRasterCM32P &cmin) {
  int lx = cmin->getLx(), ly = cmin->getLy();
  int wrapin = cmin->getWrap(), wrapout = cmout->getWrap();

  assert(lx == cmout->getLx() && ly == cmout->getLy());

  TPixelCM32 *pixIn, *lineIn, *lineEnd;
  TPixelCM32 *pixOut, *lineOut;

  for (int y = 0; y < ly; ++y) {
    lineIn = cmin->pixels(y), lineOut = cmout->pixels(y);
    lineEnd = lineIn + lx;
    for (pixIn = lineIn, pixOut = lineOut; pixIn < lineEnd; ++pixIn, ++pixOut)
      *pixOut = *pixIn, pixOut->setTone(pixOut->getTone() < 128 ? 0 : 255);
  }
}

}  // namespace

//***********************************************************************************
//    ImageExporter  definition
//***********************************************************************************

namespace {
using namespace IoCmd;

class ImageExporter {
  const TXshSimpleLevel &m_sl;
  ExportLevelOptions m_opts;

  TRasterP m_rout;
  std::auto_ptr<TOfflineGL> m_glContext;

public:
  ImageExporter(const TXshSimpleLevel &sl, const ExportLevelOptions &opts)
      : m_sl(sl), m_opts(opts) {}

  TImageP exportedImage(const TFrameId &fid, TXshLevelType outImgType);

private:
  void adjust0Dpi(const TRasterImageP &ri);

  TRasterImageP exportedImage(TRasterImageP ri);
  TRasterImageP exportedImage(TToonzImageP ti);
  TRasterImageP exportedRasterImage(TVectorImageP vi);
  TToonzImageP exportedToonzImage(TVectorImageP vi);
};

//===========================================================================

void ImageExporter::adjust0Dpi(const TRasterImageP &ri) {
  double dpix, dpiy;
  ri->getDpi(dpix, dpiy);

  if (dpix == 0 && dpiy == 0) {
    dpix = dpiy = Preferences::instance()->getDefLevelDpi();
    ri->setDpi(dpix, dpiy);
  }
}

//---------------------------------------------------------------------------

TRasterImageP ImageExporter::exportedImage(TRasterImageP ri) {
  assert(ri);

  adjust0Dpi(ri);

  if (m_opts.m_bgColor != TPixel::Transparent) {
    ri = (TRasterImageP)ri->cloneImage();
    TRop::addBackground(ri->getRaster(), m_opts.m_bgColor);
  }

  return ri;
}

//---------------------------------------------------------------------------

TRasterImageP ImageExporter::exportedImage(TToonzImageP ti) {
  // Allocate a suitable fullcolor raster if not already done
  if (!m_rout || m_rout->getSize() != ti->getRaster()->getSize())
    m_rout = TRaster32P(ti->getRaster()->getSize());

  // Remove antialias if required
  TRasterCM32P cm(ti->getRaster());
  if (m_opts.m_noAntialias) {
    // Copy output to rout's buffer for convenience
    cm = TRasterCM32P(m_rout->getLx(), m_rout->getLy(), m_rout->getWrap(),
                      (TPixelCM32 *)m_rout->getRawData());

    flattenTones(cm, ti->getRaster());
  }

  // Convert the frame's colormap to fullcolor
  {
    TTile srcTile(cm), dstTile(m_rout);
    TRop::convert(dstTile, srcTile,
                  ti->getPalette(),  // May be an in-place conversion, if
                  false, true);      // antialias was removed
  }

  // Fallback on fullcolor case
  TRasterImageP ri(m_rout);

  double dpix, dpiy;
  ti->getDpi(dpix, dpiy);
  ri->setDpi(dpix, dpiy);

  return exportedImage(TRasterImageP(m_rout));
}

//---------------------------------------------------------------------------

TRasterImageP ImageExporter::exportedRasterImage(TVectorImageP vi) {
  const TCamera &camera = m_opts.m_camera;

  TVectorRenderData rd(TVectorRenderData::ProductionSettings(),
                       camera.getStageToCameraRef(), TRect(), vi->getPalette());
  rd.m_antiAliasing = !m_opts.m_noAntialias;

  if (!m_glContext.get()) m_glContext.reset(new TOfflineGL(camera.getRes()));

  // Render the vector image to fullcolor raster
  TRasterImageP ri;
  {
    m_glContext->clear(m_opts.m_bgColor);
    m_glContext->draw(vi, rd);

    ri = TRasterImageP(m_glContext->getRaster());

    const TPointD &dpi = camera.getDpi();
    ri->setDpi(dpi.x, dpi.y);
  }

  return ri;
}

//---------------------------------------------------------------------------

TToonzImageP ImageExporter::exportedToonzImage(TVectorImageP vi) {
  // Prepare rendering data
  TPalette *plt = vi->getPalette();

  const TCamera &camera   = m_opts.m_camera;
  const TAffine &aff      = camera.getStageToCameraRef();
  const TDimensionD &size = camera.getSize();
  const TDimension &res   = camera.getRes();

  const TPointD pos(-0.5 * size.lx, -0.5 * size.ly);

  // Render to toonz image
  TToonzImageP ti = ToonzImageUtils::vectorToToonzImage(vi, aff, plt, pos, res);
  ti->setPalette(plt);

  if (m_opts.m_noAntialias) {
    TRasterCM32P ras = ti->getRaster();
    flattenTones(ras, ras);
  }

  return ti;
}

//---------------------------------------------------------------------------

TImageP ImageExporter::exportedImage(const TFrameId &fid,
                                     TXshLevelType outImgType) {
  // Retrieve the source image
  TImageP img = m_sl.getFullsampledFrame(fid, ImageManager::dontPutInCache);
  if (!img) return TImageP();

  switch (m_sl.getType()) {
  case OVL_XSHLEVEL:
    img = exportedImage(TRasterImageP(img));
    break;
  case TZP_XSHLEVEL:
    img = exportedImage(TToonzImageP(img));
    break;
  case PLI_XSHLEVEL: {
    TVectorImageP vi(img);

    // Apply temporary thickness modification
    int fCount = m_sl.getFrameCount();
    double param =
        (fCount == 1) ? 0.0 : m_sl.fid2index(fid) / double(fCount - 1);

    VectorThicknessTransformer transformer(vi, m_opts.m_thicknessTransform,
                                           param);

    img = (outImgType == TZP_TYPE) ? TImageP(exportedToonzImage(vi))
                                   : TImageP(exportedRasterImage(vi));
    break;
  }
  default:
    assert(!"Wrong level type");
    img = TImageP();
    break;
  }

  return img;
}

}  // namespace

//***********************************************************************************
//    Export Level commands
//***********************************************************************************

TImageP IoCmd::exportedImage(const std::string &ext, const TXshSimpleLevel &sl,
                             const TFrameId &fid,
                             const ExportLevelOptions &opts) {
  ImageExporter exporter(sl, opts);

  return exporter.exportedImage(fid, (ext == "tlv") ? TZP_TYPE : OVL_TYPE);
}

//---------------------------------------------------------------------------

// esporta il livello corrente in un formato full color. se forRetas e' true,
// viene esportato
// in modo adatto ad essere usato in Retas, e cioe':
//- messo il bianco al posto del transparente
//- se c'e' bianco nell'immagine, viene "sporcato"(altrimenti poi viene letto
//come trasparente da retas)
//- l'output e' solo tga a 24bit compressed nel formato pippo0001.tga

bool IoCmd::exportLevel(const TFilePath &path, TXshSimpleLevel *sl,
                        ExportLevelOptions opts,
                        OverwriteCallbacks *overwriteCB,
                        ProgressCallbacks *progressCB) {
  struct Locals {
    const TFilePath &m_path;
    TXshSimpleLevel *m_sl;
    const ExportLevelOptions &m_opts;

    OverwriteCallbacks *m_overwriteCB;
    ProgressCallbacks *m_progressCB;

    bool exportToMultifile() {
      ImageExporter exporter(*m_sl, m_opts);

      TXshLevelType outputLevelType =
          (m_path.getType() == "tlv") ? TZP_TYPE : OVL_TYPE;

      bool firstTime = true;
      for (int i = 0; i < m_sl->getFrameCount(); ++i) {
        if (m_progressCB->canceled()) return false;

        // Prepare frame export path
        TFilePath fpout;

        if (m_opts.m_forRetas) {
          QString pathOut =
              QString::fromStdWString(m_path.getParentDir().getWideString()) +
              "\\" + QString::fromStdString(m_path.getName()) +
              QString::fromStdString(m_sl->index2fid(i).expand()) + "." +
              QString::fromStdString(m_path.getType());
          fpout = TFilePath(pathOut.toStdString());
        } else
          fpout = TFilePath(m_path.withFrame(m_sl->index2fid(i)));

        // Ask for overwrite permission in case a level with the built path
        // already exists
        if (firstTime) {
          firstTime = false;

          if (TSystem::doesExistFileOrLevel(fpout)) {
            QApplication::restoreOverrideCursor();
            bool overwrite = m_overwriteCB->overwriteRequest(fpout);
            QApplication::setOverrideCursor(Qt::WaitCursor);

            if (!overwrite) return false;
          }
        }

        // Retrieve the image to export at current frame
        TImageP img =
            exporter.exportedImage(m_sl->index2fid(i), outputLevelType);
        assert(img);

        // Save the prepared fullcolor image to file
        TImageWriter iw(fpout);
        iw.setProperties(m_opts.m_props);
        iw.save(img);

        m_progressCB->setValue(i + 1);
      }

      return true;
    }

    bool exportToTlv() {
      TFilePath fp(m_path.withNoFrame());

      // Remove any existing level
      if (TSystem::doesExistFileOrLevel(fp)) {
        bool overwrite = m_overwriteCB->overwriteRequest(fp);
        if (!overwrite) return false;

        TSystem::deleteFile(fp);
      }

      TSystem::removeFileOrLevel(fp.withType("tpl"));

      // Export level
      TLevelWriterP lw(fp);

      ImageExporter exporter(*m_sl, m_opts);

      for (int i = 0; i < m_sl->getFrameCount(); ++i) {
        if (m_progressCB->canceled()) return false;

        const TFrameId &fid = m_sl->index2fid(i);

        TImageP img = exporter.exportedImage(fid, TZP_TYPE);
        assert(img);

        lw->getFrameWriter(fid)->save(img);

        m_progressCB->setValue(i + 1);
      }

      return true;
    }
  };  // Locals

  // Use default values in case some were not specified by input

  // Level
  if (!sl) {
    sl = TApp::instance()->getCurrentLevel()->getSimpleLevel();

    if (!sl) {
      DVGui::error(QObject::tr("No level selected!"));
      return false;
    }
  }

  if (sl->isEmpty()) return false;

  // Output properties
  if (!opts.m_props) {
    ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
    opts.m_props =
        scene->getProperties()->getOutputProperties()->getFileFormatProperties(
            path.getType());
  }

  // Camera (todo)
  assert(opts.m_camera.getRes().lx > 0 && opts.m_camera.getRes().ly > 0);

  // Callbacks
  std::auto_ptr<OverwriteCallbacks> overwriteDefault(
      overwriteCB ? 0 : (overwriteCB = new ExportOverwriteCB()));
  std::auto_ptr<ProgressCallbacks> progressDefault(
      progressCB ? 0 : (progressCB = new ExportProgressCB()));

  // Initialize variables
  Locals locals = {path, sl, opts, overwriteCB, progressCB};

  progressCB->setProcessedName(QString::fromStdWString(path.getWideString()));
  progressCB->setRange(0, sl->getFrameCount());

  // Export level
  BusyCursorOverride cursorOverride;
  QCoreApplication::processEvents();  // Refresh screen.   ...But WHY is this
                                      //                      necessary?
  try {
    return (path.getType() == "tlv") ? assert(sl->getType() == PLI_XSHLEVEL),
           locals.exportToTlv() : locals.exportToMultifile();
  } catch (...) {
    return false;
  }
}


text:
module Features
  module OrderTypesHelper
    def delete_order_type(order_type_name)
      page.find("a.text-danger[data-confirm=\"Are you sure you want to delete the order type «#{order_type_name}»? Existing orders won\'t be affected.\"]").click
    end
  end
end


text:
<Alloy>
	<TableViewRow class="row" id="filaComentario">
		<Label id="nombreUsuario"/>
		<Label id="fecha"/>
		<Label id="comentario"/>
	</TableViewRow>
</Alloy>


text:
/**
 * @fileoverview This module provides middleware for parsing
 * HTTP parameters from the query string and request body.
 *
 * It does not parse multipart MIME data such as file uploads which are handled
 * by the [upload] module.
 */
var {isFileUpload, isUrlEncoded, parseFileUpload, parseParameters,
    mergeParameter, BufferFactory} = require("ringo/utils/http");
var objects = require("ringo/utils/objects");
var strings = require("ringo/utils/strings");

/**
 * Middleware for parsing HTTP parameters.
 * This module handles URL-endcoded form data transmitted in the query string
 * and request body as well as JSON encoded data in the request body.
 *
 * @param {Function} next the wrapped middleware chain
 * @param {Object} app the Stick Application object
 * @returns {Function} a JSGI middleware function
 */
exports.middleware = function params(next, app) {

    return function(req) {

        var params, queryParams, postParams;
        var desc = Object.getOwnPropertyDescriptor(req, "postParams");
        var servletRequest = req.env.servletRequest;

        /**
         * An object containing the parsed HTTP parameters sent with this request.
         * @name request.params
         */
        Object.defineProperty(req, "params", {
            get: function() {
                if (!params) {
                    params = objects.merge(this.postParams, this.queryParams);
                }
                return params;
            }, configurable: true
        });

        /**
         * An object containing the parsed HTTP query string parameters sent with this request.
         * @name request.queryParams
         */
        Object.defineProperty(req, "queryParams", {
            get: function() {
                if (!queryParams) {
                    queryParams = {};
                    var encoding = servletRequest.getCharacterEncoding() || "utf8";
                    parseParameters(this.queryString, queryParams, encoding);
                }
                return queryParams;
            }, configurable: true
        });

        /**
         * An object containing the parsed HTTP POST parameters sent with this request.
         * @name request.postParams
         */
        Object.defineProperty(req, "postParams", {
            get: function() {
                if (!postParams) {
                    var contentType = req.headers["content-type"];
                    if (req.method === "POST" || req.method === "PUT") {
                        var input;
                        var encoding = servletRequest.getCharacterEncoding() || "utf8";
                        if (isUrlEncoded(contentType)) {
                            postParams = {};
                            input = req.input.read();
                            var contentLength = parseInt(req.headers["content-length"]);
                            if (!input.length && contentLength > 0) {
                                // Entity body already consumed, ask servlet API for params
                                // See ringo issues #70 and #130
                                var map = servletRequest.getParameterMap();
                                for (var entry in Iterator(map.entrySet())) {
                                    var {key, value} = entry;
                                    // value is a java string array
                                    for each (var val in value) {
                                        mergeParameter(postParams, key, val);
                                    }
                                }
                            } else {
                                parseParameters(input, postParams, encoding);
                            }
                        } else if (strings.startsWith(contentType, "application/json")) {
                            input = req.input.read();
                            postParams = JSON.parse(input.decodeToString(encoding));
                        }
                    }
                    // query previous postParams property descriptor in case
                    // this is a file upload
                    if (!postParams && desc) {
                        postParams = desc.get ? desc.get.apply(req) : desc.value;
                    }
                }
                return postParams;
            }, configurable: true
        });

        return next(req);
    };

};


text:
<VerticalLayout spacing="true" captionMargin="0" >
    <ValidationSettings formTitle="" withApply="true" withAttach="true" withPrint="true" />
    <HorizontalLayout spacing="true" width="-1px">
      <GuiField name="CODE" caption="Code" width="100px" height="-1px"  />
      <GuiField name="NAME" caption="Name" width="200px" height="-1px"  />
    </HorizontalLayout>

    <Line />
    <HorizontalLayout spacing="true" width="-1px">
      <VerticalLayout>
        <GuiField name="PHONE1" caption="Phone 1" width="110px" height="-1px"  />
        <GuiField name="PHONE2" caption="Phone 2" width="110px" height="-1px"  />
        <GuiField name="FAX" caption="Fax" width="110px" height="-1px"  />
        <GuiField name="EMAIL" caption="Email" width="110px" height="-1px"  />
      </VerticalLayout>

      <VerticalLayout>
        <GuiField name="EXTENTION1" caption="Ext. 1" width="110px" height="-1px"  />
        <GuiField name="EXTENTION2" caption="Ext. 2" width="110px" height="-1px"  />
        <GuiField name="MOBILE" caption="Mobile" width="110px " height="-1px"  />
        <GuiField name="WEB" caption="Web" width="110px" height="-1px"  />
      </VerticalLayout>
    </HorizontalLayout>

    <MoreLayout moreCaption="Country, Language...">
        <HorizontalLayout spacing="true" width="-1px">
          <GuiField name="COUNTRY" caption="Country" width="110px" height="-1px"  />
    		    <GuiField name="CITY" caption="City" width="110px" height="-1px"  />
        </HorizontalLayout>
        <HorizontalLayout spacing="true" width="-1px">
    		    <GuiField name="REGION" caption="Region" width="110px" height="-1px"  />
          <GuiField name="COMPANY" caption="Company" width="110px" height="-1px"  />
        </HorizontalLayout>
        <GuiField name="LANGUAGE" caption="Language" width="110px" height="-1px"  />
    </MoreLayout>
    <MoreLayout moreCaption="Addresses...">
    <VerticalLayout spacing="false">
        <GuiField name="DELIVERY_ADDRESS" caption="Delivery Address" width="100%" height="80px"  />
        <GuiField name="INVOICING_ADDRESS" caption="Invoicing Address" width="100%" height="-1px"  />
    </VerticalLayout>
    </MoreLayout>
    <IncludeXML name="CONTACT_LIST" storage="ADR_BK_CONTACT" dataPath="null" type="table" />
</VerticalLayout>


text:
using System;
using System.Data;
using System.Data.Entity;
using System.Diagnostics;

namespace Scorez.Web.Infrastructure.Persistence
{
    public partial class ScorezContext
    {
        private DbContextTransaction _currentTransaction;

        public ScorezContext(string connectionString)
            : base(connectionString)
        {
            Configuration.ValidateOnSaveEnabled = false;
            Configuration.LazyLoadingEnabled = false;
#if DEBUG
            Database.Log = s => Debug.Write(s);
#endif
        }

        public void BeginTransaction()
        {
            if (_currentTransaction != null)
                return;

            _currentTransaction = Database.BeginTransaction(IsolationLevel.ReadCommitted);
        }

        public void CloseTransaction()
        {
            CloseTransaction(exception: null);
        }

        public void CloseTransaction(Exception exception)
        {
            try
            {
                if (_currentTransaction != null && exception != null)
                {
                    _currentTransaction.Rollback();
                    return;
                }

                SaveChanges();

                _currentTransaction?.Commit();
            }
            catch (Exception)
            {
                if (_currentTransaction?.UnderlyingTransaction.Connection != null)
                    _currentTransaction.Rollback();

                throw;
            }
            finally
            {
                _currentTransaction?.Dispose();
                _currentTransaction = null;
            }
        }
    }
}


text:
.class Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;
.super Ljava/lang/Object;
.source "BackupManagerService.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "RestoreFileRunnable"
.end annotation

# instance fields
.field mAgent:Landroid/app/IBackupAgent;

.field mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

.field mSocket:Landroid/os/ParcelFileDescriptor;

.field mToken:I

.field final synthetic this$1:Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;

# direct methods
.method constructor <init>(Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;Landroid/app/IBackupAgent;Lcom/android/server/backup/BackupManagerService$FileMetadata;Landroid/os/ParcelFileDescriptor;I)V
    .locals 1
    .param p1, "this$1"    # Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;
    .param p2, "agent"    # Landroid/app/IBackupAgent;
    .param p3, "info"    # Lcom/android/server/backup/BackupManagerService$FileMetadata;
    .param p4, "socket"    # Landroid/os/ParcelFileDescriptor;
    .param p5, "token"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 5889
    iput-object p1, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->this$1:Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 5891
    iput-object p2, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mAgent:Landroid/app/IBackupAgent;

    .line 5892
    iput-object p3, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    .line 5893
    iput p5, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mToken:I

    .line 5900
    invoke-virtual {p4}, Landroid/os/ParcelFileDescriptor;->getFileDescriptor()Ljava/io/FileDescriptor;

    move-result-object v0

    invoke-static {v0}, Landroid/os/ParcelFileDescriptor;->dup(Ljava/io/FileDescriptor;)Landroid/os/ParcelFileDescriptor;

    move-result-object v0

    iput-object v0, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mSocket:Landroid/os/ParcelFileDescriptor;

    .line 5890
    return-void
.end method

# virtual methods
.method public run()V
    .locals 14

    .prologue
    .line 5906
    :try_start_0
    iget-object v1, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mAgent:Landroid/app/IBackupAgent;

    iget-object v2, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mSocket:Landroid/os/ParcelFileDescriptor;

    iget-object v3, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    iget-wide v3, v3, Lcom/android/server/backup/BackupManagerService$FileMetadata;->size:J

    iget-object v5, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    iget v5, v5, Lcom/android/server/backup/BackupManagerService$FileMetadata;->type:I

    .line 5907
    iget-object v6, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    iget-object v6, v6, Lcom/android/server/backup/BackupManagerService$FileMetadata;->domain:Ljava/lang/String;

    iget-object v7, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    iget-object v7, v7, Lcom/android/server/backup/BackupManagerService$FileMetadata;->path:Ljava/lang/String;

    iget-object v8, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    iget-wide v8, v8, Lcom/android/server/backup/BackupManagerService$FileMetadata;->mode:J

    iget-object v10, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mInfo:Lcom/android/server/backup/BackupManagerService$FileMetadata;

    iget-wide v10, v10, Lcom/android/server/backup/BackupManagerService$FileMetadata;->mtime:J

    .line 5908
    iget v12, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->mToken:I

    iget-object v13, p0, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask$RestoreFileRunnable;->this$1:Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;

    iget-object v13, v13, Lcom/android/server/backup/BackupManagerService$PerformAdbRestoreTask;->this$0:Lcom/android/server/backup/BackupManagerService;

    iget-object v13, v13, Lcom/android/server/backup/BackupManagerService;->mBackupManagerBinder:Landroid/app/backup/IBackupManager;

    .line 5906
    invoke-interface/range {v1 .. v13}, Landroid/app/IBackupAgent;->doRestoreFile(Landroid/os/ParcelFileDescriptor;JILjava/lang/String;Ljava/lang/String;JJILandroid/app/backup/IBackupManager;)V
    :try_end_0
    .catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0

    .line 5904
    :goto_0
    return-void

    .line 5909
    :catch_0
    move-exception v0

    .local v0, "e":Landroid/os/RemoteException;
    goto :goto_0
.end method


text:
var colors = require('colors');

class ErrorHandler {
  constructor() {
    this.errors = [];
  }

  addError(error) {
    this.errors.push(error);
  }

  output() {
    for (let error of this.errors) {
      console.log(error.constructor.name.red + ':');
      console.log(error.getMessage());
      console.log(_divider() + '\n');
    }
  }
}

function _divider() {
  return '-'.repeat(20);
}

module.exports = ErrorHandler;


text:
package org.onlab.rest.exceptions;

import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;

/**
 * Mapper for api not found exceptions to the NOT_FOUND response code.
 */
@Provider
public class NotFoundMapper extends AbstractMapper<NotFoundException> {

    @Override
    protected Response.Status responseStatus() {
        return Response.Status.NOT_FOUND;
    }

}


text:
PROG_CXX=	llc
NOMAN=		yes

.include <bsd.init.mk>

.PATH: ${LLVM_SRCDIR}/tools/llc

SRCS=	llc.cpp

LLVM_LIBS+= \
	AsmPrinter \
	IRReader \
	AsmParser \
	BitReader \
	AArch64CodeGen \
	AArch64TargetInfo \
	AArch64MCTargetDesc \
	AArch64AsmParser \
	AArch64AsmPrinter \
	AArch64Utils \
	ARMCodeGen \
	ARMTargetInfo \
	ARMMCTargetDesc \
	ARMAsmParser \
	ARMAsmPrinter \
	MipsCodeGen \
	MipsTargetInfo \
	MipsAsmParser \
	MipsMCTargetDesc \
	MipsAsmPrinter \
	PowerPCCodeGen \
	PowerPCTargetInfo \
	PowerPCMCTargetDesc \
	PowerPCAsmParser \
	PowerPCAsmPrinter \
	SparcCodeGen \
	SparcTargetInfo \
	SparcMCTargetDesc \
	X86CodeGen \
	X86TargetInfo \
	X86MCTargetDesc \
	X86AsmParser \
	X86AsmPrinter \
	X86Utils \
	Object \
	SelectionDAG \
	CodeGen \
	ScalarOpts \
	TransformsUtils \
	Analysis \
	Target \
	MCParser \
	MC \
	IR \
	Support

.include "${.PARSEDIR}/../../link.mk"

.include <bsd.prog.mk>


text:
<?php
$nocsrf_form_value = \Extension\NoCsrf::generate(null, true);
?>

<?php echo (\Uri::segment(3) == 'add' ? __('account_add') : __('account_edit')); ?>

<?php echo \Extension\Form::openMultipart(array('class' => 'form-horizontal', 'role' => 'form')); ?>

        <?php if (isset($form_status) && isset($form_status_message)) { ?>
        <div class="alert alert-<?php echo str_replace('error', 'danger', $form_status); ?>"><button type="button" class="close" data-dismiss="alert">×</button><?php echo $form_status_message; ?>

        <?php } ?>

        <input type="hidden" name="<?php echo \Config::get('security.csrf_token_key'); ?>" value="<?php echo $nocsrf_form_value; ?>" />

    <?php if (!isset($hide_form) || (isset($hide_form) && $hide_form === false)) { ?>

        <?php echo __('account_username'); ?>: *

            <?php echo \Extension\Form::input('account_username', (isset($account_username) ? $account_username : ''), array('id' => 'account_username', 'maxlength' => '255', 'class' => 'form-control', (\Uri::segment(3) == 'edit' ? 'readonly' : 'required'))); ?>

        <?php echo __('account_email'); ?>: *

            <?php echo \Extension\Form::email('account_email', (isset($account_email) ? $account_email : ''), array('id' => 'account_email', 'maxlength' => '255', 'class' => 'form-control', 'required' => '')); ?>

    <fieldset>
        <legend><?php echo __('account_password'); ?> <?php if (\Uri::segment(3) == 'edit') { ?><?php echo __('account_enter_only_when_you_want_to_change'); ?><?php } ?></legend>

            <?php echo (\Uri::segment(3) == 'add' ? __('account_password') : __('account_current_password')); ?>:

                <?php echo \Form::password('account_password', '', array('id' => 'account_password', 'maxlength' => '70', 'class' => 'form-control')); ?>

        <?php if (\Uri::segment(3) == 'edit') { ?>

            <?php echo __('account_new_password'); ?>:

                <?php echo \Form::password('account_new_password', '', array('id' => 'account_new_password', 'maxlength' => '70', 'class' => 'form-control')); ?>

        <?php } ?>
    </fieldset>

    <fieldset>
        <legend><?php echo __('account_display'); ?></legend>

            <?php echo __('account_display_name'); ?>: *

                <?php echo \Extension\Form::input('account_display_name', (isset($account_display_name) ? $account_display_name : ''), array('id' => 'account_display_name', 'maxlength' => '255', 'class' => 'form-control', 'required' => '')); ?>

<?php echo __('account_display_name_use_for_prevent_showing_username'); ?>

            <?php echo __('account_avatar'); ?>:

                <?php if (isset($account_avatar) && $account_avatar != null) { ?>

                     <?php echo __('account_delete_avatar'); ?>

                    <img src="<?php echo \Uri::createNL($account_avatar); ?>" alt="" class="img-responsive" />

                <?php } // endif $account_avatar; ?>
                <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $avatar_size*1024; // KB to Bytes ?>" />
                <?php echo \Form::file('account_avatar', array('id' => 'account_avatar')); ?>

<?php echo __('account_file_size_less_than_or_equal_to', array('file_size' => $avatar_size)); ?>
                    <?php echo __('account_file_type_allowed', array('file_types' => str_replace('|', ', ', $avatar_allowed_types))); ?>

            <?php echo __('account_timezone'); ?>: *

                <select name="account_timezone" id="account_timezone" class="form-control chosen-select" required="">
                    <option value=""></option>
                    <?php
                    if (isset($account_timezone)) {
                        $tmp_account_timezone = \Extension\Date::getRealTimezoneValue($account_timezone);
                    } else {
                        $tmp_account_timezone = \Extension\Date::getRealTimezoneValue($default_timezone);
                        $account_timezone = $default_timezone;
                    }

                    foreach ($timezone_list as $tznum => $tzval) {
                        echo '<option value="' . $tznum . '"' . (isset($account_timezone) && $account_timezone == $tznum ? ' selected="selected"' : '')  . '>' . $tznum . '</option>' . "\n";

                        // selected, no more another selected because this list have many duplicate key.
                        if (isset($account_timezone) && $account_timezone == $tznum) {
                            unset($account_timezone);
                        }
                    }
                    unset($timezone_list, $tznum, $tzval);
                    ?>
                </select>

<?php echo __('account_current_date_time_example', array('time' => \Extension\Date::gmtDate('%Y-%m-%d %H:%M:%S', (string)time(), $tmp_account_timezone))); ?>

    </fieldset>

    <fieldset>
        <legend><?php echo __('account_personal_info'); ?></legend>

            <?php echo __('account_firstname'); ?>:

                <?php echo \Extension\Form::input('account_firstname', (isset($account_firstname) ? $account_firstname : ''), array('id' => 'account_firstname', 'maxlength' => '255', 'class' => 'form-control')); ?>

            <?php echo __('account_lastname'); ?>:

                <?php echo \Extension\Form::input('account_lastname', (isset($account_lastname) ? $account_lastname : ''), array('id' => 'account_lastname', 'maxlength' => '255', 'class' => 'form-control')); ?>

            <?php echo __('account_birthdate'); ?>:

                        <?php echo \Extension\Form::date('account_birthdate', (isset($account_birthdate) ? $account_birthdate : ''), array('id' => 'account_birthdate', 'maxlength' => '10', 'class' => 'form-control')); ?>

<?php echo __('account_birthdate_format_should_be'); ?>

    </fieldset>

    <fieldset>
        <legend><?php echo __('account_role_and_status'); ?></legend>

            <?php echo __('account_role'); ?>: *

                <select name="level_group_id[]" multiple="multiple" id="level_group_id" class="form-control chosen-select" required="">
                    <option value=""></option>
                    <?php
                    if (isset($account_levels['items']) && is_array($account_levels['items'])) {
                        foreach ($account_levels['items'] as $lvg) {
                            echo '<option value="' . $lvg->level_group_id . '"' . (isset($level_group_id) && is_array($level_group_id) && in_array($lvg->level_group_id, $level_group_id) ? ' selected="selected"' : '') . '>' . $lvg->level_name . '</option>' . "\n";
                        }
                    }
                    ?>
                </select>

            <?php echo __('account_status'); ?>: *

                <select name="account_status" id="account_status" class="form-control chosen-select account_status">
                    <option value="0"<?php if (isset($account_status) && $account_status == '0') { ?> selected="selected"<?php } ?>><?php echo __('admin_disable'); ?></option>
                    <option value="1"<?php if (isset($account_status) && $account_status == '1') { ?> selected="selected"<?php } ?>><?php echo __('admin_enable'); ?></option>
                </select>

        <div class="form-group account_status_text_group"<?php if (isset($account_status) && $account_status == '0') { ?> style="display: block;"<?php } ?>>
            <?php echo __('account_status_text'); ?>:

                <?php echo \Extension\Form::input('account_status_text', (isset($account_status_text) ? $account_status_text : ''), array('id' => 'account_status_text', 'maxlength' => '255', 'class' => 'form-control')); ?>

    </fieldset>

    <?php /*<fieldset>
        <legend>Example custom field</legend>

            Phone:

                <?php echo \Extension\Form::tel('account_field[phone]', (isset($account_field['phone']) ? $account_field['phone'] : ''), array('id' => 'ex_af_phone', 'maxlength' => '20', 'class' => 'form-control')); ?>

            Home page:

                <?php echo \Extension\Form::url('account_field[homepage]', (isset($account_field['homepage']) ? $account_field['homepage'] : ''), array('id' => 'ex_af_homepage', 'maxlength' => '20', 'class' => 'form-control')); ?>

        choice main:

        <?php echo \Form::checkbox('account_field[a][0]', 'a1', (isset($account_field['a'][0]) ? $account_field['a'][0] : null)); ?> a1
        <?php echo \Form::checkbox('account_field[a][1]', 'a2', (isset($account_field['a'][1]) ? $account_field['a'][1] : null)); ?> a2

        choice sub of a2:

        <?php echo \Form::checkbox('account_field[a][a2][0]', 'a2.1', (isset($account_field['a']['a2'][0]) ? $account_field['a']['a2'][0] : null)); ?> a2.1
        <?php echo \Form::checkbox('account_field[a][a2][1]', 'a2.2', (isset($account_field['a']['a2'][1]) ? $account_field['a']['a2'][1] : null)); ?> a2.2
        <?php echo \Form::checkbox('account_field[a][a2][2]', 'a2.2', (isset($account_field['a']['a2'][2]) ? $account_field['a']['a2'][2] : null)); ?> a2.3
    </fieldset>*/ ?>

            <button type="submit" class="btn btn-primary"><?php echo __('account_submit'); ?></button>
            <a href="<?php echo \Uri::create('admin/account'); ?>" class="btn btn-default"><?php echo __('admin_cancel'); ?>
            <?php if (\Uri::segment(3) == 'add') { ?>
            <?php echo __('account_add_account_from_admin_will_not_send_email_to_user'); ?>
            <?php } elseif (\Uri::segment(3) == 'edit') {?>
            <a href="<?php echo \Uri::create('admin/account-permission/index/' . $account_id); ?>" class="btn btn-default"><?php echo __('account_set_permission'); ?>
            <?php } // endif; ?>

    <?php } // endif; ?>
<?php echo \Form::close(); ?>

<?php
// set js for this page.
\Theme::instance()->asset->js('bootstrap-datepicker.js', array(), 'fuelstart_footer')->render('fuelstart_footer');
?>


text:
<project>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>Chapter_002</artifactId>
    <version>2.0</version>
	<packaging>jar</packaging>

    <parent>
        <groupId>ru.estogov</groupId>
        <artifactId>estogov</artifactId>
        <version>2.0</version>
    </parent>

</project>