text:
/*
 * Dawn Engine
 * Written by David Avedissian (c) 2012-2019 (git@dga.dev)
 */
#include "Base.h"
#include "renderer/api/Renderer.h"
#include "scene/PhysicsScene.h"
#include "scene/Camera.h"
#include "StarSystem.h"
#include "Star.h"

namespace dw {

// TODO: Lens flares:
// http://www.ogre3d.org/forums/viewtopic.php?f=11&t=65630

StarDesc::StarDesc() : radius(0.0f), spectralClass(SC_G) {
}

Star::Star(Renderer* renderSystem, StarSystem* starSystem, PhysicsWorld* physicsMgr, StarDesc& desc)
    : SystemBody(renderSystem),
      mPhysicsMgr(physicsMgr),
      mDesc(desc),
      mFlareVisibility(0.0f),
      mFlareBillboard(nullptr),
      mGlowBillboard(nullptr),
      mFlareBillboardSet(nullptr),
      mGlowBillboardSet(nullptr),
      mSceneNode(nullptr) {
    assert(desc.radius > 0.0f);

    // Get the correct colour, and create the scene node
    mSceneNode = starSystem->getRootSceneNode()->createChildSceneNode();

    // Create the flare effect
    mFlareBillboardSet = renderSystem->getSceneMgr()->createBillboardSet(1);
    mFlareBillboardSet->setMaterialName("Scene/Star/Flare");
    mFlareBillboardSet->setBounds(Ogre::AxisAlignedBox::BOX_INFINITE, 1000000.0f);
    mSceneNode->attachObject(mFlareBillboardSet);

    // Create the glow effect
    mGlowBillboardSet = renderSystem->getSceneMgr()->createBillboardSet(1);
    mGlowBillboardSet->setMaterialName("Scene/Star/Glow");
    mGlowBillboardSet->setBounds(Ogre::AxisAlignedBox::BOX_INFINITE, 1000000.0f);
    mSceneNode->attachObject(mGlowBillboardSet);

    // Create Glow Billboard
    // Flare Billboard is created in the update step
    mGlowBillboard =
        mGlowBillboardSet->createBillboard(Ogre::Vector3::ZERO, Colour(1.0f, 1.0f, 1.0f));

    // Create light
    mLight = renderSystem->getSceneMgr()->createLight();
    mLight->setType(Ogre::Light::LT_DIRECTIONAL);
    mLight->setDiffuseColour(Colour(1.0f, 1.0f, 1.0f));
}

Star::~Star() {
    mRenderSystem->getSceneMgr()->destroyLight(mLight);
    mRenderSystem->getSceneMgr()->destroyBillboardSet(mGlowBillboardSet);
    mRenderSystem->getSceneMgr()->destroyBillboardSet(mFlareBillboardSet);
    mRenderSystem->getSceneMgr()->destroySceneNode(mSceneNode);
}

Colour Star::getColour() const {
    Colour colour;

    // Pick the colour based on the class
    switch (mDesc.spectralClass) {
        case SC_O:
            // blue
            colour = Colour(0.6f, 0.7f, 1.0f);
            break;

        case SC_B:
            // blue white
            colour = Colour(0.7f, 0.8f, 1.0f);
            break;

        case SC_A:
            // light blue white
            colour = Colour(0.87f, 0.9f, 1.0f);
            break;

        case SC_F:
            // white
            colour = Colour(0.95f, 0.95f, 1.0f);
            break;

        case SC_G:
            // yellow white
            colour = Colour(1.0f, 0.9f, 0.8f);
            break;

        case SC_K:
            // yellow orange
            colour = Colour(1.0f, 0.82f, 0.6f);
            break;

        case SC_M:
            // orange red
            colour = Colour(1.0f, 0.77f, 0.49f);
            break;

        default:
            colour = Colour(1.0f, 1.0f, 1.0f);
            break;
    }

    return colour;
}

void Star::preRender(Camera* camera) {
    Vec3 localPosition = mPosition.toCameraSpace(camera);

    // Calculate light direction and apparent radius
    float distance = math::Max(localPosition.Length(), 1.0f);
    Vec3 lightDirection = localPosition / distance;
    mLight->setDirection(-lightDirection);
    float apparentRadius = mDesc.radius / (math::Tan(camera->getFov() * 0.5f) * distance);

    // Position the billboards
    float scale = 100000.0f;
    mGlowBillboard->setPosition(lightDirection * scale);
    if (mFlareBillboard)
        mFlareBillboard->setPosition(mGlowBillboard->mPosition);

    // Scale the billboards
    mGlowBillboard->setDimensions(apparentRadius * scale * 120.0f, apparentRadius * scale * 120.0f);
    if (mFlareBillboard)
        mFlareBillboard->setDimensions(apparentRadius * scale * 120.0f,
                                       apparentRadius * scale * 60.0f);

    // Perform a ray cast and fade out the flare
    PhysicsRaycastResult query;
    mPhysicsMgr->rayQuery(camera->getPosition(), mPosition, camera, query);
    mFlareVisibility =
        math::Clamp(mFlareVisibility + (query.hit ? -1.0f : 1.0f) * 8.0f / 60.0f, 0.0f, 1.0f);
    if (mFlareVisibility < M_EPSILON && mFlareBillboard) {
        mFlareBillboardSet->removeBillboard(mFlareBillboard);
        mFlareBillboard = nullptr;
    } else if (mFlareVisibility > 0.0f && !mFlareBillboard) {
        mFlareBillboard = mFlareBillboardSet->createBillboard(mGlowBillboard->getPosition());
    }

    if (mFlareBillboard) {
        mFlareBillboard->setColour(getColour() * mFlareVisibility);
    }

    // Update satellites
    SystemBody::preRender(camera);
}
}  // namespace dw


text:
using Domain.Entities.ExamplesEntity;
using Domain.Entities.Usuario;
using Infra.BaseIdentity.Contexts;
using Infra.Data.EntityConfig;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using System.Linq;

namespace Infra.Data.Contexts
{
    public class ContextBase : ApplicationDbContext, IContextBase
    {
        public ContextBase(DbContextOptions<ContextBase> options)
        {
            ConnectionString = options.FindExtension<SqlServerOptionsExtension>().ConnectionString;
        }

        public DbSet<ExampleEntity> ExamplesEntity { get; set; }
        public DbSet<Usuario> Usuarios { get; set; }

        private string ConnectionString { get; set; }

        public override int SaveChanges()
        {
            return base.SaveChanges();
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(ConnectionString);
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            new ExampleEntityConfig().DefinirConfiguracoesDaEntidade(modelBuilder);
            new UsuarioConfig().DefinirConfiguracoesDaEntidade(modelBuilder);

            foreach (var relationship in modelBuilder.Model.GetEntityTypes().SelectMany(e => e.GetForeignKeys()))
            {
                relationship.DeleteBehavior = DeleteBehavior.Restrict;
            }

            base.OnModelCreating(modelBuilder);
        }
    }
}

redpajama_set_name: RedPajamaGithub


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

<title>CfStats (apache-cassandra API)</title>
<meta name="date" content="2016-06-06">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.tools.nodetool

Class CfStats

java.lang.Object

org.apache.cassandra.tools.NodeTool.NodeToolCmd

org.apache.cassandra.tools.nodetool.TableStats

org.apache.cassandra.tools.nodetool.CfStats

All Implemented Interfaces:

java.lang.Runnable

Deprecated.

use TableStats

@Command(name="cfstats",
         hidden=true,
         description="Print statistics on tables")
 @Deprecated
public class CfStats
extends TableStats

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.cassandra.tools.NodeTool.NodeToolCmd

NodeTool.NodeToolCmd.KeyspaceSet

Constructor Summary

Constructors

Constructor and Description

CfStats()

Deprecated.

Method Summary

Methods inherited from class org.apache.cassandra.tools.nodetool.TableStats

execute

Methods inherited from class org.apache.cassandra.tools.NodeTool.NodeToolCmd

parseOptionalKeyspace, parseOptionalKeyspace, parseOptionalTables, run

Methods inherited from class java.lang.Object

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

Constructor Detail

CfStats

public CfStats()

Deprecated.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2016 The Apache Software Foundation


text:
#include "AboutDialog.hpp"

#include <opencv2/core/core.hpp>

AboutDialog::AboutDialog(QWidget * parent, Qt::WindowFlags flags):
    QDialog(parent, flags)
{
    setupUi(this);

    qt_version_label->setText(qVersion());
    opencv_version_label->setText(CV_VERSION);
    built_date_label->setText(QString("%1 %2").arg(__DATE__, __TIME__));
}

AboutDialog::~AboutDialog()
{
}


text:
package org.apache.flink.table.runtime.sort;

import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.table.dataformat.BaseRow;
import org.apache.flink.table.runtime.TableStreamOperator;
import org.apache.flink.table.runtime.util.StreamRecordCollector;
import org.apache.flink.util.Collector;

/**
 * Operator for batch limit.
 * TODO support stopEarly.
 */
public class LimitOperator extends TableStreamOperator<BaseRow>
		implements OneInputStreamOperator<BaseRow, BaseRow> {

	private final boolean isGlobal;
	private final long limitStart;
	private final long limitEnd;

	private transient Collector<BaseRow> collector;
	private transient int count = 0;

	public LimitOperator(boolean isGlobal, long limitStart, long limitEnd) {
		this.isGlobal = isGlobal;
		this.limitStart = limitStart;
		this.limitEnd = limitEnd;
	}

	@Override
	public void open() throws Exception {
		super.open();
		this.collector = new StreamRecordCollector<>(output);
	}

	@Override
	public void processElement(StreamRecord<BaseRow> element) throws Exception {
		if (count < limitEnd) {
			count++;
			if (!isGlobal || count > limitStart) {
				collector.collect(element.getValue());
			}
		}
	}
}


text:
import { AptosClient } from "./aptos_client";
import { getFaucetClient, longTestTimeout, NODE_URL } from "./utils/test_helper.test";
import { AptosAccount } from "./aptos_account";
import { CoinClient } from "./coin_client";

test(
  "transferCoins and checkBalance works",
  async () => {
    const client = new AptosClient(NODE_URL);
    const faucetClient = getFaucetClient();
    const coinClient = new CoinClient(client);

    const alice = new AptosAccount();
    const bob = new AptosAccount();
    await faucetClient.fundAccount(alice.address(), 100_000_000);
    await faucetClient.fundAccount(bob.address(), 0);

    await client.waitForTransaction(await coinClient.transfer(alice, bob, 42), { checkSuccess: true });

    expect(await coinClient.checkBalance(bob)).toBe(BigInt(42));
  },
  longTestTimeout,
);


text:
require_relative "helper"

module Sol
  class TestClassMethodExpression < MiniTest::Test
    include SolCompile

    def class_code
      "class Space;def self.meth; return meth(22 + 22) ; end;end"
    end
    def setup
      Parfait.boot!(Parfait.default_test_options)
      ruby_tree = Ruby::RubyCompiler.compile( class_code )
      @clazz = ruby_tree.to_sol
    end
    def method
      @clazz.body.first
    end
    def test_setup
      assert_equal ClassExpression , @clazz.class
      assert_equal Statements , @clazz.body.class
      assert_equal ClassMethodExpression , method.class
    end
    def test_fail
      assert_raises{ method.to_parfait }
    end
    def test_creates_class_method
      clazz = @clazz.to_parfait
      m = clazz.single_class.get_instance_method(:meth)
      assert m , "no method :meth"
    end
    def test_creates_type_method
      clazz = @clazz.to_parfait
      m = clazz.single_class.instance_type.get_method(:meth)
      assert m , "no type method :meth"
    end
    def as_slot
      @clazz.to_parfait
      @clazz.to_slot(nil)
    end
    def test_slot
      assert_equal :meth , as_slot.method_compilers.callable.name
    end
    def test_slot_frame
      callable = as_slot.method_compilers.callable
      assert callable.frame_type.names.last.to_s.start_with?("tmp_") , "no tmp_ variable #{callable.frame_type.names}"
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hello
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Unnamed_Click(object sender, EventArgs e)
        {
            HelloLabel.Text = "Hello " + Name.Text;
        }
    }
}


text:
class Order < ActiveRecord::Base
  use_order_in_cart
