text:
package com.github.leeyazhou.scf.server.util;

import java.security.SecureRandom;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;

public class DESUtil {

  private Cipher encryptCipher = null;
  private Cipher decryptCipher = null;

  /**
   * 获取实例
   *
   * @param key 密钥,长度必须是8的倍数
   * @return
   * @throws Exception
   */
  public static DESUtil getInstance(String key) throws Exception {
    return new DESUtil(key);
  }

  /**
   *
   * @param key 密钥,长度必须是8的倍数
   * @throws Exception
   */
  private DESUtil(String key) throws Exception {
    if (key == null || key.length() % 8 != 0) {
      throw new Exception("key不合法, 长度必须是8的倍数");
    }
    byte[] bufKey = key.getBytes("utf-8");

    {
      SecureRandom sr = new SecureRandom();
      DESKeySpec dks = new DESKeySpec(bufKey);
      SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
      SecretKey securekey = keyFactory.generateSecret(dks);
      encryptCipher = Cipher.getInstance("DES");
      encryptCipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
    }

    {
      SecureRandom sr = new SecureRandom();
      DESKeySpec dks = new DESKeySpec(bufKey);
      SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
      SecretKey securekey = keyFactory.generateSecret(dks);
      decryptCipher = Cipher.getInstance("DES");
      decryptCipher.init(Cipher.DECRYPT_MODE, securekey, sr);
    }
  }

  /**
   * 加密
   *
   * @param src 原文
   * @return 密文
   * @throws Exception
   */
  public byte[] encrypt(byte[] src) throws Exception {
    return encryptCipher.doFinal(src);
  }

  /**
   * 解密
   *
   * @param dest 密文
   * @return 原文
   * @throws Exception
   */
  public byte[] decrypt(byte[] dest) throws Exception {
    return decryptCipher.doFinal(dest);
  }
}


text:
include $(srctree)/drivers/misc/mediatek/Makefile.custom

obj-y += nt35582_rgb_6575.o

redpajama_set_name: RedPajamaGithub


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';

import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatDividerModule } from '@angular/material/divider';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSliderModule } from '@angular/material/slider';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTreeModule } from '@angular/material/tree';

import { BusinessCardModule } from 'src/app/utils/business-card/business-card.module';

import { FibonacciComponent } from './fibonacci/fibonacci.component';
import { FactorialComponent } from './factorial/factorial.component';
import { PythagorasComponent } from './pythagoras/pythagoras.component';
import { SierpinskiTriangleComponent } from './sierpinski-triangle/sierpinski-triangle.component';
import { SieveAtkinComponent } from './sieve-atkin/sieve-atkin.component';
import { SieveEratosthenesComponent } from './sieve-eratosthenes/sieve-eratosthenes.component';
import { SphereComponent } from './sphere/sphere.component';
import { SpiralSacksComponent } from './spiral-sacks/spiral-sacks.component';
import { SpiralUlamComponent } from './spiral-ulam/spiral-ulam.component';
import { TheoremsComponent } from './theorems.component';
import { TheoremEuclidEulerComponent } from './euclid-euler/euclid-euler.component';

@NgModule({
  imports: [
    FormsModule, CommonModule,

    BusinessCardModule,

    MatCardModule, MatButtonModule, MatIconModule, MatListModule, MatDividerModule, MatFormFieldModule, MatInputModule,
    MatTreeModule, MatGridListModule, MatMenuModule, MatTableModule, MatPaginatorModule, MatSelectModule,
    MatSortModule, MatToolbarModule, MatSidenavModule, MatInputModule, MatSelectModule, MatRadioModule,
    MatSliderModule, MatTabsModule,

    RouterModule.forRoot([
      {
        path: 'theorems',
        component: TheoremsComponent
      }
    ])
  ],
  exports: [TheoremsComponent],
  declarations: [
    FactorialComponent, FibonacciComponent, PythagorasComponent, SierpinskiTriangleComponent, SieveAtkinComponent, SieveEratosthenesComponent,
    SphereComponent, SpiralSacksComponent, SpiralUlamComponent, TheoremEuclidEulerComponent, TheoremsComponent,
  ]
})
export class TheoremsModule { }


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. Imp. Bur. Plant Breed. & Genet. , Cambridge 125. 1944

#### Original name
null

### Remarks
null


text:
#include "bio-pch.h"

#include "bio/defs.h"

#include "bio/equivalent_factors.h"
#include "bio/biobase_db.h"
#include "bio/biobase_data_traits.h"
#include "bio/environment.h"
#include "bio/serialisable.h"

#include <boost/filesystem/fstream.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/progress.hpp>
namespace fs = boost::filesystem;

#include <iostream>

BIO_NS_START

void
get_all_pssms(pssm_set & pssms)
{
	//
	// Construct a set of all the pssms we know about...
	//

	//put each matrix in the pssm set
	for (Matrix::map_t::const_iterator m = BiobaseDb::singleton().get_matrices().begin();
		BiobaseDb::singleton().get_matrices().end() != m;
		++m)
	{
		pssms.insert(m->second.get());
	}

	//put each consensus site in the pssm set
	for (Site::map_t::const_iterator s = BiobaseDb::singleton().get_sites().begin();
		BiobaseDb::singleton().get_sites().end() != s;
		++s)
	{
		if ("CONS" == s->second->id.factor)
		{
			pssms.insert(s->second.get());
		}
	}

	std::cout << "Found " << pssms.size() << " pssms\n";
}

Factor *
FactorEquivalence::get_factor(unsigned factor_acc_number)
{
	return BiobaseDb::singleton().get_entry<FACTOR_DATA>(TableLink(FACTOR_DATA, factor_acc_number));
}

EquivalentFactors::ptr_t EquivalentFactors::construct_from_biobase()
{
	EquivalentFactors::ptr_t result(new EquivalentFactors);

	result->init_from_biobase();

	return result;
}

void EquivalentFactors::init_from_biobase()
{
	std::cout << "Building list of factor synonyms from Biobase\n";
	boost::progress_timer timer;

	//remove any existing partitions
	partitions.clear();

	//
	// Construct a set of all the pssms we know about...
	//
	pssm_set pssms;
	get_all_pssms(pssms);

	//
	// Look at each pssm
	//
	for (pssm_set::const_iterator p = pssms.begin();
		pssms.end() != p;
		++p)
	{
		const FactorLinkList & factors = (*p)->get_factors();

		//for each factor
		for (FactorLinkList::const_iterator f = factors.begin();
			factors.end() != f;
			++f)
		{
			//if it exists in biobase
			if (0 != BiobaseDb::singleton().get_entry<FACTOR_DATA>(f->get()->link))
			{
				add_object(f->get()->link.entry_idx);
			}
		}
	}
}

unsigned
EquivalentFactors::get_indicative_acc_id( partition_ptr_t partition )
{
	if( 0 == partition )
	{
		throw std::logic_error( "Null pointer in EquivalentFactors::get_indicative_acc_id()" );
	}

	return *( partition->begin() );
}

void
EquivalentFactors::init_singleton()
{
	deserialise_or_init< false >(
		*this,
		fs::path(
			BioEnvironment::singleton().get_factor_synonyms_file()
		),
		boost::bind< void >(
			&EquivalentFactors::init_from_biobase,
			_1
		)
	);
}

EquivalentFactors::partition_set_t
EquivalentFactors::get_factors_for(BiobaseTablePssmEntry * pssm) const
{
	partition_set_t result;

	const FactorLinkList & factors = pssm->get_factors();

	//for each factor
	for (FactorLinkList::const_iterator f = factors.begin();
		factors.end() != f;
		++f)
	{
		partition_ptr_t partition = find_partition(f->get()->link.entry_idx);
		if (0 != partition)
		{
			result.insert(partition);
		}
	}

	return result;
}

std::string
EquivalentFactors::get_name_for(partition_ptr_t factor)
{
	if (factor->empty())
	{
		throw std::logic_error("Factor partition empty");
	}

	Factor * f = BiobaseDb::singleton().get_entry< FACTOR_DATA >(*(factor->begin()));
	if (0 == f)
	{
		throw std::logic_error("Could not find factor in Biobase");
	}

	return f->get_name();
}

const EquivalentFactorKeyTransformer::result_type &
EquivalentFactorKeyTransformer::operator()( const result_type & partition ) const
{
	return partition;
}

EquivalentFactorKeyTransformer::result_type
EquivalentFactorKeyTransformer::operator()( const TableLink & factor ) const
{
	return EquivalentFactors::singleton().get_partition( factor.entry_idx );
}

BIO_NS_END


text:
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use JSON;
use lib "..";
use SeccubusV2;
use SeccubusScans;

my $query = CGI::new();
my $json = JSON->new();

print $query->header(-type => "application/json", -expires => "-1d", -"Cache-Control"=>"no-store, no-cache, must-revalidate", -"X-Clacks-Overhead" => "GNU Terry Pratchett");

my $params = $query->Vars;
my $scan_id = $params->{id};
my $workspace_id = $params->{workspace};
my $name = $params->{name};
my $scanner = $params->{scanner};
my $parameters = $params->{parameters};
my $password = $params->{password};
my $targets = $params->{targets};

