text:
layout: article
id: Layout
parent: Design System
published: false

permalink: design-system/layout/

title: Layout
introduction: This is a page introduction. Morbi eget mattis ipsum. Donec massa nibh, bibendum at sit amet ipsum.
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer eu lacus quis velit ultrices venenatis nec pellentesque odio. Sed non elit id odio condimentum scelerisque sed at mauris. Aliquam semper vitae elit scelerisque maximus. Duis et faucibus sapien, vel interdum lacus.


text:
<!DOCTYPE html>

    <title>Bigdata Search App</title>

    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <link href="assets/css/bootstrap-theme.css" rel="stylesheet" />
    <link href="assets/css/angular-toastr.css" rel="stylesheet" />
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
    <link href="assets/css/ui-bootstrap-csp.css" rel="stylesheet" />
    <link href="assets/css/weather-icons-wind.css" rel="stylesheet" />
    <link href="assets/css/weather-icons.css" rel="stylesheet" />
    <link href="assets/css/xeditable.css" rel="stylesheet" />
    <link href="assets/css/app.css" rel="stylesheet" />

redpajama_set_name: RedPajamaGithub


text:
#import <Foundation/Foundation.h>
@class MSAuthenticationParameters;

/*!

 @protocol
 @see documentation at - http://msdn.microsoft.com/en-us/library/dn758312(v=vs.85).aspx

 */
@protocol MSAuthenticationCallback <NSObject>

@required

- (void)accessTokenWithAuthenticationParameters:(MSAuthenticationParameters *)authenticationParameters completionBlock:(void(^)(NSString *accessToken, NSError *error))completionBlock;

@end


text:
namespace rl
{
	namespace sg
	{
		UrdfFactory::UrdfFactory()
		{
		}

		UrdfFactory::~UrdfFactory()
		{
		}

		void
		UrdfFactory::load(const ::std::string& filename, Scene* scene)
		{
			::rl::xml::DomParser parser;

			::rl::xml::Document document = parser.readFile(filename, "", XML_PARSE_NOENT);
			document.substitute(XML_PARSE_NOENT);

			::rl::xml::Path path(document);

			::rl::xml::NodeSet robots = path.eval("/robot").getValue<::rl::xml::NodeSet>();

			if (robots.empty())
			{
				throw Exception("rl::sg::UrdfFactory::load() - URDF is missing robot node");
			}

			::SoDB::init();
			::SoNodeKit::init();

			for (int i = 0; i < robots.size(); ++i)
			{
				::rl::xml::Path path(document, robots[i]);

				Model* model = scene->create();

				// name

				model->setName(path.eval("string(@name)").getValue<::std::string>());
::std::cout << model->getName() << ::std::endl;

				// materials

				::rl::xml::NodeSet materials = path.eval("material").getValue<::rl::xml::NodeSet>();

				::std::unordered_map<::std::string, ::SoVRMLAppearance*> name2appearance;

				for (int j = 0; j < materials.size(); ++j)
				{
::std::cout << "material: " << j << ::std::endl;
					::rl::xml::Path path(document, materials[j]);

					::std::string name = path.eval("string(@name)").getValue<::std::string>();

					::SoVRMLAppearance* vrmlAppearance = new ::SoVRMLAppearance();
					vrmlAppearance->ref();

					vrmlAppearance->setName(name.c_str());
					name2appearance[name] = vrmlAppearance;
::std::cout << "\tname: " << name << ::std::endl;

					::SoVRMLMaterial* vrmlMaterial = new ::SoVRMLMaterial();

					if (path.eval("count(color/@rgba) > 0").getValue<bool>())
					{
						::std::vector<::std::string> rgba;
						::std::string tmp = path.eval("string(color/@rgba)").getValue<::std::string>();
						::boost::split(rgba, tmp, ::boost::algorithm::is_space(), ::boost::algorithm::token_compress_on);
::std::cout << "\trgba: " << rgba[0] << " " << rgba[1] << " " << rgba[2] << " " << rgba[3] << ::std::endl;

						vrmlMaterial->diffuseColor.setValue(
							::boost::lexical_cast<float>(rgba[0]),
							::boost::lexical_cast<float>(rgba[1]),
							::boost::lexical_cast<float>(rgba[2])
						);
						vrmlMaterial->transparency.setValue(
							1 - ::boost::lexical_cast<float>(rgba[3])
						);
					}

					vrmlAppearance->material = vrmlMaterial;

					SoVRMLImageTexture* vrmlImageTexture = new SoVRMLImageTexture();

					if (path.eval("count(texture/@filename) > 0").getValue<bool>())
					{
						::rl::xml::NodeSet texture = path.eval("texture").getValue<::rl::xml::NodeSet>();
						::std::string textureFilename = texture[0].getLocalPath(texture[0].getProperty("filename"));
::std::cout << "\tfilename: " << textureFilename << ::std::endl;

						SbImage image;

						if (image.readFile(textureFilename.c_str()))
						{
							vrmlImageTexture->setImage(image);
						}
					}

					vrmlAppearance->texture = vrmlImageTexture;
				}

				// joints

				::std::unordered_map<::std::string, ::std::string> child2parent;
				::std::unordered_map<::std::string, ::rl::xml::Node> name2link;
				::std::multimap<::std::string, ::std::string> parent2child;

				::rl::xml::NodeSet joints = path.eval("joint").getValue<::rl::xml::NodeSet>();

				for (int j = 0; j < joints.size(); ++j)
				{
::std::cout << "joint: " << j << ::std::endl;
					::rl::xml::Path path(document, joints[j]);

					::std::string child = path.eval("string(child/@link)").getValue<::std::string>();
					::std::string parent = path.eval("string(parent/@link)").getValue<::std::string>();

					child2parent[child] = parent;
					parent2child.insert(::std::pair<::std::string, ::std::string>(parent, child));
::std::cout << "\tconnect: " << parent << " -> " << child << ::std::endl;
				}

				// links

				::rl::xml::NodeSet links = path.eval("link").getValue<::rl::xml::NodeSet>();

				::std::string root;

				for (int j = 0; j < links.size(); ++j)
				{
					::rl::xml::Path path(document, links[j]);

					::std::string name = path.eval("string(@name)").getValue<::std::string>();

					name2link[name] = links[j];

					if (child2parent.end() == child2parent.find(name))
					{
						if (root.empty())
						{
							root = name;
::std::cout << "root: " << name << ::std::endl;
						}
						else
						{
							throw Exception("rl::sg::UrdfFactory::load() - URDF has more than one root node");
						}
					}
				}

				::std::deque<::std::string> dfs;
				dfs.push_front(root);

				while (!dfs.empty())
				{
					::std::string name = dfs.front();
::std::cout << "link: " << name << ::std::endl;

					::rl::xml::Path path(document, name2link[name]);

					Body* body = model->create();

					body->setName(name);
::std::cout << "\tname: " << body->getName() << ::std::endl;

					::rl::xml::NodeSet shapes;

					if (SimpleScene* simple = dynamic_cast<SimpleScene*>(scene))
					{
						if (path.eval("count(collision) > 0").getValue<bool>())
						{
							shapes = path.eval("collision").getValue<::rl::xml::NodeSet>();
						}
						else if (path.eval("count(visual) > 0").getValue<bool>())
						{
							shapes = path.eval("visual").getValue<::rl::xml::NodeSet>();
						}
					}
					else
					{
						if (path.eval("count(visual) > 0").getValue<bool>())
						{
							shapes = path.eval("visual").getValue<::rl::xml::NodeSet>();
						}
						else if (path.eval("count(collision) > 0").getValue<bool>())
						{
							shapes = path.eval("collision").getValue<::rl::xml::NodeSet>();
						}
					}

					for (int j = 0; j < shapes.size(); ++j)
					{
						::rl::xml::Path path(document, shapes[j]);

						::SoVRMLShape* vrmlShape = new ::SoVRMLShape();
						vrmlShape->ref();

						if (path.eval("count(material/@name) > 0 and count(material//*) = 0").getValue<bool>())
						{
							::std::string name = path.eval("string(material/@name)").getValue<::std::string>();
::std::cout << "\tmaterial: " << name << ::std::endl;
							vrmlShape->appearance = name2appearance[name];
						}
						else
						{
							::std::string name = path.eval("string(material/@name)").getValue<::std::string>();

							::SoVRMLAppearance* vrmlAppearance = new ::SoVRMLAppearance();

							if (!name.empty())
							{
								vrmlAppearance->setName(name.c_str());
::std::cout << "\tmaterial name: " << name << ::std::endl;
							}

							::SoVRMLMaterial* vrmlMaterial = new ::SoVRMLMaterial();

							if (path.eval("count(material/color/@rgba) > 0").getValue<bool>())
							{
								::std::vector<::std::string> rgba;
								::std::string tmp = path.eval("string(material/color/@rgba)").getValue<::std::string>();
								::boost::split(rgba, tmp, ::boost::algorithm::is_space(), ::boost::algorithm::token_compress_on);
::std::cout << "\tmaterial rgba: " << rgba[0] << " " << rgba[1] << " " << rgba[2] << " " << rgba[3] << ::std::endl;

								vrmlMaterial->diffuseColor.setValue(
									::boost::lexical_cast<float>(rgba[0]),
									::boost::lexical_cast<float>(rgba[1]),
									::boost::lexical_cast<float>(rgba[2])
								);
								vrmlMaterial->transparency.setValue(
									1 - ::boost::lexical_cast<float>(rgba[3])
								);
							}

							vrmlAppearance->material = vrmlMaterial;

							SoVRMLImageTexture* vrmlImageTexture = new SoVRMLImageTexture();

							if (path.eval("count(material/texture/@filename) > 0").getValue<bool>())
							{
								::rl::xml::NodeSet texture = path.eval("material/texture").getValue<::rl::xml::NodeSet>();
								::std::string textureFilename = texture[0].getLocalPath(texture[0].getProperty("filename"));
::std::cout << "\tmaterial filename: " << textureFilename << ::std::endl;

								SbImage image;

								if (image.readFile(textureFilename.c_str()))
								{
									vrmlImageTexture->setImage(image);
								}
							}

							vrmlAppearance->texture = vrmlImageTexture;

							vrmlShape->appearance = vrmlAppearance;
						}

						::rl::xml::NodeSet geometries = path.eval("geometry/box|geometry/cylinder|geometry/mesh|geometry/sphere").getValue<::rl::xml::NodeSet>();

						for (int k = 0; k < geometries.size(); ++k)
						{
							if ("box" == geometries[k].getName())
							{
								::SoVRMLBox* box = new ::SoVRMLBox();

								if (!geometries[k].getProperty("size").empty())
								{
									::std::vector<::std::string> size;
									::std::string tmp = geometries[k].getProperty("size");
									::boost::split(size, tmp, ::boost::algorithm::is_space(), ::boost::algorithm::token_compress_on);

									box->size.setValue(
										::boost::lexical_cast<float>(size[0]),
										::boost::lexical_cast<float>(size[1]),
										::boost::lexical_cast<float>(size[2])
									);
								}

								vrmlShape->geometry = box;
::std::cout << "\tbox size: " << box->size.getValue()[0] << " " << box->size.getValue()[1] << " " << box->size.getValue()[2] << ::std::endl;
							}
							else if ("cylinder" == geometries[k].getName())
							{
								::SoVRMLCylinder* cylinder = new ::SoVRMLCylinder();

								if (!geometries[k].getProperty("length").empty())
								{
									cylinder->height.setValue(
										::boost::lexical_cast<float>(geometries[k].getProperty("length"))
									);
								}

								if (!geometries[k].getProperty("radius").empty())
								{
									cylinder->radius.setValue(
										::boost::lexical_cast<float>(geometries[k].getProperty("radius"))
									);
								}

								vrmlShape->geometry = cylinder;
::std::cout << "\tcylinder height: " << cylinder->height.getValue() << ::std::endl;
::std::cout << "\tcylinder radius: " << cylinder->radius.getValue() << ::std::endl;
							}
							else if ("mesh" == geometries[k].getName())
							{
								if (!geometries[k].getProperty("filename").empty())
								{
									::std::string meshFilename = geometries[k].getLocalPath(geometries[k].getProperty("filename"));
::std::cout << "\tmesh filename: " << meshFilename << ::std::endl;

#if defined(HAVE_SOSTLFILEKIT_H) && defined(HAVE_SOSTLFILEKIT_CONVERT)
									if (!boost::iends_with(meshFilename, "stl"))
									{
										throw Exception("rl::sg::UrdfFactory::load() - Only STL meshes currently supported");
									}

									::SoSTLFileKit* stlFileKit = new ::SoSTLFileKit();
									stlFileKit->ref();

									if (!stlFileKit->readFile(meshFilename.c_str()))
									{
										throw Exception("rl::sg::UrdfFactory::load() - Failed to open file '" + meshFilename + "'");
									}

									::SoSeparator* stl = stlFileKit->convert();
									stl->ref();
									stlFileKit->unref();

									::SoToVRML2Action toVrml2Action;
									toVrml2Action.apply(stl);
									::SoVRMLGroup* vrml2 = toVrml2Action.getVRML2SceneGraph();
									vrml2->ref();
									stl->unref();

									::SoSearchAction searchAction;
									searchAction.setInterest(::SoSearchAction::ALL);
									searchAction.setType(::SoVRMLShape::getClassTypeId());
									searchAction.apply(vrml2);

									for (int l = 0; l < searchAction.getPaths().getLength(); ++l)
									{
										vrmlShape->geometry = static_cast<::SoVRMLShape*>(static_cast<::SoFullPath*>(searchAction.getPaths()[l])->getTail())->geometry;

										if (vrmlShape->geometry.getValue()->isOfType(::SoVRMLIndexedFaceSet::getClassTypeId()))
										{
											::SoVRMLIndexedFaceSet* vrmlIndexedFaceSet = static_cast<::SoVRMLIndexedFaceSet*>(vrmlShape->geometry.getValue());
											vrmlIndexedFaceSet->convex.setValue(false);

											::SoVRMLCoordinate* vrmlCoordinate = static_cast<::SoVRMLCoordinate*>(vrmlIndexedFaceSet->coord.getValue());

											if (!geometries[k].getProperty("scale").empty())
											{
												::SbVec3f scale(1.0f, 1.0f, 1.0f);

												::std::vector<::std::string> scales;
												::std::string scaleProperty = geometries[k].getProperty("scale");
												::boost::split(scales, scaleProperty, ::boost::algorithm::is_space(), ::boost::algorithm::token_compress_on);
::std::cout << "\tscale: " << scales[0] << " " << scales[1] << " " << scales[2] << ::std::endl;
												scale.setValue(::std::stof(scales[0]), ::std::stof(scales[1]), ::std::stof(scales[2]));

												for (int m = 0; m < vrmlCoordinate->point.getNum(); ++m)
												{
													vrmlCoordinate->point.set1Value(
														m,
														vrmlCoordinate->point[m][0] * scale[0],
														vrmlCoordinate->point[m][1] * scale[1],
														vrmlCoordinate->point[m][2] * scale[2]
													);
												}
											}
										}
									}

									vrml2->unref();
#else
									throw Exception("rl::sg::UrdfFactory::load() - Mesh support currently not available");
#endif
								}
							}
							else if ("sphere" == geometries[k].getName())
							{
								::SoVRMLSphere* sphere = new ::SoVRMLSphere();

								if (!geometries[k].getProperty("radius").empty())
								{
									sphere->radius.setValue(
										::boost::lexical_cast<float>(geometries[k].getProperty("radius"))
									);
								}

								vrmlShape->geometry = sphere;
::std::cout << "\tsphere radius: " << sphere->radius.getValue() << ::std::endl;
							}
						}

						if (nullptr != vrmlShape->geometry.getValue())
						{
							Shape* shape = body->create(vrmlShape);

							::rl::math::Transform origin = ::rl::math::Transform::Identity();

							if (path.eval("count(origin/@rpy) > 0").getValue<bool>())
							{
								::std::vector<::std::string> rpy;
								::std::string tmp = path.eval("string(origin/@rpy)").getValue<::std::string>();
								::boost::split(rpy, tmp, ::boost::algorithm::is_space(), ::boost::algorithm::token_compress_on);
::std::cout << "\torigin rpy: " << rpy[0] << " " << rpy[1] << " " << rpy[2] << ::std::endl;

								origin.linear() = ::rl::math::AngleAxis(
									::boost::lexical_cast<::rl::math::Real>(rpy[2]),
									::rl::math::Vector3::UnitZ()
								) * ::rl::math::AngleAxis(
									::boost::lexical_cast<::rl::math::Real>(rpy[1]),
									::rl::math::Vector3::UnitY()
								) * ::rl::math::AngleAxis(
									::boost::lexical_cast<::rl::math::Real>(rpy[0]),
									::rl::math::Vector3::UnitX()
								).toRotationMatrix();
							}

							if (vrmlShape->geometry.getValue()->isOfType(::SoVRMLCylinder::getClassTypeId()))
							{
								origin *= ::rl::math::AngleAxis(90 * ::rl::math::constants::deg2rad, ::rl::math::Vector3::UnitX());
							}

							if (path.eval("count(origin/@xyz) > 0").getValue<bool>())
							{
								::std::vector<::std::string> xyz;
								::std::string tmp = path.eval("string(origin/@xyz)").getValue<::std::string>();
								::boost::split(xyz, tmp, ::boost::algorithm::is_space(), ::boost::algorithm::token_compress_on);
::std::cout << "\torigin xyz: " << xyz[0] << " " << xyz[1] << " " << xyz[2] << ::std::endl;

								origin.translation().x() = ::boost::lexical_cast<::rl::math::Real>(xyz[0]);
								origin.translation().y() = ::boost::lexical_cast<::rl::math::Real>(xyz[1]);
								origin.translation().z() = ::boost::lexical_cast<::rl::math::Real>(xyz[2]);
							}

							shape->setTransform(origin);
						}

						vrmlShape->unref();
					}

					// depth first search

					dfs.pop_front();

					::std::pair<
						::std::multimap<::std::string, ::std::string>::const_iterator,
						::std::multimap<::std::string, ::std::string>::const_iterator
					> range = parent2child.equal_range(name);

					// reverse order

					::std::multimap<::std::string, ::std::string>::const_iterator first = --range.second;
					::std::multimap<::std::string, ::std::string>::const_iterator second = --range.first;

					for (::std::multimap<::std::string, ::std::string>::const_iterator k = first; k != second; --k)
					{
						dfs.push_front(k->second);
					}
				}

				for (::std::unordered_map<::std::string, ::SoVRMLAppearance*>::iterator j = name2appearance.begin(); j != name2appearance.end(); ++j)
				{
					j->second->unref();
				}
			}
		}
	}
}