end


text:
const assert    = require('chai').assert;
const Immutable = require('immutable');
const watcher   = require('../../../dist/plugins/watch');
const startup   = require('../../../dist/startup');
const opts      = require('../../../dist/incoming-options');

function process(obj) {
    return watcher.transformOptions(startup.process(opts.merge(obj), startup.pipeline));
}

describe('uses file-watcher plugin with custom fn', function () {
    it('accepts array of objects', function () {
        const fn1 = function() {};
        const fn2 = function() {};
        const actual = process({
            watch: [
                {
                    match: '*.html',
                    fn: fn1
                },
                {
                    match:   ['*.css', 'templates/*.jade'],
                    fn: fn2,
                    options: {
                        ignored: '*.txt'
                    }
                }
            ]
        });

        const first = actual.getIn(['watch', 0]);
        const second = actual.getIn(['watch', 1]);
        assert.equal(first.get('fn'), fn1);
        assert.equal(second.get('fn'), fn2);
    });
    it('accepts single string with custom fn', function () {
        const fn1 = function() {};
        const actual = process({
            watch: {
                match: '*.html',
                fn: fn1
            }
        });

        const first  = actual.getIn(['watch', 0]);
        assert.equal(first.get('fn'), fn1);
    });
    it('accepts single Object with match as string', function () {
        const fn1 = function() {};
        const actual = process({
            watch: {
                match: '*.html',
                throttle: 1000,
                fn: fn1,
                options: {
                    ignored: ['*.txt']
                }
            }
        });

        const first = actual.getIn(['watch', 0]);
        assert.equal(first.get('fn'), fn1);
    });
    it('accepts single Object with array of strings', function () {
        const fn1 = function() {};
        const actual = process({
            watch: {
                match: ['*.html', '*.css'],
                fn: fn1
            }
        });

        const first  = actual.getIn(['watch', 0]);
        assert.equal(first.get('fn'), fn1);
    });
});


text:
const helpers = require('./helpers');
const webpack = require('webpack');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
const OpenBrowserPlugin = require('open-browser-webpack-plugin');

/**
 * Webpack Plugins
 */
const DefinePlugin = require('webpack/lib/DefinePlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');

/**
 * Webpack Constants
 */
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 3001;
const PROXY_PORT = process.env.PROXY_PORT || 17797; // backend port
const METADATA = webpackMerge(commonConfig.metadata, {
	host: HOST,
	port: PORT,
	proxyPort:PROXY_PORT,
	ENV: ENV
});

/**
 * Webpack configuration
 *
 * See: http://webpack.github.io/docs/configuration.html#cli
 */
module.exports = webpackMerge(commonConfig, {
	/**
	 * Merged metadata from webpack.common.js for index.html
	 *
	 * See: (custom attribute)
	 */
	metadata: METADATA,

	/**
	 * Switch loaders to debug mode.
	 *
	 * See: http://webpack.github.io/docs/configuration.html#debug
	 */
	debug: true,

	/**
	 * Developer tool to enhance debugging
	 *
	 * See: http://webpack.github.io/docs/configuration.html#devtool
	 * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
	 */
	devtool: 'cheap-module-source-map',

	/**
	 * Options affecting the output of the compilation.
	 *
	 * See: http://webpack.github.io/docs/configuration.html#output
	 */

	output: {
		/**
		 * The output directory as absolute path (required).
		 *
		 * See: http://webpack.github.io/docs/configuration.html#output-path
		 */
		path: helpers.build(),
		publicPath: '/',
		/**
		 * Specifies the name of each output file on disk.
		 * IMPORTANT: You must not specify an absolute path here!
		 *
		 * See: http://webpack.github.io/docs/configuration.html#output-filename
		 */
		filename: '[name].bundle.js',

		/**
		 * The filename of the SourceMaps for the JavaScript files.
		 * They are inside the output.path directory.
		 *
		 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
		 */
		sourceMapFilename: '[name].map',

		/**
		 * The filename of non-entry chunks as relative path
		 * inside the output.path directory.
		 *
		 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
		 */
		chunkFilename: '[id].chunk.js',
	},
	plugins: [
		/**
		 * Plugin: DefinePlugin
		 * Description: Define free variables.
		 * Useful for having development builds with debug logging or adding global constants.
		 *
		 * Environment helpers
		 *
		 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
		 */
		// NOTE: when adding more properties, make sure you include them in custom-typings.d.ts
		new DefinePlugin({
			'ENV': JSON.stringify(METADATA.ENV),
			'process.env': {
				'ENV': JSON.stringify(METADATA.ENV),
				'NODE_ENV': JSON.stringify(METADATA.ENV)
			}
		}),

		new webpack.ProvidePlugin({
			jQuery: 'jquery',
			$: 'jquery'
		}),
		new OpenBrowserPlugin({url: 'http://localhost:' + PORT})
	],
	devServer: {
		host: '0.0.0.0',
		port: PORT,
		outputPath: helpers.build(),
		stats: 'minimal',
		// required for html5 router
		historyApiFallback: true,
		proxy: {
			"/api/*": {
				"target": {
					"host": "localhost",
					"protocol": 'http:',
					"port": PROXY_PORT
				},
				changeOrigin: true,
				secure: false
			},
			"/swagger/*": {
				"target": {
					"host": "localhost",
					"protocol": 'http:',
					"port": PROXY_PORT
				},
				changeOrigin: true,
				secure: false
			}
		}
	}
});


text:
django_tutorial
===============

this is to house my collection of django scripts


text:
/**
 *
 */
package io.pratik.i18n.productapp.config;

import java.util.Locale;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;

/**
 * @author pratikdas
 *
 */
@Configuration
public class MessageConfig implements WebMvcConfigurer{

	@Bean("messageSource")
	public MessageSource messageSource() {
	    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
	    messageSource.setBasenames("language/messages");
	    messageSource.setDefaultEncoding("UTF-8");
	    return messageSource;
	}

	@Bean
	public LocaleResolver localeResolver() {
	    SessionLocaleResolver slr = new SessionLocaleResolver();
	    slr.setDefaultLocale(Locale.US);
	    slr.setLocaleAttributeName("current.locale");
	    slr.setTimeZoneAttributeName("current.timezone");
	    return slr;
	}

	@Bean
	public LocaleChangeInterceptor localeChangeInterceptor() {
	    LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
	    localeChangeInterceptor.setParamName("language");
	    return localeChangeInterceptor;
	}

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
	    registry.addInterceptor(localeChangeInterceptor());
	}

}


text:
require 'fileutils'

module ParkPlace
    module SlotGet
        def head(bucket_name, oid)
            @slot = ParkPlace::Models::Bucket.find_root(bucket_name).find_slot(oid)
            only_can_read @slot

            etag = @slot.etag
            since = Time.httpdate(@env.HTTP_IF_MODIFIED_SINCE) rescue nil
            raise NotModified if since and @slot.updated_at <= since
            since = Time.httpdate(@env.HTTP_IF_UNMODIFIED_SINCE) rescue nil
            raise PreconditionFailed if since and @slot.updated_at > since
            raise PreconditionFailed if @env.HTTP_IF_MATCH and etag != @env.HTTP_IF_MATCH
            raise NotModified if @env.HTTP_IF_NONE_MATCH and etag == @env.HTTP_IF_NONE_MATCH

            headers = {}
            if @slot.meta
                @slot.meta.each { |k, v| headers["x-amz-meta-#{k}"] = v }
            end
            if @slot.obj.is_a? ParkPlace::Models::FileInfo
                headers['Content-Type'] = @slot.obj.mime_type
                headers['Content-Disposition'] = @slot.obj.disposition
            end
            headers['Content-Type'] ||= 'binary/octet-stream'
            r(200, '', headers.merge('ETag' => etag, 'Last-Modified' => @slot.updated_at.httpdate, 'Content-Length' => @slot.obj.size))
        end
        def get(bucket_name, oid)
            head(bucket_name, oid)
            if @input.has_key? 'torrent'
                torrent @slot
            elsif @env.HTTP_RANGE  # ugh, parse ranges
                raise NotImplemented
            else
                case @slot.obj
                when ParkPlace::Models::FileInfo
                    file_path = File.join(STORAGE_PATH, @slot.obj.path)
                    headers['X-Sendfile'] = file_path
                else
                    @slot.obj
                end
            end
        end
    end

    module Controllers
        def self.S3 *routes
            R(*routes).send :include, ParkPlace::S3, Base
        end
    end
end


text:
using System.Windows.Controls;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Data;
using System;
using System.ComponentModel;
using System.Data;

namespace Maui.Tools.Studio.Controls
{
    /// <summary>
    /// see: http://www.codeproject.com/KB/edit/EditableTextBlock_in_WPF.aspx
    /// </summary>
    public class EditableTextBlock : TextBlock
    {
        private string myOldText;
        private EditableTextBlockAdorner myAdorner;

        public event EventHandler<ValueChangedEventArgs> TextChanged;

        public EditableTextBlock()
        {
            // http://weblogs.asp.net/okloeten/archive/2007/09/18/3940922.aspx
            var prop = DependencyPropertyDescriptor.FromProperty( TextBlock.TextProperty, typeof( TextBlock ) );
            prop.AddValueChanged( this, OnTextChanged );

            myOldText = Text;
        }

        private void OnTextChanged( object sender, EventArgs e )
        {
            try
            {
                if ( TextChanged == null )
                {
                    return;
                }

                var args = new ValueChangedEventArgs( myOldText, Text );
                TextChanged( this, args );
            }
            finally
            {
                myOldText = Text;
            }
        }

        public bool IsInEditMode
        {
            get
            {
                return (bool)GetValue( IsInEditModeProperty );
            }
            set
            {
                SetValue( IsInEditModeProperty, value );
            }
        }

        // Using a DependencyProperty as the backing store for IsInEditMode.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsInEditModeProperty =
            DependencyProperty.Register( "IsInEditMode", typeof( bool ), typeof( EditableTextBlock ), new UIPropertyMetadata( false, IsInEditModeUpdate ) );

        /// <summary>
        /// Determines whether [is in edit mode update] [the specified obj].
        /// </summary>
        private static void IsInEditModeUpdate( DependencyObject obj, DependencyPropertyChangedEventArgs e )
        {
            EditableTextBlock textBlock = obj as EditableTextBlock;
            if ( textBlock == null )
            {
                return;
            }

            //Get the adorner layer of the uielement (here TextBlock)
            AdornerLayer layer = AdornerLayer.GetAdornerLayer( textBlock );

            //If the IsInEditMode set to true means the user has enabled the edit mode then
            //add the adorner to the adorner layer of the TextBlock.
            if ( textBlock.IsInEditMode )
            {
                if ( null == textBlock.myAdorner )
                {
                    textBlock.myAdorner = new EditableTextBlockAdorner( textBlock );
                }
                layer.Add( textBlock.myAdorner );
            }
            else
            {
                //Remove the adorner from the adorner layer.
                Adorner[] adorners = layer.GetAdorners( textBlock );
                if ( adorners != null )
                {
                    foreach ( Adorner adorner in adorners )
                    {
                        if ( adorner is EditableTextBlockAdorner )
                        {
                            layer.Remove( adorner );
                        }
                    }
                }
            }
        }

        /// <summary>
        /// Gets or sets the length of the max.
        /// </summary>
        /// <value>The length of the max.</value>
        public int MaxLength
        {
            get
            {
                return (int)GetValue( MaxLengthProperty );
            }
            set
            {
                SetValue( MaxLengthProperty, value );
            }
        }

        // Using a DependencyProperty as the backing store for MaxLength.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MaxLengthProperty =
            DependencyProperty.Register( "MaxLength", typeof( int ), typeof( EditableTextBlock ), new UIPropertyMetadata( 0 ) );

        /// <summary>
        /// Invoked when an unhandled <see cref="E:System.Windows.Input.Mouse.MouseDown"/> attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
        /// </summary>
        protected override void OnMouseDown( MouseButtonEventArgs e )
        {
            if ( e.MiddleButton == MouseButtonState.Pressed )
            {
                IsInEditMode = true;
            }
            else if ( e.ClickCount == 2 )
            {
                IsInEditMode = true;
            }
        }
    }
}


text:
require "test_helper"

