text:
/*
 * $Id$
 */

/*

 Copyright (c) 2013 Board of Trustees of Leland Stanford Jr. University,
 all rights reserved.

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 STANFORD UNIVERSITY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 Except as contained in this notice, the name of Stanford University shall not
 be used in advertising or otherwise to promote the sale, use or other dealings
 in this Software without prior written authorization from Stanford University.

 */

package org.lockss.poller.v3;

import java.io.*;
import java.util.*;
import java.security.*;
import org.lockss.app.*;
import org.lockss.config.ConfigManager;
import org.lockss.daemon.*;
import org.lockss.plugin.*;
import org.lockss.protocol.*;
import org.lockss.protocol.IdentityManager.IdentityAgreement;
import org.lockss.protocol.psm.*;
import org.lockss.util.*;
import org.lockss.poller.*;
import org.lockss.poller.v3.FuncV3Poller.MyV3Poller;
import org.lockss.poller.v3.V3Serializer.*;
import org.lockss.test.*;
import org.lockss.hasher.*;
import org.lockss.repository.LockssRepositoryImpl;
import org.mortbay.util.B64Code;

import static org.lockss.util.Constants.*;

public class TestVoteBlocksCoordinator extends LockssTestCase {

  private String tempDirPath;
  private File tempDir;
  private List<VoteBlocksIterator> iterators;

  private static final String BASE_URL = "http://www.test.org/";

  public void setUp() throws Exception {
    super.setUp();
    tempDir = getTempDir();
    tempDirPath = tempDir.getAbsolutePath();
    System.setProperty("java.io.tmpdir", tempDirPath);
  }

  public void tearDown() throws Exception {
    if (iterators != null) {
      for (VoteBlocksIterator iterator: iterators) {
	iterator.release();
      }
    }
    super.tearDown();
  }

  public void testCreate() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      }};

    iterators = makeIterators(voteBlocks);
    new VoteBlocksCoordinator(iterators);
  }

  public void testNoIterators() throws Exception {
    // The List is allowed to be empty.
    VoteBlock[][] voteBlocks = {};
    iterators = Collections.EMPTY_LIST;
    VoteBlocksCoordinator coordinator =
      new VoteBlocksCoordinator(iterators);

    assertNull(coordinator.peekUrl());
  }

  public void testNullIterator() throws Exception {
    // A null VoteBlocksIterator instance means the votes are spoiled.
    VoteBlocksCoordinator coordinator =
      new VoteBlocksCoordinator(Arrays.asList((VoteBlocksIterator)null));
    assertTrue(coordinator.isSpoiled(0));
  }

  public void testCreateFail() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      }};

    try {
      new VoteBlocksCoordinator(null);
      fail("Expected exception not thrown.");
    } catch (NullPointerException e) {
      // expected
    }

    try {
      new VoteBlocksCoordinator(Collections.EMPTY_LIST);
    } catch (IllegalArgumentException e) {
      // expected: Thrown by java.util.PriorityQueue.<init>
    }
  }

  public void testVote() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      }};

    iterators = makeIterators(voteBlocks);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    for (int i = 1; i <= 4; i++) {
      String url = "http://test.com/foo" + i;
      assertEquals(coordinator.peekUrl(), url);
      for (int iteratorIndex = 0;
	   iteratorIndex < voteBlocks.length; iteratorIndex++) {
	VoteBlock voteBlock = coordinator.getVoteBlock(url, iteratorIndex);
	assertEquals(findVoteBlock(url, voteBlocks[iteratorIndex]), voteBlock);
      }
    }
    assertNull(coordinator.peekUrl());
  }

  public void testUnconsumed() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      }};

    iterators = makeIterators(voteBlocks);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    coordinator.getVoteBlock("http://test.com/foo1", 0);
    try {
      // Try to advance when there is still an unconsumed VoteBlock for foo1.
      coordinator.getVoteBlock("http://test.com/foo2", 0);
      fail("Expected exception not thrown.");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }

  public void testOutOfOrderCall() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      }};

    iterators = makeIterators(voteBlocks);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    coordinator.getVoteBlock("http://test.com/foo1", 0);
    coordinator.getVoteBlock("http://test.com/foo2", 0);
    try {
      // Try to call with a URL before the previous one.
      coordinator.getVoteBlock("http://test.com/foo1a", 0);
      fail("Expected exception not thrown.");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }

  public void testSeek() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      }};

    iterators = makeIterators(voteBlocks);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    assertEquals("http://test.com/foo1", coordinator.peekUrl());
    coordinator.seek("http://test.com/foo1");
    // seek to where we already are
    assertEquals("http://test.com/foo1", coordinator.peekUrl());

    // A url in order, but not known to any voter.
    coordinator.seek("http://test.com/foo1a");
    assertEquals("http://test.com/foo2", coordinator.peekUrl());

    coordinator.seek("http://test.com/foo2");
    assertEquals("http://test.com/foo2", coordinator.peekUrl());

    try {
      coordinator.seek(null);
      fail("Expected Exception was not thrown.");
    } catch (IllegalArgumentException e) {
      assertEquals("url is null.", e.getMessage());
    }

    // skip foo3
    coordinator.seek("http://test.com/foo4");
    assertEquals("http://test.com/foo4", coordinator.peekUrl());

    try {
      // try seeking backwards
      coordinator.seek("http://test.com/foo2");
      fail("Expected IllegalArgumentException was not thrown.");
    } catch (IllegalArgumentException e) {
      assertEquals("Current URL is http://test.com/foo4, "+
		   "past http://test.com/foo2", e.getMessage());
    }

    // And stepping off the end.
    coordinator.seek("http://test.com/foo5");
    assertEquals(null, coordinator.peekUrl());
  }

  public void testOutOfOrderUrl() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      },
      {
	// NOTE: these URLs are not in the canonical order.
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      },
      {
	makeVoteBlock("http://test.com/foo2", "content for foo1"),
	makeVoteBlock("http://test.com/foo3", "content for foo3"),
	makeVoteBlock("http://test.com/foo4", "content for foo4")
      }
    };

    iterators = makeIterators(voteBlocks);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    for (int i = 1; i <= 4; i++) {
      String url = "http://test.com/foo" + i;
      assertEquals(coordinator.peekUrl(), url);
      for (int iteratorIndex = 0;
	   iteratorIndex < voteBlocks.length; iteratorIndex++) {
	if (iteratorIndex != 1) {
	  VoteBlock voteBlock = coordinator.getVoteBlock(url, iteratorIndex);
	  assertEquals(findVoteBlock(url, voteBlocks[iteratorIndex]),
		       voteBlock);
	} else {
	  VoteBlock voteBlock;
	  switch(i) {
	  case 1:
	    // It has foo1, but out of order so not yet seen.
	    voteBlock = coordinator.getVoteBlock(url, iteratorIndex);
	    assertEquals(null, voteBlock);
	    break;
	  case 2:
	    // It has foo2
	    voteBlock = coordinator.getVoteBlock(url, iteratorIndex);
	    assertEquals(findVoteBlock(url, voteBlocks[iteratorIndex]),
			 voteBlock);
	    break;
	  default:
	    assertTrue(coordinator.isSpoiled(iteratorIndex));
	    try {
	      coordinator.getVoteBlock(url, iteratorIndex);
	      fail("Expected Exception not thrown.");
	    } catch (IllegalArgumentException e) {
	      // expected
	    }
	  }
	}
      }
    }
    assertNull(coordinator.peekUrl());
  }

  public void testPeek() throws Exception {
    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
      }};

    iterators = makeIterators(voteBlocks);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    assertEquals("http://test.com/foo1", coordinator.peekUrl());
    coordinator.getVoteBlock("http://test.com/foo1", 0);
    assertEquals("http://test.com/foo2", coordinator.peekUrl());
    try {
      coordinator.getVoteBlock("http://test.com/goo", 0);
      fail("Expected exception not thrown.");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }

  public void testIteratorIOException() throws Exception {

    final class IOExceptionVoteBlocksIterator implements VoteBlocksIterator {
      final VoteBlocksIterator iterator;
      final String failAt;

      boolean threw = false;
      boolean released = false;

      IOExceptionVoteBlocksIterator(VoteBlocksIterator iterator,
				    String failAt) {
	this.iterator = iterator;
	this.failAt = failAt;
      }

      void checkFail() throws IOException {
	if (failAt.equals(iterator.peek().getUrl())) {
	  // We only get here once.
	  assertFalse(threw);
	  threw = true;
	  throw new IOException("Expected exception.");
	}
      }

      @Override public boolean hasNext() throws IOException {
	checkFail();
	return iterator.hasNext();
      }
      @Override public VoteBlock next() throws IOException {
	checkFail();
	return iterator.next();
      }
      @Override public VoteBlock peek() throws IOException {
	checkFail();
	return iterator.peek();
      }
      @Override public void release() {
	// We only get here once.
	assertFalse(released);
	released = true;
	releaseForReal();
      }

      void releaseForReal() {
	iterator.release();
      }
    }

    // A DiskVoteBlocks that has an iterator that throws IOException
    // when it reaches the given URL.
    final class IOExceptionDiskVoteBlocks extends DiskVoteBlocks {
      final String failAt;

      IOExceptionDiskVoteBlocks(File toDir,
				VoteBlock[] voteBlocks, String failAt)
	  throws IOException {
	super(toDir);
	for (int i = 0; i < voteBlocks.length; i++) {
	  addVoteBlock(voteBlocks[i]);
	}
	this.failAt = failAt;
      }

      @Override public IOExceptionVoteBlocksIterator iterator()
	  throws FileNotFoundException {
	return new IOExceptionVoteBlocksIterator(super.iterator(), failAt);
      }
    };

    VoteBlock[][] voteBlocks = {
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      },
      {
	makeVoteBlock("http://test.com/foo1", "content for foo1"),
	makeVoteBlock("http://test.com/foo2", "content for foo2"),
	makeVoteBlock("http://test.com/foo3", "content for foo3")
      }
    };

    iterators = makeIterators(voteBlocks);
    // Add a throwing iterator to the collection
    IOExceptionDiskVoteBlocks ioeVoteBlocks =
      new IOExceptionDiskVoteBlocks(tempDir,
				    voteBlocks[0], "http://test.com/foo2");
    IOExceptionVoteBlocksIterator ioeIterator = ioeVoteBlocks.iterator();
    iterators.add(ioeIterator);
    VoteBlocksCoordinator coordinator = new VoteBlocksCoordinator(iterators);

    try {
      assertEquals("http://test.com/foo1", coordinator.peekUrl());
      assertFalse(coordinator.isSpoiled(2));
      assertFalse(ioeIterator.threw);
      assertFalse(ioeIterator.released);
      coordinator.seek("http://test.com/foo2");
      assertTrue(ioeIterator.threw);
      assertTrue(ioeIterator.released);
      assertTrue(coordinator.isSpoiled(2));
      // peekUrl() doesn't throw anything, but there's no URL since the
      // iterator threw IOException.
      assertEquals("http://test.com/foo2", coordinator.peekUrl());
    } finally {
      // Remove iterator so tearDown won't release it, which might throw.
      // Release the DiskVoteBlocks directly.
      iterators.remove(ioeIterator);
      ioeIterator.releaseForReal();
    }
  }

  // Make a collection of iterators, each with the given VoteBlock instances.
  private List<VoteBlocksIterator>
    makeIterators(VoteBlock[][] voteBlockArrays) throws Exception {
    List<VoteBlocksIterator> iterators = new ArrayList<VoteBlocksIterator>();
    for (VoteBlock[] voteBlockArray: voteBlockArrays) {
      iterators.add(makeDiskVoteBlocks(voteBlockArray).iterator());
    }
    return iterators;
  }

  // Find and return the VoteBlock with the given URL.  Note: this
  // will return the URL even if the blocks are not in canonical
  // order/.
  private VoteBlock findVoteBlock(String url, VoteBlock[] voteBlocks) {
    for (int i = 0; i < voteBlocks.length; i++) {
      if (voteBlocks[i].getUrl().equals(url)) {
	return voteBlocks[i];
      }
    }
    return null;
  }

  private VoteBlock makeVoteBlock(String url) {
    VoteBlock vb = new VoteBlock(url);
    return vb;
  }

  private VoteBlock makeVoteBlock(String url, String content)
      throws Exception {
    VoteBlock vb = new VoteBlock(url);
    addVersion(vb, content);
    return vb;
  }

  private void addVersion(VoteBlock block, String content) throws Exception {
    MessageDigest md = MessageDigest.getInstance("SHA1");
    md.update(content.getBytes());
    byte[] hash = md.digest();
    block.addVersion(0, content.length(),
                     0, content.length(),
                     hash, hash, false);
  }

  private DiskVoteBlocks makeDiskVoteBlocks(VoteBlock [] votes)
      throws Exception {
    DiskVoteBlocks vb = new DiskVoteBlocks(tempDir);
    for (int i = 0; i < votes.length; i++) {
      vb.addVoteBlock(votes[i]);
    }
    return vb;
  }
}