text:
class Outer_Class
{
	int x,y;
	//Constructor of Outer Class
	Outer_Class(int input1, int input2)
	{
		x = input1;
		y = input2;
	}

	//Method of Outer Class
	void Show_Content_Inner()
	{
		Inner_Class inner_obj = new Inner_Class();
		inner_obj.show();
		inner_obj.sum();
	}

	//Inner Class
	class Inner_Class
	{
		void show()
		{
			System.out.println(x);
			System.out.println(y);
		}
		void sum()
		{
			System.out.println(x+y);
		}

	}

}

public class NestedClass {

	public static void main(String[] args) {
		// Inner class have Access to the Variables of outer class

		//outer class object

		Outer_Class outer_obj = new Outer_Class(5,6);

		outer_obj.Show_Content_Inner();

	}

}


text:
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/browser/api/socket/app_firewall_hole_manager.h"

#include <utility>

#include "base/bind.h"
#include "base/stl_util.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/app_window/app_window.h"

using chromeos::FirewallHole;
using content::BrowserContext;

namespace extensions {

namespace {

class AppFirewallHoleManagerFactory : public BrowserContextKeyedServiceFactory {
 public:
  static AppFirewallHoleManager* GetForBrowserContext(BrowserContext* context,
                                                      bool create) {
    return static_cast<AppFirewallHoleManager*>(
        GetInstance()->GetServiceForBrowserContext(context, create));
  }

  static AppFirewallHoleManagerFactory* GetInstance() {
    return base::Singleton<AppFirewallHoleManagerFactory>::get();
  }

  AppFirewallHoleManagerFactory()
      : BrowserContextKeyedServiceFactory(
            "AppFirewallHoleManager",
            BrowserContextDependencyManager::GetInstance()) {
    DependsOn(AppWindowRegistry::Factory::GetInstance());
  }

  ~AppFirewallHoleManagerFactory() override {}