# Return an error if the required parameters were not passed
if (not (defined ($scan_id))) {
	bye("Parameter id is missing");
};
if (not (defined ($workspace_id))) {
	bye("Parameter workspace is missing");
};
if (not (defined ($name))) {
	bye("Parameter name is missing");
};
if (not (defined ($scanner))) {
	bye("Parameter scanner is missing");
};
if (not (defined ($parameters))) {
	bye("Parameter parameters is missing");
};
if (not (defined ($password))) {
        bye("update Parameter password is missing");
};
if (not (defined ($targets))) {
	bye("Parameter targets is missing");
};

eval {
	my @data = ();
	update_scan($workspace_id,$scan_id,$name,$scanner,$parameters,$password,$targets);
	push @data, {
		name		=> $name,
		scanner		=> $scanner,
		parameters	=> $parameters,
		password	=> $password,
		targets		=> $targets,
	};
	print $json->pretty->encode(\@data);
} or do {
	bye(join "\n", $@);
};

sub bye($) {
	my $error=shift;
	print $json->pretty->encode([{ error => $error }]);
	exit;
}


text:
using System;
using System.Linq;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RoslynAnalyzer11;
using SonarQube.Plugins.Test.Common;

namespace SonarQube.Plugins.Roslyn.RuleGeneratorTests
{
    [TestClass]
    public class RulesGeneratorTests
    {
        public TestContext TestContext { get; set; }

        #region Tests

        [TestMethod]
        public void RuleGen_SimpleRules()
        {
            // Arrange
            TestLogger logger = new TestLogger();
            ConfigurableAnalyzer analyzer = new ConfigurableAnalyzer();
            var diagnostic1 = analyzer.RegisterDiagnostic(key: "DiagnosticID1", description: "Some description", helpLinkUri: "www.bing.com", tags: new[] { "unnecessary" });
            var diagnostic2 = analyzer.RegisterDiagnostic(key: "Diagnostic2", description: "");

            IRuleGenerator generator = new RuleGenerator(logger);

            // Act
            Rules rules = generator.GenerateRules(new[] { analyzer });

            // Assert
            AssertExpectedRuleCount(2, rules);

            Rule rule1 = rules.Single(r => r.Key == diagnostic1.Id);
            VerifyRule(diagnostic1, rule1);

            rule1.Description.Contains(diagnostic1.Description.ToString()).Should().BeTrue("Invalid rule description");
            rule1.Description.Contains(diagnostic1.HelpLinkUri).Should().BeTrue("Invalid rule description");
            rule1.Description.Trim().StartsWith("<![CDATA").Should().BeFalse("Description should not be formatted as a CData section");

            Rule rule2 = rules.Single(r => r.Key == diagnostic2.Id);
            VerifyRule(diagnostic2, rule2);

            rule2.Description.Contains(UIResources.RuleGen_NoDescription).Should().BeTrue("Invalid rule description");
        }

        [TestMethod]
        public void CheckNoTags()
        {
            // Arrange
            TestLogger logger = new TestLogger();
            ConfigurableAnalyzer analyzer = new ConfigurableAnalyzer();
            analyzer.RegisterDiagnostic(key: "DiagnosticID1", tags: new[] { "t1" });
            analyzer.RegisterDiagnostic(key: "DiagnosticID2", tags: new[] { "T2" });

            IRuleGenerator generator = new RuleGenerator(logger);

            // Act
            Rules rules = generator.GenerateRules(new[] { analyzer });

            // Assert
            foreach (Rule rule in rules)
            {
                VerifyRuleValid(rule);

                rule.Tags.Should().BeNull();
            }
        }

        [TestMethod]
        public void RulesMustHaveDescription()
        {
            // Arrange
            TestLogger logger = new TestLogger();
            ConfigurableAnalyzer analyzer = new ConfigurableAnalyzer();
            analyzer.RegisterDiagnostic(key: "DiagnosticID1", description: null);
            analyzer.RegisterDiagnostic(key: "DiagnosticID1", description: "");
            analyzer.RegisterDiagnostic(key: "DiagnosticID2", description: " ");

            IRuleGenerator generator = new RuleGenerator(logger);

            // Act
            Rules rules = generator.GenerateRules(new[] { analyzer });

            // Assert
            foreach (Rule rule in rules)
            {
                VerifyRuleValid(rule);

                rule.Description.Should().Be(UIResources.RuleGen_NoDescription);
            }
        }

        #endregion Tests

        #region Checks

        private static void AssertExpectedRuleCount(int expected, Rules rules)
        {
            rules.Should().NotBeNull("Generated rules list should not be null");
            expected.Should().Be(rules.Count, "Unexpected number of rules");
        }

        private static void VerifyRule(Microsoft.CodeAnalysis.DiagnosticDescriptor diagnostic, Rule rule)
        {
            diagnostic.Id.Should().Be(rule.Key, "Invalid rule key");
            diagnostic.Id.Should().Be(rule.InternalKey, "Invalid rule internal key");
            RuleGenerator.Cardinality.Should().Be(rule.Cardinality, "Invalid rule cardinality");
            RuleGenerator.Status.Should().Be(rule.Status, "Invalid rule status");

            rule.Name.Should().Be(diagnostic.Title.ToString(), "Invalid rule name");
            rule.Tags.Should().BeNull("No tags information should be derived from the diagnostics");

            VerifyRuleValid(rule);
        }

        /// <summary>
        /// Verifies that the rule will be accepted by SonarQube validation when rendered into XML.
        /// </summary>
        private static void VerifyRuleValid(Rule rule)
        {
            rule.Key.Should().NotBeNull();
            string.IsNullOrWhiteSpace(rule.Description).Should().BeFalse();
            if (rule.Tags != null)
            {
                foreach (String tag in rule.Tags)
                {
                    string.Equals(tag, tag.ToLowerInvariant(), StringComparison.InvariantCulture).Should().BeTrue();
                }
            }
        }

        #endregion Checks
    }
}


text:
<img
        class="ot-icon"
        ng-src="extension/general/decoration/net.nemerosa.ontrack.extension.general.MessageDecorationExtension/{{property.value.type}}.png"
        />
<span>{{property.value.text}}</span>


text:
This director is for production, and build occlum runable instance first.