text:
<!doctype html>

<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="cleartype" content="on">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Vue Material">
    <meta name="application-name" content="Vue Material">
    <meta name="description" content="Material Design for Vue">

    <meta name="msapplication-config" content="/assets/favicon/browserconfig.xml">
    <meta name="theme-color" content="#2196f3">
    <link rel="apple-touch-icon" sizes="180x180" href="./assets/favicon/apple-touch-icon.png">
    <link rel="icon" type="image/png" href="./assets/favicon/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="./assets/favicon/favicon-194x194.png" sizes="194x194">
    <link rel="icon" type="image/png" href="./assets/favicon/android-chrome-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="./assets/favicon/favicon-16x16.png" sizes="16x16">
    <link rel="manifest" href="./assets/favicon/manifest.json">
    <link rel="mask-icon" href="./assets/favicon/safari-pinned-tab.svg" color="#2196f3">
    <link rel="shortcut icon" href="./assets/favicon/favicon.ico">

    <title>Vue Material</title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>

  <body>
    <div id="gpress-main" v-cloak>

    </div>

  </body>
</html>

redpajama_set_name: RedPajamaGithub


text:
REG_FIDDLE(RRect_isComplex, 256, 100, false, 0) {
void draw(SkCanvas* canvas) {
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(16);
    SkVector radii[] = {{25, 30}, {40, 30}, {40, 30}, {20, 30}};
    SkRRect rrect;
    rrect.setRectRadii({30, 10, 100, 60}, radii);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isComplex() ? "complex" : "not complex", 64, 90, paint);
    radii[0].fX = 20;
    rrect.setRectRadii(rrect.getBounds(), radii);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isComplex() ? "complex" : "not complex", 64, 90, paint);
}
}  // END FIDDLE
#endif  // Disabled until updated to use current API.


text:
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Material.Light">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
        <item name="android:colorPrimary">#AA66CC</item>
	    <item name="android:colorPrimaryDark">#9933CC</item>
	    <item name="android:textColorPrimary">#FFFFFF</item>
	    <item name="android:navigationBarColor">#9933CC</item>
	    <item name="android:colorAccent">#AA66CC</item>
	    <item name="android:colorControlHighlight">#9933CC</item>
	    <item name="android:textColor">#FF9933CC</item>
	    <item name="android:editTextStyle">@style/AppThemeEditTextStyle</item>
	    <item name="android:spinnerStyle">@style/AppThemeSpinnerStyle</item>
    </style>

    <!-- EditText theme. -->
    <style name="AppThemeEditTextStyle" parent="@android:style/Widget.EditText">
        <item name="android:minHeight">56dp</item>
        <item name="android:maxLines">1</item>
        <item name="android:textColor">#FF9933CC</item>
        <item name="android:background">@drawable/material_border</item>
        <item name="android:paddingLeft">16dp</item>
        <item name="android:paddingRight">16dp</item>
    </style>

    <!-- Spinner theme. -->
    <style name="AppThemeSpinnerStyle" parent="@android:style/Widget.Material.Spinner">
        <item name="android:minHeight">56dp</item>
        <item name="android:background">@drawable/material_border</item>
    </style>

</resources>


text:
let path = require('path');
let ProfileManage = require('../module/profile-manage');
let config = require('../../../conf/core.conf');
let rfs = require('../../../components/util/fs');
let fs = require('fs');

module.exports = args => {

    let targetPath = path.join(config.storagePath, 'user', 'profile');
    let pm = new ProfileManage(config.user.profile);
    pm.removeAllProfile();

    console.log('  正在移除所有用户配置的文件...');

    if (rfs.rmdirsSync(targetPath)) {
        pm.write();
        console.log('  已成功移除该所有用户的配置信息。');
    } else {
        console.log('  移除失败:请检查权限是否正确。');
    }
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Class NotNull
   </title>
    <meta name="viewport" content="width=device-width">
    <meta name="title" content="Class NotNull
   ">
    <meta name="generator" content="docfx 2.9.3.0">

    <link rel="shortcut icon" href="../favicon.ico">
    <link rel="stylesheet" href="../styles/docfx.vendor.css">
    <link rel="stylesheet" href="../styles/docfx.css">
    <link rel="stylesheet" href="../styles/main.css">
    <meta property="docfx:navrel" content="../toc.html">
    <meta property="docfx:tocrel" content="toc.html">

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

              </button>

              <form class="navbar-form navbar-right" role="search" id="search">

                  <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">

              </form>

          Show / Hide Table of Contents

Class NotNull

Represents the ValueRule for requiring the value to not be null

Inheritance

System.Object

ValueRule

NotNull

Inherited Members

                  ValueRule.ValueTypeMismatch

                  ValueRule.Property

                  ValueRule.FailIfValueTypeMismatch<TDesired>(IRuleContext, Object)

                  System.Object.ToString()

                  System.Object.Equals(System.Object)

                  System.Object.Equals(System.Object, System.Object)

                  System.Object.ReferenceEquals(System.Object, System.Object)

                  System.Object.GetHashCode()

                  System.Object.GetType()

                  System.Object.MemberwiseClone()

Namespace:Bifrost.Validation.Rules

Assembly:Bifrost.dll

Syntax

public class NotNull : ValueRule, IValueRule, IRule

Constructors

                |
                Improve this Doc

                View Source

NotNull(PropertyInfo)

Initializes a new instance of the NotNull rule

Declaration

public NotNull(PropertyInfo property)

Parameters

                    Type
                    Name
                    Description

                    System.Reflection.PropertyInfo
                    property

System.Reflection.PropertyInfo the rule is for

Fields

                |
                Improve this Doc

                View Source

ValueIsNull

When a value is null, this is the reason given

Declaration

public static BrokenRuleReason ValueIsNull

Field Value

                    Type
                    Description

                    BrokenRuleReason

Methods

                |
                Improve this Doc

                View Source

Evaluate(IRuleContext, Object)

Declaration

public override void Evaluate(IRuleContext context, object instance)

Parameters

                    Type
                    Name
                    Description

                    IRuleContext
                    context

                    System.Object
                    instance

Overrides

ValueRule.Evaluate(IRuleContext, Object)

Extension Methods

                  ConceptExtensions.IsConcept(Object)

                  ConceptExtensions.GetConceptValue(Object)

                  DynamicExtensions.AsExpandoObject(Object)

                  MethodCalls.CallGenericMethod<TOut, T, T1, T2, T3>(T, Expression<Func<T, Func<T1, T2, T3, TOut>>>, T1, T2, T3, Type[])

                  MethodCalls.CallGenericMethod<TOut, T, T1, T2>(T, Expression<Func<T, Func<T1, T2, TOut>>>, T1, T2, Type[])

                  MethodCalls.CallGenericMethod<TOut, T, T1>(T, Expression<Func<T, Func<T1, TOut>>>, T1, Type[])

                  MethodCalls.CallGenericMethod<TOut, T>(T, Expression<Func<T, Func<TOut>>>, Type[])

                  MethodCalls.Generics<T>(T)

                    Improve this Doc

                    View Source

              Back to top

            Copyright © 2008-2017 Dolittle


text:
<?php

ini_set('memory_limit', '512M');

require_once __DIR__.'/vendor/autoload.php';
// We are Gentoo users, we love color in bash shell :)
$colors = new Colors();

// Detect more than 10000 consecutive characters on first line
function detect_obfuscated($filecontent)
{
    $weirdlength = 1000;
    //if (isset($filecontent[1]) && strlen($filecontent[1]) > $weirdlength && preg_match("/[A-Za-z0-9\\\]{$weirdlength}/",$filecontent[1])) { // If a line contains more than 10,000 characters, write it to stdout
    for ($line = 0; $line <= 1; ++$line) {
        if (isset($filecontent[$line]) && strlen($filecontent[$line]) > $weirdlength) { // If a line contains more than 10,000 characters, write it to stdout
            return true;
        }
    }

    return false;
}

// Detect eval functions on first line
function detect_onelineshell($filecontent)
{
    $lines = 3;
    for ($i = 0; $i < $lines; ++$i) {
        if (isset($filecontent[$i]) && preg_match("/(eval[\s]*\(|system\(|\\\x)/", $filecontent[$i])) {
            return true;
        }
    }
    if (isset($filecontent[count($filecontent) - 1]) && preg_match("/(eval\(|system\()/", $filecontent[count($filecontent) - 1])) {
        return true;
    }

    return false;
}

// Detect php files in upload folder
function detect_upload($filename)
{
    if (preg_match('#/wp-content/uploads#', $filename) && filesize($filename) > 1024) {
        return true;
    }

    return false;
}

// Detect webshells patterns
function detect_shell($filecontent)
{
    global $shells;

    foreach ($shells as $shell) {
        $shell = trim($shell);
        if (preg_match("/$shell/", implode($filecontent))) {
            return true;
        }
    }

    return false;
}

// Check whitelist
function in_whitelist($filename)
{
    global $whitelist;

    foreach ($whitelist as $wl) {
        if (false !== strpos($filename, trim($wl))) {
            return true;
        }
    }

    return false;
}

// Display a report of infected file
function report_file($file, $reason)
{
    global $colors;

    if (!in_whitelist($file)) {
        echo $colors->getColoredString("Infected file (reason : $reason) :\n", 'red');
        echo $colors->getColoredString("\t$file\n", 'light_blue');
    }
}

// Delete the infected file with/without confirmation
function delete_file($file, $content, $confirmation)
{
    global $colors;

    echo $colors->getColoredString("This file ($file) containing the following code :\n", 'cyan');
    echo "\t".$content."\n";

    if ($confirmation) {
        echo $colors->getColoredString('Delete ? (y/n)', 'cyan');
        $handle = fopen('php://stdin', 'r');
        $input = fgets($handle);

        if (trim($input) == 'y') {
            unlink($file);
        } else {
            echo "$input";
        }
    } else {
        unlink($file);
    }
}

// Propose and apply patch
function patch_file($file, $content)
{
    global $colors;

    $newfile = preg_replace("/^.*<\?php/", '<?php', $content[0]);
    $fp = fopen("$file.fixed", 'w');
    fwrite($fp, $newfile);
    for ($i = 1; $i < count($content); ++$i) {
        fwrite($fp, $content[$i]);
    }
    fclose($fp);
    exec("diff -u $file $file.fixed > fix.patch");

    if (filesize('fix.patch') > 0) {
        $diff = file('fix.patch');
        echo $colors->getColoredString("I'm proposing the following patch. What do you think ?\n", 'cyan');

        echo "\n".implode($diff)."\n";

        echo $colors->getColoredString('Apply ? (y/n)', 'cyan');
        $handle = fopen('php://stdin', 'r');
        $input = fgets($handle);
        if (trim($input) == 'y') {
            exec("patch $file < fix.patch");
            unlink('fix.patch');
            unlink("$file.fixed");
        } else {
            echo 'No patch applied';
        }
    }
    unlink('fix.patch');
}

// Main(void)
if (empty($argv[1])) {
    die("Usage: php find.php directory_to_scan > infected.txt\n");
} else {
    echo $colors->getColoredString('Scanning '.$argv[1]." for potential obfuscated malware...\n\n", 'green');
    $data = array();
    if (file_exists($argv[1])) {
        if (is_dir($argv[1])) {
            $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1]), RecursiveIteratorIterator::SELF_FIRST); // Grab array of the entire structures of $argv[1] (a directory)
        } else {
            // Scan file directly
            $files = array($argv[1]);
        }

        $c = 0; // Counter for files processed
        $f = 0; // Counter for files with potential malware

        // Preload data
        $shells = file(dirname(__FILE__).'/data/webshells.txt');
        $whitelist = file(dirname(__FILE__).'/data/whitelist.txt');

        foreach ($files as $file) {
            if (is_dir($file) === true) { // Not in use, was used to check directory traversal was working properly
            } else { // If is file
                if (preg_match("/\.php$/", $file)) { // Currently only selects PHP scripts for scanning
                    $arr = file($file); // Puts each line of the file into an array element

                    if (detect_shell($arr)) {
                        report_file($file, 'Shell script pattern');
                        ++$f;
                        continue;
                    }

                    if (detect_obfuscated($arr)) {
                        report_file($file, 'obfuscated code on first line');
                        ++$f;
                        continue;
                    }

                    if (detect_onelineshell($arr)) {
                        report_file($file, 'First-line file with eval');
                        if (count($arr) == 1) {
                            delete_file($file, implode($arr), true);
                        } else {
                            patch_file($file, $arr);
                        }
                        ++$f;
                        continue;
                    }

                    if (detect_upload($file)) {
                        report_file($file, 'PHP file in wordpress upload dir');
                        ++$f;
                        continue;
                    }
                }
            }
            ++$c;
        }
    } else {
        die('The specified scan path does not exist!');
    }
}