 private:
  // BrowserContextKeyedServiceFactory
  KeyedService* BuildServiceInstanceFor(
      BrowserContext* context) const override {
    return new AppFirewallHoleManager(context);
  }

  BrowserContext* GetBrowserContextToUse(
      BrowserContext* context) const override {
    return context;
  }
};

bool HasVisibleAppWindows(BrowserContext* context,
                          const std::string& extension_id) {
  AppWindowRegistry* registry = AppWindowRegistry::Get(context);

  for (const AppWindow* window : registry->GetAppWindowsForApp(extension_id)) {
    if (!window->is_hidden()) {
      return true;
    }
  }

  return false;
}

}  // namespace

AppFirewallHole::~AppFirewallHole() {
  manager_->Close(this);
}

AppFirewallHole::AppFirewallHole(AppFirewallHoleManager* manager,
                                 PortType type,
                                 uint16_t port,
                                 const std::string& extension_id)
    : type_(type),
      port_(port),
      extension_id_(extension_id),
      manager_(manager),
      weak_factory_(this) {
}

void AppFirewallHole::SetVisible(bool app_visible) {
  app_visible_ = app_visible;
  if (app_visible_) {
    if (!firewall_hole_) {
      FirewallHole::Open(type_, port_, "" /* all interfaces */,
                         base::Bind(&AppFirewallHole::OnFirewallHoleOpened,
                                    weak_factory_.GetWeakPtr()));
    }
  } else {
    firewall_hole_.reset(nullptr);
  }
}

void AppFirewallHole::OnFirewallHoleOpened(
    scoped_ptr<FirewallHole> firewall_hole) {
  if (app_visible_) {
    DCHECK(!firewall_hole_);
    firewall_hole_ = std::move(firewall_hole);
  }
}

AppFirewallHoleManager::AppFirewallHoleManager(BrowserContext* context)
    : context_(context), observer_(this) {
  observer_.Add(AppWindowRegistry::Get(context));
}

AppFirewallHoleManager::~AppFirewallHoleManager() {
  STLDeleteValues(&tracked_holes_);
}

AppFirewallHoleManager* AppFirewallHoleManager::Get(BrowserContext* context) {
  return AppFirewallHoleManagerFactory::GetForBrowserContext(context, true);
}

scoped_ptr<AppFirewallHole> AppFirewallHoleManager::Open(
    AppFirewallHole::PortType type,
    uint16_t port,
    const std::string& extension_id) {
  scoped_ptr<AppFirewallHole> hole(
      new AppFirewallHole(this, type, port, extension_id));
  tracked_holes_.insert(std::make_pair(extension_id, hole.get()));
  if (HasVisibleAppWindows(context_, extension_id)) {
    hole->SetVisible(true);
  }
  return hole;
}

void AppFirewallHoleManager::Close(AppFirewallHole* hole) {
  auto range = tracked_holes_.equal_range(hole->extension_id());
  for (auto iter = range.first; iter != range.second; ++iter) {
    if (iter->second == hole) {
      tracked_holes_.erase(iter);
      return;
    }
  }
  NOTREACHED();
}

void AppFirewallHoleManager::OnAppWindowRemoved(AppWindow* app_window) {
  OnAppWindowHidden(app_window);
}

void AppFirewallHoleManager::OnAppWindowHidden(AppWindow* app_window) {
  DCHECK(context_ == app_window->browser_context());
  if (!HasVisibleAppWindows(context_, app_window->extension_id())) {
    const auto& range = tracked_holes_.equal_range(app_window->extension_id());
    for (auto iter = range.first; iter != range.second; ++iter) {
      iter->second->SetVisible(false);
    }
  }
}

void AppFirewallHoleManager::OnAppWindowShown(AppWindow* app_window,
                                              bool was_hidden) {
  const auto& range = tracked_holes_.equal_range(app_window->extension_id());
  for (auto iter = range.first; iter != range.second; ++iter) {
    iter->second->SetVisible(true);
  }
}

}  // namespace extensions


text:
export default {
	'color-mode-toggle': {
		display: 'inline-flex',
		borderRadius: 0,
		paddingY: 2,
		paddingX: [2, 3],
		backgroundColor: 'transparent',
		color: 'text',
		appearance: 'none',
	},
}


text:
package org.opencb.opencga.catalog.client;

import org.opencb.datastore.core.QueryOptions;
import org.opencb.datastore.core.QueryResult;
import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.catalog.models.*;

import java.util.List;
import java.util.Map;

/**
 * Created by jacobo on 10/02/15.
 */
public interface CatalogClient {

    interface CatalogResourceClient <R>{
        public QueryResult<R> create(QueryOptions options) throws CatalogException;
        public QueryResult<R> read(QueryOptions options) throws CatalogException;
        public QueryResult<R> readAll(QueryOptions options) throws CatalogException;
        public QueryResult<R> update(QueryOptions options) throws CatalogException;
        public QueryResult<R> delete() throws CatalogException;
    }

    interface CatalogUserClient extends CatalogResourceClient <User>{
        public String  getUserId(String sessionId);

        public QueryResult<User> update(QueryOptions options) throws CatalogException;
        public QueryResult<User> read(QueryOptions options) throws CatalogException;
        public QueryResult<User> create(String id, String name, String email, String password, String organization,
                                        QueryOptions options) throws CatalogException;
        public QueryResult<User> changePassword(String userId, String oldPassword, String newPassword) throws CatalogException;
    }

    interface CatalogProjectClient extends CatalogResourceClient <Project>{
        public String  getUserId(int projectId) throws CatalogException;
        public Integer getProjectId(String projectId) throws CatalogException;

        public QueryResult<Project> create(String ownerId, String name, String alias, String description,
                                           String organization, QueryOptions options) throws CatalogException;
    }
    interface CatalogStudyClient extends CatalogResourceClient <Study>{
        public String  getUserId(int studyId) throws CatalogException;
        public Integer getProjectId(int studyId) throws CatalogException;
        public Integer getStudyId(String studyId) throws CatalogException;

        public QueryResult<Study> create(int projectId, String name, String alias, Study.Type type,
                                         String creatorId, String creationDate, String description, String status,
                                         String cipher, String uriScheme, Map<String, Object> stats,
                                         Map<String, Object> attributes) throws CatalogException;
        public QueryResult<Study> share(int studyId, Acl acl) throws CatalogException;
    }
    interface CatalogFileClient extends CatalogResourceClient <File>{
        public String  getUserId(int fileId) throws CatalogException;
        public Integer getProjectId(int fileId) throws CatalogException;
        public Integer getStudyId(int fileId) throws CatalogException;
        public Integer getFileId(String fileId) throws CatalogException;
        public QueryResult<File> create(int studyId, File.Type type, File.Format format, File.Bioformat bioformat, String path,
                                        String ownerId, String creationDate, String description, File.Status status,
                                        long diskUsage, int experimentId, List<Integer> sampleIds, int jobId,
                                        Map<String, Object> stats, Map<String, Object> attributes,
                                        boolean parents) throws CatalogException;
    }
    interface CatalogJobClient extends CatalogResourceClient <Job>{
        public Integer getStudyId(int jobId);

        public QueryResult<Job> visit(int jobId);
    }
    interface CatalogSampleClient extends CatalogResourceClient <Project>{
        public Integer getProjectId(String projectId);

        public QueryResult<Annotation> annotate(int sampleId);
    }
    interface CatalogExperimentClient extends CatalogResourceClient <Project>{
        public Integer getProjectId(String projectId);
    }

    String getSessionId();
    void setSessionId(String sessionId);

    String getUserId();
    void setUserId(String userId);

    CatalogUserClient users();
    CatalogUserClient users(String userId);
    CatalogProjectClient projects();
    CatalogProjectClient projects(int projectId);
    CatalogStudyClient studies();
    CatalogStudyClient studies(int studyId);
    CatalogFileClient files();
    CatalogFileClient files(int fileId);
    CatalogJobClient jobs();
    CatalogJobClient jobs(int jobId);
    void close() throws CatalogException;

}


text:
package org.oyach.jvm.core.lang.reflect;

/**
 * description
 *
 * @author oyach
 * @since 0.0.1
 */
public interface Member {
}


text:
// SLNTools
// Copyright (c) 2009
// by Christian Warren
//
// 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
// THE AUTHORS OR COPYRIGHT HOLDERS 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.

#endregion

using System;
using System.Windows.Forms;

namespace CWDev.SLNTools
{
    using CommandLine;

    internal class Program
    {
        private enum CommandList
        {
            CompareSolutions,
            MergeSolutions,
            CreateFilterFileFromSolution,
            EditFilterFile,
            OpenFilterFile
        }

        private class Arguments
        {
            [DefaultArgument(ArgumentType.Required, HelpText = "Command Name (CompareSolutions|MergeSolutions|CreateFilterFileFromSolution|EditFilterFile|OpenFilterFile|SortProjects)")]
            public CommandList Command = (CommandList)(-1);
        }