You can see building command in [manually_build.yaml](https://github.com/intel-analytics/BigDL/blob/main/.github/workflows/manually_build.yml#L485) : bigdl-ppml-trusted-big-data-ml-scala-occlum-production.
It will build image normally, and then run occlum-build to build occlum runable instance (by running occlum init and build first) in /opt/occlum_spark. The default configuration is:
```bash
-e SGX_MEM_SIZE=20GB \
-e SGX_THREAD=2048 \
-e SGX_HEAP=1GB \
-e SGX_KERNEL_HEAP=1GB \
```

final_name=`intelanalytics/bigdl-ppml-trusted-big-data-ml-scala-occlum-production:${TAG}-build`. But the final image size is too large because there are too many dependencies in this image.

## Using BigDL PPML Occlum EHSM Attestation
Bigdl ppml use EHSM as reference KMS&AS, you can deploy EHSM following the [guide](https://github.com/intel-analytics/BigDL/tree/main/ppml/services/ehsm/kubernetes#deploy-bigdl-ehsm-kms-on-kubernetes-with-helm-charts)
We assume you have already set up environment and enroll yourself on EHSM.

In [start-spark-local.sh](https://github.com/intel-analytics/BigDL/blob/main/ppml/trusted-big-data-ml/scala/docker-occlum/production/start-spark-local.sh). Set `ATTESTATION` = true and modify `PCCL_URL`, `ATTESTATION_URL` to the env value you have set,
and modify `APP_ID`, `API_KEY` to the value you have get  when enroll, and then you can change `CHALLENGE` and
`REPORT_DATA` for attestation.

``` bash
#start-spark-local.sh
-e ATTESTATION=false \   set to true to start attestation.
-e PCCS_URL=https://PCCS_IP:PCCS_PORT \  PCCS URL, obtained from KMS services or a self-deployed one. Should match the format https://<ip_address>:<port>.
-e ATTESTATION_URL=ESHM_IP:EHSM_PORT \  URL of attestation service. Should match the format <ip_address>:<port>.
-e APP_ID=your_app_id \ The appId generated by your attestation service.
-e API_KEY=your_api_key \ The apiKey generated by your attestation service.
-e CHALLENGE=cHBtbAo= \ Challenge to get quote of attestation service which will be verified by local SGX SDK. Should be a BASE64 string. It can be a casual BASE64 string, for example, it can be generated by the command echo ppml|base64.
-e REPORT_DATA=ppml \ A random String to generator a quote which will be send to attestation service and use for attest. Default is ppml.
```
### Register and get policy_Id
1. Fill in the configuration above and Enter the occlum runable image.
```bash
bash start-spark-local.sh
```
2. Verify that the attestation server is trusted.
```bash
bash verify-attestation-service.sh
```
3. Register application on attestation server
```bash
bash RegisterMrEnclave.sh
```
4. Get the policy_Id and save for running this occlum application.
```bash
policy_Id ${policy_Id}
```


text:
<?xml version="1.0" encoding="UTF-8"?>
<document id="DDI-DrugBank.d100">
    <sentence id="DDI-DrugBank.d100.s0" text="Increased nephrotoxicity has been reported following concomitant administration of cephalosporins and aminoglycoside antibiotics.">
        <entity id="DDI-DrugBank.d100.s0.e0" charOffset="83-96"
            type="group" text="cephalosporins"/>
        <entity id="DDI-DrugBank.d100.s0.e1" charOffset="102-127"
            type="group" text="aminoglycoside antibiotics"/>
        <pair id="DDI-DrugBank.d100.s0.p0" e1="DDI-DrugBank.d100.s0.e0"
            e2="DDI-DrugBank.d100.s0.e1" ddi="true" type="effect"/>
    </sentence>
    <sentence id="DDI-DrugBank.d100.s1" text="Drug/Laboratory Test Interactions Cephalosporins, including cefotaxime sodium, are known to occasionally induce a positive direct Coombs test.">
        <entity id="DDI-DrugBank.d100.s1.e0" charOffset="34-47"
            type="group" text="Cephalosporins"/>
        <entity id="DDI-DrugBank.d100.s1.e1" charOffset="60-76"
            type="drug" text="cefotaxime sodium"/>
        <pair id="DDI-DrugBank.d100.s1.p0" e1="DDI-DrugBank.d100.s1.e0"
            e2="DDI-DrugBank.d100.s1.e1" ddi="false"/>
    </sentence>
</document>


text:
using Autofac;

namespace MyVote.UI.Helpers
{
    public static class Ioc
    {
		public static IContainer Container { get; set; }

		public static T Resolve<T>()
		{
			return Container.Resolve<T>();
		}

		public static object Resolve(System.Type objectType)
		{
			return Container.Resolve(objectType);
		}
	}
}


text:
package com.flushout.fomonitor;

import com.flushout.fomonitor.MainActivity;
import com.flushout.fomonitor.General.General;
import com.flushout.fomonitor.General.InternetStatus;
import com.flushout.fomonitor.Models.UserInfo;
import com.flushout.fomonitor.WebService.Synchronize;
import com.flushout.fomonitor.R;
import com.flushout.fomonitor.General.Font;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class ConfirmationActivity extends ActionBarActivity {

	private String activationCode;
	private String companyName;
	private String categoryId;
	Runnable registerTask = null;
	private String pin;

	private EditText txtUserName;
	private EditText txtUserEmail;
	ProgressDialog  dialog;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		Log.d("ConfirmationActivity", "1");
		super.onCreate(savedInstanceState);
        // Hide title bar Notification
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.confirmation_activity);
		Log.d("ConfirmationActivity", "2");
		TextView txtConfirmation_1 = (TextView) findViewById(R.id.txtConfirmation_1);
		TextView txtCompanyName = (TextView) findViewById(R.id.txtCompanyName);
		TextView txtConfirmation_2 = (TextView) findViewById(R.id.txtConfirmation_2);
		Log.d("ConfirmationActivity", "3");

		Intent intent = this.getIntent();
		Log.d("ConfirmationActivity", "4");
		activationCode = intent.getStringExtra("activationCode");
		companyName = intent.getStringExtra("companyName");
		categoryId = intent.getStringExtra("categoryId");
		pin = intent.getStringExtra("pin");
		Log.d("ConfirmationActivity", "5");
		txtCompanyName.setText(companyName);
		Log.d("ConfirmationActivity", "6");
		//Wizard_Open.pin
		Button btnNext = (Button) findViewById(R.id.btnNext);
		Log.d("ConfirmationActivity", "8");
		txtUserName = (EditText) findViewById(R.id.txtUserName);
		txtUserEmail = (EditText) findViewById(R.id.txtUserEmail);
		Log.d("ConfirmationActivity", "9 Ok");

	}

	public void goAccept(View view)
	{
		Log.d("ConfirmationActivity", "goAccept 1");
		if (!InternetStatus.isOnline())
		{
			Log.d("ConfirmationActivity", "goAccept 2");
			General.alertError(this, getResources().getString(R.string.network_error), getResources().getString(R.string.check_connection));
		}
		else
		{
			Log.d("ConfirmationActivity", "goAccept 3");
			if (null != dialog) dialog.dismiss();
			Log.d("ConfirmationActivity", "goAccept 4");
			dialog = ProgressDialog.show(ConfirmationActivity.this, getResources().getString(R.string.hold_on), getResources().getString(R.string.register_go), true);
			Log.d("ConfirmationActivity", "goAccept 5");
			registerTask = new Runnable()
		    {
				public void run()
				{
					Log.d("ConfirmationActivity", "goAccept 6");
					String user_name = txtUserName.getText().toString();
					String user_email = txtUserEmail.getText().toString();

					Log.d("ConfirmationActivity", "goAccept 7");
					if (Synchronize.sendRegisterUser(activationCode, user_name, pin, categoryId,user_email))
					{
						Log.d("ConfirmationActivity", "ConfirmationActivity->goAccept 8");
						UserInfo.setUserInfo(user_name, companyName,user_email,false);
/*						Log.d("ConfirmationActivity", "goAccept 9");
						Synchronize.sendApps();
						Log.d("ConfirmationActivity", "goAccept 10");
						Synchronize.downloadCompanySettings();
						Log.d("ConfirmationActivity", "goAccept 11");
						Synchronize.downloadAllowedApps(true);
						Log.d("ConfirmationActivity", "goAccept 12");
						Synchronize.downloadAllowedSettingsMenu();
						Log.d("ConfirmationActivity", "goAccept 13");

						dialog.dismiss();*/
						Intent intentLauncher = new Intent(ConfirmationActivity.this, AuthenticationActivity.class);
						intentLauncher.putExtra("user_name", user_name);
						intentLauncher.putExtra("companyName", companyName);
						intentLauncher.putExtra("user_email", user_email);
						startActivity(intentLauncher);
					}
					else
					{
						Log.d("ConfirmationActivity", "goAccept 9");
						dialog.dismiss();

						ConfirmationActivity.this.runOnUiThread(new Runnable()
						{
							public void run()
							{
								General.alertError(ConfirmationActivity.this, getResources().getString(R.string.error), getResources().getString(R.string.register_problem));
							}
						});
					}
				}
			};
			Thread appLoaderThread = new Thread(null, registerTask, "AppLoaderThread");
			appLoaderThread.start();

/*			Log.d("ConfirmationActivity", "goAccept 6");
			String user_name = txtUserName.getText().toString();
			Log.d("ConfirmationActivity", "goAccept 7");
			if (Synchronize.sendRegisterUser(activationCode, user_name, pin))
			{
				Log.d("ConfirmationActivity", "goAccept 8");
				UserInfo.setUserInfo(user_name, companyName);
				Log.d("ConfirmationActivity", "goAccept 9");
				Synchronize.sendApps();
				Log.d("ConfirmationActivity", "goAccept 10");
				Synchronize.downloadCompanySettings();
				Log.d("ConfirmationActivity", "goAccept 11");
				Synchronize.downloadAllowedApps(true);
				Log.d("ConfirmationActivity", "goAccept 12");
				Synchronize.downloadAllowedSettingsMenu();
				Log.d("ConfirmationActivity", "goAccept 13");

				dialog.dismiss();
				Intent intentLauncher = new Intent(ConfirmationActivity.this, MainActivity.class);
				startActivity(intentLauncher);
			} else{
				Log.d("ConfirmationActivity", "goAccept 9");
				dialog.dismiss();

				ConfirmationActivity.this.runOnUiThread(new Runnable()
				{
					public void run()
					{
						General.alertError(ConfirmationActivity.this, getResources().getString(R.string.error), getResources().getString(R.string.register_problem));
					}
				});
			}*/
		}
	}

	public void goCancel(View view)
	{
		Intent intentRegister = new Intent(this, RegisterActivity.class);

		startActivity(intentRegister);
	}

}


text:
class RegisteredProvider < ActiveRecord::Base
  class Docker < RegisteredProvider
    def self.load_registered_providers
      return unless super

      transaction do
        [
          set('Docker', 'bb92f39d-9823-40f3-8d9d-c4eda1962825')
        ].each { |s| create! s.merge!(type: 'RegisteredProvider::Docker') }
      end
    end

    def provider_class
      'Provider::Docker'.constantize
    end

    def description
      'Docker Services'
    end

    def tags
      ['docker']
    end

    def questions
      [{ name: :docker_host, value_type: :string, field: :text, label: 'Docker Host URL', required: :if_new },
       { name: :username, value_type: :string, field: :text, label: 'Docker Username', required: :if_new },
       { name: :password, value_type: :password, field: :password, label: 'Docker Password', required: :if_new }
      ]
    end
  end
end


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.
 */

package org.flowable.form.spring.autodeployment;

import java.io.IOException;

import org.flowable.engine.common.api.FlowableException;
import org.flowable.form.api.FormDeploymentBuilder;
import org.flowable.form.api.FormRepositoryService;
import org.springframework.core.io.Resource;

/**
 * Default implementation of {@link AutoDeploymentStrategy} that groups all {@link Resource}s into a single deployment. This implementation is equivalent to the previously used implementation.
 *
 * @author Tiese Barrell
 */
public class DefaultAutoDeploymentStrategy extends AbstractAutoDeploymentStrategy {

    /**
     * The deployment mode this strategy handles.
     */
    public static final String DEPLOYMENT_MODE = "default";

    @Override
    protected String getDeploymentMode() {
        return DEPLOYMENT_MODE;
    }

    @Override
    public void deployResources(final String deploymentNameHint, final Resource[] resources, final FormRepositoryService repositoryService) {

        // Create a single deployment for all resources using the name hint as the literal name
        final FormDeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(deploymentNameHint);

        for (final Resource resource : resources) {
            final String resourceName = determineResourceName(resource);

            try {
                deploymentBuilder.addInputStream(resourceName, resource.getInputStream());

            } catch (IOException e) {
                throw new FlowableException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
            }
        }

        deploymentBuilder.deploy();

    }

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>ChineseMorphologicalAnalyzer(Chen): source/include/boost/config/compiler/digitalmars.hpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">

Main Page

Namespaces

Classes

Files

source/include/boost/config/compiler/digitalmars.hpp

00001 //  Copyright (C) Christof Meerwald 2003
00002 //  Copyright (C) Dan Watkins 2003
00003 //
00004 //  Use, modification and distribution are subject to the
00005 //  Boost Software License, Version 1.0. (See accompanying file
00006 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00007
00008 //  Digital Mars C++ compiler setup:
00009 #define BOOST_COMPILER __DMC_VERSION_STRING__
00010
00011 #define BOOST_HAS_LONG_LONG
00012 #define BOOST_HAS_PRAGMA_ONCE
00013
00014 #define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
00015 #define BOOST_NO_OPERATORS_IN_NAMESPACE
00016 #define BOOST_NO_SFINAE
00017 #define BOOST_NO_TEMPLATE_TEMPLATES
00018 #define BOOST_NO_USING_TEMPLATE
00019 #define BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING
00020 #define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
00021
00022 // check for exception handling support:
00023 #ifndef _CPPUNWIND
00024 #  define BOOST_NO_EXCEPTIONS
00025 #endif
00026
00027 #if (__DMC__ < 0x833)
00028 #  if defined(BOOST_ASSERT_CONFIG)
00029 #     error "Unknown compiler version - please run the configure tests and report the results"
00030 #  endif
00031 #endif

<address style="text-align: right;">Generated on Thu Apr 30 11:47:22 2009 for ChineseMorphologicalAnalyzer(Chen) by

 1.5.5 </address>


text:
using namespace std;

Dictionary::Dictionary()
{
    // Read the system dictionary file.
    ifstream file("/usr/share/dict/words");
    string word;

    // Copy the words in the dictionary into memory for fast lookups later.
    while (file.good()) {
        file >> word;
        word[0] = tolower(word[0]);
        words.insert(word);
    }

    file.close();
}

bool Dictionary::lookup(string word)
{
    // Make word lowercase for comparison first.
    transform(word.begin(), word.end(), word.begin(), ::tolower);

    // Simply check if the word is in the dictionary at least once.
    return words.count(word) > 0;
}


text:
<?php
class Members_MemberContactController extends Kwf_Controller_Action_Auto_Form
{
    protected $_permissions = array('save', 'add');
    protected $_modelName = 'MemberContacts';

    protected function _initFields()
    {
        $this->_form->add(new Kwf_Form_Field_TextField('subject', trl('Subject')))
            ->setWidth(300);
        $this->_form->add(new Kwf_Form_Field_TextArea('text', trl('Text')))
            ->setWidth(300);
    }

    protected function _beforeInsert(Kwf_Model_Row_Interface $row)
    {
        $row->member_id = $this->_getParam('member_id');
    }
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Ric. auton. lich. crost. (Verona) 96 (1852)

#### Original name
Lichen candidus Weber

### Remarks
null


text:
import matplotlib.pyplot as plt
from numpy.random import randn

z = randn(10)

red_dot, = plt.plot(z, "ro", markersize=15)
# Put a white cross over some of the data.
white_cross, = plt.plot(z[:5], "w+", markeredgewidth=3, markersize=15)

plt.legend([red_dot, (red_dot, white_cross)], ["Attr A", "Attr A+B"])


text:
namespace Google.Cloud.BinaryAuthorization.V1.Snippets
{
    // [START binaryauthorization_v1_generated_SystemPolicyV1_GetSystemPolicy_async_flattened_resourceNames]
    using Google.Cloud.BinaryAuthorization.V1;
    using System.Threading.Tasks;

    public sealed partial class GeneratedSystemPolicyV1ClientSnippets
    {
        /// <summary>Snippet for GetSystemPolicyAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated and should be regarded as a code template only.
        /// It will require modifications to work:
        /// - It may require correct/in-range values for request initialization.
        /// - It may require specifying regional endpoints when creating the service client as shown in
        ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
        /// </remarks>
        public async Task GetSystemPolicyResourceNamesAsync()
        {
            // Create client
            SystemPolicyV1Client systemPolicyV1Client = await SystemPolicyV1Client.CreateAsync();
            // Initialize request argument(s)
            PolicyName name = PolicyName.FromProject("[PROJECT]");
            // Make the request
            Policy response = await systemPolicyV1Client.GetSystemPolicyAsync(name);
        }
    }
    // [END binaryauthorization_v1_generated_SystemPolicyV1_GetSystemPolicy_async_flattened_resourceNames]
}


text:
namespace Google.Cloud.BinaryAuthorization.V1.Snippets
{
    // [START binaryauthorization_v1_generated_BinauthzManagementServiceV1_DeleteAttestor_sync_flattened]
    using Google.Cloud.BinaryAuthorization.V1;

    public sealed partial class GeneratedBinauthzManagementServiceV1ClientSnippets
    {
        /// <summary>Snippet for DeleteAttestor</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void DeleteAttestor()
        {
            // Create client
            BinauthzManagementServiceV1Client binauthzManagementServiceV1Client = BinauthzManagementServiceV1Client.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/attestors/[ATTESTOR]";
            // Make the request
            binauthzManagementServiceV1Client.DeleteAttestor(name);
        }
    }
    // [END binaryauthorization_v1_generated_BinauthzManagementServiceV1_DeleteAttestor_sync_flattened]
}


text:
using System;
using System.Linq;

namespace Microsoft.WindowsAzure.Management.Network.Models
{
    /// <summary>
    /// Parameters supplied to the Add Network Security Group to subnet
    /// operation.
    /// </summary>
    public partial class NetworkSecurityGroupAddToSubnetParameters
    {
        private string _name;

        /// <summary>
        /// Required. Gets or sets name for a Network Security Group from this
        /// subscription.
        /// </summary>
        public string Name
        {
            get { return this._name; }
            set { this._name = value; }
        }

        /// <summary>
        /// Initializes a new instance of the
        /// NetworkSecurityGroupAddToSubnetParameters class.
        /// </summary>
        public NetworkSecurityGroupAddToSubnetParameters()
        {
        }

        /// <summary>
        /// Initializes a new instance of the
        /// NetworkSecurityGroupAddToSubnetParameters class with required
        /// arguments.
        /// </summary>
        public NetworkSecurityGroupAddToSubnetParameters(string name)
            : this()
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            this.Name = name;
        }
    }
}


text:
/**
 * Defines the interface for a 3DCityDBLayer. This Object is an interface for
 * documentation purpose and is not intended to be instantiated directly.
 *
 * @alias Layer3DCityDB
 * @constructor
 *
 * @param {Object} [options] Object with the following properties:
 * @param {String} [options.url] url to the layer data
 * @param {String} [options.id] id of this layer
 * @param {String} [options.name] name of this layer
 * @param {String} [options.region] region/bbox  of this layer Cesium.Rectangle
 *
 */

function Layer3DCityDB(options) {
    /**
     * @type {Boolean}
     * if the layer is currently active
     */
    this._active = false;
    /**
     * @type {Array}
     * HashMap of currently highlighted objects (objectid, color);
     */
    this._highlightedObjects = {};
    /**
     * @type {Array}
     * list of currently hidden Objects
     */
    this._hiddenObjects = [];
    /**
     * @type {Array}
     * list of eventhandler.
     */
    this._eventhandler = [];
    /**
     * @type {Object} cameraPosition Object
     * see https://github.com/AnalyticalGraphicsInc/cesium/blob/1.11/Source/Scene/Camera.js#L2353 for options.
     */
    this._cameraPosition = {};
    /**
     * @type {String} url
     */
    this._url = options.url;
    /**
     * @type {String} name of the layer
     */
    this._name = options.name;
    /**
     * @type {String} id of this layer
     * if not set by a given value an uuid is created
     */
    this._id = options.id ? options.id : Cesium.createGuid();
    /**
     * @type {Cesium.Rectangle} region of the whole layer
     */
    this._region = options.region;

    /**
     * handles ClickEvents
     * @type {Cesium.Event} clickEvent
     */
    this._clickEvent = new Cesium.Event();

    /**
     * handles ClickEvents
     * @type {Cesium.Event} clickEvent
     */
    this._mouseInEvent = new Cesium.Event();

    /**
     * handles ClickEvents
     * @type {Cesium.Event} clickEvent
     */
    this._mouseOutEvent = new Cesium.Event();
}

defineProperties(Layer3DCityDB.prototype, {
    /**
     * returns if the layer is currently active
     * @memberof Layer3DCityDB.prototype
     * @type {Boolean}
     */
    active: {
        get: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets the currently highlighted Objects as an object hashmap {objectid, color}
     * @memberof Layer3DCityDB.prototype
     * @type {Object}
     */
    highlightedObjects: {
        get: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets the currently hidden Objects as an array
     * @memberof Layer3DCityDB.prototype
     * @type {Array}
     */
    hiddenObjects: {
        get: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets/Sets the CameraPosition.
     * @memberof Layer3DCityDB.prototype
     * @type {Object}
     * see https://github.com/AnalyticalGraphicsInc/cesium/blob/1.11/Source/Scene/Camera.js#L2353 for options.
     */
    cameraPosition: {
        get: Cesium.DeveloperError.throwInstantiationError,
        set: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets the url of the layer
     * @memberof Layer3DCityDB.prototype
     * @type {String}
     */
    url: {
        get: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets the name of this layer.
     * @memberof Layer3DCityDB.prototype
     * @type {String}
     */
    name: {
        get: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets the id of this layer, the id should be unique.
     * @memberof Layer3DCityDB.prototype
     * @type {String}
     */
    id: {
        get: Cesium.DeveloperError.throwInstantiationError
    },
    /**
     * Gets region/bbox of this layer as an Cesium Rectangle Object with longitude/latitude values in radians.
     * @memberof Layer3DCityDB.prototype
     * @type {Cesium.Rectangle}
     */
    region: {
        get: Cesium.DeveloperError.throwInstantiationError
    }

});

/**
 * activates or deactivates the layer
 * @param {Boolean} value
 */
Layer3DCityDB.prototype.activate = Cesium.DeveloperError.throwInstantiationError;

/**
 * highlights one or more object with a given color;
 * @param {Object<String, Cesium.Color>} An object hashMap with the objectId and a cesium Color
 */
Layer3DCityDB.prototype.highlight = Cesium.DeveloperError.throwInstantiationError;

/**
 * undo highlighting
 * @param {Array<String>} A list of Object Ids. The default material will be restored
 */
Layer3DCityDB.prototype.unHighlight = Cesium.DeveloperError.throwInstantiationError;

/**
 * hideObjects
 * @param {Array<String>} A list of Object Ids which will be hidden
 */
Layer3DCityDB.prototype.hideObjects = Cesium.DeveloperError.throwInstantiationError;

/**
 * showObjects, to undo hideObjects
 * @param {Array<String>} A list of Object Ids which will be unhidden.
 */
Layer3DCityDB.prototype.showObjects = Cesium.DeveloperError.throwInstantiationError;

/**
 * zooms to the layer cameraPostion
 */
Layer3DCityDB.prototype.zoomToStartPosition = Cesium.DeveloperError.throwInstantiationError;

/**
 * removes an Eventhandler
 * @param {String} event (either CLICK, MOUSEIN or MOUSEOUT)
 * @param {function} callback function to be called
 */
Layer3DCityDB.prototype.removeEventHandler = function (event, callback) {
    if (event == "CLICK") {
        this._clickEvent.removeEventListener(callback, this);
    } else if (event == "MOUSEIN") {
        this._mouseInEvent.removeEventListener(callback, this);
    } else if (event == "MOUSEOUT") {
        this._mouseOutEvent.removeEventListener(callback, this);
    }
}

/**
 * adds an Eventhandler
 * @param {String} event (either CLICK, MOUSEIN or MOUSEOUT)
 * @param {function} callback function to be called
 * @return {String} id of the event Handler, can be used to remove the event Handler
 */
Layer3DCityDB.prototype.registerEventHandler = function (event, callback) {
    if (event == "CLICK") {
        this._clickEvent.addEventListener(callback, this);
    } else if (event == "MOUSEIN") {
        this._mouseInEvent.addEventListener(callback, this);
    } else if (event == "MOUSEOUT") {
        this._mouseOutEvent.addEventListener(callback, this);
    }
}

/**
 * triggers an Event
 * @param {String} event (either CLICK, MOUSEIN or MOUSEOUT)
 * @param {Object} cesium object. Scene.pick result.
 */
Layer3DCityDB.prototype.triggerEvent = function (event, object) {
    // get Object id from object
    if (event == "CLICK") {
        this._clickEvent.raiseEvent(objectId);
    } else if (event == "MOUSEIN") {
        this._mouseInEvent.raiseEvent(objectId);
    } else if (event == "MOUSEOUT") {
        this._mouseOutEvent.raiseEvent(objectId);
    }
}


text:
using System;
using System.IO;
using System.Linq;
using NMoneys.Extensions;
using NMoneys.Serialization.Tests.Entity_Framework.Support;
using NUnit.Framework;
using Testing.Commons;
using Testing.Commons.NUnit.Constraints;

namespace NMoneys.Serialization.Tests.Entity_Framework
{
	[TestFixture]
	public class PersistenceTester
	{
		private FileInfo _dbFile;
		[OneTimeSetUp]
		public void SetupDb()
		{
			_dbFile = new FileInfo("Persistence.sdf");
			_dbFile.Delete();
		}

		[OneTimeTearDown]
		public void TearDownDb()
		{
			_dbFile.Delete();
		}

		[Test]
		public void Roundtrip_IsPossible()
		{
			Guid oneKey = GuidBuilder.Build(1), twoKey = GuidBuilder.Build(2);

			using (var ctx = new TestDbContext(_dbFile))
			{
				ctx
					.Add(id: oneKey, number: 1, text: "uno", monetaryQuantity: 11.1m.Dkk())
					.Add(id: twoKey, number: 2, text: "dos", monetaryQuantity: 22.222m.Eur());

				ctx.SaveChanges();
			}

			using (var ctx = new TestDbContext(_dbFile))
			{
				TestEntity one = ctx.Entities.SingleOrDefault(e => e.Id == oneKey);

				Assert.That(one, Is.Not.Null);
				Assert.That(one, Must.Match.Expected(new
				{
					Number = 1,
					Quantity = new
					{
						Amount = 11.1m,
						Currency = CurrencyIsoCode.DKK.AlphabeticCode()
					}
				}));

				TestEntity two = ctx.Entities.SingleOrDefault(e => e.Id == twoKey);

				Assert.That(two, Is.Not.Null);
				Assert.That(two, Must.Match.Expected(new
				{
					Number = 2,
					Quantity = new
					{
						Amount = 22.222m,
						Currency = CurrencyIsoCode.EUR.AlphabeticCode()
					}
				}));
			}
		}
	}
}


text:
class Word < ApplicationRecord
  using StringRefinements
  include NormalizedValued
  include TokenRelated

  searchkick batch_size: 200

  has_many :entries, inverse_of: :word, dependent: :destroy
  has_many :notes, dependent: :destroy
  has_many :tokens, through: :entries
  belongs_to :language
  belongs_to :user

  validates :value, uniqueness: { scope: [:language_id, :user_id] }
  validates :language, presence: true
  validates :user, presence: true

  accepts_nested_attributes_for :notes, reject_if: :all_blank

  scope :owned_by, -> (user) { where(user_id: user.id) }
  scope :search_import, lambda {
    includes(:language).includes(:tokens).includes(:notes)
  }

  before_validation :mark_duplicate, if: :duplicate_present?
  after_save :merge_duplicate, if: :duplicate_present?

  def search_data
    as_json(only: search_data_attributes).merge(
      tokens: all_tokens,
      notes: all_notes,
      language: language.try(:code)
    )
  end

  def search_data_attributes
    [:value, :user_id]
  end

  def parse_update(params, _current_user)
    parse_notes(params)
    parse_attributes(params)
    save!
  end

  def destroy(force: false)
    super() if tokens.count.zero? || force
  end

  protected

  def duplicate_present?
    duplicate.present?
  end

  def mark_duplicate
    duplicate.update_attribute(:value, "#{duplicate.value}_marked_for_deletion")
  end

  def merge_duplicate
    migrate_attribute(:notes, from: duplicate, unique: :value)
    migrate_attribute(:entries, from: duplicate, unique: :token_id)
    duplicate.reload if duplicate.persisted?
    duplicate.destroy! if duplicate.persisted?
    @duplicate = nil
  end

  def migrate_attribute(what, from: self, to: self, unique: nil)
    from.method(what).call.each do |attr|
      attr.word_id = to.id
      check_uniqueness_and_save(what, attr, to: to, unique: unique)
    end
  end

  def check_uniqueness_and_save(what, attr, to: self, unique: nil)
    attr_val = attr.method(unique).call
    already_exists = to.method(what).call.map(&unique).include?(attr_val)
    return attr.destroy if already_exists
    attr.save!
  end

  def duplicate
    @duplicate ||= Word.where(
      value: value, language_id: language_id, user_id: user_id
    ).where.not(id: id).first.presence
  end

  def parse_attributes(params)
    %w(value language_id).each do |attribute|
      val = params[attribute]
      val = val.utf8downcase.strip if val.is_a?(String)
      method("#{attribute}=").call(val) if params.key?(attribute)
    end
  end

  def parse_notes(params)
    return unless params.key?(:notes)
    params[:notes].each do |value|
      notes.find_or_initialize_by(value: value).word = self unless value.blank?
    end
    notes.where.not(value: params[:notes]).each(&:destroy)
  end

  def all_tokens
    tokens.loaded? ? tokens.map(&:value) : tokens.pluck(:value)
  end

  def all_notes
    notes.loaded? ? notes.map(&:value) : notes.pluck(:value)
  end
end


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.apache.hadoop.mapreduce.v2.api.records (hadoop-mapreduce-client-common 2.3.0 API)
</TITLE>

<META NAME="date" CONTENT="2015-03-06">

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

org.apache.hadoop.mapreduce.v2.api.records

Interfaces

AMInfo

Counter

CounterGroup

Counters

JobReport

TaskAttemptCompletionEvent

TaskAttemptReport

TaskReport

Classes

JobId

TaskAttemptId

TaskId

Enums

Avataar

JobState

Locality

Phase

TaskAttemptCompletionEventStatus

TaskAttemptState

TaskState

TaskType


text:
module Tilia
  module Dav
    class Exception
      # MethodNotAllowed
      #
      # The 405 is thrown when a client tried to create a directory on an already
      # existing directory
      class MethodNotAllowed < Exception
        # Returns the HTTP statuscode for this exception
        #
        # @return int
        def http_code
          405
        end

        # This method allows the exception to return any extra HTTP response headers.
        #
        # The headers must be returned as an array.
        #
        # @param \Sabre\DAV\Server server
        # @return array
        def http_headers(server)
          methods = server.allowed_methods(server.request_uri)
          { 'Allow' => methods.join(', ').upcase }
        end
      end
    end
  end
end


text:
<!DOCTYPE html>

	<title>Sample hash page</title>


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <title>HTML: Lists</title>

All about rabbits!

Why rabbits make great pets

They're furry!

Great listeners!

Eat all your leftover carrots!

Top 3 most famous rabbits

Bugs bunny

Easter Bunny

Thumper

Basic info

Rabbits are little creatures with long ears and puffy tails, and they move their nose up and down in an adorable way.
       They eat the most orange vegetables in our world, and they reproduce more than any human ever has.

Songs

Little Bunny Foo Foo,

I don't want to see you

scooping up the field mice

and bopping them on the head!


text:
require "acceptance_helper"
require "virtus"
require "scrivener"

module Models
  class TaskQueue
    include Virtus
    include Scrivener::Validations
    attr_accessor :uid, :persisted_attributes, :num_saved
    attribute :name, String
    def validate
      assert_present :name
    end
  end

  class Task
    include Virtus
    include Scrivener::Validations
    attr_accessor :uid, :persisted_attributes, :num_saved
    attribute :title, String
    attribute :task_queue, TaskQueue
    attribute :queued_at, Time
    def validate
      assert_present :title
    end
  end

  class Team
    include Virtus
    include Scrivener::Validations
    attr_accessor :uid, :persisted_attributes, :num_saved
    attribute :name, String
    def validate
      assert_present :name
    end
  end

  class Teammate
    include Virtus
    include Scrivener::Validations
    attr_accessor :uid, :persisted_attributes, :num_saved
    attribute :name, String
    attribute :team, Team
    def validate
      assert_present :name
      assert_present :team
    end
  end

  class Skill
    include Virtus
    include Scrivener::Validations
    attr_accessor :uid, :persisted_attributes, :num_saved
    attribute :level, Integer
    attribute :task_queue, TaskQueue
    attribute :teammate, Teammate
    def validate
      %i[level task_queue teammate].each { |name| assert_present(name) }
      assert_numeric :level
    end
  end
end

class PersistentAccessor
  include Redistent::Accessor
  ModelNotValid = Class.new(StandardError)
  before_write { |model| raise ModelNotValid, model.errors unless model.valid? }
  after_write { |model| model.num_saved = (model.num_saved || 0) + 1 }
  namespace Models
  model :team do
    collection :teammates, model: :teammate, index: :team
  end
  model :teammate do
    index :team
    collection :skills, model: :skill, index: :teammate
    collection :queues, model: :queue, using: :skill, index: [:teammate, :queue]
  end
  model :task do
    index :queue do
      store :tasks_waiting, sorted_by: :queued_at, if: ->(task) { task.status == "queued" }
      store :tasks_offered,                        if: ->(task) { task.status == "offered" }
    end
  end
  model :queue, class: TaskQueue do
    sorted_collection :tasks_waiting, model: :task, index: {:queue => :tasks_waiting}
    collection :tasks_offered,        model: :task, index: {:queue => :tasks_offered}
    collection :skills, model: :skill, index: :queue
    collection :teammates, model: :teammate, using: :skill, index: [:queue, :teammate]
  end
  model :skill do
    index :queue, inline_reference: true
    index :teammate, inline_reference: true
  end
end

feature "persisting models" do
  let(:accessor) { PersistentAccessor.new(redis_config) }

  scenario "write, reload and erase a model" do
    queue = TaskQueue.new(name: "fix bugs")
    accessor.write(queue)
    expect(queue.num_saved).to eq(1)
    accessor.write(queue)
    expect(queue.num_saved).to eq(2)

    reloaded = accessor.read(:task_queue, queue.uid)
    expect(reloaded.name).to eq("fix bugs")

    accessor.erase(reloaded)
    expect { accessor.read(:task_queue, queue.uid) }.to raise_error
  end

  scenario "write a model with references and reload it with references" do
    queue = TaskQueue.new(name: "fix bugs")
    teammate = Teammate.new(name: "John Doe", team: Team.new(name: "Anonymous"))
    skill = Skill.new(task_queue: queue, teammate: teammate, level: 50)
    accessor.write(skill)

    reloaded = accessor.read(:skill, skill.uid)
    expect(reloaded.level).to eq(skill.level)
    expect(reloaded.task_queue.uid).to eq(skill.task_queue.uid)
    expect(reloaded.teammate.uid).to eq(skill.teammate.uid)
  end

  scenario "query a model's referrers" do
    team = Team.new(name: "engineering")
    teammate = Teammate.new(name: "John Doe", team: team)
    other = Teammate.new(name: "Jane Doe", team: team)
    accessor.write(teammate, other)
    reloaded_team = accessor.read(:team, teammate.team.uid)

    collection = accessor.collection(reloaded_team, :teammates)
    expect(collection.count).to eq(2)
    expect(collection.all.map(&:name).sort).to eq(["Jane Doe", "John Doe"])
  end

  scenario "query a model's referrers via another model" do
    teammate = Teammate.new(name: "John Doe", team: Team.new(name: "Anonymous"))
    bugs = TaskQueue.new(name: "fix bugs")
    specs = TaskQueue.new(name: "write specs")
    enhancements = TaskQueue.new(name: "enhancements")
    accessor.write(
      Skill.new(teammate: teammate, task_queue: bugs, level: 50),
      Skill.new(teammate: teammate, task_queue: enhancements, level: 50)
    )

    collection = accessor.collection(teammate, :task_queues)
    expect(collection.count).to eq(2)
    expect(collection.all.map(&:name).sort).to eq(["enhancements", "fix bugs"])
  end

  scenario "query a model's sorted collection" do
    queue = TaskQueue.new(name: "fix bugs")
    def queue.add_task(task)
      task.queued_at = Time.now
      task.task_queue = self
    end
    task1 = Task.new(title: "bug #123")
    task2 = Task.new(title: "bug #456")

    queue.add_task(task2)
    queue.add_task(task1)
    accessor.write(queue, task1, task2)

    queue = accessor.read(:task_queue, queue.uid)
    collection = accessor.collection(queue, :tasks)
    expect(collection.count).to eq(2)
    expect(collection.first_uid).to eq(task2.uid)
  end
end


text:
/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM /builds/tinderbox/Xr-Mozilla1.9-Release/Darwin_8.8.4_Depend/mozilla/netwerk/base/public/nsIRequestObserver.idl
 */

#ifndef __gen_nsIRequestObserver_h__
#define __gen_nsIRequestObserver_h__

#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIRequest; /* forward declaration */

/* starting interface:    nsIRequestObserver */
#define NS_IREQUESTOBSERVER_IID_STR "fd91e2e0-1481-11d3-9333-00104ba0fd40"

#define NS_IREQUESTOBSERVER_IID \
  {0xfd91e2e0, 0x1481, 0x11d3, \
    { 0x93, 0x33, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }}

/**
 * nsIRequestObserver
 *
 * @status FROZEN
 */
class NS_NO_VTABLE NS_SCRIPTABLE nsIRequestObserver : public nsISupports {
 public:

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IREQUESTOBSERVER_IID)

  /**
     * Called to signify the beginning of an asynchronous request.
     *
     * @param aRequest request being observed
     * @param aContext user defined context
     *
     * An exception thrown from onStartRequest has the side-effect of
     * causing the request to be canceled.
     */
  /* void onStartRequest (in nsIRequest aRequest, in nsISupports aContext); */
  NS_SCRIPTABLE NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) = 0;

  /**
     * Called to signify the end of an asynchronous request.  This
     * call is always preceded by a call to onStartRequest.
     *
     * @param aRequest request being observed
     * @param aContext user defined context
     * @param aStatusCode reason for stopping (NS_OK if completed successfully)
     *
     * An exception thrown from onStopRequest is generally ignored.
     */
  /* void onStopRequest (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatusCode); */
  NS_SCRIPTABLE NS_IMETHOD OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatusCode) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIRequestObserver, NS_IREQUESTOBSERVER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIREQUESTOBSERVER \
  NS_SCRIPTABLE NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext); \
  NS_SCRIPTABLE NS_IMETHOD OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatusCode);

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIREQUESTOBSERVER(_to) \
  NS_SCRIPTABLE NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) { return _to OnStartRequest(aRequest, aContext); } \
  NS_SCRIPTABLE NS_IMETHOD OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatusCode) { return _to OnStopRequest(aRequest, aContext, aStatusCode); }

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIREQUESTOBSERVER(_to) \
  NS_SCRIPTABLE NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStartRequest(aRequest, aContext); } \
  NS_SCRIPTABLE NS_IMETHOD OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatusCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStopRequest(aRequest, aContext, aStatusCode); }

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsRequestObserver : public nsIRequestObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIREQUESTOBSERVER

  nsRequestObserver();