class TestMapnikPointSymbolizer < Test::Unit::TestCase

  def setup
    @sym = Mapnik::PointSymbolizer.new
  end

  def test_presence
    assert Mapnik::PointSymbolizer
    assert Mapnik::PointPlacement::CENTROID
    assert Mapnik::PointPlacement::INTERIOR
  end

  def test_should_initialize
    assert @sym
  end

  def test_should_get_and_set_filename
    assert_equal "", @sym.filename
    new_filename = "/my/incredible/graphic.png"
    @sym.filename = new_filename
    assert_equal new_filename, @sym.filename
  end

  def test_should_get_and_set_allows_overlap
    assert !@sym.allows_overlap?
    @sym.allows_overlap = true
    assert @sym.allows_overlap?
    @sym.allows_overlap = false
    assert !@sym.allows_overlap?
  end

  def test_should_get_and_set_opacity
    assert_equal 1, @sym.opacity
    new_opacity = 0.5
    @sym.opacity = new_opacity
    assert_equal new_opacity, @sym.opacity
  end

  def test_should_get_and_set_ignore_placement
    assert !@sym.ignores_placement?
    @sym.ignores_placement = true
    assert @sym.ignores_placement?
  end

  def test_should_get_and_set_placement
    assert_equal Mapnik::PointPlacement::CENTROID, @sym.placement
    @sym.placement = Mapnik::PointPlacement::INTERIOR
    assert_equal Mapnik::PointPlacement::INTERIOR, @sym.placement
  end

end


text:
<?xml version="1.0"?>
<!DOCTYPE project>

<project name="build-common-plugins" xmlns:antelope="antlib:ise.antelope.tasks">
	<import file="build-common.xml" />

	<target name="build-service">
		<for param="service.file">
			<path>
				<fileset
					dir="."
					includes="*/docroot/WEB-INF/service.xml"
				/>
			</path>
			<sequential>
				<antelope:stringutil string="@{service.file}" property="service.file.index">
					<antelope:indexof string="docroot" fromindex="0" />
				</antelope:stringutil>

				<antelope:stringutil string="@{service.file}" property="portlet.dir">
					<antelope:substring beginindex="0" endindex="${service.file.index}" />
				</antelope:stringutil>

				<ant dir="${portlet.dir}" target="build-service" inheritAll="false" />
			</sequential>
		</for>
	</target>

	<target name="clean">
		<antcall target="loop-modules">
			<param name="loop.modules.cmd" value="clean-module" />
		</antcall>
	</target>

	<target name="clean-module">
		<ant dir="${module.name}" target="clean" inheritAll="false" />
	</target>

	<target name="compile">
		<antcall target="loop-modules">
			<param name="loop.modules.cmd" value="compile-module" />
		</antcall>
	</target>

	<target name="compile-module">
		<ant dir="${module.name}" target="compile" inheritAll="false" />
	</target>

	<target name="deploy">
		<antcall target="loop-modules">
			<param name="loop.modules.cmd" value="deploy-module" />
		</antcall>
	</target>

	<target name="deploy-module">
		<ant dir="${module.name}" target="deploy" inheritAll="false" />
	</target>

	<target name="jar">
		<antcall target="loop-modules">
			<param name="loop.modules.cmd" value="jar-module" />
		</antcall>
	</target>

	<target name="jar-module">
		<ant dir="${module.name}" target="jar" inheritAll="false" />
	</target>

	<target name="loop-modules">
		<if>
			<not>
				<equals arg1="${plugins.includes}" arg2="" />
			</not>
			<then>
				<for param="module.name">
					<path>
						<dirset dir="." excludes="${plugins.excludes}" includes="${plugins.includes}" />
					</path>
					<sequential>
						<antelope:stringutil string="@{module.name}" property="module.name.unix">
							<antelope:replace regex="\\" replacement="/" />
						</antelope:stringutil>

						<antelope:grep in="${module.name.unix}" regex="(.*/)(.*)" group="2" property="module.name" />

						<antcall target="${loop.modules.cmd}" />
					</sequential>
				</for>
			</then>
		</if>
	</target>

	<target name="setup-eclipse">
		<antcall target="loop-modules">
			<param name="loop.modules.cmd" value="setup-eclipse-module" />
		</antcall>
	</target>

	<target name="setup-eclipse-module">
		<ant dir="${module.name}" target="setup-eclipse" inheritAll="false" />
	</target>

	<target name="war">
		<antcall target="loop-modules">
			<param name="loop.modules.cmd" value="war-module" />
		</antcall>
	</target>

	<target name="war-module">
		<ant dir="${module.name}" target="war" inheritAll="false" />
	</target>
</project>


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

namespace GenVScripting
{
    // The abstraction in this program/library jumps directly from commands to script files, with
    // no individual "scripts" in between. That's because scripts *aren't guaranteed to be modular*
    // or anything like that. Multiple scripts could jump to a simple "end" offset shared by all of
    // them. Nothing stops scripts from having their values unexpectedly aligned, as well.
    //
    // Instead, this program deals with script "entrypoints." Entrypoints' header order is pre-
    // served, but they're added to the decompiled script in their actual file order (i.e. going
    // from smallest offset to largest offset). They're similar enough to normal offsets that they
    // don't get any special abstraction offsets don't.
    //
    // How offsets will be integrated into a list of commands has yet to be determined. Script off-
    // sets should be flexible enough to not duplicate data due to running into another offset.

    /// <summary>
    /// Used to expose info about all the script data in a file.
    /// </summary>
    public class ScriptFileInfo : IDecompilable
    {
        List<CommandInfo> commands;
        List<int> offsets;
        BinaryReader reader;

        public List<CommandInfo> Commands { get => commands; set => commands = value; }
        public List<int> Offsets { get => offsets; set => offsets = value; }
        public BinaryReader Reader { set => reader = value; }

        public ScriptFileInfo(BinaryReader reader)
        {
            commands = new List<CommandInfo>();
            offsets = new List<int>();
            Reader = reader;
        }

        /// <summary>
        /// Reads from a compiled script to find the values contained.
        /// </summary>
        public void Decompile()
        {

            throw new NotImplementedException();
        }

        //public void AddOffset(int offset)
        //{
        //    offsets.Add(offset);
        //    GenVScriptDecompiler.ReadScript(reader);
        //}
    }
}


text:
namespace Animal_hierarchy.Enums
{
    public enum Gender
    {
        notSet,
        male,
        female
    }
}


text:
"""test_mock_chroot_config_highlevel.py - Testing for high-level Mock
configuration generators in mock_chroot.config.highlevel
"""
import mock_chroot.config
from mock_chroot import MockChroot

class TestMockConfigHighLevel(object):
    def test_bind_mount(self, custom_mock_cfg, dir_to_mount):
        cmc = MockChroot(config=mock_chroot.config.compose(
            custom_mock_cfg,
            mock_chroot.config.bind_mount(dir_to_mount['pair'])
        ))
        output = cmc.chroot('cat', dir_to_mount['test_file_path'])
        # If we got here, we've no exception so the file is there
        assert output

    def test_file(self, custom_mock_cfg):
        file_path = '/a_generated_file.txt'
        file_content = 'just some generated text'
        cmc = MockChroot(config=mock_chroot.config.compose(
            custom_mock_cfg,
            mock_chroot.config.file(file_path, file_content)
        ))
        # Must clean the chroot for files to be created
        cmc.clean()
        output = cmc.chroot('cat', file_path)
        # If we got here, we've no exception so the file is there
        assert output == file_content

    def test_env_vars(self, custom_mock_cfg):
        var_name = 'MY_VAR'
        var_value = 'my value'
        cmc = MockChroot(config=mock_chroot.config.compose(
            custom_mock_cfg,
            mock_chroot.config.env_vars(**{var_name: var_value})
        ))
        output = cmc.chroot('bash', '-c', 'echo "${0}"'.format(var_name))
        # If we got here, we've no exception so the file is there
        assert output.rstrip() == var_value

    def test_use_host_resolv(self, custom_mock_cfg):
        host_name = 'www.google.com'
        cmc = MockChroot(config=mock_chroot.config.compose(
            custom_mock_cfg,
            mock_chroot.config.use_host_resolv()
        ))
        output = cmc.chroot('getent', 'hosts', host_name)
        # If we got here, we've no exception so DNS worked
        assert output


text:
<?php

namespace Brouzie\Sphinxy\Tests\Query;

use Brouzie\Sphinxy\Connection;

class MultiResultSetTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Connection
     */
    private static $conn;

    public static function setUpBeforeClass()
    {
        self::$conn = new Connection(new Connection\PdoConnection($_ENV['sphinx_dsn']));
    }

    public function setUp()
    {
        self::$conn->executeUpdate('TRUNCATE RTINDEX products');
        self::$conn->executeUpdate("INSERT INTO products (id, title) VALUES (1, 'product 1'), (2, 'product 2'), (3, 'product 3'), (4, 'product 4'), (5, 'product 5'), (6, 'product 6'), (7, 'product 7')");
    }

    public function testMultiResultSet()
    {
        $multiResultSet = self::$conn->executeMultiQuery('SELECT id FROM products ORDER BY id ASC;SELECT id FROM products ORDER BY id DESC');

        $this->assertInstanceOf('Brouzie\Sphinxy\Query\MultiResultSet', $multiResultSet);
        $this->assertCount(2, $multiResultSet);

        $expected = array(
            array(
                array('id' => 1),
                array('id' => 2),
                array('id' => 3),
                array('id' => 4),
                array('id' => 5),
                array('id' => 6),
                array('id' => 7),
            ),
            array(
                array('id' => 7),
                array('id' => 6),
                array('id' => 5),
                array('id' => 4),
                array('id' => 3),
                array('id' => 2),
                array('id' => 1),
            ),
        );

        foreach ($multiResultSet as $i => $resultSet) {
            $this->assertInstanceOf('Brouzie\Sphinxy\Query\SimpleResultSet', $resultSet);
            $this->assertEquals($expected[$i], iterator_to_array($resultSet->getIterator()));
        }
    }
}


text:
#

#
# Make sure environmental variable EDK_SOURCE is set
#
!IFNDEF EDK_SOURCE
!ERROR EDK_SOURCE environmental variable not set
!ENDIF

#
# Do this if you want to compile from this directory
#
!IFNDEF TOOLCHAIN
TOOLCHAIN = TOOLCHAIN_MSVC
!ENDIF

!INCLUDE $(BUILD_DIR)\PlatformTools.env

#
# Target specific information
#
TARGET_NAME         = StrGather
TARGET_SRC_DIR      = $(EDK_TOOLS_SOURCE)\$(TARGET_NAME)
TARGET_EXE          = $(EDK_TOOLS_OUTPUT)\StrGather.exe

#
# Build targets
#

all: $(TARGET_EXE)

LIBS      = "$(EDK_TOOLS_OUTPUT)\Common.lib"

OBJECTS   = $(EDK_TOOLS_OUTPUT)\StrGather.obj  \
            $(EDK_TOOLS_OUTPUT)\StringDB.obj

INC_DEPS  = $(TARGET_SRC_DIR)\StrGather.h $(TARGET_SRC_DIR)\StringDB.h

C_FLAGS = $(C_FLAGS) /W4

#
# Compile each source file
#
$(EDK_TOOLS_OUTPUT)\StrGather.obj : $(TARGET_SRC_DIR)\StrGather.c $(INC_DEPS)
  $(CC) $(C_FLAGS) $(INC_PATHS) $(TARGET_SRC_DIR)\StrGather.c /Fo$@

$(EDK_TOOLS_OUTPUT)\StringDB.obj : $(TARGET_SRC_DIR)\StringDB.c $(INC_DEPS)
  $(CC) $(C_FLAGS) $(INC_PATHS) $(TARGET_SRC_DIR)\StringDB.c /Fo$@

#
# Add Binary Build description for this tools.
#

!IF (("$(EFI_BINARY_TOOLS)" == "YES") && EXIST($(EFI_PLATFORM_BIN)\Tools\$(TARGET_NAME).exe))
$(TARGET_EXE): $(EFI_PLATFORM_BIN)\Tools\$(TARGET_NAME).exe
  copy $(EFI_PLATFORM_BIN)\Tools\$(TARGET_NAME).exe $(TARGET_EXE) /Y
  if exist $(EFI_PLATFORM_BIN)\Tools\$(TARGET_NAME).pdb \
  copy $(EFI_PLATFORM_BIN)\Tools\$(TARGET_NAME).pdb $(EDK_TOOLS_OUTPUT)\$(TARGET_NAME).pdb /Y