        [STAThread]
        static void Main(string[] args)
        {
            //args = new string[] { "CompareSolutions", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Lors du Branch).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Branche WinFixFrs).sln" };
            //args = new string[] { "MergeSolutions", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Lors du Branch).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Branche WinFixFrs).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Main).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\Results.sln" };
            //args = new string[] { "CreateFilterFileFromSolution", @"C:\DevCodePlex\SLNTools\Main\SLNTools.sln" };
            //args = new string[] { "OpenFilterFile", @"C:\DevCodePlex\SLNTools\Main\Test.slnfilter" };
            //args = new string[] { "/?" };
            //args = new string[] { "CreateFilterFileFromSolution", @"E:\SLNTools\SLNTools\Main\SLNTools.sln" };
            //args = new string[] { "MergeSolutions" };

            try
            {
                string[] commandName;
                string[] commandArguments;
                if (args.Length > 1)
                {
                    commandName = new string[1];
                    Array.ConstrainedCopy(args, 0, commandName, 0, 1);
                    commandArguments = new string[args.Length - 1];
                    Array.ConstrainedCopy(args, 1, commandArguments, 0, commandArguments.Length);
                }
                else
                {
                    commandName = args;
                    commandArguments = new string[0];
                }

                var parsedArguments = new Arguments();

                var reporter = new MessageBoxErrorReporter
                            {
                                CommandUsage = Parser.ArgumentsUsage(parsedArguments.GetType())
                            };

                if (Parser.ParseArguments(commandName, parsedArguments, reporter.Handler))
                {
                    Command command;
                    switch (parsedArguments.Command)
                    {
                        case CommandList.CompareSolutions:
                            command = new CompareSolutionsCommand();
                            break;

                        case CommandList.MergeSolutions:
                            command = new MergeSolutionsCommand();
                            break;

                        case CommandList.CreateFilterFileFromSolution:
                            command = new CreateFilterFileFromSolutionCommand();
                            break;

                        case CommandList.OpenFilterFile:
                            command = new OpenFilterFileCommand();
                            break;

                        case CommandList.EditFilterFile:
                            command = new EditFilterFileCommand();
                            break;

                        default:
                            command = null;
                            reporter.Handler("Invalid command name.");
                            break;
                    }

                    if (command != null)
                    {
                        reporter.CommandName = parsedArguments.Command.ToString();
                        command.Run(commandArguments, reporter);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
    }
}


text:
<?php

namespace Perfumer\Framework\View\TemplateProvider;

interface ProviderInterface
{
    /**
     * @param string $template
     * @return string
     */
    public function dispatch($template);
}


text:
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CaboodleES.Interface;
using CaboodleES;

namespace CaboodleEsTest
{
    [TestClass]
    public class EntityComponentTest
    {
        Caboodle caboodle;

        [TestInitialize]
        public void InitTest()
        {
            try
            {
                caboodle = new Caboodle();
                caboodle.Systems.Add<MockSystem1>();
                caboodle.Systems.Init();
            }
            finally { Assert.IsNotNull(caboodle, "Failed to initialize ECS."); }
        }

        [TestMethod]
        public void TestRemoveEntitySystemReflection()
        {
            var e = caboodle.Entities.Create();
            e.AddComponent<Mock1>();
            caboodle.Systems.Update();
            caboodle.Entities.Remove(e.Id);
            caboodle.Systems.Update();
        }

        [TestMethod]
        public void TestEntityComponentsData()
        {
            var ent = caboodle.Entities.Create();
            var c1 = ent.AddComponent<MockTransform>();
            c1.x = 123;
            c1.y = 3210;

            var c2 = ent.GetComponent<MockTransform>();

            Assert.AreEqual(123, c2.x);
            Assert.AreEqual(3210, c2.y);
        }

        [TestMethod]
        public void TestGetComponentData()
        {
            float expected = 51f;
            Entity entityToTest = null;
            for(int i = 0; i < 10000; i++)
            {
                Entity newEnt = caboodle.Entities.Create();
                newEnt.AddComponent<MockTransform>().x = i;
                if (i == expected)
                    entityToTest = newEnt;
            }

            MockTransform comp = entityToTest.GetComponent<MockTransform>();

            Assert.AreEqual(expected, comp.x);
        }

        [TestMethod]
        public void TestAAEngineStressEntityComponentAddRemoval()
        {
            List<Entity> ents = new List<Entity>();
            int iterations = 3000;

            for (int i = 0; i < iterations; i++)
            {
                var ent = caboodle.Entities.Create();
                ent.AddComponent<Mock1>();
                var c = ent.AddComponent<MockTransform>();
                c.x = 234;
                c.y = 3434;
                ent.AddComponent<Mock3>();
                ents.Add(ent);
            }

            for (int i = 0; i < 15000; i++)
            {
                var ent = caboodle.Entities.Create();
                ent.AddComponent<Mock1>();
                ent.AddComponent<Mock2>();
                ent.AddComponent<Mock3>();
                ent.AddComponent<Mock4>();
                ent.AddComponent<Mock5>();
                ent.AddComponent<Mock6>();
                ent.AddComponent<MockTransform>();
            }

            for (int i = 0; i < iterations; i++)
            {
                var ent = ents[i];
                ent.GetComponent<Mock1>();
                ent.Destroy();
            }

            Assert.AreEqual(15000, caboodle.Entities.Count);
        }

        [TestMethod]
        public void TestEntityAddRemoveComponents()
        {
            var ent = caboodle.Entities.Create();
            ent.AddComponent<Mock1>();
            ent.AddComponent<Mock2>();
            ent.AddComponent<Mock3>();
            ent.AddComponent<Mock4>();
            ent.AddComponent<Mock5>();
            ent.AddComponent<Mock6>();

            var c1 = ent.GetComponent<Mock1>();
            var c2 = ent.GetComponent<Mock2>();
            var c3 = ent.GetComponent<Mock3>();
            var c4 = ent.GetComponent<Mock4>();
            var c5 = ent.GetComponent<Mock5>();
            var c6 = ent.GetComponent<Mock6>();

            Assert.IsNotNull(c1);
            Assert.IsNotNull(c2);
            Assert.IsNotNull(c3);
            Assert.IsNotNull(c4);
            Assert.IsNotNull(c5);
            Assert.IsNotNull(c6);

            ent.RemoveComponent<Mock1>();
            ent.RemoveComponent<Mock2>();
            ent.RemoveComponent<Mock3>();
            ent.RemoveComponent<Mock4>();
            ent.RemoveComponent<Mock5>();
            ent.RemoveComponent<Mock6>();
            ent.RemoveComponent<Mock1>();

        }

        [TestMethod]
        public void TestAddRemoveEntity()
        {
            var ent = caboodle.Entities.Create();

            ent.Destroy();
        }

        private class Mock1 : Component { public override void Reset() { } }
        private class Mock2 : Component { public override void Reset() { } }
        private class Mock3 : Component { public override void Reset() { } }
        private class Mock4 : Component { public override void Reset() { } }
        private class Mock5 : Component { public override void Reset() { } }
        private class Mock6 : Component { public override void Reset() { } }

        private class MockTransform : Component
        {
            public float x;
            public float y;
            public override void Reset() { x = 0f; y = 0f; }
        }

        [CaboodleES.Attributes.ComponentUsageAttribute(4,
           CaboodleES.Attributes.LoopType.Update, CaboodleES.System.Aspect.Match, typeof(Mock1))]
        public class MockSystem1 : CaboodleES.System.Processor
        {
            public override void Start()
            {
            }

            public override void Process(IDictionary<int, Entity> entities)
            {
                foreach (var entity in entities.Values)
                {

                    if (entity == null)
                        Assert.Fail();

                    Caboodle.Entities.Get(entity.Id); // This statment should never throw an exception within a System loop
                }
            }
        }
    }
}


text:
var EventEmitter = require('events').EventEmitter;
var RamAppDispatcher = require('../dispatcher/RamAppDispatcher');
var ActionTypes = require('../constants/RamConstants').ActionTypes;
var merge = require('react/lib/merge');
var R = require('ramda');

var CHANGE_EVENT = 'change';

var SyncStore = merge(EventEmitter.prototype, {
  progress: 0,
  getProgress: function() {
    return this.progress;
  },
  emitChange: function() {
    this.emit(CHANGE_EVENT);
  },
  addChangeListener: function(callback) {
    this.on(CHANGE_EVENT, callback);
  },
  removeChangeListener: function(callback) {
    this.removeListener(CHANGE_EVENT, callback);
  },
});

SyncStore.dispatchToken = RamAppDispatcher.register(function(payload) {
  var action = payload.action;

  switch(action.type) {
    case ActionTypes.SYNC_PROGRESS:
      SyncStore.progress = action.progress;
      SyncStore.emitChange();
      break;
    case ActionTypes.SYNC_DONE:
      SyncStore.progress = 1;
      SyncStore.emitChange();
      break;
  }
});

module.exports = SyncStore;


text:
{% extends "standardLayout.html" %}

{% block content %}

Delete Manifest

  Are you sure you want to delete manifest '{{ manifest.filename }}'?
  This will delete {{ manifest.samplePlateCount() }} sample plate records.

<form method="POST" class="form-horizontal" action="{{ url_for('manifest_delete_confirm') }}">
    {{ form.hidden_tag() }}

        Cancel
        <button type="submit" class="btn btn-primary">Delete</button>

</form>

{% endblock %}


text:
package gw.testloader;

import gw.lang.reflect.IType;
import gw.lang.reflect.ITypeLoader;
import gw.lang.reflect.ITypeInfo;
import gw.lang.reflect.TypeSystem;
import gw.lang.reflect.java.IJavaBackedType;
import gw.lang.reflect.java.IJavaClassInfo;
import gw.internal.gosu.parser.ClassJavaClassInfo;

import java.util.Set;
import java.util.HashSet;

public class WrappingJavaBackedTestType extends WrappingTestTypeBase implements IJavaBackedType, IWrappingTestType {

  private Class _implCLass;
  private Class _javaSuperClass;

  public WrappingJavaBackedTestType(ITypeLoader loader, String name, IType wrappedType,
                                    Class implClass,
                                    Class javaSuperClass,
                                    Class... wrappedInterfaces) {
    _implCLass = implClass;
    _javaSuperClass = javaSuperClass;
    init(loader, name, wrappedType, wrappedInterfaces);
  }

  @Override
  protected ITypeInfo makeTypeInfo() {
    return new WrappingJavaBackedTestTypeInfo(this, getWrappedType());
  }

  public Class getImplClass() {
    return _implCLass;
  }

  @Override
  protected Set<IType> makeTypeHierarchy() {
    HashSet<IType> types = new HashSet<IType>();
    types.add(this);
    types.addAll(TypeSystem.get(_javaSuperClass).getAllTypesInHierarchy());
    for (Class wrappedInterface : getWrappedInterfaces()) {
      types.add(TypeSystem.get(wrappedInterface));
    }
    return types;
  }

  @Override
  public IType getSupertype() {
    return TypeSystem.get(_javaSuperClass);
  }

  @Override
  public Class getBackingClass() {
    return _implCLass;
  }

  @Override
  public IJavaClassInfo getBackingClassInfo() {
    return new ClassJavaClassInfo(_implCLass, getTypeLoader().getModule());
  }

  @Override
  public IType getTypeFromJavaBackedType() {
    return TypeSystem.getTypeFromJavaBasedType(this);
  }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>formalv-prim63_mathcomp: 1 m 21 s 🏆</title>
    <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
    <link href="../../../../../bootstrap.min.css" rel="stylesheet">
    <link href="../../../../../bootstrap-custom.css" rel="stylesheet">
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

             Coq bench

clean / released

8.14.1 / formalv-prim63_mathcomp - 1.0.0

            « Up

              formalv-prim63_mathcomp

                1.0.0
                1 m 21 s 🏆

📅  (2022-07-19 14:49:40 UTC)

Context

# Packages matching: installed
# Name                   # Installed # Synopsis
base-bigarray            base
base-threads             base
base-unix                base
conf-findutils           1           Virtual package relying on findutils
conf-gmp                 4           Virtual package relying on a GMP lib system installation
coq                      8.14.1      Formal proof management system
dune                     3.3.1       Fast, portable, and opinionated build system
ocaml                    4.05.0      The OCaml compiler (virtual package)
ocaml-base-compiler      4.05.0      Official 4.05.0 release
ocaml-config             1           OCaml Switch Configuration
ocaml-secondary-compiler 4.08.1-1    OCaml 4.08.1 Secondary Switch Compiler
ocamlfind                1.9.1       A library manager for OCaml
ocamlfind-secondary      1.9.1       Adds support for ocaml-secondary-compiler to ocamlfind
zarith                   1.12        Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
synopsis: "Refinements from MathComp nat and int to Coq primitive integers Uint63/Sint63" # One-line description
description: """
FV Prim63 to MathComp provides conversions from the Coq primitive integers
Uint63 and Sint63 to the MathComp natural and integer numbers nat and int,
and vice versa, as well as lemmas to rewrite between their respective
operations.
""" # Longer description, can span several lines
homepage: "https://gitlab.com/formalv/formalv"
dev-repo: "git+https://gitlab.com/formalv/formalv"
bug-reports: "https://gitlab.com/formalv/formalv/-/issues"
doc: "https://formalv.gitlab.io/-/formalv/-/jobs/2693138482/artifacts/public/index.html"
maintainer: "Mireia González Bedmar <mireia.gbedmar@formalv.com>"
tags: [
  "keyword:refinement"
  "keyword:primitive integers"
  "logpath:formalv"
]
authors: [
  "Ana de Almeida Borges"
  "Quim Casals Buñuel"
  "Juan Conejero Rodriguez"
  "Mireia González Bedmar"
  "Eduardo Hermo Reyes"
]
license: "PolyForm Noncommercial License 1.0.0" # Make sure this is reflected by a LICENSE file in your sources
depends: [
  "coq" {>= "8.14" & < "8.16~"}
  "coq-mathcomp-algebra" {>= "1.12" & < "1.15~" }
  "coq-mathcomp-ssreflect" {>= "1.12" & < "1.15~" }
]
build: [
  [make "-C" "theories/prim63_mathcomp" "-j" "%{jobs}%"]
]
install: [
  [make "-C" "theories/prim63_mathcomp" "install"]
]
url {
  src: "https://gitlab.com/formalv/formalv/-/archive/1.0.0/formalv-1.0.0.tar.gz"
  checksum: "sha256=73143b71400fefb310144640cac71cf6abafdc06a6f6acc29d024a42b91eabdc"
}

Lint

Command

true

Return code

0

Dry install 🏜

Dry install with the current Coq version:

Command

opam install -y --show-action coq-formalv-prim63_mathcomp.1.0.0 coq.8.14.1

Return code

0

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

Command

true

Return code

0

Install dependencies

Command

opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-formalv-prim63_mathcomp.1.0.0 coq.8.14.1

Return code

0

Duration

12 m 49 s

Install 🚀

Command

opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-formalv-prim63_mathcomp.1.0.0 coq.8.14.1

Return code

0

Duration

1 m 21 s

Installation size

Total: 1 M

180 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrint_Z.vo

176 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrint_Z.glob

105 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrint_Sint63.glob

92 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_Uint63.vo

92 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Sint63_extra.glob

85 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrint_Sint63.vo

78 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_Uint63.glob

76 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_Sint63.vo

69 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Sint63_extra.vo

55 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_Sint63.glob

49 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Uint63_extra.vo

48 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Uint63_Sint63.vo

43 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Uint63_extra.glob

36 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Z_extra.vo

31 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Uint63_Sint63.glob

26 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_prim63_mathcomp.vo

25 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_signed_prim63_mathcomp.vo

25 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrint_Z.v

25 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/nat_of_posL.vo

22 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_unsigned_prim63_mathcomp.vo

19 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_nat.vo

17 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrint_Sint63.v

15 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_Uint63.v

14 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Z_extra.glob

14 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Sint63_extra.v

12 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_Sint63.v

9 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Uint63_extra.v

7 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Uint63_Sint63.v

4 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/nat_of_posL.glob

4 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/Z_extra.v

2 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/nat_of_posL.v

2 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_nat.glob

2 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_prim63_mathcomp.v

2 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/ssrnat_nat.v

1 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_signed_prim63_mathcomp.v

1 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_unsigned_prim63_mathcomp.v

1 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_prim63_mathcomp.glob

1 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_signed_prim63_mathcomp.glob

1 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/formalv/prim63_mathcomp/all_unsigned_prim63_mathcomp.glob

Uninstall 🧹

Command

opam remove -y coq-formalv-prim63_mathcomp.1.0.0

Return code

0

Missing removes

                none

Wrong removes

                none

          Sources are on GitHub © Guillaume Claret 🐣


text:
using Mono.Addins;

using System;
using System.Reflection;
using System.Threading;
using System.Text;
using System.Net;
using System.Net.Sockets;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
{
    public class JsonStore
    {
        private static readonly ILog m_log =
            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        protected virtual OSD ValueStore { get; set; }

        protected class TakeValueCallbackClass
        {
            public string Path { get; set; }
            public bool UseJson { get; set; }
            public TakeValueCallback Callback { get; set; }

            public TakeValueCallbackClass(string spath, bool usejson, TakeValueCallback cback)
            {
                Path = spath;
                UseJson = usejson;
                Callback = cback;
            }
        }

        protected List<TakeValueCallbackClass> m_TakeStore;
        protected List<TakeValueCallbackClass> m_ReadStore;

        // add separators for quoted paths and array references
        protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");

        // add quotes to bare identifiers which are limited to alphabetic characters
        protected static Regex m_ParsePassThree = new Regex("(?<!{[^}]*)\\.([a-zA-Z]+)(?=\\.)");

        // remove extra separator characters
        protected static Regex m_ParsePassFour = new Regex("\\.+");

        // expression used to validate the full path, this is canonical representation
        protected static Regex m_ValidatePath = new Regex("^\\.(({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])\\.)*$");

        // expression used to match path components
        protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");

        // extract the internals of an array reference
        protected static Regex m_SimpleArrayPattern = new Regex("^\\[([0-9]+)\\]$");
        protected static Regex m_ArrayPattern = new Regex("^\\[([0-9]+|\\+)\\]$");

        // extract the internals of a has reference
        protected static Regex m_HashPattern = new Regex("^{([^}]+)}$");

        // -----------------------------------------------------------------
        /// <summary>
        /// This is a simple estimator for the size of the stored data, it
        /// is not precise, but should be close enough to implement reasonable
        /// limits on the storage space used
        /// </summary>
        // -----------------------------------------------------------------
        public int StringSpace { get; set; }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public static bool CanonicalPathExpression(string ipath, out string opath)
        {
            Stack<string> path;
            if (! ParsePathExpression(ipath,out path))
            {
                opath = "";
                return false;
            }

            opath = PathExpressionToKey(path);
            return true;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public JsonStore()
        {
            StringSpace = 0;
            m_TakeStore = new List<TakeValueCallbackClass>();
            m_ReadStore = new List<TakeValueCallbackClass>();
        }

        public JsonStore(string value) : this()
        {
            // This is going to throw an exception if the value is not
            // a valid JSON chunk. Calling routines should catch the
            // exception and handle it appropriately
            if (String.IsNullOrEmpty(value))
                ValueStore = new OSDMap();
            else
                ValueStore = OSDParser.DeserializeJson(value);
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public JsonStoreNodeType GetNodeType(string expr)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
                return JsonStoreNodeType.Undefined;

            OSD result = ProcessPathExpression(ValueStore,path);

            if (result == null)
                return JsonStoreNodeType.Undefined;

            if (result is OSDMap)
                return JsonStoreNodeType.Object;

            if (result is OSDArray)
                return JsonStoreNodeType.Array;

            if (OSDBaseType(result.Type))
                return JsonStoreNodeType.Value;

            return JsonStoreNodeType.Undefined;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public JsonStoreValueType GetValueType(string expr)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
                return JsonStoreValueType.Undefined;

            OSD result = ProcessPathExpression(ValueStore,path);

            if (result == null)
                return JsonStoreValueType.Undefined;

            if (result is OSDMap)
                return JsonStoreValueType.Undefined;

            if (result is OSDArray)
                return JsonStoreValueType.Undefined;

            if (result is OSDBoolean)
                return JsonStoreValueType.Boolean;

            if (result is OSDInteger)
                return JsonStoreValueType.Integer;

            if (result is OSDReal)
                return JsonStoreValueType.Float;

            if (result is OSDString)
                return JsonStoreValueType.String;

            return JsonStoreValueType.Undefined;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public int ArrayLength(string expr)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
                return -1;

            OSD result = ProcessPathExpression(ValueStore,path);
            if (result != null && result.Type == OSDType.Array)
            {
                OSDArray arr = result as OSDArray;
                return arr.Count;
            }

            return -1;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public bool GetValue(string expr, out string value, bool useJson)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
            {
                value = "";
                return false;
            }

            OSD result = ProcessPathExpression(ValueStore,path);
            return ConvertOutputValue(result,out value,useJson);
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public bool RemoveValue(string expr)
        {
            return SetValueFromExpression(expr,null);
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public bool SetValue(string expr, string value, bool useJson)
        {
            OSD ovalue;

            // One note of caution... if you use an empty string in the
            // structure it will be assumed to be a default value and will
            // not be seialized in the json

            if (useJson)
            {
                // There doesn't appear to be a good way to determine if the
                // value is valid Json other than to let the parser crash
                try
                {
                    ovalue = OSDParser.DeserializeJson(value);
                }
                catch (Exception)
                {
                    if (value.StartsWith("'") && value.EndsWith("'"))
                    {
                        ovalue = new OSDString(value.Substring(1,value.Length - 2));
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else
            {
                ovalue = new OSDString(value);
            }

            return SetValueFromExpression(expr,ovalue);
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public bool TakeValue(string expr, bool useJson, TakeValueCallback cback)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
                return false;

            string pexpr = PathExpressionToKey(path);

            OSD result = ProcessPathExpression(ValueStore,path);
            if (result == null)
            {
                m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
                return false;
            }

            string value = String.Empty;
            if (! ConvertOutputValue(result,out value,useJson))
            {
                // the structure does not match the request so i guess we'll wait
                m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
                return false;
            }

            SetValueFromExpression(expr,null);
            cback(value);

            return true;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        public bool ReadValue(string expr, bool useJson, TakeValueCallback cback)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
                return false;

            string pexpr = PathExpressionToKey(path);

            OSD result = ProcessPathExpression(ValueStore,path);
            if (result == null)
            {
                m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
                return false;
            }

            string value = String.Empty;
            if (! ConvertOutputValue(result,out value,useJson))
            {
                // the structure does not match the request so i guess we'll wait
                m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
                return false;
            }

            cback(value);

            return true;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        protected bool SetValueFromExpression(string expr, OSD ovalue)
        {
            Stack<string> path;
            if (! ParsePathExpression(expr,out path))
                return false;

            if (path.Count == 0)
            {
                ValueStore = ovalue;
                StringSpace = 0;
                return true;
            }

            // pkey will be the final element in the path, we pull it out here to make sure
            // that the assignment works correctly
            string pkey = path.Pop();
            string pexpr = PathExpressionToKey(path);
            if (pexpr != "")
                pexpr += ".";

            OSD result = ProcessPathExpression(ValueStore,path);
            if (result == null)
                return false;

            // Check pkey, the last element in the path, for and extract array references
            MatchCollection amatches = m_ArrayPattern.Matches(pkey,0);
            if (amatches.Count > 0)
            {
                if (result.Type != OSDType.Array)
                    return false;

                OSDArray amap = result as OSDArray;

                Match match = amatches[0];
                GroupCollection groups = match.Groups;
                string akey = groups[1].Value;

                if (akey == "+")
                {
                    string npkey = String.Format("[{0}]",amap.Count);

                    if (ovalue != null)
                    {
                        StringSpace += ComputeSizeOf(ovalue);

                        amap.Add(ovalue);
                        InvokeNextCallback(pexpr + npkey);
                    }
                    return true;
                }

                int aval = Convert.ToInt32(akey);
                if (0 <= aval && aval < amap.Count)
                {
                    if (ovalue == null)
                    {
                        StringSpace -= ComputeSizeOf(amap[aval]);
                        amap.RemoveAt(aval);
                    }
                    else
                    {
                        StringSpace -= ComputeSizeOf(amap[aval]);
                        StringSpace += ComputeSizeOf(ovalue);
                        amap[aval] = ovalue;
                        InvokeNextCallback(pexpr + pkey);
                    }
                    return true;
                }

                return false;
            }

            // Check for and extract hash references
            MatchCollection hmatches = m_HashPattern.Matches(pkey,0);
            if (hmatches.Count > 0)
            {
                Match match = hmatches[0];
                GroupCollection groups = match.Groups;
                string hkey = groups[1].Value;

                if (result is OSDMap)
                {
                    // this is the assignment case
                    OSDMap hmap = result as OSDMap;
                    if (ovalue != null)
                    {
                        StringSpace -= ComputeSizeOf(hmap[hkey]);
                        StringSpace += ComputeSizeOf(ovalue);

                        hmap[hkey] = ovalue;
                        InvokeNextCallback(pexpr + pkey);
                        return true;
                    }

                    // this is the remove case
                    if (hmap.ContainsKey(hkey))
                    {
                        StringSpace -= ComputeSizeOf(hmap[hkey]);
                        hmap.Remove(hkey);
                        return true;
                    }

                    return false;
                }

                return false;
            }

            // Shouldn't get here if the path was checked correctly
            m_log.WarnFormat("[JsonStore] invalid path expression");
            return false;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        protected bool InvokeNextCallback(string pexpr)
        {
            // Process all of the reads that match the expression first
            List<TakeValueCallbackClass> reads =
                m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });

            foreach (TakeValueCallbackClass readcb in reads)
            {
                m_ReadStore.Remove(readcb);
                ReadValue(readcb.Path,readcb.UseJson,readcb.Callback);
            }

            // Process one take next
            TakeValueCallbackClass takecb =
                m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });

            if (takecb != null)
            {
                m_TakeStore.Remove(takecb);
                TakeValue(takecb.Path,takecb.UseJson,takecb.Callback);

                return true;
            }

            return false;
        }

        // -----------------------------------------------------------------
        /// <summary>
        /// Parse the path expression and put the components into a stack. We
        /// use a stack because we process the path in inverse order later
        /// </summary>
        // -----------------------------------------------------------------
        protected static bool ParsePathExpression(string expr, out Stack<string> path)
        {
            path = new Stack<string>();

            // add front and rear separators
            expr = "." + expr + ".";

            // add separators for quoted exprs and array references
            expr = m_ParsePassOne.Replace(expr,".$1.",-1,0);

            // add quotes to bare identifier
            expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);

            // remove extra separators
            expr = m_ParsePassFour.Replace(expr,".",-1,0);

            // validate the results (catches extra quote characters for example)
            if (m_ValidatePath.IsMatch(expr))
            {
                MatchCollection matches = m_PathComponent.Matches(expr,0);
                foreach (Match match in matches)
                    path.Push(match.Groups[1].Value);

                return true;
            }

            return false;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param>path is a stack where the top level of the path is at the bottom of the stack</param>
        // -----------------------------------------------------------------
        protected static OSD ProcessPathExpression(OSD map, Stack<string> path)
        {
            if (path.Count == 0)
                return map;

            string pkey = path.Pop();

            OSD rmap = ProcessPathExpression(map,path);
            if (rmap == null)
                return null;

            // ---------- Check for an array index ----------
            MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0);

            if (amatches.Count > 0)
            {
                if (rmap.Type != OSDType.Array)
                {
                    m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Array,rmap.Type,pkey);
                    return null;
                }

                OSDArray amap = rmap as OSDArray;

                Match match = amatches[0];
                GroupCollection groups = match.Groups;
                string akey = groups[1].Value;
                int aval = Convert.ToInt32(akey);

                if (aval < amap.Count)
                    return (OSD) amap[aval];

                return null;
            }

            // ---------- Check for a hash index ----------
            MatchCollection hmatches = m_HashPattern.Matches(pkey,0);

            if (hmatches.Count > 0)
            {
                if (rmap.Type != OSDType.Map)
                {
                    m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey);
                    return null;
                }

                OSDMap hmap = rmap as OSDMap;

                Match match = hmatches[0];
                GroupCollection groups = match.Groups;
                string hkey = groups[1].Value;

                if (hmap.ContainsKey(hkey))
                    return (OSD) hmap[hkey];

                return null;
            }

            // Shouldn't get here if the path was checked correctly
            m_log.WarnFormat("[JsonStore] Path type (unknown) does not match the structure");
            return null;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        protected static bool ConvertOutputValue(OSD result, out string value, bool useJson)
        {
            value = String.Empty;

            // If we couldn't process the path
            if (result == null)
                return false;

            if (useJson)
            {
                // The path pointed to an intermediate hash structure
                if (result.Type == OSDType.Map)
                {
                    value = OSDParser.SerializeJsonString(result as OSDMap,true);
                    return true;
                }

                // The path pointed to an intermediate hash structure
                if (result.Type == OSDType.Array)
                {
                    value = OSDParser.SerializeJsonString(result as OSDArray,true);
                    return true;
                }

                value = "'" + result.AsString() + "'";
                return true;
            }

            if (OSDBaseType(result.Type))
            {
                value = result.AsString();
                return true;
            }

            return false;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        protected static string PathExpressionToKey(Stack<string> path)
        {
            if (path.Count == 0)
                return "";

            string pkey = "";
            foreach (string k in path)
                pkey = (pkey == "") ? k : (k + "." + pkey);

            return pkey;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        protected static bool OSDBaseType(OSDType type)
        {
            // Should be the list of base types for which AsString() returns
            // something useful
            if (type == OSDType.Boolean)
                return true;
            if (type == OSDType.Integer)
                return true;
            if (type == OSDType.Real)
                return true;
            if (type == OSDType.String)
                return true;
            if (type == OSDType.UUID)
                return true;
            if (type == OSDType.Date)
                return true;
            if (type == OSDType.URI)
                return true;

            return false;
        }

        // -----------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        // -----------------------------------------------------------------
        protected static int ComputeSizeOf(OSD value)
        {
            string sval;

            if (ConvertOutputValue(value,out sval,true))
                return sval.Length;

            return 0;
        }
    }

    // -----------------------------------------------------------------
    /// <summary>
    /// </summary>
    // -----------------------------------------------------------------
    public class JsonObjectStore : JsonStore
    {
        private static readonly ILog m_log =
            LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        private Scene m_scene;
        private UUID m_objectID;

        protected override OSD ValueStore
        {
            get
            {
                SceneObjectPart sop = m_scene.GetSceneObjectPart(m_objectID);
                if (sop == null)
                {
                    // This is bad
                    return null;
                }

                return sop.DynAttrs.TopLevelMap;
            }

            // cannot set the top level
            set
            {
                m_log.InfoFormat("[JsonStore] cannot set top level value in object store");
            }
        }

        public JsonObjectStore(Scene scene, UUID oid) : base()
        {
            m_scene = scene;
            m_objectID = oid;

            // the size limit is imposed on whatever is already in the store
            StringSpace = ComputeSizeOf(ValueStore);
        }
    }

}


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

namespace Karcero.Visualizer
{
    public static class Screenshot
    {
        /// <summary>
        /// Gets a PNG "screenshot" of the current UIElement
        /// </summary>
        /// <param name="source">UIElement to screenshot</param>
        /// <param name="scale">Scale to render the screenshot</param>
        /// <returns>Byte array of PNG data</returns>
        public static byte[] GetPngImage(this UIElement source, double scale = 1)
        {
            var actualHeight = source.RenderSize.Height;
            var actualWidth = source.RenderSize.Width;

            var renderHeight = actualHeight * scale;
            var renderWidth = actualWidth * scale;

            var renderTarget = new RenderTargetBitmap((int)renderWidth, (int)renderHeight, 96, 96, PixelFormats.Pbgra32);
            var sourceBrush = new VisualBrush(source);

            var drawingVisual = new DrawingVisual();
            var drawingContext = drawingVisual.RenderOpen();

            using (drawingContext)
            {
                drawingContext.PushTransform(new ScaleTransform(scale, scale));
                drawingContext.DrawRectangle(sourceBrush, null, new Rect(new Point(0, 0), new Size(actualWidth, actualHeight)));
            }
            renderTarget.Render(drawingVisual);

            var pngEncoder = new PngBitmapEncoder();
            pngEncoder.Frames.Add(BitmapFrame.Create(renderTarget));
            Byte[] imageArray;

            using (var outputStream = new MemoryStream())
            {
                pngEncoder.Save(outputStream);
                imageArray = outputStream.ToArray();
            }

            return imageArray;
        }
    }
}


text:
using System;

namespace Casimodo.Lib.Data
{
    [AttributeUsage(AttributeTargets.Class)]
    public class KeyInfoAttribute : Attribute
    {
        public string PropName { get; set; }
    }
}


text:
package space.cyberworlds.ljpostj;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Hashtable;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 *
 */
public class App
{

	private static final Logger logger_ = LoggerFactory.getLogger(App.class);

	static LjApiClient lac;

	static final String SUBJ_TOKEN = "SUBJECT:";

	static final String ACTION_POST_STR = "post";

	static final int ACTION_UNKNOWN = 0;
	static final int ACTION_POST = 1;

	private static String msg = "";

	public static int getAction (String s)
	{
		int res = ACTION_UNKNOWN;

		if (ACTION_POST_STR.equalsIgnoreCase(ACTION_POST_STR))
		{
			res = ACTION_POST;
		}

		return res;
	}

	public static int getSecLevel(String s)
	{
		int res = LjApiClient.SECURITY_LEVEL_PRIVATE;

		if (s.equalsIgnoreCase("public"))
		{
			res = LjApiClient.SECURITY_LEVEL_PUBLIC;
			msg = "sec level PUBLIC";
			logger_.info(msg);
			System.out.println(msg);

		} else if (s.equalsIgnoreCase("private"))
		{
			res = LjApiClient.SECURITY_LEVEL_PRIVATE;
			msg = "sec level PRIVATE";
			logger_.info(msg);
			System.out.println(msg);

		} else if (s.equalsIgnoreCase("friends"))
		{
			res = LjApiClient.SECURITY_LEVEL_FRIENDS;
			msg = "sec level FRIENDS";
			logger_.info(msg);
			System.out.println(msg);
		}
		else
		{
			msg = "Unknown sec level " + s + " forcing PRIVATE";
			logger_.info(msg);
			res = LjApiClient.SECURITY_LEVEL_PRIVATE;
			System.out.println(msg);

		}

		return res;
	}

	/**
	 * Moves file from 'incoming' to 'processed' dir
	 * @param dirIn directory with *.txt files
	 * @param fileName short file name (no slashes)
	 * @return returns true if file was moved successfully or false otherwise
	 */
	public static boolean moveFile (String dirIn, String fileName)
	{
		boolean res = false;

		String dirOut = dirIn + "/processed";

		File file = new File(dirOut);
		if (!file.exists())
		{
			if (file.mkdir())
			{
				msg = "Directory for processed files is created!";
				System.out.println(msg);
				logger_.info(msg);
			} else
			{
				System.out.println("Failed to create  a directory for processed files");
				System.out.println(msg);
				logger_.error(msg);
			}
		}

		try
		{

			File afile = new File(dirIn + "/" + fileName);

			if (afile.renameTo(new File(dirOut + "/" + afile.getName())))
			{
				msg =  "File was successfully moved: " + fileName;
				System.out.println(msg);
				logger_.info(msg);

				res = true;
			} else
			{
				msg =  "File is failed to move: " + fileName;
				System.out.println(msg);
				logger_.error(msg);

				res = false;
			}

		} catch (Exception e)
		{
			e.printStackTrace();

			msg = "Error moving file :" + fileName;
			System.out.println(msg);
			logger_.error(msg);
			res = false;
		}

		return res;
	}

	/**
	 * Lists all of the *.txt files in dir directory
	 * @param dir directory with *.txt files
	 * @return ArrayList with a short file names
	 */
	public static ArrayList listTxtFiles (String dir)
	{
		File f = new File(dir);
		ArrayList<String> names = new ArrayList<String>(
				Arrays.asList(
						f.list(
								new FilenameFilter()
								{
									@Override
									public boolean accept(File dir, String name)
									{
										if(name.lastIndexOf('.')>0)
										{
											// get last index for '.' char
											int lastIndex = name.lastIndexOf('.');

											// get extension
											String str = name.substring(lastIndex);

											// match path name extension
											if(str.equals(".txt"))
											{
												return true;
											}
										}
										return false;
									}
								}

								)));

		return names;
	}

	/**
	 * Uploads file to the server
	 * @param dir
	 * @param fileName
	 * @param secLevel
	 * @param backdated
	 * @return returns false if file upload failed, true otherwise
	 * @throws IOException
	 * @throws XmlRpcException
	 */
	public static boolean processFile (String dir, String fileName, int secLevel, boolean backdated) throws IOException, XmlRpcException
	{
		boolean res = false;

		FileInputStream fstream = new FileInputStream(dir + "/" + fileName);
		BufferedReader br = new BufferedReader(new InputStreamReader(fstream));

		String strLine;

		String strDate = br.readLine();

		String [] date =  strDate.split(" ");

		System.out.println(date[0] + " " +  date [1] + " " + date[2]);

		String subj = "";
		String text = "";

		String s = br.readLine();
		if (0 == s.indexOf(SUBJ_TOKEN))
		{
			subj = s.substring(SUBJ_TOKEN.length());
		}
		else
		{
			text += s + "\n";
		}

		while ((strLine = br.readLine()) != null)
		{
			text += strLine + "\n";
		}

		br.close();

		HashMap <Object, Object> options = null;

		if (backdated)
		{
			logger_.debug("backdated entry, creating options");
			options = new HashMap <Object, Object> ();
			options.put(new String ("opt_backdated"), new Boolean(true));
		}

		HashMap <Object, Object> resMap = lac.postevent(subj, text, "unix",
					secLevel,
					Integer.valueOf(date[0]),
					Integer.valueOf(date[1]),
					Integer.valueOf(date[2]),
					Integer.valueOf(date[3]),
					Integer.valueOf(date[4]),
					options);

		//check if url is returned

		if (null != resMap)
		{

			String url = "";

			for (HashMap.Entry <Object, Object> entry : resMap.entrySet())
			{
				if (entry.getKey().toString().equals("url"))
				{
					res = true;

					url = entry.getValue().toString();
					msg = " File: " + fileName + " was uploaded to url: " +  url;

					logger_.info(msg);
					System.out.println(msg);

					moveFile (dir, fileName);
				}
			}

			if (url.isEmpty())
			{
				msg = " File: " + fileName + " url was not found in servers response.";

				logger_.info(msg);
				System.out.println(msg);
			}

		}

		return res;
	}

    public static void main( String[] args )
    {

    	String actionStr = "";
    	int action = ACTION_UNKNOWN;
    	boolean stop = false;
    	boolean backdated = false;

    	String user = "";
    	String password = "";

    	String dir = "";
    	int secLevel = -1;

		Option optnUser = Option.builder("u").
				required(true)
				.hasArg(true)
				.desc("Username. Mandatory value")
				.longOpt("user")
				.build();

		Option optnPassword = Option.builder("p").
				required(true)
				.hasArg(true)
				.desc("Password. Mandatory value")
				.longOpt("password")
				.build();

		Option optnAction = Option.builder("a").
				required(true)
				.hasArg(true)
				.desc("Action. Accepted values: 'post'.  'post' loads data from the specialy crafted files in the upload directory")
				.longOpt("action")
				.build();

		Option optnDir = Option.builder("d")
				.required(false)
				.hasArg(true)
				.desc("Full path to upload dir. Must not contain a trailing slash. (Required when using a 'post' action)")
				.longOpt("dir")
				.build();

		Option optnSecLevel = Option.builder("s")
				.required(false)
				.hasArg(true)
				.desc("Security level. Required for 'post' action. Accepted values are: 'public', 'private', 'friends'")
				.longOpt("secLevel")
				.build();

		Option optnBackdated = Option.builder("b")
				.required(false)
				.hasArg(false)
				.desc("Post is backdated. Don't add to friends feeds and RSS. (Option for 'post' action)")
				.longOpt("backdated")
				.build();

		Option optnHelp = Option.builder("h").
				required(false)
				.hasArg(false)
				.desc("Prints help message")
				.longOpt("help")
				.build();

    	Options options = new Options();

    	options.addOption(optnDir);
    	options.addOption(optnAction);
    	options.addOption(optnSecLevel);
    	options.addOption(optnUser);
    	options.addOption(optnPassword);
    	options.addOption(optnBackdated);
    	options.addOption(optnHelp);

    	CommandLineParser parser = new DefaultParser();
    	try
    	{
    		CommandLine line = parser.parse( options, args );

    		if (line.hasOption("help"))
    		{
    			HelpFormatter formatter = new HelpFormatter();
    			formatter.printHelp( "ljpostj", options );
    			return;
    		}

    		if (line.hasOption("dir"))
    			dir = line.getOptionValue("dir");

    		if (line.hasOption("secLevel"))
    		{
    			secLevel = getSecLevel(line.getOptionValue("secLevel"));
    		}

    		if (line.hasOption("user"))
    			user = line.getOptionValue("user");

    		if (line.hasOption("password"))
    		{
    			password = line.getOptionValue("password");
    		}

    		if (line.hasOption("backdated"))
    		{
    			backdated = true;
    		}

    		msg = "user: '" + user + "'";
    		logger_.info(msg);
    		System.out.println(msg);

    		if (line.hasOption("action"))
    		{
    			actionStr = line.getOptionValue("action");

    			if (ACTION_POST == getAction(actionStr))
    			{
    				System.out.println("action = post\n");
    			} else
    			{
    				System.out.println("Unknown action: " + actionStr+"\n");
    				stop = true;
    			}
    		}
    	}
    	catch( ParseException exp )
    	{
    		msg = "Parsing failed.  Reason: " + exp.getMessage();
    		System.err.println(msg);
    		logger_.error(msg);

    		stop = true;
    	}

    	if (stop)
    		return;

        try
		{
			lac = new LjApiClient(user, password);
			lac.login();

		} catch (MalformedURLException e)
		{
			msg = "malformed URL exception. Error: " + e.getMessage();
			System.out.println(msg);
			logger_.error(msg);
			e.printStackTrace();
			stop = true;
		} catch (XmlRpcException e)
		{
			msg = "XmlRpc exception. Error: " + e.getMessage();
			logger_.error(msg);
			System.out.println(msg);
			e.printStackTrace();
			stop = true;
		}

        if (stop)
        	return;

        ArrayList al = listTxtFiles (dir);

        for (int i  =0; i < al.size(); i++)
        {
        	if (stop)
        	{
        		msg = "Exiting.";
        		System.out.println(msg);
        		logger_.info(msg);
        		break;
        	}

        	try
			{
				try
				{
					try
					{
						msg = "Processing '"  + al.get(i) + "' sec level: " + secLevel + " backdated: " + backdated;
						logger_.info(msg);
						System.out.println(msg);

						if (!processFile(dir, (String) al.get(i), secLevel, backdated))
						{
							stop = true;
						}

						Thread.sleep(1000);

					} catch (InterruptedException e)
					{
						e.printStackTrace();
						msg = "Interrupted exception. Error: " + e.getMessage();
						logger_.error(msg);
						System.out.println(msg);

						stop = true;
					}
				} catch (XmlRpcException e)
				{
					e.printStackTrace();
					msg = "XmlRpc exception. Error: " + e.getMessage();
					logger_.error(msg);
					System.out.println(msg);

					stop = true;
				}
			} catch (IOException e)
			{
				e.printStackTrace();
				msg = "IO exception. Error: " + e.getMessage();
				logger_.error(msg);
				System.out.println(msg);

				stop = true;
			}
        }

    }

}


text:
package ginproxy

import (
	"net/http/httputil"
	"net/url"

	"github.com/gin-gonic/gin"
)

type (
	ProxyRouter struct {
		upstream string
		proxy    *httputil.ReverseProxy
	}
)

func NewGinProxy(upstream string) (*ProxyRouter, error) {
	u, err := url.Parse(upstream)
	if err != nil {
		return nil, err
	}

	return &ProxyRouter{
		proxy: httputil.NewSingleHostReverseProxy(u),
	}, nil
}

func (p *ProxyRouter) Handler(c *gin.Context) {
	p.proxy.ServeHTTP(c.Writer, c.Request)
}


text:
package org.apache.flink.table.api

import org.apache.flink.table.expressions.ApiExpressionUtils.unwrapFromApi
import org.apache.flink.table.expressions.Expression
import org.apache.flink.types.Row

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

/** Tests for conversion between objects and [[Expression]]s used in Expression DSL. */
class ImplicitConversionsTest extends ImplicitExpressionConversions {
  @Test
  def testSeqConversion(): Unit = {
    val expr = Seq(1, 2).toExpr

    assertThatEquals(expr, array(1, 2))
  }

  @Test
  def testSeqOfExpressionsConversion(): Unit = {
    val expr = Seq(row(1, "ABC"), row(3, "DEF")).toExpr

    assertThatEquals(expr, array(row(1, "ABC"), row(3, "DEF")))
  }

  @Test
  def testListConversion(): Unit = {
    val expr = List(1, 2).toExpr

    assertThatEquals(expr, array(1, 2))
  }

  @Test
  def testMapConversion(): Unit = {
    val expr = Map("key1" -> List(2), "key2" -> List(1, 2)).toExpr

    assertThatEquals(
      expr,
      map(
        "key1",
        array(2),
        "key2",
        array(1, 2)
      )
    )
  }

  @Test
  def testNestedListConversion(): Unit = {
    val expr = List(List(1), List(2)).toExpr

    assertThatEquals(expr, array(array(1), array(2)))
  }

  @Test
  def testRowConversion(): Unit = {
    val expr = Row.of(Int.box(1), "ABC").toExpr

    assertThatEquals(expr, row(1, "ABC"))
  }

  @Test
  def testRowConversionWithScalaTypes(): Unit = {
    val expr = Row.of(Int.box(1), Seq("ABC", "DEF"), BigDecimal(1234)).toExpr

    assertThatEquals(expr, row(1, array("ABC", "DEF"), BigDecimal(1234)))
  }

  private def assertThatEquals(actual: Expression, expected: Expression): Unit = {
    assertThat(unwrapFromApi(actual)).isEqualTo(unwrapFromApi(expected))
  }
}


text:
<?php
// Need to Modify the Proxi Verification Address
// Need to Encrypt the password

require_once 'database.php';

//NEED TO MODIFY USERINFO()

class User{
	/* REGISTRATION DATA PACKAGE
	 */
	function index($method,$data){
		switch ($method){
			case "register":
				$this->register($data);
				//DATA: "email","password","phone"
				break;
			case "login":
				$this->login($data);
				//DATA: "email","password"
				break;
			case "logout":
				$this->logout();
				break;
			case "alter":
				$this->alter($data);
				//DATA: "email","password","phone"
				break;
			case "retreivePassword":
				$this->retrievePassword($data);
				//DATA: "email","phone"
				break;
			case "userInfo":
				$this->userInfo($data);
				//DATA: "email"
				break;
			default:
				echo "Cannot Find Appropriate Method";
		}
	}

	function register($data){
			//Password, Email, Phone

		//Encrypt

		// Check Validation of Email
		require "./BraintreeLibrary/braintree-php-3.7.0/lib/Braintree.php";
		Braintree_Configuration::environment('sandbox');
		Braintree_Configuration::merchantId('xcw69y6y437ct7mw');
		Braintree_Configuration::publicKey('mzd9yptqz6dd7ym9');
		Braintree_Configuration::privateKey('9c86283aeb4a127ccb9999f20cb0c451');
		if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $data["email"])){
			die("Email Address Is Not Validate.");
		}
		$user_active_key = md5(rand(0,1000));
		$email = $data['email'];
		$password= $data['password'];
		$phone = $data['phone'];
		$firstName = $data['firstName'];
		$lastName = $data['lastName'];

		$db = IDB::connection();
		$sql_email= "Select * from User where user_email = '$email'";
		//If Email Exists
		if ($query=$db->query($sql_email)){
			if (count($row = $query->fetchAll())!=0){
				die("Email already Exists");
			}
		}
		$merchantAccountParams = [
	 	 'individual' => [
	  	  'firstName' => $data["firstName"],
	  	  'lastName' => $data["lastName"],
	 	   'email' => $data["email"],
	 	   'phone' => $data["phone"],
	 	   'dateOfBirth' => $data["dateOfBirth"],
	 	   'address' => [
	 	     'streetAddress' => '501 College Ave.',
	  	    'locality' => 'Wheaton',
	  	    'region' => 'IL',
	 	     'postalCode' => '60187'
	 	   ]
		  ],
		  'funding' => [
		    'destination' => Braintree_MerchantAccount::FUNDING_DESTINATION_MOBILE_PHONE,
		    'mobilePhone' => $data["venmoPhone"]
		  ],
		  'tosAccepted' => true,
		  'masterMerchantAccountId' => "proximarketplaceinc"
		];
		$result = Braintree_MerchantAccount::create($merchantAccountParams);
		if ($result->success) {
			$transaction_id = $result->merchantAccount->id;
			if (empty($transaction_id)) {
				die("failed");
			}
			$sql = "Insert into User (user_email, user_password, user_active_key, user_phone, user_register_date, user_last_login, merchantAccount_id,user_first_name,user_last_name)
				 values ( '$email', '$password', '$user_active_key', '$phone',NOW(),NOW(),'$transaction_id','$firstName','$lastName'
				)";

			if ($query = $db->query($sql)){

				echo "successfully create user";

				/*$to = $email; // Send email to our user
				$subject = 'Activation For Your Proxi Account'; // Give the email a subject
				$message = '

							Thanks for signing up!
							Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below.

							------------------------
							Username: '.$email.'
							Password: '.$password.'
							------------------------

							Please click this link to activate your account:
							http://www.proximarketplace.com/verify.php?email='.$email.'&hash='.$user_active_key.'

							'; // Our message above including the link

				// Need to be Modified, If Doesn't work, Use SMTP with Proxi gmail account.
				$headers = 'From:noreply@proximarketplace.com' . "\r\n"; // Set from headers
				*/

			}
			else{
				//email to proxi about all user info.
				echo "cannot create user";
			}

		}else{
			echo $result;
		}

	}//check

	// data: email, password
	function login($data){
		//Email, Password

		$email = $data['email'];
		$password= $data['password'];
		$db= IDB::connection();
		$sql= "select user_id, user_password, user_active from User where user_email = '$email'";
		if ($result = $db->query($sql)){
			$row= $result->fetch(PDO::FETCH_OBJ);
		}
		if ($row->user_password != $password||$row->user_active == "1") {
		echo "login error";
		}else{
		$id = $row->user_id;
		$sql_update = "update User set user_last_login= NOW() where user_id = '$id'";

		echo "success login";
		}
	}//check

	// setcookie (session_name(), '', time()-300) <---- Reset Session

	function logout(){

		session_destroy();
		echo "session_destroy";
		echo "session_id: ";
		echo print_r($_SESSION['id']);
	}

	//@return true/false
	function alter($data){
		//Phone, Password

		$phone= $data['phone'];
		$password = $data['password'];
		$id = $_SESSION["id"];
		$db= IDB::connection();
		$sql= "update User set user_phone='$phone', user_password = '$password' where user_id = '$id'";
		//query->prepare.
		if ($result = $db->query($sql)) return true or die(false);
	}

	function retrievePassword($data){
		//Email, Phone

		// malefunctional.
		$email = $data['email'];
		$phone = $data['phone'];
		$db = IDB::connection();
		$sql = "update User set user_password = '' where user_email = ? and user_phone = ?";
		$query = $db->prepare($sql);
		if($result = $query->execute(array($email,$phone))){

			//send EMAIL to user to reset password
		}else{
			echo "failed to connect";
		}
	}

	//NEED MODIFIED
	function userInfo($data){
		$db = IDB::connection();
		$sql = "select * from user where user_email = ?";
		$query = $db->prepare($sql);
		$email = $data['email'];
		$query->execute(array($email));
		$row = $query->fetch(PDO::FETCH_OBJ);
		$data_array = array(
				"user_email" => $row->user_email,
				"user_phone" => $row->user_phone
				// userInfo
		);
		print_r($data_array);

	}

}

?>