private:
  ~nsRequestObserver();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsRequestObserver, nsIRequestObserver)

nsRequestObserver::nsRequestObserver()
{
  /* member initializers and constructor code */
}

nsRequestObserver::~nsRequestObserver()
{
  /* destructor code */
}

/* void onStartRequest (in nsIRequest aRequest, in nsISupports aContext); */
NS_IMETHODIMP nsRequestObserver::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onStopRequest (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatusCode); */
NS_IMETHODIMP nsRequestObserver::OnStopRequest(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatusCode)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

#endif /* __gen_nsIRequestObserver_h__ */


text:
GRPC implementation and test
============================

NOTE: files in `src/` are shared with the GRPC project, and maintained there
(any changes should be submitted to GRPC instead). These files are copied
from GRPC, and work with both the Protobuf and FlatBuffers code generator.

`tests/` contains a GRPC specific test, you need to have built and installed
the GRPC libraries for this to compile. This test will build using the
`FLATBUFFERS_BUILD_GRPCTEST` option to the main FlatBuffers CMake project.


text:
<?php

namespace Conner\Tagging\Model;

use Conner\Tagging\TaggingUtility;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * @package Conner\Tagging\Model
 * @property string id
 * @property string name
 * @property string slug
 * @property bool suggest
 * @property integer count
 * @property integer tag_group_id
 * @property TagGroup group
 * @property string description
 * @method static suggested()
 * @method static inGroup(string $group)
 */