text:
- Analista de sistemas
- Programador PHP
- Ex-presidente do PHP Maranhão
- Membro ativo da comunidade de Startups do Maranhão
- Fundador do Mr Lucky
- Scrum Master Certificado
- Evangelista de Devs para Startups

## Perfil

Desenvolvedor há mais de 15 anos. Apaixonado por desenvolver software focado em gente. Membro engajado das comunidades de desenvolvimento de sofware.

Posso ajudá-lo com: Desenvolvimento web, Melhorar como palestrante, Agile e Como pensar o seu MVP.

## Links

* [LinkedIn](https://br.linkedin.com/in/evaldobarbosa)
* [Medium](https://medium.com/@evaldobarbosa)
* [Facebook](https://fb.me/evaldo.barbosa.902)
* [Twitter](https://twitter.com/evaldobarbosa)
* [Telegram](@EvaldoBarbosa)

## Gostaria de retribuir a ajuda de Evaldo Barbosa?

Remende o trabalho dele no linkedin e outras redes sociais. Se for o caso, tem também o [PagSeguro](https://pag.ae/bjmht6d).

## Mentorados(as)

* Quer ser meu mentorado?


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>RefCnt: refcnt-private.h Source File | Piles</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="/assets/css/tabs.css" rel="stylesheet" type="text/css"/>

<link href="/assets/css/navtree.css" rel="stylesheet" type="text/css"/>

<link href="/assets/css/styleSheetFile.css" rel="stylesheet" type="text/css" />

<link rel="icon"
  type="image/png"
  href="/assets/images/pile-16.png">
<link rel="shortcut icon"
  type="image/png"
  href="/assets/images/pile-16.png">
<link rel="stylesheet" href="/assets/css/main.css">

Piles

    home
    docs
    piles
    GitHub

RefCnt Pile
     version 0.0.1

C++ class implementing a simple reference counting mechanism.

Main Page

Classes

Files

File List

refcnt-private.h

Go to the documentation of this file.

    1

   10 #ifndef GUARD_REFCNT_PRIVATE_H_INCLUDE

   11 #define GUARD_REFCNT_PRIVATE_H_INCLUDE

   12

   13 #include <refcnt/refcnt-config.h>

   14

   15 #if 0

   16 #    define REFCNT_DEBUGM printf

   17 #else

   18 #    define REFCNT_DEBUGM black_hole

   19 #endif

   20

   21 #if 0

   22 #    define REFCNT_TRACE_ENTRY printf("REFCNT ENTRY %s in %s[%d]\n", __func__, __FILE__, __LINE__)

   23 #else

   24 #    define REFCNT_TRACE_ENTRY

   25 #endif

   26

   27 #if 0

   28 #    define REFCNT_TRACE_EXIT printf("REFCNT EXIT %s in %s[%d]\n", __func__, __FILE__, __LINE__)

   29 #else

   30 #    define REFCNT_TRACE_EXIT

   31 #endif

   32

   33

   34 static inline void black_hole (...)

   35 {}

   36

   37 #endif // GUARD_REFCNT_PRIVATE_H_INCLUDE

<address class="footer"></address>


text:
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Razor.CSharp.Mvc;
using JetBrains.ReSharper.Psi.Razor.Mvc.Impl;
using Nancy.ReSharper.Plugin.CustomReferences;

namespace Nancy.ReSharper.Plugin.Utils
{
    [ProjectFileType(typeof(RazorCSharpProjectFileType))]
    public class RazorCSharpNancyProjectFileLanguageService : RazorCSharpMvcProjectFileLanguageService
    {
        public RazorCSharpNancyProjectFileLanguageService(RazorCSharpProjectFileType razorCSharpProjectFileType)
            : base(razorCSharpProjectFileType)
        {
        }

        public override PsiLanguageType GetPsiLanguageType(IProjectFile projectFile)
        {
            if (projectFile.IsProjectReferencingNancyRazorViewEngine())
            {
                return GetPsiLanguageType(projectFile.LanguageType);
            }

            return base.GetPsiLanguageType(projectFile);
        }

        public override IPsiSourceFileProperties GetPsiProperties(IProjectFile projectFile, IPsiSourceFile sourceFile)
        {
            if (!projectFile.IsProjectReferencingNancyRazorViewEngine())
            {
                return base.GetPsiProperties(projectFile, sourceFile);
            }

            return new RazorMvcPsiProjectFileProperties(projectFile, sourceFile);
        }
    }
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Ceratanthus kerrii Doan

### Remarks
null


text:
using System;
using System.Linq;
using Google.Apis.Dfareporting.v2_2;
using Google.Apis.Dfareporting.v2_2.Data;

namespace DfaReporting.Samples {
  /// <summary>
  /// This example lists all existing campaigns for the specified user profile.
  /// </summary>
  class GetCampaigns : SampleBase {
    /// <summary>
    /// Returns a description about the code example.
    /// </summary>
    public override string Description {
      get {
        return "This example lists all existing campaigns for the specified" +
            " user profile.\n";
      }
    }

    /// <summary>
    /// Main method, to run this code example as a standalone application.
    /// </summary>
    /// <param name="args">The command line arguments.</param>
    public static void Main(string[] args) {
      SampleBase codeExample = new GetCampaigns();
      Console.WriteLine(codeExample.Description);
      codeExample.Run(DfaReportingFactory.getInstance());
    }

    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long profileId = long.Parse(_T("INSERT_PROFILE_ID_HERE"));

      // Limit the fields returned.
      String fields = "nextPageToken,campaigns(id,name)";

      CampaignsListResponse campaigns;
      String nextPageToken = null;

      do {
        // Create and execute the campaigns list request.
        CampaignsResource.ListRequest request =  service.Campaigns.List(profileId);
        request.Fields = fields;
        request.PageToken = nextPageToken;
        campaigns = request.Execute();

        foreach (Campaign campaign in campaigns.Campaigns) {
          Console.WriteLine("Campaign with ID {0} and name \"{1}\" was found.",
              campaign.Id, campaign.Name);
        }

        // Update the next page token.
        nextPageToken = campaigns.NextPageToken;
      } while (campaigns.Campaigns.Any() && !String.IsNullOrEmpty(nextPageToken));
    }
  }
}


text:
<bill session="115" type="h" number="1979" updated="2017-06-19T21:45:16Z">
  <state datetime="2017-04-06">REFERRED</state>
  <status>
    <introduced datetime="2017-04-06"/>
  </status>
  <introduced datetime="2017-04-06"/>
  <titles>
    <title type="short" as="introduced">No More Tulias: Drug Law Enforcement Evidentiary Standards Improvement Act of 2017</title>
    <title type="short" as="introduced">No More Tulias: Drug Law Enforcement Evidentiary Standards Improvement Act of 2017</title>
    <title type="official" as="introduced">To increase the evidentiary standard required to convict a person for a drug offense, to require screening of law enforcement officers or others acting under color of law participating in drug task forces, and for other purposes.</title>
    <title type="display">No More Tulias: Drug Law Enforcement Evidentiary Standards Improvement Act of 2017</title>
  </titles>
  <sponsor bioguide_id="J000032"/>
  <cosponsors/>
  <actions>
    <action datetime="2017-04-06">
      <text>Introduced in House</text>
    </action>
    <action datetime="2017-04-06" state="REFERRED">
      <text>Referred to the House Committee on the Judiciary.</text>
    </action>
    <action datetime="2017-05-01">
      <text>Referred to the Subcommittee on Crime, Terrorism, Homeland Security, and Investigations.</text>
    </action>
  </actions>
  <committees>
    <committee subcommittee="" code="HSJU" name="House Judiciary" activity="Referral"/>
    <committee subcommittee="Crime, Terrorism, Homeland Security, and Investigations" code="HSJU08" name="House Judiciary" activity="Referral"/>
  </committees>
  <relatedbills/>
  <subjects>
    <term name="Crime and law enforcement"/>
    <term name="Criminal investigation, prosecution, interrogation"/>
    <term name="Criminal justice information and records"/>
    <term name="Drug trafficking and controlled substances"/>
    <term name="Drug, alcohol, tobacco use"/>
    <term name="Evidence and witnesses"/>
    <term name="Law enforcement administration and funding"/>
    <term name="Law enforcement officers"/>
    <term name="Racial and ethnic relations"/>
  </subjects>
  <amendments/>
  <committee-reports/>
</bill>


text:
#ifndef CJET_ABLOG_H
#define CJET_ABLOG_H

#ifdef __cplusplus
extern "C" {
#endif

void set_warning_level(unsigned int level);

#ifdef __cplusplus
}
#endif

#endif


text:
from __future__ import print_function

import mysql.connector
from mysql.connector import errorcode

from crawler import my_utils as utils
from crawler.items import StoreItem

import scrapy

from scrapy import signals
from scrapy.xlib.pydispatch import dispatcher
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from scrapy.selector import Selector
from scrapy.http import Request, FormRequest

import re

# definir um update maroto

def insert_software(db_conn, db_cursor, software):
    add_software = ("INSERT INTO software "
              "(id_software, url, name, price, description, linux, mac, windows, release_date, hdd_space) "
              "VALUES (%(id_software)s, %(url)s, %(name)s, %(price)s, %(description)s, %(linux)s, %(mac)s, %(windows)s, %(release_date)s, %(hdd_space)s)")

    data_software = {
        'id_software': software['id_software'],
        'url': software['url'],
        'name': software['name'],
        'price': software['price'],
        'description': software['description'],
        'linux': software['linux'],
        'mac': software['mac'],
        'windows': software['windows'],
        'release_date': software['release_date'],
        'hdd_space': software['hdd_space'],
    }

    # print (add_software)
    # print (data_software)

    db_cursor.execute(add_software, data_software)
    db_conn.commit()

def insert_genre(db_conn, db_cursor, genre):
    # MySQL escapes \' with another '
    genre = genre.replace("'", "''")

    exist_check = ("SELECT id_genre FROM genre WHERE name LIKE \'%s\'" % genre)
    db_cursor.execute(exist_check)

    data_exists = db_cursor.fetchone()
    if data_exists:
        id_genre = data_exists[0]
    else:
        insert = ("INSERT INTO genre "
                "(name) "
                "VALUES ('%s')" % genre)

        db_cursor.execute(insert)
        db_conn.commit()

        id_genre = db_cursor.lastrowid

    return id_genre

def insert_tag(db_conn, db_cursor, tag):
    tag = tag.replace("'", "''")

    exist_check = ("SELECT id_tag FROM tag WHERE name LIKE \'%s\'" % tag)
    db_cursor.execute(exist_check)

    data_exists = db_cursor.fetchone()
    if data_exists:
        id_tag = data_exists[0]
    else:
        insert = ("INSERT INTO tag "
                "(name) "
                "VALUES ('%s')" % tag)

        db_cursor.execute(insert)
        db_conn.commit()

        id_tag = db_cursor.lastrowid

    return id_tag

def insert_developer(db_conn, db_cursor, developer):
    developer = developer.replace("'", "''")

    exist_check = ("SELECT id_developer FROM developer WHERE name LIKE \'%s\'" % developer)
    db_cursor.execute(exist_check)

    data_exists = db_cursor.fetchone()
    if data_exists:
        id_dev = data_exists[0]
    else:
        insert = ("INSERT INTO developer "
              "(name) "
              "VALUES ('%s')" % developer)

        db_cursor.execute(insert)
        db_conn.commit()

        id_dev = db_cursor.lastrowid

    return id_dev

def insert_rel_software_genre(db_conn, db_cursor, id_software, id_genre):
    add_rel = ("INSERT INTO rel_software_genre "
              "(fk_genre, fk_software) "
              "VALUES (%s, %s)" % (id_genre, id_software))

    db_cursor.execute(add_rel)
    db_conn.commit()

def insert_rel_software_tag(db_conn, db_cursor, id_software, id_tag):
    add_rel = ("INSERT INTO rel_software_tag "
                "(fk_tag, fk_software) "
                "VALUES (%s, %s)" % (id_tag, id_software))

    db_cursor.execute(add_rel)
    db_conn.commit()

def insert_rel_software_developer(db_conn, db_cursor, id_software, id_developer):
    add_rel = ("INSERT INTO rel_software_developer "
              "(fk_developer, fk_software) "
              "VALUES (%s, %s)" % (id_developer, id_software))

    db_cursor.execute(add_rel)
    db_conn.commit()

def parse_storeitem(self, response, db_conn, db_cursor):
    url = response.url

    # no name, no game
    name_list = response.xpath('//div[@class="apphub_AppName"]/text()').extract()
    name = name_list[0].encode('utf-8')
    if (not name):
        return

    id_software = 0
    id_regex = re.compile('([0-9]{1,})')
    id_search = re.search(id_regex, str(url))
    id_software = int(id_search.groups(0)[0])

    # Checar se o item já existe é uma boa.
    # check_software_item = ("SELECT COUNT(1) FROM software WHERE id_software=%s" % id_software)
    # db_cursor.execute(check_software_item)
    # if db_cursor.fetchone()[0]:
    #     return

    mac = utils.os_validator(response.xpath('//div[contains(@data-os, "mac")]').extract())
    lin = utils.os_validator(response.xpath('//div[contains(@data-os, "lin")]').extract())
    win = utils.os_validator(response.xpath('//div[contains(@data-os, "win")]').extract())
    price = utils.price_validator(response.xpath('//meta[@itemprop="price"]/@content').extract())
    description = utils.description_validator(response.xpath('//div[@id="game_area_description"]//text()').extract())

    release_date = ""
    release = response.xpath('//span[@class="date"]/text()').extract()
    if (release):
        release_date = str(release[0])

    size = 0.0
    size_str = utils.whitespace_remover(response.xpath('substring-after(//div[@class="sysreq_contents"], "Hard Drive:")').extract()[0].upper())
    game_size = re.compile('([0-9]{1,})(MB|GB)')
    src_size = re.search(game_size, size_str)

    if (src_size):
        size = float(str(src_size.groups(0)[0]))

        if (str(src_size.groups(0)[1]) == "GB"):
            size *= 1024

    item = StoreItem()
    item['url'] = url
    item['id_software'] = id_software
    item['name'] = name
    item['price'] = price
    item['description'] = description
    item['mac'] = mac
    item['linux'] = lin
    item['windows'] = win
    item['release_date'] = release_date
    item['hdd_space'] = size

    # Insere informações de desenvolvedor, tag e gênero
    developers = response.xpath('//div[@class="details_block"]/a[contains(@href, "http://store.steampowered.com/search/?developer")]/text()')
    dev_ids = []
    for dev in developers:
        dev_ids.append(insert_developer(db_conn, db_cursor, dev.extract().strip()))

    tag_ids = []
    tags = response.xpath('//div[@class="glance_tags popular_tags"]/a[contains(@href, "http://store.steampowered.com/tag")]/text()')
    for tag in tags:
        tag_ids.append(insert_tag(db_conn, db_cursor, tag.extract().strip()))

    genre_ids = []
    genres = response.xpath('//div[@class="details_block"]/a[contains(@href, "http://store.steampowered.com/genre")]/text()')
    for genre in genres:
        genre_ids.append(insert_genre(db_conn, db_cursor, genre.extract().strip()))

    # Insere o jogo
    insert_software(db_conn, db_cursor, item)

    # Insere as relações do jogo
    for id_genre in genre_ids:
        insert_rel_software_genre(db_conn, db_cursor, id_software, id_genre)

    for id_tag in tag_ids:
        insert_rel_software_tag(db_conn, db_cursor, id_software, id_tag)

    for id_dev in dev_ids:
        insert_rel_software_developer(db_conn, db_cursor, id_software, id_dev)

    return item

# scrapy crawl spider -o steam.json
# scrapy crawl somespider -s JOBDIR=crawls/somespider-1

#old_widow
#@TGL_Doggbatata23

# fazer a parte de fórum (posts)

class StoreSpider(CrawlSpider):
    global db_conn
    global db_cursor

    name = "storespider"
    allowed_domains = ["store.steampowered.com"]
    start_urls = [
        "http://store.steampowered.com/",
        "http://store.steampowered.com/app/242700/",
        "http://store.steampowered.com/app/209000"
        "http://store.steampowered.com/app/730/",
        "http://store.steampowered.com/app/321080/",
        "http://store.steampowered.com/app/258817",
        "http://store.steampowered.com/app/218620/",
        "http://store.steampowered.com/app/265590",
        "http://store.steampowered.com/app/222880",
    ]

    # Adicionar tolerância por gênero e tags para crawling
    # http://store.steampowered.com/tag/en/Action/#os%5B%5D=linux&p=0&tab=NewReleases

    # Tolerância pra essa url que é das da hora:
    # http://store.steampowered.com/search/?developer=Level%20Up%20Labs%2C%20LLC

    rules = (
        Rule(
            LinkExtractor(
                #recommended/morelike/app/[0-9]{1,}'
                allow=('app/[0-9]{1,}', 'store.steampowered.com/(tag|genre|search)'),
                deny=('\?l', 'facebook', 'twitter', 'login', 'reddit'),
            ),

            callback='parse_items',
            process_links='link_processor',
            process_request='request_processor',
            follow=True
        ),
    )

    search_url = re.compile('store.steampowered.com/(tag|genre|search)')
    software_url = re.compile('store.steampowered.com/app/[0-9]{1,}')
    recommended_url = re.compile('(.+?)/recommended')
    agecheck_url = re.compile('store.steampowered.com/agecheck/app/[0-9]{1,}')

    print ("open database")
    db_conn = mysql.connector.connect(user='root', password='@TGL_Dogg', host='localhost', database='steampunk')
    db_cursor = db_conn.cursor()

    # Fecha conexão com o banco após limpar
    def spider_ended(spider):
        db_conn.close()
        db_cursor.close()
        print ("close database")

    dispatcher.connect(spider_ended, signals.spider_closed)

    # Parser principal, vai decidir como vamos parsear os itens que recebemos
    def parse_items(self, response):
        is_recommended_url = re.search(self.recommended_url, response.url) != None
        is_software_url = re.search(self.software_url, response.url) != None
        is_search_url = re.search(self.search_url, response.url) != None

        # São urls com listagem de jogos, não parseamos elas, apenas visitamos para pegar mais jogos.
        if (is_recommended_url or is_search_url):
            return

        if (is_software_url):
            yield parse_storeitem(self, response, db_conn, db_cursor)

    # Edita as urls antes de crawlear
    def link_processor(self, links):
        for link in links:
            url = link.url

            is_software_url = re.search(self.software_url, url) != None
            is_recommended_url = re.search(self.recommended_url, url) != None

            # Remove o "?snr=" e outras sujeiras dos links da loja
            if (is_software_url or is_recommended_url):
                # store.steampowered.com/app/730/?snr=1_5_9__305
                # store.steampowered.com/recommended/morelike/app/730/?snr=blablabla
                # store.steampowered.com/app/100410/www.nevercenter.com/www.nevercenter.com/www.nevercenter.com/www.nevercenter.com/www.nevercenter.com/www.nevercenter.com/www.nevercenter.com/www.nevercenter.com/camerabag
                snr_url = re.compile('(.+?)app/[0-9]{1,}')
                results = re.search(snr_url, url)

                # Garante que não veio nada vazio
                if results:
                    link.url = results.group(0)

        return links

    # Faz um bypass nos jogos que tem restrição de idade
    # PS: juro que todos os membros do grupo são maiores de 18
    def request_processor(self, request):
        is_agecheck_url = re.search(self.agecheck_url, request.url) != None

        if (is_agecheck_url):
            return FormRequest(
                    url=request.url,
                    formdata={'ageDay': "1", 'ageMonth': "1", "ageYear" : "1995"},
                    callback=self.parse_items)
        else:
            return request


text:
<?php

namespace Circle314\Component\Exception\PHPError;

use \ErrorException;

class WarningException extends ErrorException
{

}


text:
package org.kaazing.gateway.transport.ws.extension;

import java.util.List;

/**
 * This class represents an extension present in the extensions header of a WebSocket handshake HTTP request or response,
 * as defined by the following syntax:
 * <pre>
 *     Sec-WebSocket-Extensions = extension-list
 *       extension-list = 1#extension
 *        extension = extension-token *( ";" extension-param )
 *        extension-token = registered-token
 *        registered-token = token
 *        extension-param = token [ "=" (token | quoted-string) ]
 *            ;When using the quoted-string syntax variant, the value
 *            ;after quoted-string unescaping MUST conform to the
 *            ;'token' ABNF.
 * </pre>
 */
public interface ExtensionHeader {
    enum EndpointKind { CLIENT, SERVER }

    String getExtensionToken();

    List<ExtensionParameter> getParameters() ;

    boolean hasParameters();
}


text:
package spatial.interpreter

import argon.core._
import argon.nodes._
import spatial.nodes._
import argon.interpreter.{Interpreter => AInterpreter}

trait Strings extends AInterpreter {

  override def matchNode(lhs: Sym[_])  = super.matchNode(lhs).orElse {

    case StringConcat(EString(a), EString(b)) =>
      a + b

    case ToString(EAny(a)) =>
      a.toString

  }

}


text:
		<button onclick="$('#selectedUsers').sortable('enable')" type="button">Enable</button>
		<button onclick="$('#selectedUsers').sortable('disable')" type="button">Disable</button>
		<button onclick="alert($('#selectedUsers').sortable('serialize'))" type="button">Serialize!</button>
		<button onclick="alert($('#selectedUsers').sortable('toArray'))" type="button">ID's to Array!</button>

				Selected users

Susan

Beth

Bob

Edward

Kate

				User list

Jack

John

Marry

Claire

Daniel


text:
#ifndef SEWENEW_REDISPLUSPLUS_ASYNC_REDIS_H
#define SEWENEW_REDISPLUSPLUS_ASYNC_REDIS_H

#include "async_connection.h"
#include "async_connection_pool.h"
#include "async_sentinel.h"
#include "async_subscriber.h"
#include "event_loop.h"
#include "utils.h"
#include "command.h"
#include "command_args.h"
#include "command_options.h"
#include "cmd_formatter.h"

namespace sw {

namespace redis {

class AsyncRedis {
public:
    AsyncRedis(const ConnectionOptions &opts,
            const ConnectionPoolOptions &pool_opts = {},
            const EventLoopSPtr &loop = nullptr);

    AsyncRedis(const std::shared_ptr<AsyncSentinel> &sentinel,
                const std::string &master_name,
                Role role,
                const ConnectionOptions &connection_opts,
                const ConnectionPoolOptions &pool_opts = {},
                const EventLoopSPtr &loop = nullptr);

    AsyncRedis(const AsyncRedis &) = delete;
    AsyncRedis& operator=(const AsyncRedis &) = delete;

    AsyncRedis(AsyncRedis &&) = default;
    AsyncRedis& operator=(AsyncRedis &&) = default;

    ~AsyncRedis();

    AsyncSubscriber subscriber();

    template <typename Result, typename ...Args>
    auto command(const StringView &cmd_name, Args &&...args)
        -> typename std::enable_if<!IsInvocable<typename LastType<Args...>::type,
                                        Future<Result> &&>::value, Future<Result>>::type {
        auto formatter = [](const StringView &name, Args &&...params) {
            CmdArgs cmd_args;
            cmd_args.append(name, std::forward<Args>(params)...);
            return fmt::format_cmd(cmd_args);
        };

        return _command<Result>(formatter, cmd_name, std::forward<Args>(args)...);
    }

    template <typename Result, typename ...Args>
    auto command(const StringView &cmd_name, Args &&...args)
        -> typename std::enable_if<IsInvocable<typename LastType<Args...>::type,
                                        Future<Result> &&>::value, void>::type {
        _callback_idx_command<Result>(LastValue(std::forward<Args>(args)...),
                cmd_name,
                MakeIndexSequence<sizeof...(Args) - 1>(),
                std::forward<Args>(args)...);
    }

    template <typename Result, typename Input>
    auto command(Input first, Input last)
        -> typename std::enable_if<IsIter<Input>::value, Future<Result>>::type {
        auto formatter = [](Input start, Input stop) {
            CmdArgs cmd_args;
            while (start != stop) {
                cmd_args.append(*start);
                ++start;
            }
            return fmt::format_cmd(cmd_args);
        };

        return _command<Result>(formatter, first, last);
    }

    template <typename Result, typename Input, typename Callback>
    auto command(Input first, Input last, Callback &&cb)
        -> typename std::enable_if<IsIter<Input>::value, void>::type {
        auto formatter = [](Input start, Input stop) {
            CmdArgs cmd_args;
            while (start != stop) {
                cmd_args.append(*start);
                ++start;
            }
            return fmt::format_cmd(cmd_args);
        };

        _callback_fmt_command<Result>(std::forward<Callback>(cb), formatter,
                first, last);
    }

    // CONNECTION commands.

    Future<std::string> echo(const StringView &msg) {
        return _command<std::string>(fmt::echo, msg);
    }

    Future<std::string> ping() {
        return _command<std::string, FormattedCommand (*)()>(fmt::ping);
    }

    Future<std::string> ping(const StringView &msg) {
        return _command<std::string,
               FormattedCommand (*)(const StringView &)>(fmt::ping, msg);
    }

    // KEY commands.

    Future<long long> del(const StringView &key) {
        return _command<long long>(fmt::del, key);
    }

    template <typename Callback>
    auto del(const StringView &key, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::del, key);
    }

    template <typename Input>
    Future<long long> del(Input first, Input last) {
        range_check("DEL", first, last);

        return _command<long long>(fmt::del_range<Input>, first, last);
    }

    template <typename Input, typename Callback>
    auto del(Input first, Input last, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        range_check("DEL", first, last);

        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::del_range<Input>, first, last);
    }

    template <typename T>
    Future<long long> del(std::initializer_list<T> il) {
        return del(il.begin(), il.end());
    }

    template <typename T, typename Callback>
    auto del(std::initializer_list<T> il, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        del<decltype(il.begin()), Callback>(il.begin(), il.end(), std::forward<Callback>(cb));
    }

    Future<long long> exists(const StringView &key) {
        return _command<long long>(fmt::exists, key);
    }

    template <typename Input>
    Future<long long> exists(Input first, Input last) {
        range_check("EXISTS", first, last);

        return _command<long long>(fmt::exists_range<Input>, first, last);
    }

    template <typename T>
    Future<long long> exists(std::initializer_list<T> il) {
        return exists(il.begin(), il.end());
    }

    Future<bool> expire(const StringView &key, const std::chrono::seconds &timeout) {
        return _command<bool>(fmt::expire, key, timeout);
    }

    Future<bool> expireat(const StringView &key,
                    const std::chrono::time_point<std::chrono::system_clock,
                                                    std::chrono::seconds> &tp) {
        return _command<bool>(fmt::expireat, key, tp);
    }

    Future<bool> pexpire(const StringView &key, const std::chrono::milliseconds &timeout) {
        return _command<bool>(fmt::pexpire, key, timeout);
    }

    Future<bool> pexpireat(const StringView &key,
                    const std::chrono::time_point<std::chrono::system_clock,
                                                    std::chrono::milliseconds> &tp) {
        return _command<bool>(fmt::pexpireat, key, tp);
    }

    Future<long long> pttl(const StringView &key) {
        return _command<long long>(fmt::pttl, key);
    }

    Future<void> rename(const StringView &key, const StringView &newkey) {
        return _command<void>(fmt::rename, key, newkey);
    }

    Future<bool> renamenx(const StringView &key, const StringView &newkey) {
        return _command<bool>(fmt::renamenx, key, newkey);
    }

    Future<long long> ttl(const StringView &key) {
        return _command<long long>(fmt::ttl, key);
    }

    Future<long long> unlink(const StringView &key) {
        return _command<long long>(fmt::unlink, key);
    }

    template <typename Input>
    Future<long long> unlink(Input first, Input last) {
        range_check("UNLINK", first, last);

        return _command<long long>(fmt::unlink_range<Input>, first, last);
    }

    template <typename T>
    Future<long long> unlink(std::initializer_list<T> il) {
        return unlink(il.begin(), il.end());
    }

    // STRING commands.

    Future<long long> append(const StringView &key, const StringView &str) {
        return _command<long long>(fmt::append, key, str);
    }

    Future<OptionalString> get(const StringView &key) {
        return _command<OptionalString>(fmt::get, key);
    }

    template <typename Callback>
    void get(const StringView &key, Callback &&cb) {
        _callback_fmt_command<OptionalString>(std::forward<Callback>(cb), fmt::get, key);
    }

    Future<long long> incr(const StringView &key) {
        return _command<long long>(fmt::incr, key);
    }

    Future<long long> incrby(const StringView &key, long long increment) {
        return _command<long long>(fmt::incrby, key, increment);
    }

    Future<double> incrbyfloat(const StringView &key, double increment) {
        return _command<double>(fmt::incrbyfloat, key, increment);
    }

    template <typename Output, typename Input>
    Future<Output> mget(Input first, Input last) {
        range_check("MGET", first, last);

        return _command<Output>(fmt::mget<Input>, first, last);
    }

    template <typename Output, typename T>
    Future<Output> mget(std::initializer_list<T> il) {
        return mget<Output>(il.begin(), il.end());
    }

    template <typename Input>
    Future<void> mset(Input first, Input last) {
        range_check("MSET", first, last);

        return _command<void>(fmt::mset<Input>, first, last);
    }

    template <typename T>
    Future<void> mset(std::initializer_list<T> il) {
        return mset(il.begin(), il.end());
    }

    template <typename Input>
    Future<bool> msetnx(Input first, Input last) {
        range_check("MSETNX", first, last);

        return _command<bool>(fmt::msetnx<Input>, first, last);
    }

    template <typename T>
    Future<bool> msetnx(std::initializer_list<T> il) {
        return msetnx(il.begin(), il.end());
    }

    Future<bool> set(const StringView &key,
                const StringView &val,
                const std::chrono::milliseconds &ttl = std::chrono::milliseconds(0),
                UpdateType type = UpdateType::ALWAYS) {
        return _command_with_parser<bool, fmt::SetResultParser>(fmt::set, key, val, ttl, type);
    }

    template <typename Callback>
    auto set(const StringView &key,
                const StringView &val,
                Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<bool> &&>::value, void>::type {
        _callback_command_with_parser<bool, fmt::SetResultParser>(std::forward<Callback>(cb),
                fmt::set, key, val, std::chrono::milliseconds(0), UpdateType::ALWAYS);
    }

    template <typename Callback>
    auto set(const StringView &key,
                const StringView &val,
                const std::chrono::milliseconds &ttl,
                Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<bool> &&>::value, void>::type {
        _callback_command_with_parser<bool, fmt::SetResultParser>(std::forward<Callback>(cb),
                fmt::set, key, val, ttl, UpdateType::ALWAYS);
    }

    template <typename Callback>
    auto set(const StringView &key,
                const StringView &val,
                const std::chrono::milliseconds &ttl,
                UpdateType type,
                Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<bool> &&>::value, void>::type {
        _callback_command_with_parser<bool, fmt::SetResultParser>(std::forward<Callback>(cb),
                fmt::set, key, val, ttl, type);
    }

    Future<bool> set(const StringView &key,
                const StringView &val,
                bool keepttl,
                UpdateType type = UpdateType::ALWAYS) {
        return _command_with_parser<bool, fmt::SetResultParser>(fmt::set_keepttl, key, val, keepttl, type);
    }

    template <typename Callback>
    auto set(const StringView &key,
                const StringView &val,
                bool keepttl,
                Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<bool> &&>::value, void>::type {
        _callback_command_with_parser<bool, fmt::SetResultParser>(std::forward<Callback>(cb),
                fmt::set_keepttl, key, val, keepttl, UpdateType::ALWAYS);
    }

    template <typename Callback>
    auto set(const StringView &key,
                const StringView &val,
                bool keepttl,
                UpdateType type,
                Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<bool> &&>::value, void>::type {
        _callback_command_with_parser<bool, fmt::SetResultParser>(std::forward<Callback>(cb),
                fmt::set_keepttl, key, val, keepttl, type);
    }

    Future<long long> strlen(const StringView &key) {
        return _command<long long>(fmt::strlen, key);
    }

    // LIST commands.

    Future<OptionalStringPair> blpop(const StringView &key,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        return _command<OptionalStringPair>(fmt::blpop, key, timeout);
    }

    template <typename Input>
    Future<OptionalStringPair> blpop(Input first,
                                Input last,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        range_check("BLPOP", first, last);

        return _command<OptionalStringPair>(fmt::blpop_range<Input>, first, last, timeout);
    }

    template <typename T>
    Future<OptionalStringPair> blpop(std::initializer_list<T> il,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        return blpop(il.begin(), il.end(), timeout);
    }

    Future<OptionalStringPair> brpop(const StringView &key,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        return _command<OptionalStringPair>(fmt::brpop, key, timeout);
    }

    template <typename Input>
    Future<OptionalStringPair> brpop(Input first,
                                Input last,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        range_check("BRPOP", first, last);

        return _command<OptionalStringPair>(fmt::brpop_range<Input>, first, last, timeout);
    }

    template <typename T>
    Future<OptionalStringPair> brpop(std::initializer_list<T> il,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        return brpop(il.begin(), il.end(), timeout);
    }

    Future<OptionalString> brpoplpush(const StringView &source,
                                const StringView &destination,
                                const std::chrono::seconds &timeout = std::chrono::seconds{0}) {
        return _command<OptionalString>(fmt::brpoplpush, source, destination, timeout);
    }

    Future<long long> llen(const StringView &key) {
        return _command<long long>(fmt::llen, key);
    }

    Future<OptionalString> lpop(const StringView &key) {
        return _command<OptionalString>(fmt::lpop, key);
    }

    Future<long long> lpush(const StringView &key, const StringView &val) {
        return _command<long long>(fmt::lpush, key, val);
    }

    template <typename Input>
    Future<long long> lpush(const StringView &key, Input first, Input last) {
        range_check("LPUSH", first, last);

        return _command<long long>(fmt::lpush_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> lpush(const StringView &key, std::initializer_list<T> il) {
        return lpush(key, il.begin(), il.end());
    }

    template <typename Output>
    Future<Output> lrange(const StringView &key, long long start, long long stop) {
        return _command<Output>(fmt::lrange, key, start, stop);
    }

    Future<long long> lrem(const StringView &key, long long count, const StringView &val) {
        return _command<long long>(fmt::lrem, key, count, val);
    }

    Future<void> ltrim(const StringView &key, long long start, long long stop) {
        return _command<void>(fmt::ltrim, key, start, stop);
    }

    Future<OptionalString> rpop(const StringView &key) {
        return _command<OptionalString>(fmt::rpop, key);
    }

    Future<OptionalString> rpoplpush(const StringView &source, const StringView &destination) {
        return _command<OptionalString>(fmt::rpoplpush, source, destination);
    }

    Future<long long> rpush(const StringView &key, const StringView &val) {
        return _command<long long>(fmt::rpush, key, val);
    }

    template <typename Input>
    Future<long long> rpush(const StringView &key, Input first, Input last) {
        range_check("RPUSH", first, last);

        return _command<long long>(fmt::rpush_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> rpush(const StringView &key, std::initializer_list<T> il) {
        return rpush(key, il.begin(), il.end());
    }

    // HASH commands.

    Future<long long> hdel(const StringView &key, const StringView &field) {
        return _command<long long>(fmt::hdel, key, field);
    }

    template <typename Callback>
    auto hdel(const StringView &key, const StringView &field, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::hdel, key, field);
    }

    template <typename Input>
    Future<long long> hdel(const StringView &key, Input first, Input last) {
        range_check("HDEL", first, last);

        return _command<long long>(fmt::hdel_range<Input>, key, first, last);
    }

    template <typename Input, typename Callback>
    auto hdel(const StringView &key, Input first, Input last, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        range_check("HDEL", first, last);

        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::hdel_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> hdel(const StringView &key, std::initializer_list<T> il) {
        return hdel(key, il.begin(), il.end());
    }

    template <typename T, typename Callback>
    auto hdel(const StringView &key, std::initializer_list<T> il, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        hdel<decltype(il.begin()), Callback>(key, il.begin(), il.end(), std::forward<Callback>(cb));
    }

    Future<bool> hexists(const StringView &key, const StringView &field) {
        return _command<bool>(fmt::hexists, key, field);
    }

    Future<OptionalString> hget(const StringView &key, const StringView &field) {
        return _command<OptionalString>(fmt::hget, key, field);
    }

    template <typename Callback>
    void hget(const StringView &key, const StringView &field, Callback &&cb) {
        _callback_fmt_command<OptionalString>(std::forward<Callback>(cb), fmt::hget, key, field);
    }

    template <typename Output>
    Future<Output> hgetall(const StringView &key) {
        return _command<Output>(fmt::hgetall, key);
    }

    template <typename Output, typename Callback>
    void hgetall(const StringView &key, Callback &&cb) {
        _callback_fmt_command<Output>(std::forward<Callback>(cb), fmt::hgetall, key);
    }

    Future<long long> hincrby(const StringView &key, const StringView &field, long long increment) {
        return _command<long long>(fmt::hincrby, key, field, increment);
    }

    Future<double> hincrbyfloat(const StringView &key, const StringView &field, double increment) {
        return _command<double>(fmt::hincrbyfloat, key, field, increment);
    }

    template <typename Output>
    Future<Output> hkeys(const StringView &key) {
        return _command<Output>(fmt::hkeys, key);
    }

    Future<long long> hlen(const StringView &key) {
        return _command<long long>(fmt::hlen, key);
    }

    template <typename Output, typename Input>
    Future<Output> hmget(const StringView &key, Input first, Input last) {
        range_check("HMGET", first, last);

        return _command<Output>(fmt::hmget<Input>, key, first, last);
    }

    template <typename Output, typename T>
    Future<Output> hmget(const StringView &key, std::initializer_list<T> il) {
        return hmget<Output>(key, il.begin(), il.end());
    }

    template <typename Input>
    Future<void> hmset(const StringView &key, Input first, Input last) {
        range_check("HMSET", first, last);

        return _command<void>(fmt::hmset<Input>, key, first, last);
    }

    template <typename T>
    Future<void> hmset(const StringView &key, std::initializer_list<T> il) {
        return hmset(key, il.begin(), il.end());
    }

    Future<bool> hset(const StringView &key, const StringView &field, const StringView &val) {
        return _command<bool>(fmt::hset, key, field, val);
    }

    template <typename Callback>
    auto hset(const StringView &key, const StringView &field, const StringView &val, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::hset, key, field, val);
    }

    Future<bool> hset(const StringView &key, const std::pair<StringView, StringView> &item) {
        return hset(key, item.first, item.second);
    }

    template <typename Callback>
    auto hset(const StringView &key, const std::pair<StringView, StringView> &item, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        hset<Callback>(key, item.first, item.second, std::forward<Callback>(cb));
    }

    template <typename Input>
    auto hset(const StringView &key, Input first, Input last)
        -> typename std::enable_if<!std::is_convertible<Input, StringView>::value, Future<long long>>::type {
        range_check("HSET", first, last);

        return _command<long long>(fmt::hset_range<Input>, key, first, last);
    }

    template <typename Input, typename Callback>
    auto hset(const StringView &key, Input first, Input last, Callback &&cb)
        -> typename std::enable_if<!std::is_convertible<Input, StringView>::value &&
            IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        range_check("HSET", first, last);

        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::hset_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> hset(const StringView &key, std::initializer_list<T> il) {
        return hset(key, il.begin(), il.end());
    }

    template <typename T, typename Callback>
    auto hset(const StringView &key, std::initializer_list<T> il, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        hset<decltype(il.begin()), Callback>(key, il.begin(), il.end(), std::forward<Callback>(cb));
    }

    template <typename Output>
    Future<Output> hvals(const StringView &key) {
        return _command<Output>(fmt::hvals, key);
    }

    // SET commands.

    Future<long long> sadd(const StringView &key, const StringView &member) {
        return _command<long long>(fmt::sadd, key, member);
    }

    template <typename Callback>
    auto sadd(const StringView &key, const StringView &member, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::sadd, key, member);
    }

    template <typename Input>
    Future<long long> sadd(const StringView &key, Input first, Input last) {
        range_check("SADD", first, last);

        return _command<long long>(fmt::sadd_range<Input>, key, first, last);
    }

    template <typename Input, typename Callback>
    auto sadd(const StringView &key, Input first, Input last, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        range_check("SADD", first, last);

        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::sadd_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> sadd(const StringView &key, std::initializer_list<T> il) {
        return sadd(key, il.begin(), il.end());
    }

    template <typename T, typename Callback>
    auto sadd(const StringView &key, std::initializer_list<T> il, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        sadd<decltype(il.begin()), Callback>(key, il.begin(), il.end(), std::forward<Callback>(cb));
    }

    Future<long long> scard(const StringView &key) {
        return _command<long long>(fmt::scard, key);
    }

    Future<bool> sismember(const StringView &key, const StringView &member) {
        return _command<bool>(fmt::sismember, key, member);
    }

    template <typename Callback>
    void sismember(const StringView &key, const StringView &member, Callback &&cb) {
        _callback_fmt_command<bool>(std::forward<Callback>(cb), fmt::sismember, key, member);
    }

    template <typename Output>
    Future<Output> smembers(const StringView &key) {
        return _command<Output>(fmt::smembers, key);
    }

    template <typename Output, typename Callback>
    void smembers(const StringView &key, Callback &&cb) {
        _callback_fmt_command<Output>(std::forward<Callback>(cb), fmt::smembers, key);
    }

    Future<OptionalString> spop(const StringView &key) {
        return _command<OptionalString,
               FormattedCommand (*)(const StringView &)>(fmt::spop, key);
    }

    template <typename Output>
    Future<Output> spop(const StringView &key, long long count) {
        return _command<Output,
               FormattedCommand (*)(const StringView &, long long)>(fmt::spop, key, count);
    }

    Future<long long> srem(const StringView &key, const StringView &member) {
        return _command<long long>(fmt::srem, key, member);
    }

    template <typename Callback>
    auto srem(const StringView &key, const StringView &member, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::srem, key, member);
    }

    template <typename Input>
    Future<long long> srem(const StringView &key, Input first, Input last) {
        range_check("SREM", first, last);

        return _command<long long>(fmt::srem_range<Input>, key, first, last);
    }

    template <typename Input, typename Callback>
    auto srem(const StringView &key, Input first, Input last, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        range_check("SREM", first, last);

        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::srem_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> srem(const StringView &key, std::initializer_list<T> il) {
        return srem(key, il.begin(), il.end());
    }

    template <typename T, typename Callback>
    auto srem(const StringView &key, std::initializer_list<T> il, Callback &&cb)
        -> typename std::enable_if<IsInvocable<typename std::decay<Callback>::type, Future<long long> &&>::value, void>::type {
        srem<decltype(il.begin()), Callback>(key, il.begin(), il.end(), std::forward<Callback>(cb));
    }

    // SORTED SET commands.

    auto bzpopmax(const StringView &key,
                    const std::chrono::seconds &timeout = std::chrono::seconds{0})
        -> Future<Optional<std::tuple<std::string, std::string, double>>> {
        return _command<Optional<std::tuple<std::string, std::string, double>>>(
                fmt::bzpopmax, key, timeout);
    }

    template <typename Input>
    auto bzpopmax(Input first,
                    Input last,
                    const std::chrono::seconds &timeout = std::chrono::seconds{0})
        -> Future<Optional<std::tuple<std::string, std::string, double>>> {
        range_check("BZPOPMAX", first, last);

        return _command<Optional<std::tuple<std::string, std::string, double>>>(
                fmt::bzpopmax_range<Input>, first, last, timeout);
    }

    template <typename T>
    auto bzpopmax(std::initializer_list<T> il,
                    const std::chrono::seconds &timeout = std::chrono::seconds{0})
        -> Future<Optional<std::tuple<std::string, std::string, double>>> {
        return bzpopmax(il.begin(), il.end(), timeout);
    }

    auto bzpopmin(const StringView &key,
                    const std::chrono::seconds &timeout = std::chrono::seconds{0})
        -> Future<Optional<std::tuple<std::string, std::string, double>>> {
        return _command<Optional<std::tuple<std::string, std::string, double>>>(
                fmt::bzpopmin, key, timeout);
    }

    template <typename Input>
    auto bzpopmin(Input first,
                    Input last,
                    const std::chrono::seconds &timeout = std::chrono::seconds{0})
        -> Future<Optional<std::tuple<std::string, std::string, double>>> {
        range_check("BZPOPMIN", first, last);

        return _command<Optional<std::tuple<std::string, std::string, double>>>(
                fmt::bzpopmin_range<Input>, first, last, timeout);
    }

    template <typename T>
    auto bzpopmin(std::initializer_list<T> il,
                    const std::chrono::seconds &timeout = std::chrono::seconds{0})
        -> Future<Optional<std::tuple<std::string, std::string, double>>> {
        return bzpopmin(il.begin(), il.end(), timeout);
    }

    Future<long long> zadd(const StringView &key,
                    const StringView &member,
                    double score,
                    UpdateType type = UpdateType::ALWAYS,
                    bool changed = false) {
        return _command<long long>(fmt::zadd, key, member, score, type, changed);
    }

    template <typename Input>
    Future<long long> zadd(const StringView &key,
                    Input first,
                    Input last,
                    UpdateType type = UpdateType::ALWAYS,
                    bool changed = false) {
        range_check("ZADD", first, last);

        return _command<long long>(fmt::zadd_range<Input>,
                key,
                first,
                last,
                type,
                changed);
    }

    template <typename T>
    Future<long long> zadd(const StringView &key,
                    std::initializer_list<T> il,
                    UpdateType type = UpdateType::ALWAYS,
                    bool changed = false) {
        return zadd(key, il.begin(), il.end(), type, changed);
    }

    Future<long long> zcard(const StringView &key) {
        return _command<long long>(fmt::zcard, key);
    }

    template <typename Interval>
    Future<long long> zcount(const StringView &key, const Interval &interval) {
        return _command<long long>(fmt::zcount<Interval>, key, interval);
    }

    Future<double> zincrby(const StringView &key, double increment, const StringView &member) {
        return _command<double>(fmt::zincrby, key, increment, member);
    }

    template <typename Interval>
    Future<long long> zlexcount(const StringView &key, const Interval &interval) {
        return _command<long long>(fmt::zlexcount<Interval>, key, interval);
    }

    Future<Optional<std::pair<std::string, double>>> zpopmax(const StringView &key) {
        return _command<Optional<std::pair<std::string, double>>,
                FormattedCommand (*)(const StringView &)>(fmt::zpopmax, key);
    }

    template <typename Output>
    Future<Output> zpopmax(const StringView &key, long long count) {
        return _command<Output, FormattedCommand (*)(const StringView &, long long)>(
                fmt::zpopmax, key, count);
    }

    Future<Optional<std::pair<std::string, double>>> zpopmin(const StringView &key) {
        return _command<Optional<std::pair<std::string, double>>,
                FormattedCommand (*)(const StringView &)>(fmt::zpopmin, key);
    }

    template <typename Output>
    Future<Output> zpopmin(const StringView &key, long long count) {
        return _command<Output, FormattedCommand (*)(const StringView &, long long)>(
                fmt::zpopmin, key, count);
    }

    template <typename Output>
    Future<Output> zrange(const StringView &key, long long start, long long stop) {
        return _command<Output>(fmt::zrange, key, start, stop);
    }

    template <typename Output, typename Interval>
    Future<Output> zrangebylex(const StringView &key,
                        const Interval &interval,
                        const LimitOptions &opts) {
        return _command<Output>(fmt::zrangebylex<Interval>,
                key, interval, opts);
    }

    template <typename Output, typename Interval>
    Future<Output> zrangebylex(const StringView &key, const Interval &interval) {
        return zrangebylex<Output>(key, interval, {});
    }

    // TODO: withscores parameter
    template <typename Output, typename Interval>
    Future<Output> zrangebyscore(const StringView &key,
                        const Interval &interval,
                        const LimitOptions &opts) {
        return _command<Output>(fmt::zrangebyscore<Interval>,
                key, interval, opts);
    }

    template <typename Output, typename Interval>
    Future<Output> zrangebyscore(const StringView &key, const Interval &interval) {
        return zrangebyscore(key, interval, {});
    }

    Future<OptionalLongLong> zrank(const StringView &key, const StringView &member) {
        return _command<OptionalLongLong>(fmt::zrank, key, member);
    }

    Future<long long> zrem(const StringView &key, const StringView &member) {
        return _command<long long>(fmt::zrem, key, member);
    }

    template <typename Input>
    Future<long long> zrem(const StringView &key, Input first, Input last) {
        range_check("ZREM", first, last);

        return _command<long long>(fmt::zrem_range<Input>, key, first, last);
    }

    template <typename T>
    Future<long long> zrem(const StringView &key, std::initializer_list<T> il) {
        return zrem(key, il.begin(), il.end());
    }

    template <typename Interval>
    Future<long long> zremrangebylex(const StringView &key, const Interval &interval) {
        return _command<long long>(fmt::zremrangebylex<Interval>, key, interval);
    }

    Future<long long> zremrangebyrank(const StringView &key, long long start, long long stop) {
        return _command<long long>(fmt::zremrangebyrank, key, start, stop);
    }

    template <typename Interval>
    Future<long long> zremrangebyscore(const StringView &key, const Interval &interval) {
        return _command<long long>(fmt::zremrangebyscore<Interval>, key, interval);
    }

    template <typename Output, typename Interval>
    Future<Output> zrevrangebylex(const StringView &key,
                        const Interval &interval,
                        const LimitOptions &opts) {
        return _command<Output>(fmt::zrevrangebylex<Interval>,
                key, interval, opts);
    }

    template <typename Output, typename Interval>
    Future<Output> zrevrangebylex(const StringView &key, const Interval &interval) {
        return zrevrangebylex<Output>(key, interval, {});
    }

    Future<OptionalLongLong> zrevrank(const StringView &key, const StringView &member) {
        return _command<OptionalLongLong>(fmt::zrevrank, key, member);
    }

    Future<OptionalDouble> zscore(const StringView &key, const StringView &member) {
        return _command<OptionalDouble>(fmt::zscore, key, member);
    }

    // SCRIPTING commands.

    template <typename Result, typename Keys, typename Args>
    Future<Result> eval(const StringView &script,
                Keys keys_first,
                Keys keys_last,
                Args args_first,
                Args args_last) {
        return _command<Result>(fmt::eval<Keys, Args>,
                script, keys_first, keys_last, args_first, args_last);
    }

    template <typename Result>
    Future<Result> eval(const StringView &script,
                std::initializer_list<StringView> keys,
                std::initializer_list<StringView> args) {
        return eval<Result>(script,
                keys.begin(), keys.end(),
                args.begin(), args.end());
    }

    template <typename Result, typename Keys, typename Args>
    Future<Result> evalsha(const StringView &script,
                    Keys keys_first,
                    Keys keys_last,
                    Args args_first,
                    Args args_last) {
        return _command<Result>(fmt::evalsha<Keys, Args>,
                script, keys_first, keys_last, args_first, args_last);
    }

    template <typename Result>
    Future<Result> evalsha(const StringView &script,
                    std::initializer_list<StringView> keys,
                    std::initializer_list<StringView> args) {
        return evalsha<Result>(script,
                keys.begin(), keys.end(),
                args.begin(), args.end());
    }

    // PUBSUB commands.

    Future<long long> publish(const StringView &channel, const StringView &message) {
        return _command<long long>(fmt::publish, channel, message);
    }

    template <typename Callback>
    void publish(const StringView &channel, const StringView &message, Callback &&cb) {
        _callback_fmt_command<long long>(std::forward<Callback>(cb), fmt::publish, channel, message);
    }

    // co_command* are used internally. DO NOT use them.

    template <typename Result, typename Callback>
    void co_command(FormattedCommand cmd, Callback &&cb) {
        return co_command_with_parser<Result, DefaultResultParser<Result>, Callback>(
                std::move(cmd), std::forward<Callback>(cb));
    }

    template <typename Result, typename ResultParser, typename Callback>
    void co_command_with_parser(FormattedCommand cmd, Callback &&cb) {
        assert(_pool);
        SafeAsyncConnection connection(*_pool);

        connection.connection().send<Result, ResultParser, Callback>(
                std::move(cmd), std::forward<Callback>(cb));
    }

private:
    template <typename Result, typename Formatter, typename ...Args>
    Future<Result> _command(Formatter formatter, Args &&...args) {
        return _command_with_parser<Result, DefaultResultParser<Result>>(
                formatter, std::forward<Args>(args)...);
    }

    template <typename Result, typename ResultParser, typename Formatter, typename ...Args>
    Future<Result> _command_with_parser(Formatter formatter, Args &&...args) {
        auto formatted_cmd = formatter(std::forward<Args>(args)...);

        assert(_pool);
        SafeAsyncConnection connection(*_pool);

        return connection.connection().send<Result, ResultParser>(std::move(formatted_cmd));
    }

    template <typename Result, typename Callback, std::size_t ...Is, typename ...Args>
    void _callback_idx_command(Callback &&cb, const StringView &cmd_name,
            const IndexSequence<Is...> &, Args &&...args) {
        _callback_command<Result>(std::forward<Callback>(cb), cmd_name,
                NthValue<Is>(std::forward<Args>(args)...)...);
    }

    template <typename Result, typename Callback, typename ...Args>
    void _callback_command(Callback &&cb, const StringView &cmd_name, Args &&...args) {
        auto formatter = [](const StringView &name, Args &&...params) {
            CmdArgs cmd_args;
            cmd_args.append(name, std::forward<Args>(params)...);
            return fmt::format_cmd(cmd_args);
        };

        _callback_fmt_command<Result>(std::forward<Callback>(cb), formatter, cmd_name,
                std::forward<Args>(args)...);
    }

    template <typename Result, typename Callback, typename Formatter, typename ...Args>
    void _callback_fmt_command(Callback &&cb, Formatter formatter, Args &&...args) {
        _callback_command_with_parser<Result, DefaultResultParser<Result>, Callback>(
                std::forward<Callback>(cb), formatter, std::forward<Args>(args)...);
    }

    template <typename Result, typename ResultParser, typename Callback,
             typename Formatter, typename ...Args>
    void _callback_command_with_parser(Callback &&cb, Formatter formatter, Args &&...args) {
        auto formatted_cmd = formatter(std::forward<Args>(args)...);

        assert(_pool);
        SafeAsyncConnection connection(*_pool);

        connection.connection().send<Result, ResultParser, Callback>(
                std::move(formatted_cmd), std::forward<Callback>(cb));
    }

    EventLoopSPtr _loop;

    bool _own_loop{false};

    AsyncConnectionPoolSPtr _pool;
};

}

}

#endif // end SEWENEW_REDISPLUSPLUS_ASYNC_REDIS_H


text:
using System.Data.Entity.ModelConfiguration;
using MvcMusicStore.Domain.Entities;

namespace MvcMusicStore.Data.Context.Mapping
{
    public class CartMap : EntityTypeConfiguration<Cart>
    {
        public CartMap()
        {
            // Primary Key
            HasKey(t => t.RecordId);

            // Properties
            Property(t => t.CartId)
                .IsRequired();

            Property(t => t.AlbumId)
                .IsRequired();

            Property(t => t.Count)
                .IsRequired();

            Property(t => t.DateCreated)
                .IsRequired();

            Ignore(t => t.ValidationResult);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<recipeml version="0.5">
  <recipe>
    <head>
      <title>"Fred's Schezuan Sauce"</title>
      <categories>
        <cat>Sauces</cat>
        <cat>Low-fat</cat></categories>
      <yield>12</yield></head>
    <ingredients>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>teaspoon</unit></amt>
        <item>Sesame Oil</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>teaspoons</unit></amt>
        <item>Whole yellow mustard seed</item></ing>
      <ing>
        <amt>
          <qty>4</qty>
          <unit/></amt>
        <item>Garlic cloves; crushed</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>small</unit></amt>
        <item>Shallot (optional) finely chopped</item></ing>
      <ing>
        <amt>
          <qty>2</qty>
          <unit>tablespoons</unit></amt>
        <item>Low salt tamari</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit/></amt>
        <item>Thai pepper; finely chopped (or jalapeno, italian, or what have you) -OR- Tabasco)</item></ing>
      <ing>
        <amt>
          <qty>1 1/2</qty>
          <unit>cups</unit></amt>
        <item>Tomato juice or V8</item></ing>
      <ing>
        <amt>
          <qty>1/2</qty>
          <unit>teaspoons</unit></amt>
        <item>White pepper</item></ing>
      <ing>
        <amt>
          <qty>1/2</qty>
          <unit>teaspoons</unit></amt>
        <item>Ground cumin</item></ing>
      <ing>
        <amt>
          <qty>1</qty>
          <unit>teaspoon</unit></amt>
        <item>Arrowroot; -OR- Corn starch)</item></ing>
      <ing>
        <amt>
          <qty/>
          <unit/></amt>
        <item>Ground black pepper to taste</item></ing></ingredients>
    <directions>
      <step>  Well, this is NOT non-fat, but is low fat. It's kind of a Schezuan sauce I
  guess, of my own invention. If I could figure out how to avoid using the
  oil it would be non-fat, but anything I've tried has been less than yummy.
  Considering it makes about 1 1/2 cups of sauce, and that goes a long way
  (ie: 2 Tbs per serving, approx), the fat content per serving should be
  about 1g due to the sauce. The flavor of the sesame oil is quite
  indespensible, to me.

  It's quite spicy, be warned! But it's fantastic for vegetables over rice,
  or with vegetables, grilled chicken, and rice noodles; or stirred into
  plain wild rice. Experiment!

  DIRECTIONS: =========== In a small skillet, saute the garlic, hot pepper,
  shallot, and mustard seed in the oil until the garlic and shallots brown
  and the mustard seeds begin to pop (best over high heat, but don't let the
  oil burn).  Add the tomato juice, tamari, white pepper and cumin. Lower
  heat and simmer 5 mins. In a smal cup mix 2 tsp cold water and the
  arrowroot until smooth. Stir into sauce, stirring constantly. The sauce
  should thicken in about a minute or two. Remove from heat and stir into
  your favorite dish.

  From: ft@maxwell.ccs.att.com (Frederick True)

  From Gemini's MASSIVE MealMaster collection at www.synapse.com/~gemini

</step></directions></recipe></recipeml>