!ELSE
$(TARGET_EXE) : $(OBJECTS) $(LIBS)
  $(LINK) $(MSVS_LINK_LIBPATHS) $(L_FLAGS) $(LIBS) /out:$(TARGET_EXE) $(OBJECTS)
!IF ("$(EFI_BINARY_BUILD)" == "YES")
  if not exist $(EFI_PLATFORM_BIN)\Tools mkdir $(EFI_PLATFORM_BIN)\Tools
  if exist $(TARGET_EXE) copy $(TARGET_EXE) $(EFI_PLATFORM_BIN)\tools\$(TARGET_NAME).exe /Y
  if exist $(EDK_TOOLS_OUTPUT)\$(TARGET_NAME).pdb \
  copy $(EDK_TOOLS_OUTPUT)\$(TARGET_NAME).pdb $(EFI_PLATFORM_BIN)\Tools\$(TARGET_NAME).pdb /Y
!ENDIF
!ENDIF

clean:


text:
import PropTypes from 'prop-types';
import React from 'react';
import { findDOMNode } from 'react-dom';
import EventCell from './EventCell';
import getHeight from 'dom-helpers/query/height';
import { accessor, elementType } from './utils/propTypes';
import { segStyle } from './utils/eventLevels';
import { isSelected } from './utils/selection';

/* eslint-disable react/prop-types */
export default {
  propTypes: {
    slots: PropTypes.number.isRequired,
    end: PropTypes.instanceOf(Date),
    start: PropTypes.instanceOf(Date),

    selected: PropTypes.object,
    eventPropGetter: PropTypes.func,
    titleAccessor: accessor,
    // @Appointment field info declaration
    patientNameAccessor: accessor,
    clinicianImageAccessor: accessor,
    clinicianNameAccessor: accessor,
    appointmentTypeAccessor: accessor,
    appointmentTimeAccessor: accessor,
    appointmentAddressAccessor: accessor,
    coPayAccessor: accessor,
    soapNoteTitleAccessor: accessor,
    setProfileTitleAccessor: accessor,
    staffsAccessor: accessor,
    isRecurrenceAccessor: accessor,
    isRecurrenceEditAccessor: accessor,
    isEditAccessor: accessor,
    isDeleteAccessor: accessor,
    isCancelAccessor: accessor,
    isUnCancelAccessor: accessor,
    isApproveAccessor: accessor,
    cancellationReasonAccessor: accessor,
    isAppointmentRenderedAccessor: accessor,
    isVideoCallAccessor: accessor,
    isAppoinmentCancelledAccessor: accessor,
    practitionerNameAccessor: accessor,
    statusNameAccessor: accessor,

    usersAvailability: PropTypes.object,

    allDayAccessor: accessor,
    startAccessor: accessor,
    endAccessor: accessor,

    eventComponent: elementType,
    eventWrapperComponent: elementType.isRequired,
    onSelect: PropTypes.func
  },

  defaultProps: {
    segments: [],
    selected: {},
    slots: 7
  },

  renderEvent(props, event) {
    let {
        eventPropGetter, selected, start, end
      , startAccessor
      , endAccessor
      , titleAccessor
      , patientNameAccessor
      , clinicianImageAccessor
      , clinicianNameAccessor
      , appointmentTypeAccessor
      , appointmentTimeAccessor
      , appointmentAddressAccessor
      , coPayAccessor
      , soapNoteTitleAccessor
      , setProfileTitleAccessor
      , staffsAccessor
      , isRecurrenceAccessor
      , isRecurrenceEditAccessor
      , isEditAccessor
      , isDeleteAccessor
      , isCancelAccessor
      , isApproveAccessor
      , isUnCancelAccessor
      , cancellationReasonAccessor
      , isAppointmentRenderedAccessor
      , isVideoCallAccessor
      , isAppoinmentCancelledAccessor
      , practitionerNameAccessor
      , statusNameAccessor
      , usersAvailability
      , allDayAccessor, eventComponent
      , eventWrapperComponent
      , onSelect } = props;

    return (
      <EventCell
        event={event}
        eventWrapperComponent={eventWrapperComponent}
        eventPropGetter={eventPropGetter}
        onSelect={onSelect}
        selected={isSelected(event, selected)}
        startAccessor={startAccessor}
        endAccessor={endAccessor}
        titleAccessor={titleAccessor}
        patientNameAccessor={patientNameAccessor}
        clinicianImageAccessor={clinicianImageAccessor}
        clinicianNameAccessor={clinicianNameAccessor}
        appointmentTypeAccessor={appointmentTypeAccessor}
        appointmentTimeAccessor={appointmentTimeAccessor}
        appointmentAddressAccessor={appointmentAddressAccessor}
        coPayAccessor={coPayAccessor}
        soapNoteTitleAccessor={soapNoteTitleAccessor}
        setProfileTitleAccessor={setProfileTitleAccessor}
        staffsAccessor={staffsAccessor}
        isRecurrenceAccessor={isRecurrenceAccessor}
        isRecurrenceEditAccessor={isRecurrenceEditAccessor}
        isEditAccessor={isEditAccessor}
        isDeleteAccessor={isDeleteAccessor}
        isCancelAccessor={isCancelAccessor}
        isUnCancelAccessor={isUnCancelAccessor}
        isApproveAccessor={isApproveAccessor}
        cancellationReasonAccessor={cancellationReasonAccessor}
        isAppointmentRenderedAccessor={isAppointmentRenderedAccessor}
        isVideoCallAccessor={isVideoCallAccessor}
        isAppoinmentCancelledAccessor={isAppoinmentCancelledAccessor}
        practitionerNameAccessor={practitionerNameAccessor}
        statusNameAccessor={statusNameAccessor}
        allDayAccessor={allDayAccessor}
        usersAvailability={usersAvailability}
        slotStart={start}
        slotEnd={end}
        eventComponent={eventComponent}
      />
    )
  },

  renderSpan(props, len, key, content = ' ', left){
    let { slots } = props;

    let customClass = `rbc-row-segment custom-class-${left}`;
    return (
      <div key={key} className={customClass} style={segStyle(Math.abs(len), slots)}>
        {content}
      </div>
    )
  },

  getRowHeight(){
    getHeight(findDOMNode(this))
  }
}


text:
#ifndef __GLES2Plugin_H__
#define __GLES2Plugin_H__

#include "OgrePlugin.h"
#include "OgreGLES2RenderSystem.h"

namespace Ogre
{
    /** Plugin instance for GL ES 2 Manager */
    class GLES2Plugin : public Plugin
    {

    public:
        GLES2Plugin();

        /// @copydoc Plugin::getName
        const String& getName() const;

        /// @copydoc Plugin::install
        void install();

        /// @copydoc Plugin::initialise
        void initialise();

        /// @copydoc Plugin::shutdown
        void shutdown();

        /// @copydoc Plugin::uninstall
        void uninstall();
    protected:
        GLES2RenderSystem* mRenderSystem;

    };
}

#endif


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>o3 Rocket Blog - Apple Xcode Low Ratings</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="o3 Rocket, public relations, Silicon Valley,
				      events, community promotion, social media">

  <link href="/bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet">
  <link href="/bower_components/bootstrap/dist/css/bootstrap-theme.css" rel="stylesheet">
  <link href="/css/o3rocket.css" rel="stylesheet">

        <button type="button" class="navbar-toggle" data-toggle="collapse"
                data-target="#o3rocket-navbar-collapse">
          Toggle navigation

        </button>
        o3 Rocket Communications

Home

Blog

Apple Xcode Low Ratings

      by: Craig Oda,
       11 Dec 2013

      tags:

Show-stopping bugs in Apple Xcode plague the otherwise nice developer tool.  Apple needs to step up hardware support and testing.

  Although I've been using Mac OS X for many years, I've never used Xcode.  I normally use Emacs on Linux Ubuntu at
  home to teach my son Python.  He's using Komodo on Ubuntu.  When we are on vacation, he uses Komodo on Mac
  and I use Emacs on Mac.

As I was getting ready for our trip to Hawaii, I decided to update my GitHub
  repositories on my MacBook Pro so that my son could continue to develop his games on vacation.

Since Git
  doesn't install by default on the Mac, I decided to install Xcode and the Apple command line tools.

I was
  really surprised at the large number of low reviews and complaints about Xcode.

Since there are a number of 5 star ratings, I have to
    assume that the product itself is good and that there are some showstopper bugs which results in many 1 star
    ratings.

I've used Apple products extensively and found the Apple
    hardware and OS to be of high quality.  It's surprising that the company is shipping their Xcode product with
    some critical bugs.

While Apple is working on Xcode, Google is working with
    on Android Studio with JetBrains.  The new Android Studio is based on the IntelliJ IDEA, not Eclipse.  Currently,
    it's on version 0.3.2.

The competition is stepping up their game

Android Studio Developer Preview gearing up to give
    Xcode some competition

Update: Friday, December 13, 2013

I wasn't able to install Xcode on my three year old
    MacBook Pro.  From reading the comments on the AppStore, this is a common problem.  I'm not sure if it has
    anything to do with my running Mac OS X Mavericks.   The good news is that I was able to install the Apple
    Command Line Tools with no problems.  The Apple Command Line Tools installs git and I can now move things back
    and forth with github easily.

I was also able to install XQuartz http://xquartz.macosforge.org with no problem and can run the applications
  that I need.

Despite the problem with Xcode installation, I don't think it will affect me over the Christmas
  holiday.   I'll try and install the tools I need on my wife's MacBook Air 11" which has the new Haswell Core i5
  CPU in it with Intel HD Graphics 5000.  That should be able to run everything fine.

Gigi Read just
  bought an even better computer, the MacBook Air 13" with 8 gig of memory.  That's a really nice machine.  I
  may end up picking one up in 2014.  In the meantime, I'm plodding forward with my old 2010 MacBook Pro, a new
  Windows 8 notebook, and my main Linux desktop machine at home.

          previous

          next

linux 2

github 1

discourse 1

community 1

hardware hacking 1

marketing tools 1

Facebook 1

By the o3 Rocket casual web team


text:
module PDC
  module V1
    require 'pdc/v1/product'
    require 'pdc/v1/arch'
    require 'pdc/v1/release'
    require 'pdc/v1/release_variant'
    require 'pdc/v1/release_rpm_mapping'
    require 'pdc/v1/content_delivery_repo'
    require 'pdc/v1/global_component_contact'
    require 'pdc/v1/released_file'
    require 'pdc/v1/multi_destination'
    require 'pdc/v1/variant_cpe'
    require 'pdc/v1/push_target'
  end
end


text:
#include "NvmExpressPei.h"

/**
  Transfer MMIO Data to memory.

  @param[in,out] MemBuffer    Destination: Memory address.
  @param[in] MmioAddr         Source: MMIO address.
  @param[in] Size             Size for read.

  @retval EFI_SUCCESS         MMIO read sucessfully.

**/
EFI_STATUS
NvmeMmioRead (
  IN OUT VOID *MemBuffer,
  IN     UINTN MmioAddr,
  IN     UINTN Size
  )
{
  UINTN    Offset;
  UINT8    Data;
  UINT8    *Ptr;

  // priority has adjusted
  switch (Size) {
    case 4:
      *((UINT32 *)MemBuffer) = MmioRead32 (MmioAddr);
      break;

    case 8:
      *((UINT64 *)MemBuffer) = MmioRead64 (MmioAddr);
      break;

    case 2:
      *((UINT16 *)MemBuffer) = MmioRead16 (MmioAddr);
      break;

    case 1:
      *((UINT8 *)MemBuffer) = MmioRead8 (MmioAddr);
      break;

    default:
      Ptr = (UINT8 *)MemBuffer;
      for (Offset = 0; Offset < Size; Offset += 1) {
        Data = MmioRead8 (MmioAddr + Offset);
        Ptr[Offset] = Data;
      }
      break;
  }

  return EFI_SUCCESS;
}