class Tag extends Model
{
    protected $table = 'tagging_tags';
    public $timestamps = false;
    public $fillable = ['name', 'description'];

    /**
     * @param array $attributes
     */
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);

        $this->connection = config('tagging.connection');
    }

    /**
     * @inheritDoc
     */
    public function save(array $options = [])
    {
        if(strlen($this->name) < 1) {
            throw new \RuntimeException('Cannot save a tag with an empty name');
        }

        $this->slug = TaggingUtility::normalize($this->name);

        return parent::save($options);
    }

    /**
     * Tag group setter
     * @param string $group
     * @return Tag
     */
    public function setGroup(string $group)
    {
        $model = TaggingUtility::tagGroupModelString();

        $tagGroup = $model::query()
            ->where('slug', TaggingUtility::normalize($group))
            ->first();

        if ($tagGroup) {
            $this->group()->associate($tagGroup);
            $this->save();

            return $this;
        } else {
            throw new \RuntimeException('No Tag Group found: '. $group);
        }
    }

    /**
     * Tag group remove
     * @return Tag
     */
    public function removeGroup()
    {
        $this->group()->dissociate();
        $this->save();

        return $this;
    }

    /**
     * Tag group helper function
     * @param string $groupName
     * @return bool
     */
    public function isInGroup($groupName): bool
    {
        if ($this->group && ($this->group->slug == TaggingUtility::normalize($groupName))) {
            return true;
        }

        return false;
    }

    /**
     * Tag group relationship
     */
    public function group()
    {
        return $this->belongsTo(TaggingUtility::tagGroupModelString(), 'tag_group_id');
    }

    /**
     * Get suggested tags
     */
    public function scopeSuggested($query)
    {
        return $query->where('suggest', true);
    }

    /**
     * Get suggested tags
     * @param Builder $query
     * @param $groupName
     * @return Builder
     */
    public function scopeInGroup(Builder $query, $groupName)
    {
        $groupSlug = TaggingUtility::normalize($groupName);

        return $query->whereHas('group', function (Builder $query) use ($groupSlug) {
            $query->where('slug', $groupSlug);
        });
    }

    /**
     * Set the name of the tag : $tag->name = 'myname';
     *
     * @param string $value
     */
    public function setNameAttribute(string $value)
    {
        $this->attributes['name'] = TaggingUtility::displayize($value);
    }

    /**
     * Look at the tags table and delete any tags that are no longer in use by any taggable database rows.
     * Does not delete tags where 'suggest' value is true
     *
     * @return mixed
     */
    public static function deleteUnused()
    {
        return (new static)->newQuery()
            ->where('count', '=', 0)
            ->where('suggest', false)
            ->delete();
    }
}