/**
  Transfer memory data to MMIO.

  @param[in,out] MmioAddr    Destination: MMIO address.
  @param[in] MemBuffer       Source: Memory address.
  @param[in] Size            Size for write.

  @retval EFI_SUCCESS        MMIO write sucessfully.

**/
EFI_STATUS
NvmeMmioWrite (
  IN OUT UINTN MmioAddr,
  IN     VOID *MemBuffer,
  IN     UINTN Size
  )
{
  UINTN    Offset;
  UINT8    Data;
  UINT8    *Ptr;

  // priority has adjusted
  switch (Size) {
    case 4:
      MmioWrite32 (MmioAddr, *((UINT32 *)MemBuffer));
      break;

    case 8:
      MmioWrite64 (MmioAddr, *((UINT64 *)MemBuffer));
      break;

    case 2:
      MmioWrite16 (MmioAddr, *((UINT16 *)MemBuffer));
      break;

    case 1:
      MmioWrite8 (MmioAddr, *((UINT8 *)MemBuffer));
      break;

    default:
      Ptr = (UINT8 *)MemBuffer;
      for (Offset = 0; Offset < Size; Offset += 1) {
        Data = Ptr[Offset];
        MmioWrite8 (MmioAddr + Offset, Data);
      }
      break;
  }

  return EFI_SUCCESS;
}

/**
  Get the page offset for specific NVME based memory.

  @param[in] BaseMemIndex    The Index of BaseMem (0-based).

  @retval - The page count for specific BaseMem Index

**/
UINT32
NvmeBaseMemPageOffset (
  IN UINTN              BaseMemIndex
  )
{
  UINT32                Pages;
  UINTN                 Index;
  UINT32                PageSizeList[5];

  PageSizeList[0] = 1;  /* ASQ */
  PageSizeList[1] = 1;  /* ACQ */
  PageSizeList[2] = 1;  /* SQs */
  PageSizeList[3] = 1;  /* CQs */
  PageSizeList[4] = NVME_PRP_SIZE;  /* PRPs */

  if (BaseMemIndex > MAX_BASEMEM_COUNT) {
    DEBUG ((DEBUG_ERROR, "%a: The input BaseMem index is invalid.\n", __FUNCTION__));
    ASSERT (FALSE);
    return 0;
  }

  Pages = 0;
  for (Index = 0; Index < BaseMemIndex; Index++) {
    Pages += PageSizeList[Index];
  }

  return Pages;
}

/**
  Wait for NVME controller status to be ready or not.

  @param[in] Private      The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.
  @param[in] WaitReady    Flag for waitting status ready or not.

  @return EFI_SUCCESS     Successfully to wait specific status.
  @return others          Fail to wait for specific controller status.

**/
EFI_STATUS
NvmeWaitController (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private,
  IN BOOLEAN                             WaitReady
  )
{
  NVME_CSTS              Csts;
  EFI_STATUS             Status;
  UINT32                 Index;
  UINT8                  Timeout;

  //
  // Cap.To specifies max delay time in 500ms increments for Csts.Rdy to set after
  // Cc.Enable. Loop produces a 1 millisecond delay per itteration, up to 500 * Cap.To.
  //
  if (Private->Cap.To == 0) {
    Timeout = 1;
  } else {
    Timeout = Private->Cap.To;
  }

  Status = EFI_SUCCESS;
  for(Index = (Timeout * 500); Index != 0; --Index) {
    MicroSecondDelay (1000);

    //
    // Check if the controller is initialized
    //
    Status = NVME_GET_CSTS (Private, &Csts);
    if (EFI_ERROR(Status)) {
      DEBUG ((DEBUG_ERROR, "%a: NVME_GET_CSTS fail, Status - %r\n", __FUNCTION__, Status));
      return Status;
    }

    if ((BOOLEAN) Csts.Rdy == WaitReady) {
      break;
    }
  }

  if (Index == 0) {
    Status = EFI_TIMEOUT;
  }

  return Status;
}

/**
  Disable the Nvm Express controller.

  @param[in] Private     The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.

  @return EFI_SUCCESS    Successfully disable the controller.
  @return others         Fail to disable the controller.

**/
EFI_STATUS
NvmeDisableController (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private
  )
{
  NVME_CC       Cc;
  NVME_CSTS     Csts;
  EFI_STATUS    Status;

  Status = NVME_GET_CSTS (Private, &Csts);

  //
  // Read Controller Configuration Register.
  //
  Status = NVME_GET_CC (Private, &Cc);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NVME_GET_CC fail, Status - %r\n", __FUNCTION__, Status));
    goto ErrorExit;
  }

  if (Cc.En == 1) {
    Cc.En = 0;
    //
    // Disable the controller.
    //
    Status = NVME_SET_CC (Private, &Cc);
    if (EFI_ERROR (Status)) {
      DEBUG ((DEBUG_ERROR, "%a: NVME_SET_CC fail, Status - %r\n", __FUNCTION__, Status));
      goto ErrorExit;
    }
  }

  Status = NvmeWaitController (Private, FALSE);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NvmeWaitController fail, Status - %r\n", __FUNCTION__, Status));
    goto ErrorExit;
  }

  return EFI_SUCCESS;

ErrorExit:
  DEBUG ((DEBUG_ERROR, "%a fail, Status - %r\n", __FUNCTION__, Status));
  return Status;
}

/**
  Enable the Nvm Express controller.

  @param[in] Private    The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.

  @return EFI_SUCCESS         Successfully enable the controller.
  @return EFI_DEVICE_ERROR    Fail to enable the controller.
  @return EFI_TIMEOUT         Fail to enable the controller in given time slot.

**/
EFI_STATUS
NvmeEnableController (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private
  )
{
  NVME_CC       Cc;
  EFI_STATUS    Status;

  //
  // Enable the controller
  // CC.AMS, CC.MPS and CC.CSS are all set to 0
  //
  ZeroMem (&Cc, sizeof (NVME_CC));
  Cc.En     = 1;
  Cc.Iosqes = 6;
  Cc.Iocqes = 4;
  Status    = NVME_SET_CC (Private, &Cc);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NVME_SET_CC fail, Status - %r\n", __FUNCTION__, Status));
    goto ErrorExit;
  }

  Status = NvmeWaitController (Private, TRUE);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NvmeWaitController fail, Status - %r\n", __FUNCTION__, Status));
    goto ErrorExit;
  }

  return EFI_SUCCESS;

ErrorExit:
  DEBUG ((DEBUG_ERROR, "%a fail, Status: %r\n", __FUNCTION__, Status));
  return Status;
}

/**
  Get the Identify Controller data.

  @param[in] Private     The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.
  @param[in] Buffer      The Buffer used to store the Identify Controller data.

  @return EFI_SUCCESS    Successfully get the Identify Controller data.
  @return others         Fail to get the Identify Controller data.

**/
EFI_STATUS
NvmeIdentifyController (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private,
  IN VOID                                *Buffer
  )
{
  EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET    CommandPacket;
  EDKII_PEI_NVM_EXPRESS_COMMAND                     Command;
  EDKII_PEI_NVM_EXPRESS_COMPLETION                  Completion;
  EFI_STATUS                                        Status;

  ZeroMem (&CommandPacket, sizeof(EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
  ZeroMem (&Command, sizeof(EDKII_PEI_NVM_EXPRESS_COMMAND));
  ZeroMem (&Completion, sizeof(EDKII_PEI_NVM_EXPRESS_COMPLETION));

  Command.Cdw0.Opcode = NVME_ADMIN_IDENTIFY_CMD;
  //
  // According to Nvm Express 1.1 spec Figure 38, When not used, the field shall be cleared to 0h.
  // For the Identify command, the Namespace Identifier is only used for the Namespace Data structure.
  //
  Command.Nsid        = 0;

  CommandPacket.NvmeCmd        = &Command;
  CommandPacket.NvmeCompletion = &Completion;
  CommandPacket.TransferBuffer = Buffer;
  CommandPacket.TransferLength = sizeof (NVME_ADMIN_CONTROLLER_DATA);
  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
  CommandPacket.QueueType      = NVME_ADMIN_QUEUE;
  //
  // Set bit 0 (Cns bit) to 1 to identify the controller
  //
  CommandPacket.NvmeCmd->Cdw10 = 1;
  CommandPacket.NvmeCmd->Flags = CDW10_VALID;

  Status = NvmePassThru (
             Private,
             NVME_CONTROLLER_NSID,
             &CommandPacket
             );
  return Status;
}

/**
  Get specified identify namespace data.

  @param[in] Private        The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.
  @param[in] NamespaceId    The specified namespace identifier.
  @param[in] Buffer         The buffer used to store the identify namespace data.

  @return EFI_SUCCESS         Successfully get the identify namespace data.
  @return EFI_DEVICE_ERROR    Fail to get the identify namespace data.

**/
EFI_STATUS
NvmeIdentifyNamespace (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private,
  IN UINT32                              NamespaceId,
  IN VOID                                *Buffer
  )
{
  EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET    CommandPacket;
  EDKII_PEI_NVM_EXPRESS_COMMAND                     Command;
  EDKII_PEI_NVM_EXPRESS_COMPLETION                  Completion;
  EFI_STATUS                                        Status;

  ZeroMem (&CommandPacket, sizeof(EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
  ZeroMem (&Command, sizeof(EDKII_PEI_NVM_EXPRESS_COMMAND));
  ZeroMem (&Completion, sizeof(EDKII_PEI_NVM_EXPRESS_COMPLETION));

  Command.Cdw0.Opcode = NVME_ADMIN_IDENTIFY_CMD;
  Command.Nsid        = NamespaceId;

  CommandPacket.NvmeCmd        = &Command;
  CommandPacket.NvmeCompletion = &Completion;
  CommandPacket.TransferBuffer = Buffer;
  CommandPacket.TransferLength = sizeof (NVME_ADMIN_NAMESPACE_DATA);
  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
  CommandPacket.QueueType      = NVME_ADMIN_QUEUE;
  //
  // Set bit 0 (Cns bit) to 1 to identify a namespace
  //
  CommandPacket.NvmeCmd->Cdw10 = 0;
  CommandPacket.NvmeCmd->Flags = CDW10_VALID;

  Status = NvmePassThru (
             Private,
             NamespaceId,
             &CommandPacket
             );
  return Status;
}

/**
  Dump the Identify Controller data.

  @param[in] ControllerData    The pointer to the NVME_ADMIN_CONTROLLER_DATA data structure.

**/
VOID
NvmeDumpControllerData (
  IN NVME_ADMIN_CONTROLLER_DATA    *ControllerData
  )
{
  UINT8    Sn[21];
  UINT8    Mn[41];

  CopyMem (Sn, ControllerData->Sn, sizeof (ControllerData->Sn));
  Sn[20] = 0;
  CopyMem (Mn, ControllerData->Mn, sizeof (ControllerData->Mn));
  Mn[40] = 0;

  DEBUG ((DEBUG_INFO, " == NVME IDENTIFY CONTROLLER DATA ==\n"));
  DEBUG ((DEBUG_INFO, "    PCI VID   : 0x%x\n", ControllerData->Vid));
  DEBUG ((DEBUG_INFO, "    PCI SSVID : 0x%x\n", ControllerData->Ssvid));
  DEBUG ((DEBUG_INFO, "    SN        : %a\n",   Sn));
  DEBUG ((DEBUG_INFO, "    MN        : %a\n",   Mn));
  DEBUG ((DEBUG_INFO, "    FR        : 0x%lx\n", *((UINT64*)ControllerData->Fr)));
  DEBUG ((DEBUG_INFO, "    RAB       : 0x%x\n", ControllerData->Rab));
  DEBUG ((DEBUG_INFO, "    IEEE      : 0x%x\n", *(UINT32*)ControllerData->Ieee_oui));
  DEBUG ((DEBUG_INFO, "    AERL      : 0x%x\n", ControllerData->Aerl));
  DEBUG ((DEBUG_INFO, "    SQES      : 0x%x\n", ControllerData->Sqes));
  DEBUG ((DEBUG_INFO, "    CQES      : 0x%x\n", ControllerData->Cqes));
  DEBUG ((DEBUG_INFO, "    NN        : 0x%x\n", ControllerData->Nn));
  return;
}

/**
  Create IO completion queue.

  @param[in] Private     The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.

  @return EFI_SUCCESS    Successfully create io completion queue.
  @return others         Fail to create io completion queue.

**/
EFI_STATUS
NvmeCreateIoCompletionQueue (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private
  )
{
  EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET    CommandPacket;
  EDKII_PEI_NVM_EXPRESS_COMMAND                     Command;
  EDKII_PEI_NVM_EXPRESS_COMPLETION                  Completion;
  EFI_STATUS                                        Status;
  NVME_ADMIN_CRIOCQ                                 CrIoCq;

  ZeroMem (&CommandPacket, sizeof(EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
  ZeroMem (&Command, sizeof(EDKII_PEI_NVM_EXPRESS_COMMAND));
  ZeroMem (&Completion, sizeof(EDKII_PEI_NVM_EXPRESS_COMPLETION));
  ZeroMem (&CrIoCq, sizeof(NVME_ADMIN_CRIOCQ));

  CommandPacket.NvmeCmd        = &Command;
  CommandPacket.NvmeCompletion = &Completion;

  Command.Cdw0.Opcode = NVME_ADMIN_CRIOCQ_CMD;
  Command.Cdw0.Cid    = Private->Cid[NVME_ADMIN_QUEUE]++;
  CommandPacket.TransferBuffer = Private->CqBuffer[NVME_IO_QUEUE];
  CommandPacket.TransferLength = EFI_PAGE_SIZE;
  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
  CommandPacket.QueueType      = NVME_ADMIN_QUEUE;

  CrIoCq.Qid   = NVME_IO_QUEUE;
  CrIoCq.Qsize = NVME_CCQ_SIZE;
  CrIoCq.Pc    = 1;
  CopyMem (&CommandPacket.NvmeCmd->Cdw10, &CrIoCq, sizeof (NVME_ADMIN_CRIOCQ));
  CommandPacket.NvmeCmd->Flags = CDW10_VALID | CDW11_VALID;

  Status = NvmePassThru (
             Private,
             NVME_CONTROLLER_NSID,
             &CommandPacket
             );
  return Status;
}

/**
  Create IO submission queue.

  @param[in] Private     The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.

  @return EFI_SUCCESS    Successfully create io submission queue.
  @return others         Fail to create io submission queue.

**/
EFI_STATUS
NvmeCreateIoSubmissionQueue (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private
  )
{
  EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET    CommandPacket;
  EDKII_PEI_NVM_EXPRESS_COMMAND                     Command;
  EDKII_PEI_NVM_EXPRESS_COMPLETION                  Completion;
  EFI_STATUS                                        Status;
  NVME_ADMIN_CRIOSQ                                 CrIoSq;

  ZeroMem (&CommandPacket, sizeof(EDKII_PEI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));
  ZeroMem (&Command, sizeof(EDKII_PEI_NVM_EXPRESS_COMMAND));
  ZeroMem (&Completion, sizeof(EDKII_PEI_NVM_EXPRESS_COMPLETION));
  ZeroMem (&CrIoSq, sizeof(NVME_ADMIN_CRIOSQ));

  CommandPacket.NvmeCmd        = &Command;
  CommandPacket.NvmeCompletion = &Completion;

  Command.Cdw0.Opcode = NVME_ADMIN_CRIOSQ_CMD;
  Command.Cdw0.Cid    = Private->Cid[NVME_ADMIN_QUEUE]++;
  CommandPacket.TransferBuffer = Private->SqBuffer[NVME_IO_QUEUE];
  CommandPacket.TransferLength = EFI_PAGE_SIZE;
  CommandPacket.CommandTimeout = NVME_GENERIC_TIMEOUT;
  CommandPacket.QueueType      = NVME_ADMIN_QUEUE;

  CrIoSq.Qid   = NVME_IO_QUEUE;
  CrIoSq.Qsize = NVME_CSQ_SIZE;
  CrIoSq.Pc    = 1;
  CrIoSq.Cqid  = NVME_IO_QUEUE;
  CrIoSq.Qprio = 0;
  CopyMem (&CommandPacket.NvmeCmd->Cdw10, &CrIoSq, sizeof (NVME_ADMIN_CRIOSQ));
  CommandPacket.NvmeCmd->Flags = CDW10_VALID | CDW11_VALID;

  Status = NvmePassThru (
             Private,
             NVME_CONTROLLER_NSID,
             &CommandPacket
             );
  return Status;
}

/**
  Initialize the Nvm Express controller.

  @param[in] Private     The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.

  @retval EFI_SUCCESS    The NVM Express Controller is initialized successfully.
  @retval Others         A device error occurred while initializing the controller.

**/
EFI_STATUS
NvmeControllerInit (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private
  )
{
  EFI_STATUS    Status;
  UINTN         Index;
  NVME_AQA      Aqa;
  NVME_ASQ      Asq;
  NVME_ACQ      Acq;
  NVME_VER      Ver;

  //
  // Dump the NVME controller implementation version
  //
  NVME_GET_VER (Private, &Ver);
  DEBUG ((DEBUG_INFO, "NVME controller implementation version: %d.%d\n", Ver.Mjr, Ver.Mnr));

  //
  // Read the controller Capabilities register and verify that the NVM command set is supported
  //
  NVME_GET_CAP (Private, &Private->Cap);
  if (Private->Cap.Css != 0x01) {
    DEBUG ((DEBUG_ERROR, "%a: The NVME controller doesn't support NVMe command set.\n", __FUNCTION__));
    return EFI_UNSUPPORTED;
  }

  //
  // Currently, the driver only supports 4k page size
  //
  if ((Private->Cap.Mpsmin + 12) > EFI_PAGE_SHIFT) {
    DEBUG ((DEBUG_ERROR, "%a: The driver doesn't support page size other than 4K.\n", __FUNCTION__));
    ASSERT (FALSE);
    return EFI_UNSUPPORTED;
  }

  for (Index = 0; Index < NVME_MAX_QUEUES; Index++) {
    Private->Pt[Index]  = 0;
    Private->Cid[Index] = 0;
    ZeroMem ((VOID *)(UINTN)(&Private->SqTdbl[Index]), sizeof (NVME_SQTDBL));
    ZeroMem ((VOID *)(UINTN)(&Private->CqHdbl[Index]), sizeof (NVME_CQHDBL));
  }
  ZeroMem (Private->Buffer, EFI_PAGE_SIZE * NVME_MEM_MAX_PAGES);

  //
  // Disable the NVME controller first
  //
  Status = NvmeDisableController (Private);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NvmeDisableController fail, Status - %r\n", __FUNCTION__, Status));
    return Status;
  }

  //
  // Set the number of entries in admin submission & completion queues
  //
  Aqa.Asqs  = NVME_ASQ_SIZE;
  Aqa.Rsvd1 = 0;
  Aqa.Acqs  = NVME_ACQ_SIZE;
  Aqa.Rsvd2 = 0;

  //
  // Address of admin submission & completion queues
  //
  Asq = (UINT64)(UINTN)(NVME_ASQ_BASE (Private) & ~0xFFF);
  Acq = (UINT64)(UINTN)(NVME_ACQ_BASE (Private) & ~0xFFF);

  //
  // Address of I/O submission & completion queues
  //
  Private->SqBuffer[0] = (NVME_SQ *)(UINTN)NVME_ASQ_BASE (Private);    // NVME_ADMIN_QUEUE
  Private->CqBuffer[0] = (NVME_CQ *)(UINTN)NVME_ACQ_BASE (Private);    // NVME_ADMIN_QUEUE
  Private->SqBuffer[1] = (NVME_SQ *)(UINTN)NVME_SQ_BASE (Private, 0);  // NVME_IO_QUEUE
  Private->CqBuffer[1] = (NVME_CQ *)(UINTN)NVME_CQ_BASE (Private, 0);  // NVME_IO_QUEUE
  DEBUG ((DEBUG_INFO, "Admin Submission Queue Size (Aqa.Asqs) = [%08X]\n", Aqa.Asqs));
  DEBUG ((DEBUG_INFO, "Admin Completion Queue Size (Aqa.Acqs) = [%08X]\n", Aqa.Acqs));
  DEBUG ((DEBUG_INFO, "Admin Submission Queue (SqBuffer[0]) =   [%08X]\n", Private->SqBuffer[0]));
  DEBUG ((DEBUG_INFO, "Admin Completion Queue (CqBuffer[0]) =   [%08X]\n", Private->CqBuffer[0]));
  DEBUG ((DEBUG_INFO, "I/O   Submission Queue (SqBuffer[1]) =   [%08X]\n", Private->SqBuffer[1]));
  DEBUG ((DEBUG_INFO, "I/O   Completion Queue (CqBuffer[1]) =   [%08X]\n", Private->CqBuffer[1]));

  //
  // Program admin queue attributes
  //
  NVME_SET_AQA (Private, &Aqa);

  //
  // Program admin submission & completion queues address
  //
  NVME_SET_ASQ (Private, &Asq);
  NVME_SET_ACQ (Private, &Acq);

  //
  // Enable the NVME controller
  //
  Status = NvmeEnableController (Private);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NvmeEnableController fail, Status - %r\n", __FUNCTION__, Status));
    return Status;
  }

  //
  // Get the Identify Controller data
  //
  if (Private->ControllerData == NULL) {
    Private->ControllerData = (NVME_ADMIN_CONTROLLER_DATA *)AllocateZeroPool (sizeof (NVME_ADMIN_CONTROLLER_DATA));
    if (Private->ControllerData == NULL) {
      return EFI_OUT_OF_RESOURCES;
    }
  }
  Status = NvmeIdentifyController (Private, Private->ControllerData);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: NvmeIdentifyController fail, Status - %r\n", __FUNCTION__, Status));
    return Status;
  }
  NvmeDumpControllerData (Private->ControllerData);

  //
  // Check the namespace number for storing the namespaces information
  //
  if (Private->ControllerData->Nn > MAX_UINT32 / sizeof (PEI_NVME_NAMESPACE_INFO)) {
    DEBUG ((
      DEBUG_ERROR,
      "%a: Number of Namespaces field in Identify Controller data not supported by the driver.\n",
      __FUNCTION__
      ));
    return EFI_UNSUPPORTED;
  }

  //
  // Create one I/O completion queue and one I/O submission queue
  //
  Status = NvmeCreateIoCompletionQueue (Private);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: Create IO completion queue fail, Status - %r\n", __FUNCTION__, Status));
    return Status;
  }
  Status = NvmeCreateIoSubmissionQueue (Private);
  if (EFI_ERROR (Status)) {
    DEBUG ((DEBUG_ERROR, "%a: Create IO submission queue fail, Status - %r\n", __FUNCTION__, Status));
  }

  return Status;
}

/**
  Free the resources allocated by an NVME controller.

  @param[in] Private     The pointer to the PEI_NVME_CONTROLLER_PRIVATE_DATA data structure.

**/
VOID
NvmeFreeControllerResource (
  IN PEI_NVME_CONTROLLER_PRIVATE_DATA    *Private
  )
{
  //
  // Free the controller data buffer
  //
  if (Private->ControllerData != NULL) {
    FreePool (Private->ControllerData);
    Private->ControllerData = NULL;
  }

  //
  // Free the DMA buffers
  //
  if (Private->Buffer != NULL) {
    IoMmuFreeBuffer (
       NVME_MEM_MAX_PAGES,
       Private->Buffer,
       Private->BufferMapping
       );
    Private->Buffer = NULL;
  }

  //
  // Free the namespaces information buffer
  //
  if (Private->NamespaceInfo != NULL) {
    FreePool (Private->NamespaceInfo);
    Private->NamespaceInfo = NULL;
  }

  //
  // Free the controller private data structure
  //
  FreePool (Private);
  return;
}


text:
package colossus.metrics

import akka.actor._

import scala.concurrent.duration._

import java.util.concurrent.ConcurrentHashMap

import scala.language.higherKinds
import scala.reflect.ClassTag

/**
 * The base trait for any exported value from an event collector
 *
 * This requires that every matric value is a semi-group (associative +
 * operation), however they should really be monoids (semi-group with a zero
 * value).  Unfortunately this cannot be enforced by this trait since these are
 * passed in actor messages and must be monomorphic
 */
trait MetricValue {
  def + (b: MetricValue): MetricValue

  def value: RawMetricValue
}

class EventCollectorException(message: String) extends Exception(message)

object MetricValues {

  def wrongType(left: MetricValue, right: MetricValue): Nothing = throw new EventCollectorException(s"Attempted to merge incompatible values $left, $right")

  case class SumValue(value: Long) extends MetricValue {
    def +(b: MetricValue) = b match {
      case SumValue(bval) => SumValue(value + bval)
      case _ => wrongType(this, b)
    }

  }

  /**
   * In most cases a weight is a count
   */
  case class WeightedAverageValue(value: Long, weight: Long) extends MetricValue {
    def +(other: MetricValue) = other match {
      case WeightedAverageValue(v, w) => {
        val wsum = weight + w
        if (wsum > 0) {
          WeightedAverageValue(((value * weight) + (v * w)) / wsum, wsum)
        } else {
          WeightedAverageValue(0, 0)
        }
      }
      case _ => wrongType(this, other)
    }

  }

  case class MinValue(value: Long) extends MetricValue {
    def +(other: MetricValue) = other match {
      case MinValue(v) => MinValue(math.min(v, value))
      case _ => wrongType(this, other)
    }

  }

  case class MaxValue(value: Long) extends MetricValue {
    def +(other: MetricValue) = other match {
      case MaxValue(v) => MaxValue(math.max(v, value))
      case _ => wrongType(this, other)
    }

  }

  /**
   * This value is intended for metrics that are unique and should never need to be aggregated
   */
  case class BasicValue(value: Long) extends MetricValue {
    def +(other: MetricValue) = wrongType(this, other)
  }

}

trait MetricEvent {
  def address: MetricAddress
}

case class MetricSystemConfig(tickPeriod: FiniteDuration = 1.second)

sealed trait Locality
trait SharedLocality extends Locality
trait LocalLocality  extends Locality with MetricProducer {
  def event: PartialFunction[MetricEvent, Unit]
}

trait EventLocality[E <: EventCollector]
object EventLocality {
  type Shared[E <: EventCollector] = E with SharedLocality
  type Local[E <: EventCollector] = E with LocalLocality
}
import EventLocality._

case class CollectionContext(globalTags: TagMap, interval: FiniteDuration)

trait EventCollector {
  def address: MetricAddress
}

/**
 * Since we are basically requiring every EventCollector to be constructed with
 * a single parameter (which should be a case class), this trait is required to
 * be extended by that parameter.  The type parameter exists solely for the
 * purpose of type inference, so we can do getOrAdd(Rate(...)), and simply by
 * supplying the Rate (which returns a RateParams, which extends
 * MetricParams[Rate]), the method can infer that it should be returning a Rate
 */
trait MetricParams[E <: EventCollector, T] {self: T =>
  //not sure if this is needed
  val address: MetricAddress

  //we need the f-bound polymorphism to retain the transformed type
  def transformAddress(f: MetricAddress => MetricAddress): T
}

trait TickedCollector extends EventCollector {
  def tick(tickPeriod: FiniteDuration)
}

/**
 * This is passed to new event collectors in addition to their own config.
 *
 * TODO: we might want to include global tags in here as well, and remove them
 * from CollectionContext.  This would mean event collectors would be
 * constructed with global tagsinstead of them being passed in during
 * collection, but right now that basically already happens since the tags are
 * passed in during the collection's construction and then it passes it to each
 * collector
 *
 * @param intervals The aggregation intervals configured for the MetricSystem this collection belongs to
 */
case class CollectorConfig(intervals: Seq[FiniteDuration])

/**
 * This is a typeclass that is basically just an EventCollector factory.
 *
 */
trait Generator[C <: EventCollector, P] {
  //notice - we "should" restrict the P type to be a subtype of MetricParams[T],
  //however that makes this incompatible with the type parameters of the
  //collection's getOrAdd method.  And we are not allow to add view-bounds to a
  //trait, so for now we're kind of stuck

  /**
   * Generate a local collector given the params object
   */
  def local(params: P, collectorConfig: CollectorConfig): C with LocalLocality

  /**
   * Generate a shared collector given the params object
   */
  def shared(params:P, collectorConfig: CollectorConfig)(implicit collector: ActorRef): C with SharedLocality
}

trait Collection[L <: Locality] {
  import Collection.ParamsFor
  //notice - the type lambda is basically the same as a view bounds (P <%
  //MetricParams[U]), but view bounds are deprecated.  We need this instead of
  //just subtype (P <: MetricParams[U]) becuase for some reason type inference
  //fails when we do that
  def getOrAdd[T <: EventCollector : ClassTag, P : ParamsFor[T]#Type](params: P)(implicit generator: Generator[T,P]): T with L

}
object Collection {
  type ParamsFor[U <: EventCollector] = ({type Type[P] = P => MetricParams[U,P]})
}

class DuplicateMetricException(message: String) extends Exception(message)

/**
 * A Local collection is designed only to be used inside an actor or otherwise
 * thread-safe environment.  Notice that even though the collection we're
 * storing the event collectors is thread-safe, the collectors themselves are
 * not.  The collector actor must be the actor receiving events for metrics in
 * the map
 *
 * note - this is not intended to be directly constructed by users
 */
class LocalCollection(
  namespace: MetricAddress = MetricAddress.Root,
  val globalTags: TagMap = TagMap.Empty,
  val intervals: Seq[FiniteDuration] = Nil,
  metrics:ConcurrentHashMap[MetricAddress, Local[EventCollector]] = new ConcurrentHashMap[MetricAddress, Local[EventCollector]],
  parent: Option[LocalCollection] = None
) extends Collection[LocalLocality] {
  import Collection.ParamsFor
  import LocalCollection._

  val localProducers = collection.mutable.ArrayBuffer[MetricProducer]()

  val collectorConfig = CollectorConfig(intervals)

  def getOrAdd[T <: EventCollector : ClassTag, P : ParamsFor[T]#Type](_params: P)(implicit creator: Generator[T, P]): Local[T] = {
    val params: P = _params.transformAddress(namespace / _)
    parent.map{_.getOrAdd(params)}.getOrElse {
      val created = creator.local(params, collectorConfig)
      metrics.putIfAbsent(params.address, created: Local[EventCollector]) match {
        case null => created
        case exists: T => {
          //because of type erasure, if we try to match against
          //Local[T] or T with LocalLocality[T], it creates false positives (it
          //thinks a Local[Counter] is the same type as a Local[Rate]), bad :(
          exists.asInstanceOf[Local[T]]
        }
        case other => throw new DuplicateMetricException(s"An event collector of type ${other.getClass.getSimpleName} already exists")
      }
    }
  }

  def handleEvent(event: MetricEvent): EventResult = {
    Option(metrics.get(event.address)).map{c =>
      c.event.andThen{_ => Ok}.orElse[MetricEvent,EventResult]({
        case _ => InvalidEvent
      })(event)
    }.getOrElse{
      UnknownMetric
    }

  }

  def attach(producer: MetricProducer) {
    localProducers += producer
  }

  def aggregate(interval: FiniteDuration): MetricMap = {
    //do not move this import unless you want to have a bad time
    import scala.collection.JavaConversions._
    val now = System.currentTimeMillis
    val context = CollectionContext(globalTags, interval)
    val eventMetrics = metrics.values.map{_.metrics(context)}
    val producerMetrics = localProducers.map{_.metrics(context)}
    //TODO: using <+> here should be unnecessary, might want to use ++
    (eventMetrics ++ producerMetrics)
      .foldLeft[MetricMap](Map()){case (build, m) => build <+> m}
      .filter{! _._2.isEmpty}
  }

  //TODO this method is probably not needed, can be merged with aggregate
  def tick(tickPeriod: FiniteDuration) {
    import scala.collection.JavaConversions._
    metrics.values.collect{
      case t: TickedCollector => t.tick(tickPeriod)
    }
  }

  def subCollection(subSpace: MetricAddress = MetricAddress.Root, subTags: TagMap = TagMap.Empty) = {
    new LocalCollection(subSpace, subTags, intervals, metrics, Some(this))
  }

}

object LocalCollection {
  sealed trait EventResult
  sealed trait EventError extends EventResult

  case object InvalidEvent extends EventError
  case object UnknownMetric extends EventError
  case object Ok extends EventResult
}

/**
 * A Shared collection is a collection where every metric it returns is
 * completely thread-safe.  A Shared collection is useful if you want to pass
 * one collection to many actors, but be aware that since every event is sent
 * as a separate actor message (as opposed to local collections which collect
 * events just as function calls), this should not be used for very-high
 * frequency events.
 */
class SharedCollection private[colossus](val local: LocalCollection, val collector: ActorRef) extends Collection[SharedLocality] {

  import Collection.ParamsFor

  def getOrAdd[T <: EventCollector : ClassTag, P : ParamsFor[T]#Type](params: P)(implicit creator: Generator[T, P]): Shared[T] = {
    //create the actual collector
    local.getOrAdd(params)
    //get a shared interface for it
    creator.shared(params, CollectorConfig(local.intervals))(collector)
  }

  def shared = this
}

object SharedCollection {

  def apply(globalTags: TagMap = TagMap.Empty)(implicit system: MetricSystem, fact: ActorRefFactory): SharedCollection = {

    val metrics = new ConcurrentHashMap[MetricAddress, Local[EventCollector]]
    val local = new LocalCollection(MetricAddress.Root, globalTags, system.metricIntervals.keys.toSeq, metrics)

    val collector = fact.actorOf(Props(classOf[Collector], system, local))

    new SharedCollection(local, collector)
  }

}


text:
(function($){

$.extend(true, window.Parsley, {
  asyncValidators: {
    'default': {
      fn: function (xhr) {
        return 'resolved' === xhr.state();
      },
      url: false
    },
    reverse: {
      fn: function (xhr) {
        // If reverse option is set, a failing ajax request is considered successful
        return 'rejected' === xhr.state();
      },
      url: false
    }
  },

  addAsyncValidator: function (name, fn, url, options) {
    window.Parsley.asyncValidators[name.toLowerCase()] = {
      fn: fn,
      url: url || false,
      options: options || {}
    };

    return this;
  },

  eventValidate: function (event) {
    // For keyup, keypress, keydown.. events that could be a little bit obstrusive
    // do not validate if val length < min threshold on first validation. Once field have been validated once and info
    // about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.
    if (new RegExp('key').test(event.type))
      if (!this._ui.validationInformationVisible && this.getValue().length <= this.options.validationThreshold)
        return;

    this._ui.validatedOnce = true;
    this.whenValidate();
  }
});

window.Parsley.addValidator('remote', {
  requirementType: {
    '': 'string',
    'validator': 'string',
    'reverse': 'boolean',
    'options': 'object'
  },

  validateString: function (value, url, options, instance) {
    var
      data = {},
      ajaxOptions,
      csr,
      validator = options.validator || (true === options.reverse ? 'reverse' : 'default');

    if ('undefined' === typeof window.Parsley.asyncValidators[validator])
      throw new Error('Calling an undefined async validator: `' + validator + '`');

    // Fill data with current value
    data[instance.$element.attr('name') || instance.$element.attr('id')] = value;

    // Merge options passed in from the function with the ones in the attribute
    var remoteOptions = $.extend(true, options.options || {} , window.Parsley.asyncValidators[validator].options);

    // All `$.ajax(options)` could be overridden or extended directly from DOM in `data-parsley-remote-options`
    ajaxOptions = $.extend(true, {}, {
      url: window.Parsley.asyncValidators[validator].url || url,
      data: data,
      type: 'GET'
    }, remoteOptions);

    // Generate store key based on ajax options
    csr = $.param(ajaxOptions);

    // Initialise querry cache
    if ('undefined' === typeof window.Parsley._remoteCache)
      window.Parsley._remoteCache = {};

    // Try to retrieve stored xhr
    var xhr = window.Parsley._remoteCache[csr] = window.Parsley._remoteCache[csr] || $.ajax(ajaxOptions);

    var handleXhr = function() {
      var result = window.Parsley.asyncValidators[validator].fn.call(instance, xhr, url, options);
      if (!result) // Map falsy results to rejected promise
        result = $.Deferred().reject();
      return $.when(result);
    };

    return xhr.then(handleXhr, handleXhr);
  },

  priority: -1
});

window.Parsley.on('form:submit', function () {
  window.Parsley._remoteCache = {};
});

window.ParsleyExtend.addAsyncValidator = function () {
  window.ParsleyUtils.warnOnce('Accessing the method `addAsyncValidator` through an instance is deprecated. Simply call `window.Parsley.addAsyncValidator(...)`');
  return window.Parsley.apply(window.Parsley.addAsyncValidator, arguments);
};

})(jQuery);


text:
enyo.kind({
	name: "App",
	kind: enyo.VFlexBox,
	components: [
		{kind: "Button", caption: "Open Image Popup", onclick: "openPopupClick"},
		{kind: "Button", caption: "Open ImageView Popup", onclick: "openViewImagePopupClick"},
		{kind: "Popup", onBeforeOpen: "beforePopupOpen", components: [
			{content: "Some images"},
			{kind: "Image", onload: "imageLoad"},
			{kind: "HFlexBox", components: [
				{kind: "Button", caption: "Next", onclick: "nextClick", flex: 1},
				{kind: "Button", caption: "Close", popupHandler: true, flex: 1}
			]}
		]},
		{name: "viewImagePopup", kind: "Popup", layoutKind: "VFlexLayout",
			height: "500px", width: "500px", onBeforeOpen: "beforeViewImagePopupOpen", components: [
			{content: "Image Viewer"},
			{kind: "ImageView", flex: 1, style: "border: 1px solid black;"},
			{kind: "HFlexBox", components: [
				{kind: "Button", caption: "Next", onclick: "nextImageViewClick", flex: 1},
				{kind: "Button", caption: "Close", popupHandler: true, flex: 1}
			]}
		]}
	],
	index: 0,
	create: function() {
		this.inherited(arguments);
	},
	images: ["images/1.jpg", "images/2.jpg"],
	openPopupClick: function() {
		this.$.popup.openAtCenter();
	},
	openViewImagePopupClick: function() {
		this.$.viewImagePopup.openAtCenter();
	},
	beforePopupOpen: function() {
		this.updateImage();
	},
	nextClick: function() {
		// hide image while switching to smooth transition
		this.$.popup.applyStyle("visibility", "hidden");
		this.index = (this.index +1) % this.images.length;
		this.updateImage();
	},
	updateImage: function() {
		this.$.image.setSrc(this.images[this.index]);
	},
	imageLoad: function() {
		this.$.popup.resized();
		// show after a slight delay.
		enyo.asyncMethod(this, function() {
			this.$.popup.applyStyle("visibility", null);
		});
	},
	//
	beforeViewImagePopupOpen: function() {
		this.updateViewImage();
	},
	nextImageViewClick: function() {
		this.index = (this.index +1) % this.images.length;
		this.updateViewImage();
	},
	updateViewImage: function() {
		this.$.imageView.setCenterSrc(this.images[this.index]);
	}
});


text:
/**
* jQuery ligerUI 1.2.2
*
* http://ligerui.com
*
* Author daomi 2013 [ gd_star@163.com ]
*
*/
(function ($)
{
    $.fn.ligerMenuBar = function (options)
    {
        return $.ligerui.run.call(this, "ligerMenuBar", arguments);
    };
    $.fn.ligerGetMenuBarManager = function ()
    {
        return $.ligerui.run.call(this, "ligerGetMenuBarManager", arguments);
    };

    $.ligerDefaults.MenuBar = {};

    $.ligerMethos.MenuBar = {};

    $.ligerui.controls.MenuBar = function (element, options)
    {
        $.ligerui.controls.MenuBar.base.constructor.call(this, element, options);
    };
    $.ligerui.controls.MenuBar.ligerExtend($.ligerui.core.UIComponent, {
        __getType: function ()
        {
            return 'MenuBar';
        },
        __idPrev: function ()
        {
            return 'MenuBar';
        },
        _extendMethods: function ()
        {
            return $.ligerMethos.MenuBar;
        },
        _render: function ()
        {
            var g = this, p = this.options;
            g.menubar = $(this.element);
            if (!g.menubar.hasClass("l-menubar")) g.menubar.addClass("l-menubar");
            if (p && p.items)
            {
                $(p.items).each(function (i, item)
                {
                    g.addItem(item);
                });
            }
            $(document).click(function ()
            {
                $(".l-panel-btn-selected", g.menubar).removeClass("l-panel-btn-selected");
            });
            g.set(p);
        },
        addItem: function (item)
        {
            var g = this, p = this.options;
            var ditem = $('

');
            g.menubar.append(ditem);
            item.id && ditem.attr("menubarid", item.id);
            item.text && $("span:first", ditem).html(item.text);
            item.disable && ditem.addClass("l-menubar-item-disable");
            item.click && ditem.click(function () { item.click(item); });
            if (item.menu)
            {
                var menu = $.ligerMenu(item.menu);
                ditem.hover(function ()
                {
                    g.actionMenu && g.actionMenu.hide();
                    var left = $(this).offset().left;
                    var top = $(this).offset().top + $(this).height();
                    menu.show({ top: top, left: left });
                    g.actionMenu = menu;
                    $(this).addClass("l-panel-btn-over l-panel-btn-selected").siblings(".l-menubar-item").removeClass("l-panel-btn-selected");
                }, function ()
                {
                    $(this).removeClass("l-panel-btn-over");
                });
            }
            else
            {
                ditem.hover(function ()
                {
                    $(this).addClass("l-panel-btn-over");
                }, function ()
                {
                    $(this).removeClass("l-panel-btn-over");
                });
                $(".l-menubar-item-down", ditem).remove();
            }

        }
    });

})(jQuery);


text:
angular.module('deco').directive('decoNavLinks',
        ['$location', function ($location) {
            return {
              restrict: 'E',
              templateUrl: 'deco.navLinks',
              scope: {
                links: '=links',
                doesFit: '=doesFit',
                permission: '=permission'
              },
              link: function ($scope, element, attrs) {
                $scope.type = attrs.type;
                // redirect to new path
                $scope.goto = function (path) {
                  $('.sublinks').removeClass('show');
                  $location.path(path);
                };

                // is current path active
                $scope.isActive = function (linkPath) {
                  var match = $location.path().match('^' + linkPath);
                  if (match != null && match[0] == linkPath) {
                    return true;
                  }
                  return false;
                }

                $scope.permissionControl = function(node){
                  if (node && 'permissions' in node){
                    return $scope.permission(node.permissions);
                  }
                  return true;

                };

                // activated when main link extender is clicked
                $scope.toggleSubLinksIn = function (event) {
                  var el = event.currentTarget;
                  event.stopPropagation();
                  var sublinks = $(el).parent().parent().children()[1];
                  if ($(sublinks).hasClass('show')) {
                    $(sublinks).removeClass('show');
                  }
                  else {
                    $(sublinks).addClass('show');
                  }
                };

                // has sublinks
                $scope.showAny = function (collection) {
                  for (var key in collection) {
                    if (collection.hasOwnProperty(key) &&
                            collection[key].PageSchema.isActive &&
                            collection[key].PageSchema.showInIndex) {
                      return true;
                    }
                  }
                  return false;
                };

                // to test main link action icon if sublinks are opened, fix this
                // use element to determine, this is only ng-class related thing
                $scope.areSublinksOpened = function (index) {
                  var sublinks = $(element).find('.sublinks')[index];
                  return $(sublinks).hasClass('show');
                };
              }
            };
          }]);


text:
package org.jboss.quickstarts.ws.client;

import org.jboss.quickstarts.ws.jaxws.samples.retail.profile.Customer;
import org.jboss.quickstarts.ws.jaxws.samples.retail.profile.DiscountRequest;
import org.jboss.quickstarts.ws.jaxws.samples.retail.profile.DiscountResponse;
import org.jboss.quickstarts.ws.jaxws.samples.retail.profile.ProfileMgmt;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;

/**
 *
 * @author rsearls@redhat.com
 */
public class Client {

    public static void main(String[] args)
    {
        String endPointAddress = "http://localhost:8080/jboss-jaxws-retail/ProfileMgmtService/ProfileMgmt";
        QName serviceName = new QName("http://org.jboss.ws/samples/retail/profile", "ProfileMgmtService");

        try {
            URL wsdlURL = new URL(endPointAddress + "?wsdl");
            Service service = Service.create(wsdlURL, serviceName);
            ProfileMgmt proxy = service.getPort(ProfileMgmt.class);

            Customer customer = new Customer();
            customer.setFirstName("Jay");
            customer.setLastName("Boss");
            customer.setCreditCardDetails("newbie");
            DiscountRequest dRequest = new DiscountRequest();
            dRequest.setCustomer(customer);

            DiscountResponse dResponse = proxy.getCustomerDiscount(dRequest);
            Customer responseCustomer = dResponse.getCustomer();
            System.out.format("%s %s\'s discount is %.2f%n", responseCustomer.getFirstName(),
                responseCustomer.getLastName(), dResponse.getDiscount());

        } catch (Exception e) {
            System.out.println(e);
        }
    }
}


text:
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace GitCandy.DAL.Mapping
{
    public class AuthorizationLogMap : EntityTypeConfiguration<AuthorizationLog>
    {
        public AuthorizationLogMap()
        {
            // Primary Key
            this.HasKey(t => t.AuthCode);

            // Properties
            this.Property(t => t.IssueIp)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.LastIp)
                .IsRequired()
                .HasMaxLength(40);

            // Table & Column Mappings
            this.ToTable("AuthorizationLog");
            this.Property(t => t.AuthCode).HasColumnName("AuthCode");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.IssueDate).HasColumnName("IssueDate");
            this.Property(t => t.Expires).HasColumnName("Expires");
            this.Property(t => t.IssueIp).HasColumnName("IssueIp");
            this.Property(t => t.LastIp).HasColumnName("LastIp");
            this.Property(t => t.IsValid).HasColumnName("IsValid");

            // Relationships
            this.HasRequired(t => t.User)
                .WithMany(t => t.AuthorizationLogs)
                .HasForeignKey(d => d.UserID);

        }
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.osconfig.v1beta.model;

/**
 * Information related to the a standard versioned package. This includes package info for APT, Yum,
 * Zypper, and Googet package managers.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the OS Config API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class InventoryVersionedPackage extends com.google.api.client.json.GenericJson {

  /**
   * The system architecture this package is intended for.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String architecture;

  /**
   * The name of the package.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String packageName;

  /**
   * The version of the package.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String version;

  /**
   * The system architecture this package is intended for.
   * @return value or {@code null} for none
   */
  public java.lang.String getArchitecture() {
    return architecture;
  }

  /**
   * The system architecture this package is intended for.
   * @param architecture architecture or {@code null} for none
   */
  public InventoryVersionedPackage setArchitecture(java.lang.String architecture) {
    this.architecture = architecture;
    return this;
  }

  /**
   * The name of the package.
   * @return value or {@code null} for none
   */
  public java.lang.String getPackageName() {
    return packageName;
  }

  /**
   * The name of the package.
   * @param packageName packageName or {@code null} for none
   */
  public InventoryVersionedPackage setPackageName(java.lang.String packageName) {
    this.packageName = packageName;
    return this;
  }

  /**
   * The version of the package.
   * @return value or {@code null} for none
   */
  public java.lang.String getVersion() {
    return version;
  }

  /**
   * The version of the package.
   * @param version version or {@code null} for none
   */
  public InventoryVersionedPackage setVersion(java.lang.String version) {
    this.version = version;
    return this;
  }

  @Override
  public InventoryVersionedPackage set(String fieldName, Object value) {
    return (InventoryVersionedPackage) super.set(fieldName, value);
  }

  @Override
  public InventoryVersionedPackage clone() {
    return (InventoryVersionedPackage) super.clone();
  }

}


text:
var Promise = require('bluebird');
var errors = require('../errors');

module.exports = function (direction) {
	if (direction === 'h') {
		return Promise.resolve({ image: this.image.flip() });
	} else if (direction === 'v') {
		return Promise.resolve({ image: this.image.flop() });
	} else {
		return Promise.reject(new errors.MalformedOperations('Unknown flip direction "' + direction + '"'));
	}
};