text:
class Solution(object):
    def searchInsert(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: int
        """
        start = 0
        end = len(nums) - 1
        while True:
            mid = start + (end - start) / 2
            if start == end:
                return mid if nums[mid] >= target else mid+1
            elif nums[mid] >= target:
                end = mid
            elif nums[mid] < target:
                start = mid + 1


text:
package com.greenpepper.runner;

import static java.lang.String.format;

import com.greenpepper.Statistics;
import com.greenpepper.util.log.GreenPepperLogger;

import java.io.PrintStream;

import org.slf4j.Logger;

/**
 *
LoggingMonitor class.

 *
 * @author oaouattara
 * @version $Id: $Id
 */
public class LoggingMonitor implements SpecificationRunnerMonitor
{
    private static final Logger LOGGER = GreenPepperLogger.getLogger(LoggingMonitor.class);
    private PrintStream out;
    private PrintStream err;

    /**
     *
Constructor for LoggingMonitor.

     *
     * @param out a {@link java.io.PrintStream} object.
     * @param err a {@link java.io.PrintStream} object.
     */
    public LoggingMonitor( PrintStream out, PrintStream err )
    {
        this.err = err;
        this.out = out;
    }

    /** {@inheritDoc} */
    public void testRunning( String location )
    {
        out.println( "Running " + location );
    }

    /** {@inheritDoc} */
    public void testDone( int rightCount, int wrongCount, int exceptionCount, int ignoreCount )
    {
        Statistics stats = new Statistics( rightCount, wrongCount, exceptionCount, ignoreCount );
        out.println( stats.toString() + (stats.indicatesFailure() ? " <<< FAILURE! " : "") );
    }

    /** {@inheritDoc} */
    public void exceptionOccured( Throwable t )
    {
        if (t instanceof RuntimeException)
        {
            err.println( "An unexpected error occured" );
            t.printStackTrace( err );
        }
        else
        {
            err.println( format("Error: %s %s", t.getClass().getName(), t.getMessage()) );
            if (t.getCause() != null)
            {
                err.println( "Caused by:" );
                t.getCause().printStackTrace( err );
            }
        }
    }
}


text:
using NServiceBus;
using NServiceBus.Testing;
using NUnit.Framework;

namespace UnitTesting.AdditionalDependencies
{

    #region TestingAdditionalDependencies

    public class MyTest
    {
        [Test]
        public void RunWithDependencyInjection()
        {
            Test.Initialize();

            var mockService = new MyService();
            Test.Handler(bus => new WithDependencyInjectionHandler(mockService));
            //Rest of test
        }
    }

    class WithDependencyInjectionHandler : IHandleMessages<MyMessage>
    {
        MyService myService;

        public WithDependencyInjectionHandler(MyService myService)
        {
            this.myService = myService;
        }

        public void Handle(MyMessage message)
        {
        }
    }

    #endregion

    class MyMessage
    {
    }

    class MyService
    {
    }
}


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

<title>it.unical.mat.embasp.languages Class Hierarchy</title>
<meta name="date" content="2020-01-23">
<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

Next

Frames

No Frames

All Classes

Hierarchy For Package it.unical.mat.embasp.languages

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

it.unical.mat.embasp.languages.Mapper

java.lang.Throwable (implements java.io.Serializable)

java.lang.Exception

it.unical.mat.embasp.languages.IllegalAnnotationException

it.unical.mat.embasp.languages.ObjectNotValidException

Annotation Type Hierarchy

it.unical.mat.embasp.languages.Id (implements java.lang.annotation.Annotation)

it.unical.mat.embasp.languages.Param (implements java.lang.annotation.Annotation)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
package ca.six.todo.home;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;

import java.util.List;

import ca.six.todo.R;
import ca.six.todo.model.Task;

/**
 * Created by songzhw on 2016-05-12.
 */
public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder> {
    public List<Task> data;

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_home, null);
        ViewHolder holder = new ViewHolder(itemView);
        return holder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        if(data != null && data.size() > position){
            Task task = data.get(position);
            holder.cbComplete.setChecked(task.isCompleted);
            holder.tvTask.setText(task.content);
        }
    }

    @Override
    public int getItemCount() {
        return data == null ? 0 : data.size();
    }

    public class ViewHolder extends RecyclerView.ViewHolder{
        public CheckBox cbComplete;
        public TextView tvTask;

        public ViewHolder(View itemView) {
            super(itemView);
            tvTask = (TextView) itemView.findViewById(R.id.tvTask);
            cbComplete = (CheckBox) itemView.findViewById(R.id.cbComplete);
        }
    }
}


text:
//---------------------------------------------------------------------
// <copyright file="Converter.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;

namespace System.Data.Common.Utils.Boolean
{

    /// <summary>
    /// Handles conversion of expressions to different forms (decision diagram, etc)
    /// </summary>
    internal sealed class Converter<T_Identifier>
    {
        private readonly Vertex _vertex;
        private readonly ConversionContext<T_Identifier> _context;
        private DnfSentence<T_Identifier> _dnf;
        private CnfSentence<T_Identifier> _cnf;

        internal Converter(BoolExpr<T_Identifier> expr, ConversionContext<T_Identifier> context)
        {
            _context = context ?? IdentifierService<T_Identifier>.Instance.CreateConversionContext();
            _vertex = ToDecisionDiagramConverter<T_Identifier>.TranslateToRobdd(expr, _context);
        }

        internal Vertex Vertex
        {
            get { return _vertex; }
        }

        internal DnfSentence<T_Identifier> Dnf
        {
            get
            {
                InitializeNormalForms();
                return _dnf;
            }
        }

        internal CnfSentence<T_Identifier> Cnf
        {
            get
            {
                InitializeNormalForms();
                return _cnf;
            }
        }

        /// <summary>
        /// Converts the decision diagram (Vertex) wrapped by this converter and translates it into DNF
        /// and CNF forms. I'll first explain the strategy with respect to DNF, and then explain how CNF
        /// is achieved in parallel. A DNF sentence representing the expression is simply a disjunction
        /// of every rooted path through the decision diagram ending in one. For instance, given the
        /// following decision diagram:
        ///
        ///                         A
        ///                       0/ \1
        ///                      B     C
        ///                    0/ \1 0/ \1
        ///                 One   Zero   One
        ///
        /// the following paths evaluate to 'One'
        ///
        ///                 !A, !B
        ///                 A, C
        ///
        /// and the corresponding DNF is (!A.!B) + (A.C)
        ///
        /// It is easy to compute CNF from the DNF of the negation, e.g.:
        ///
        ///     !((A.B) + (C.D)) iff. (!A+!B) . (!C+!D)
        ///
        /// To compute the CNF form in parallel, we negate the expression (by swapping One and Zero sinks)
        /// and collect negation of the literals along the path. In the above example, the following paths
        /// evaluate to 'Zero':
        ///
        ///                 !A, B
        ///                 A, !C
        ///
        /// and the CNF (which takes the negation of all literals in the path) is (!A+B) . (A+!C)
        /// </summary>
        private void InitializeNormalForms()
        {
            if (null == _cnf)
            {
                // short-circuit if the root is true/false
                if (_vertex.IsOne())
                {
                    // And() -> True
                    _cnf = new CnfSentence<T_Identifier>(Set<CnfClause<T_Identifier>>.Empty);
                    // Or(And()) -> True
                    var emptyClause = new DnfClause<T_Identifier>(Set<Literal<T_Identifier>>.Empty);
                    var emptyClauseSet = new Set<DnfClause<T_Identifier>>();
                    emptyClauseSet.Add(emptyClause);
                    _dnf = new DnfSentence<T_Identifier>(emptyClauseSet.MakeReadOnly());
                }
                else if (_vertex.IsZero())
                {
                    // And(Or()) -> False
                    var emptyClause = new CnfClause<T_Identifier>(Set<Literal<T_Identifier>>.Empty);
                    var emptyClauseSet = new Set<CnfClause<T_Identifier>>();
                    emptyClauseSet.Add(emptyClause);
                    _cnf = new CnfSentence<T_Identifier>(emptyClauseSet.MakeReadOnly());
                    // Or() -> False
                    _dnf = new DnfSentence<T_Identifier>(Set<DnfClause<T_Identifier>>.Empty);
                }
                else
                {
                    // construct clauses by walking the tree and constructing a clause for each sink
                    Set<DnfClause<T_Identifier>> dnfClauses = new Set<DnfClause<T_Identifier>>();
                    Set<CnfClause<T_Identifier>> cnfClauses = new Set<CnfClause<T_Identifier>>();
                    Set<Literal<T_Identifier>> path = new Set<Literal<T_Identifier>>();

                    FindAllPaths(_vertex, cnfClauses, dnfClauses, path);

                    _cnf = new CnfSentence<T_Identifier>(cnfClauses.MakeReadOnly());
                    _dnf = new DnfSentence<T_Identifier>(dnfClauses.MakeReadOnly());
                }
            }
        }

        private void FindAllPaths(Vertex vertex, Set<CnfClause<T_Identifier>> cnfClauses, Set<DnfClause<T_Identifier>> dnfClauses,
            Set<Literal<T_Identifier>> path)
        {
            if (vertex.IsOne())
            {
                // create DNF clause
                var clause = new DnfClause<T_Identifier>(path);
                dnfClauses.Add(clause);
            }
            else if (vertex.IsZero())
            {
                // create CNF clause
                var clause = new CnfClause<T_Identifier>(new Set<Literal<T_Identifier>>(path.Select(l => l.MakeNegated())));
                cnfClauses.Add(clause);
            }
            else
            {
                // keep on walking...
                foreach (var successor in _context.GetSuccessors(vertex))
                {
                    path.Add(successor.Literal);
                    FindAllPaths(successor.Vertex, cnfClauses, dnfClauses, path);
                    path.Remove(successor.Literal);
                }
            }
        }
    }
}


text:
def can_build(env, platform):
    return True

def configure(env):
    pass

def get_doc_classes():
    return [
        "UPNP",
        "UPNPDevice"
    ]

def get_doc_path():
    return "doc_classes"


text:
<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <!-- root logger -->
  <root>
    <level value="WARN" />
  </root>

  <!-- custom loggers -->
  <logger name="NGin.Core.Test">
    <level value="DEBUG"/>
    <!--UNCOMMENT FOR WINDOWS CONSOLE OUTPUT-->
    <!--<appender-ref ref="WinConsoleAppender" />-->
    <!--UNCOMMENT FOR ANSI CONSOLE OUTPUT-->
    <!--<appender-ref ref="AnsiConsoleAppender" />-->
    <!--UNCOMMENT FOR FILE OUTPUT-->
    <appender-ref ref="LogFileAppender" />
  </logger>

  <!-- appenders -->
  <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
    <file value="NGin.Core.Test.log" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="1MB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
      <param name="Header" type="log4net.Util.PatternString" value="**************************************************%newline***** SESSION START: %date *****%newline%newline"/>
      <param name="Footer" type="log4net.Util.PatternString" value="***** SESSION END:   %date *****%newline**************************************************%newline%newline"/>
      <!--<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] ::%X{auth}:: - %m%n"/>-->
      <conversionPattern value="%d [%-5level] %logger tid:%thread %newline%message%newline%newline" />
    </layout>
    <filter type="log4net.Filter.LevelRangeFilter">
      <param name="LevelMin" value="DEBUG" />
      <param name="LevelMax" value="FATAL" />
    </filter>
  </appender>
  <!-- use this with unix versions of log4net fo colored output -->
  <appender name="AnsiConsoleAppender" type="log4net.Appender.AnsiColorTerminalAppender">
    <mapping>
      <level value="FATAL" />
      <foreColor value="Red" />
      <backColor value="White" />
    </mapping>
    <mapping>
      <level value="ERROR" />
      <foreColor value="Red" />
    </mapping>
    <mapping>
      <level value="WARN" />
      <foreColor value="Yellow" />
    </mapping>
    <mapping>
      <level value="INFO" />
      <foreColor value="Cyan" />
    </mapping>
    <mapping>
      <level value="DEBUG" />
      <foreColor value="Green" />
    </mapping>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%d [%-5level] %logger tid:%thread %newline%message%newline%newline" />
    </layout>
  </appender>
  <!-- use this with Win32 version of log4net fo colored output -->
  <appender name="WinConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
    <mapping>
      <level value="FATAL" />
      <foreColor value="Red" />
      <backColor value="White" />
    </mapping>
    <mapping>
      <level value="ERROR" />
      <foreColor value="Red, HighIntensity" />
    </mapping>
    <mapping>
      <level value="WARN" />
      <foreColor value="Yellow" />
    </mapping>
    <mapping>
      <level value="INFO" />
      <foreColor value="Cyan" />
    </mapping>
    <mapping>
      <level value="DEBUG" />
      <foreColor value="Green" />
    </mapping>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%d [%-5level] %logger tid:%thread %newline%message%newline%newline" />
    </layout>
  </appender>

</log4net>


text:
For UnitTesting:
--------------
	open NgDicomViewer\Tests\Unit\Test.html

For E2E testing:
----------------

Requirements:

	      You need to install node js

	      install protractor globally [ npm install protractor -g ]

	      updated web driver [ webdriver-manager update ]

step 1: start ng-dicomviewer in local host

			>open node command prompt
			>cd to NgDicomViewer\Tests\NodeLauncher
			>node app.js

            this will start ng-dicomviewer in local host @port 3000

step 2: Start web driver

			>open another node command prompt
			>cd to NgDicomViewer\Tests\E2E
			>webdriver-manager start

step 3 : Start protractor

			>open another node command prompt
			>cd to NgDicomViewer\Tests\E2E
			>protractor conf.js

Note: e2e testing uses chrome as the testing browser