answer stringlengths 15 1.25M |
|---|
using System;
using UnityEngine;
using LuaInterface;
public class GraphicsWrap
{
public static void Register(IntPtr L)
{
LuaMethod[] regs = new LuaMethod[]
{
new LuaMethod("DrawMesh", DrawMesh),
new LuaMethod("DrawMeshNow", DrawMeshNow),
new LuaMethod("DrawProcedural", DrawProcedural),
new LuaMethod("<API key>", <API key>),
new LuaMethod("DrawTexture", DrawTexture),
new LuaMethod("<API key>", <API key>),
new LuaMethod("Blit", Blit),
new LuaMethod("BlitMultiTap", BlitMultiTap),
new LuaMethod("<API key>", <API key>),
new LuaMethod("<API key>", <API key>),
new LuaMethod("SetRenderTarget", SetRenderTarget),
new LuaMethod("New", _CreateGraphics),
new LuaMethod("GetClassType", GetClassType),
};
LuaField[] fields = new LuaField[]
{
new LuaField("activeColorBuffer", <API key>, null),
new LuaField("activeDepthBuffer", <API key>, null),
};
LuaScriptMgr.RegisterLib(L, "UnityEngine.Graphics", typeof(Graphics), regs, fields, typeof(object));
}
[<API key>(typeof(LuaCSFunction))]
static int _CreateGraphics(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 0)
{
Graphics obj = new Graphics();
LuaScriptMgr.PushObject(L, obj);
return 1;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.New");
}
return 0;
}
static Type classType = typeof(Graphics);
[<API key>(typeof(LuaCSFunction))]
static int GetClassType(IntPtr L)
{
LuaScriptMgr.Push(L, classType);
return 1;
}
[<API key>(typeof(LuaCSFunction))]
static int <API key>(IntPtr L)
{
LuaScriptMgr.PushValue(L, Graphics.activeColorBuffer);
return 1;
}
[<API key>(typeof(LuaCSFunction))]
static int <API key>(IntPtr L)
{
LuaScriptMgr.PushValue(L, Graphics.activeDepthBuffer);
return 1;
}
[<API key>(typeof(LuaCSFunction))]
static int DrawMesh(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 4)
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetUnityObject(L, 1, typeof(Mesh));
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetNetObject(L, 2, typeof(Matrix4x4));
Material arg2 = (Material)LuaScriptMgr.GetUnityObject(L, 3, typeof(Material));
int arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
Graphics.DrawMesh(arg0,arg1,arg2,arg3);
return 0;
}
else if (count == 5 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4);
return 0;
}
else if (count == 5 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4);
return 0;
}
else if (count == 6 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera), typeof(int)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5);
return 0;
}
else if (count == 6 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5);
return 0;
}
else if (count == 7 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
<API key> arg6 = (<API key>)LuaScriptMgr.GetLuaObject(L, 7);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
return 0;
}
else if (count == 7 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera), typeof(int)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
return 0;
}
else if (count == 8 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(bool)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
<API key> arg6 = (<API key>)LuaScriptMgr.GetLuaObject(L, 7);
bool arg7 = LuaDLL.lua_toboolean(L, 8);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
return 0;
}
else if (count == 8 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
<API key> arg7 = (<API key>)LuaScriptMgr.GetLuaObject(L, 8);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
return 0;
}
else if (count == 8 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(UnityEngine.Rendering.ShadowCastingMode)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
<API key> arg6 = (<API key>)LuaScriptMgr.GetLuaObject(L, 7);
UnityEngine.Rendering.ShadowCastingMode arg7 = (UnityEngine.Rendering.ShadowCastingMode)LuaScriptMgr.GetLuaObject(L, 8);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
return 0;
}
else if (count == 9 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(bool), typeof(bool)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
<API key> arg6 = (<API key>)LuaScriptMgr.GetLuaObject(L, 7);
bool arg7 = LuaDLL.lua_toboolean(L, 8);
bool arg8 = LuaDLL.lua_toboolean(L, 9);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
return 0;
}
else if (count == 9 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(bool)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
<API key> arg7 = (<API key>)LuaScriptMgr.GetLuaObject(L, 8);
bool arg8 = LuaDLL.lua_toboolean(L, 9);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
return 0;
}
else if (count == 9 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(UnityEngine.Rendering.ShadowCastingMode)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
<API key> arg7 = (<API key>)LuaScriptMgr.GetLuaObject(L, 8);
UnityEngine.Rendering.ShadowCastingMode arg8 = (UnityEngine.Rendering.ShadowCastingMode)LuaScriptMgr.GetLuaObject(L, 9);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
return 0;
}
else if (count == 9 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(UnityEngine.Rendering.ShadowCastingMode), typeof(bool)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
Camera arg4 = (Camera)LuaScriptMgr.GetLuaObject(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
<API key> arg6 = (<API key>)LuaScriptMgr.GetLuaObject(L, 7);
UnityEngine.Rendering.ShadowCastingMode arg7 = (UnityEngine.Rendering.ShadowCastingMode)LuaScriptMgr.GetLuaObject(L, 8);
bool arg8 = LuaDLL.lua_toboolean(L, 9);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
return 0;
}
else if (count == 10 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(bool), typeof(bool)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
<API key> arg7 = (<API key>)LuaScriptMgr.GetLuaObject(L, 8);
bool arg8 = LuaDLL.lua_toboolean(L, 9);
bool arg9 = LuaDLL.lua_toboolean(L, 10);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
return 0;
}
else if (count == 10 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable), typeof(Material), typeof(int), typeof(Camera), typeof(int), typeof(<API key>), typeof(UnityEngine.Rendering.ShadowCastingMode), typeof(bool)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetLuaObject(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetLuaObject(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
<API key> arg7 = (<API key>)LuaScriptMgr.GetLuaObject(L, 8);
UnityEngine.Rendering.ShadowCastingMode arg8 = (UnityEngine.Rendering.ShadowCastingMode)LuaScriptMgr.GetLuaObject(L, 9);
bool arg9 = LuaDLL.lua_toboolean(L, 10);
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
return 0;
}
else if (count == 11)
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetUnityObject(L, 1, typeof(Mesh));
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Material arg3 = (Material)LuaScriptMgr.GetUnityObject(L, 4, typeof(Material));
int arg4 = (int)LuaScriptMgr.GetNumber(L, 5);
Camera arg5 = (Camera)LuaScriptMgr.GetUnityObject(L, 6, typeof(Camera));
int arg6 = (int)LuaScriptMgr.GetNumber(L, 7);
<API key> arg7 = (<API key>)LuaScriptMgr.GetNetObject(L, 8, typeof(<API key>));
UnityEngine.Rendering.ShadowCastingMode arg8 = (UnityEngine.Rendering.ShadowCastingMode)LuaScriptMgr.GetNetObject(L, 9, typeof(UnityEngine.Rendering.ShadowCastingMode));
bool arg9 = LuaScriptMgr.GetBoolean(L, 10);
Transform arg10 = (Transform)LuaScriptMgr.GetUnityObject(L, 11, typeof(Transform));
Graphics.DrawMesh(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.DrawMesh");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int DrawMeshNow(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 2)
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetUnityObject(L, 1, typeof(Mesh));
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetNetObject(L, 2, typeof(Matrix4x4));
Graphics.DrawMeshNow(arg0,arg1);
return 0;
}
else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(Matrix4x4), typeof(int)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Matrix4x4 arg1 = (Matrix4x4)LuaScriptMgr.GetLuaObject(L, 2);
int arg2 = (int)LuaDLL.lua_tonumber(L, 3);
Graphics.DrawMeshNow(arg0,arg1,arg2);
return 0;
}
else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(Mesh), typeof(LuaTable), typeof(LuaTable)))
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetLuaObject(L, 1);
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
Graphics.DrawMeshNow(arg0,arg1,arg2);
return 0;
}
else if (count == 4)
{
Mesh arg0 = (Mesh)LuaScriptMgr.GetUnityObject(L, 1, typeof(Mesh));
Vector3 arg1 = LuaScriptMgr.GetVector3(L, 2);
Quaternion arg2 = LuaScriptMgr.GetQuaternion(L, 3);
int arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
Graphics.DrawMeshNow(arg0,arg1,arg2,arg3);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.DrawMeshNow");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int DrawProcedural(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 2)
{
MeshTopology arg0 = (MeshTopology)LuaScriptMgr.GetNetObject(L, 1, typeof(MeshTopology));
int arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
Graphics.DrawProcedural(arg0,arg1);
return 0;
}
else if (count == 3)
{
MeshTopology arg0 = (MeshTopology)LuaScriptMgr.GetNetObject(L, 1, typeof(MeshTopology));
int arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
Graphics.DrawProcedural(arg0,arg1,arg2);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.DrawProcedural");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int <API key>(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 2)
{
MeshTopology arg0 = (MeshTopology)LuaScriptMgr.GetNetObject(L, 1, typeof(MeshTopology));
ComputeBuffer arg1 = (ComputeBuffer)LuaScriptMgr.GetNetObject(L, 2, typeof(ComputeBuffer));
Graphics.<API key>(arg0,arg1);
return 0;
}
else if (count == 3)
{
MeshTopology arg0 = (MeshTopology)LuaScriptMgr.GetNetObject(L, 1, typeof(MeshTopology));
ComputeBuffer arg1 = (ComputeBuffer)LuaScriptMgr.GetNetObject(L, 2, typeof(ComputeBuffer));
int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
Graphics.<API key>(arg0,arg1,arg2);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.<API key>");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int DrawTexture(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 2)
{
Rect arg0 = (Rect)LuaScriptMgr.GetNetObject(L, 1, typeof(Rect));
Texture arg1 = (Texture)LuaScriptMgr.GetUnityObject(L, 2, typeof(Texture));
Graphics.DrawTexture(arg0,arg1);
return 0;
}
else if (count == 3)
{
Rect arg0 = (Rect)LuaScriptMgr.GetNetObject(L, 1, typeof(Rect));
Texture arg1 = (Texture)LuaScriptMgr.GetUnityObject(L, 2, typeof(Texture));
Material arg2 = (Material)LuaScriptMgr.GetUnityObject(L, 3, typeof(Material));
Graphics.DrawTexture(arg0,arg1,arg2);
return 0;
}
else if (count == 6)
{
Rect arg0 = (Rect)LuaScriptMgr.GetNetObject(L, 1, typeof(Rect));
Texture arg1 = (Texture)LuaScriptMgr.GetUnityObject(L, 2, typeof(Texture));
int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
int arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
int arg4 = (int)LuaScriptMgr.GetNumber(L, 5);
int arg5 = (int)LuaScriptMgr.GetNumber(L, 6);
Graphics.DrawTexture(arg0,arg1,arg2,arg3,arg4,arg5);
return 0;
}
else if (count == 7 && LuaScriptMgr.CheckTypes(L, 1, typeof(Rect), typeof(Texture), typeof(Rect), typeof(int), typeof(int), typeof(int), typeof(int)))
{
Rect arg0 = (Rect)LuaScriptMgr.GetLuaObject(L, 1);
Texture arg1 = (Texture)LuaScriptMgr.GetLuaObject(L, 2);
Rect arg2 = (Rect)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
Graphics.DrawTexture(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
return 0;
}
else if (count == 7 && LuaScriptMgr.CheckTypes(L, 1, typeof(Rect), typeof(Texture), typeof(int), typeof(int), typeof(int), typeof(int), typeof(Material)))
{
Rect arg0 = (Rect)LuaScriptMgr.GetLuaObject(L, 1);
Texture arg1 = (Texture)LuaScriptMgr.GetLuaObject(L, 2);
int arg2 = (int)LuaDLL.lua_tonumber(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
Material arg6 = (Material)LuaScriptMgr.GetLuaObject(L, 7);
Graphics.DrawTexture(arg0,arg1,arg2,arg3,arg4,arg5,arg6);
return 0;
}
else if (count == 8 && LuaScriptMgr.CheckTypes(L, 1, typeof(Rect), typeof(Texture), typeof(Rect), typeof(int), typeof(int), typeof(int), typeof(int), typeof(LuaTable)))
{
Rect arg0 = (Rect)LuaScriptMgr.GetLuaObject(L, 1);
Texture arg1 = (Texture)LuaScriptMgr.GetLuaObject(L, 2);
Rect arg2 = (Rect)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
Color arg7 = LuaScriptMgr.GetColor(L, 8);
Graphics.DrawTexture(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
return 0;
}
else if (count == 8 && LuaScriptMgr.CheckTypes(L, 1, typeof(Rect), typeof(Texture), typeof(Rect), typeof(int), typeof(int), typeof(int), typeof(int), typeof(Material)))
{
Rect arg0 = (Rect)LuaScriptMgr.GetLuaObject(L, 1);
Texture arg1 = (Texture)LuaScriptMgr.GetLuaObject(L, 2);
Rect arg2 = (Rect)LuaScriptMgr.GetLuaObject(L, 3);
int arg3 = (int)LuaDLL.lua_tonumber(L, 4);
int arg4 = (int)LuaDLL.lua_tonumber(L, 5);
int arg5 = (int)LuaDLL.lua_tonumber(L, 6);
int arg6 = (int)LuaDLL.lua_tonumber(L, 7);
Material arg7 = (Material)LuaScriptMgr.GetLuaObject(L, 8);
Graphics.DrawTexture(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7);
return 0;
}
else if (count == 9)
{
Rect arg0 = (Rect)LuaScriptMgr.GetNetObject(L, 1, typeof(Rect));
Texture arg1 = (Texture)LuaScriptMgr.GetUnityObject(L, 2, typeof(Texture));
Rect arg2 = (Rect)LuaScriptMgr.GetNetObject(L, 3, typeof(Rect));
int arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
int arg4 = (int)LuaScriptMgr.GetNumber(L, 5);
int arg5 = (int)LuaScriptMgr.GetNumber(L, 6);
int arg6 = (int)LuaScriptMgr.GetNumber(L, 7);
Color arg7 = LuaScriptMgr.GetColor(L, 8);
Material arg8 = (Material)LuaScriptMgr.GetUnityObject(L, 9, typeof(Material));
Graphics.DrawTexture(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.DrawTexture");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int <API key>(IntPtr L)
{
LuaScriptMgr.CheckArgsCount(L, 1);
UnityEngine.Rendering.CommandBuffer arg0 = (UnityEngine.Rendering.CommandBuffer)LuaScriptMgr.GetNetObject(L, 1, typeof(UnityEngine.Rendering.CommandBuffer));
Graphics.<API key>(arg0);
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int Blit(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Texture), typeof(Material)))
{
Texture arg0 = (Texture)LuaScriptMgr.GetLuaObject(L, 1);
Material arg1 = (Material)LuaScriptMgr.GetLuaObject(L, 2);
Graphics.Blit(arg0,arg1);
return 0;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(Texture), typeof(RenderTexture)))
{
Texture arg0 = (Texture)LuaScriptMgr.GetLuaObject(L, 1);
RenderTexture arg1 = (RenderTexture)LuaScriptMgr.GetLuaObject(L, 2);
Graphics.Blit(arg0,arg1);
return 0;
}
else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(Texture), typeof(Material), typeof(int)))
{
Texture arg0 = (Texture)LuaScriptMgr.GetLuaObject(L, 1);
Material arg1 = (Material)LuaScriptMgr.GetLuaObject(L, 2);
int arg2 = (int)LuaDLL.lua_tonumber(L, 3);
Graphics.Blit(arg0,arg1,arg2);
return 0;
}
else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(Texture), typeof(RenderTexture), typeof(Material)))
{
Texture arg0 = (Texture)LuaScriptMgr.GetLuaObject(L, 1);
RenderTexture arg1 = (RenderTexture)LuaScriptMgr.GetLuaObject(L, 2);
Material arg2 = (Material)LuaScriptMgr.GetLuaObject(L, 3);
Graphics.Blit(arg0,arg1,arg2);
return 0;
}
else if (count == 4)
{
Texture arg0 = (Texture)LuaScriptMgr.GetUnityObject(L, 1, typeof(Texture));
RenderTexture arg1 = (RenderTexture)LuaScriptMgr.GetUnityObject(L, 2, typeof(RenderTexture));
Material arg2 = (Material)LuaScriptMgr.GetUnityObject(L, 3, typeof(Material));
int arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
Graphics.Blit(arg0,arg1,arg2,arg3);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.Blit");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int BlitMultiTap(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
Texture arg0 = (Texture)LuaScriptMgr.GetUnityObject(L, 1, typeof(Texture));
RenderTexture arg1 = (RenderTexture)LuaScriptMgr.GetUnityObject(L, 2, typeof(RenderTexture));
Material arg2 = (Material)LuaScriptMgr.GetUnityObject(L, 3, typeof(Material));
Vector2[] objs3 = LuaScriptMgr.GetParamsObject<Vector2>(L, 4, count - 3);
Graphics.BlitMultiTap(arg0,arg1,arg2,objs3);
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int <API key>(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(int), typeof(ComputeBuffer)))
{
int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
ComputeBuffer arg1 = (ComputeBuffer)LuaScriptMgr.GetLuaObject(L, 2);
Graphics.<API key>(arg0,arg1);
return 0;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(int), typeof(RenderTexture)))
{
int arg0 = (int)LuaDLL.lua_tonumber(L, 1);
RenderTexture arg1 = (RenderTexture)LuaScriptMgr.GetLuaObject(L, 2);
Graphics.<API key>(arg0,arg1);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.<API key>");
}
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int <API key>(IntPtr L)
{
LuaScriptMgr.CheckArgsCount(L, 0);
Graphics.<API key>();
return 0;
}
[<API key>(typeof(LuaCSFunction))]
static int SetRenderTarget(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 1)
{
RenderTexture arg0 = (RenderTexture)LuaScriptMgr.GetUnityObject(L, 1, typeof(RenderTexture));
Graphics.SetRenderTarget(arg0);
return 0;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(RenderBuffer), typeof(RenderBuffer)))
{
RenderBuffer arg0 = (RenderBuffer)LuaScriptMgr.GetLuaObject(L, 1);
RenderBuffer arg1 = (RenderBuffer)LuaScriptMgr.GetLuaObject(L, 2);
Graphics.SetRenderTarget(arg0,arg1);
return 0;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(RenderBuffer[]), typeof(RenderBuffer)))
{
RenderBuffer[] objs0 = LuaScriptMgr.GetArrayObject<RenderBuffer>(L, 1);
RenderBuffer arg1 = (RenderBuffer)LuaScriptMgr.GetLuaObject(L, 2);
Graphics.SetRenderTarget(objs0,arg1);
return 0;
}
else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(RenderTexture), typeof(int)))
{
RenderTexture arg0 = (RenderTexture)LuaScriptMgr.GetLuaObject(L, 1);
int arg1 = (int)LuaDLL.lua_tonumber(L, 2);
Graphics.SetRenderTarget(arg0,arg1);
return 0;
}
else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(RenderBuffer), typeof(RenderBuffer), typeof(int)))
{
RenderBuffer arg0 = (RenderBuffer)LuaScriptMgr.GetLuaObject(L, 1);
RenderBuffer arg1 = (RenderBuffer)LuaScriptMgr.GetLuaObject(L, 2);
int arg2 = (int)LuaDLL.lua_tonumber(L, 3);
Graphics.SetRenderTarget(arg0,arg1,arg2);
return 0;
}
else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(RenderTexture), typeof(int), typeof(CubemapFace)))
{
RenderTexture arg0 = (RenderTexture)LuaScriptMgr.GetLuaObject(L, 1);
int arg1 = (int)LuaDLL.lua_tonumber(L, 2);
CubemapFace arg2 = (CubemapFace)LuaScriptMgr.GetLuaObject(L, 3);
Graphics.SetRenderTarget(arg0,arg1,arg2);
return 0;
}
else if (count == 4)
{
RenderBuffer arg0 = (RenderBuffer)LuaScriptMgr.GetNetObject(L, 1, typeof(RenderBuffer));
RenderBuffer arg1 = (RenderBuffer)LuaScriptMgr.GetNetObject(L, 2, typeof(RenderBuffer));
int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
CubemapFace arg3 = (CubemapFace)LuaScriptMgr.GetNetObject(L, 4, typeof(CubemapFace));
Graphics.SetRenderTarget(arg0,arg1,arg2,arg3);
return 0;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: Graphics.SetRenderTarget");
}
return 0;
}
} |
.ng-invalid-url{
background: red;
}
tr > td{
text-overflow: ellipsis !important;
overflow: hidden !important;
white-space: nowrap !important;
} |
<?php
class EdenImageIndexTest extends <API key>
{
public function testBlur() {
$class = eden('image', __DIR__ . '/assets/stars.gif', 'gif');
// var_dump($class->getDimensions());
$this->assertInstanceOf('Eden\Image\Index', $class);
}
} |
package com.example.madiskar.<API key>.fragments;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import com.example.madiskar.<API key>.R;
public class SettingsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
<API key>(R.xml.preferences);
}
} |
// <API key>.h
// RealmTest
#import <UIKit/UIKit.h>
@interface <API key> : <API key>
- (void)reload;
@end |
<div class="well">Well, it's a well! Could add well-sm or well-lg too</div> |
# Civilization
Java console game based off Sid Meier's Civilization V
*DEVELOPMENT ON HOLD UNTIL PROCEDURAL GENERATION ALGORITHM COMPLETED
Screenshots

Checklist
- [ ] Reduce use of exceptions as logical operator
- [ ] Add layout for GUI interface
- [ ] Fix synchronization and messaging between interface and console
- [ ] Shift console input into GUI textfields
- [ ] Add additional units
- [ ] Restrict settle locations to prevent overlap |
'use strict';
// var declaration
var mongoose = require('mongoose'),
Timesheet = mongoose.model('Timesheet'),
_ = require('lodash');
var <API key> = require('../performance/<API key>.service.server');
// helper function declaration
var updateTimesheet = function(req, res) {
Timesheet.findById(req.body._id, function(err, timesheet) {
if(err) {
return res.send(400, {message: 'Something error'});
} else {
timesheet = _.extend(timesheet, req.body);
timesheet.save(function(err) {
if(err) {
return res.send(400, {message: 'Something error'});
} else {
<API key>.doCalculation(timesheet.user, timesheet.year, timesheet.month);
res.send(200);
}
});
}
});
};
// exported function declaration
exports.do = function(req, res) {
updateTimesheet(req, res);
}; |
<link rel=stylesheet media=all href="/css/detail.css">
<style>
/* 750 */
@media only screen and (min-width:751px)
{
}
/* 960 */
@media only screen and (min-width:961px)
{
}
/* 1280 */
@media only screen and (min-width:1281px)
{
}
</style>
<script defer src="/js/detail.js"></script>
<base href="<?php echo $this->media_root ?>">
<div id=breadcrumb>
<ol class="breadcrumb container">
<li><a href="<?php echo base_url() ?>"></a></li>
<li><a href="<?php echo base_url($this->class_name) ?>"><?php echo $this->class_name_cn ?></a></li>
<li class=active><?php echo $title ?></li>
</ol>
</div>
<div id=content class=container>
<?php if ( empty($item) ): ?>
<p><?php echo $error ?></p>
<?php
else:
$current_role = $this->session->role;
$current_level = $this->session->level;
$role_allowed = array('', '');
$level_allowed = 30;
if ( in_array($current_role, $role_allowed) && ($current_level >= $level_allowed) ):
?>
<ul id=item-actions class=list-unstyled>
<li><a href="<?php echo base_url($this->class_name.'/edit?id='.$item[$this->id_name]) ?>"></a></li>
</ul>
<?php endif ?>
<dl id=list-info class=dl-horizontal>
<dt><?php echo $this->class_name_cn ?>ID</dt>
<dd><?php echo $item[$this->id_name] ?></dd>
<dt></dt>
<dd class=row>
<?php if ( empty($item['url_image_main']) ): ?>
<p></p>
<?php else: ?>
<figure class="col-xs-12 col-sm-6 col-md-4">
<img src="<?php echo $item['url_image_main'] ?>">
</figure>
<?php endif ?>
</dd>
<dt></dt>
<dd>
<?php if ( empty($item['figure_image_urls']) ): ?>
<p></p>
<?php else: ?>
<ul class=row>
<?php
$figure_image_urls = explode(',', $item['figure_image_urls']);
foreach($figure_image_urls as $url):
?>
<li class="col-xs-6 col-sm-4 col-md-3">
<img src="<?php echo $url ?>">
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
</dd>
<?php
foreach ($data_to_display as $name => $name_cn):
$html = '<dt>'. $name_cn. '</dt>';
$html .= '<dd>'. $item[$name]. '</dd>';
echo $html;
endforeach;
?>
</dl>
<dl id=list-record class=dl-horizontal>
<dt></dt>
<dd>
<?php echo $item['time_create'] ?>
<a href="<?php echo base_url('stuff/detail?id='.$item['creator_id']) ?>" target=new></a>
</dd>
<?php if ( ! empty($item['time_delete']) ): ?>
<dt></dt>
<dd><?php echo $item['time_delete'] ?></dd>
<?php endif ?>
<?php if ( ! empty($item['operator_id']) ): ?>
<dt></dt>
<dd>
<?php echo $item['time_edit'] ?>
<a href="<?php echo base_url('stuff/detail?id='.$item['operator_id']) ?>" target=new></a>
</dd>
<?php endif ?>
</dl>
<?php endif ?>
</div> |
package l2;
import java.util.Stack;
public class LeftMostAppFinder implements AppFinder {
// Stack interface
// peek top, peek
// LinkedList, (Deque), allocate
// : LinkedList peek null, Stack throw exception
// : replace, root
protected Stack<Node> path = new Stack<>();
protected Stack<Boolean> isAppLeft = new Stack<>();
@Override
public void init(Node root) {
path.push(root);
isAppLeft.push(false);
}
@Override
public boolean find() {
//System.out.println("find: path: " + path);
while (true) {
Node curr = path.peek();
if (curr instanceof App) {
Node left = ((App) curr).getLeft();
if (left instanceof Lam) {
return true;
} else {
path.push(left);
isAppLeft.push(true);
}
} else if (curr instanceof Lam) {
path.push(((Lam) curr).getBody());
isAppLeft.push(false);
} else if (curr instanceof Var) {
while (true) {
path.pop();
boolean isLeft = isAppLeft.pop();
if (isLeft == true) { // the only one case who has a next sibling
path.push(((App) path.peek()).getRight());
isAppLeft.push(false);
break;
}
if (path.isEmpty()) {
return false;
}
}
} else {
throw new RuntimeException("strange: curr: " + curr);
}
}
}
@Override
public App getApp() {
return (App) path.peek();
}
} |
<h1>10. Centuries to Nanoseconds</h1>
</br>
Write program to enter an integer number of centuries and convert it to years, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds.
</br>
<h4>Examples</h4>
</br>
<table>
<tr>
<th>Input</th>
<th>Output</th>
</tr>
<tr>
<td>
1
</td>
<td>1 centuries = 100 years = 36524 days = 876576 hours = 52594560 minutes = 3155673600 seconds = 3155673600000 milliseconds = 3155673600000000 microseconds = 3155673600000000000 nanoseconds
</td>
</tr>
<tr>
<td>
5
</td>
<td>5 centuries = 500 years = 182621 days = 4382904 hours = 262974240 minutes = 15778454400 seconds = 15778454400000 milliseconds = 15778454400000000 microseconds = <API key> nanoseconds
</td>
</tr>
</table>
</br>
<h4>Hints</h4>
</br> |
namespace Task03.PageEvents
{
using System;
public partial class Events : System.Web.UI.Page
{
protected void Page_PreInit(object sender, EventArgs e)
{
Response.Write("Page_PreInit invoked" + "<hr/>");
}
protected void Page_Init(object sender, EventArgs e)
{
Response.Write("Page_Init invoked" + "<hr/>");
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_Load invoked" + "<hr/>");
}
protected void Page_PreRender(object sender, EventArgs e)
{
Response.Write("Page_PreRender invoked" + "<hr/>");
}
protected void Page_Unload(object sender, EventArgs e)
{
// You can not use this - the page no longer exists
}
}
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Snapshot` struct in crate `rustc_trans`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Snapshot">
<title>rustc_trans::middle::infer::unify::Snapshot - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../../main.css">
<link rel="shortcut icon" href="http:
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]
<section class="sidebar">
<a href='../../../../rustc_trans/index.html'><img src='http:
<p class='location'><a href='../../../index.html'>rustc_trans</a>::<wbr><a href='../../index.html'>middle</a>::<wbr><a href='../index.html'>infer</a>::<wbr><a href='index.html'>unify</a></p><script>window.sidebarCurrent = {name: 'Snapshot', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</section>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press 'S' to search, '?' for more options..."
type="search">
</div>
</form>
</nav>
<section id='main' class="content struct">
<h1 class='fqn'><span class='in-band'>Struct <a href='../../../index.html'>rustc_trans</a>::<wbr><a href='../../index.html'>middle</a>::<wbr><a href='../index.html'>infer</a>::<wbr><a href='index.html'>unify</a>::<wbr><a class='struct' href=''>Snapshot</a><wbr><a class='stability Unstable' title=''>Unstable</a></span><span class='out-of-band'><span id='render-detail'>
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
</span><a id='src-92136' href='../../../../rustc/middle/infer/unify/struct.Snapshot.html?gotosrc=92136'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Snapshot<K> <span class='where'>where K: <a class='trait' href='../../../../rustc_trans/middle/infer/unify/trait.UnifyKey.html' title='rustc_trans::middle::infer::unify::UnifyKey'>UnifyKey</a></span> {
// some fields omitted
}</pre><div class='docblock'><p>At any time, users may snapshot a unification table. The changes
made during the snapshot may either be <em>committed</em> or <em>rolled back</em>.</p>
</div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<div id="help" class="hidden">
<div class="shortcuts">
<h1>Keyboard shortcuts</h1>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h1>Search tricks</h1>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>typedef</code> (or
<code>tdef</code>).
</p>
</div>
</div>
<script>
window.rootPath = "../../../../";
window.currentCrate = "rustc_trans";
window.playgroundUrl = "";
</script>
<script src="../../../../jquery.js"></script>
<script src="../../../../main.js"></script>
<script async src="../../../../search-index.js"></script>
</body>
</html> |
div.pager {
padding: 3px;
text-align: right;
}
div.pager-size {
padding: 3px;
text-align: left;
}
a.pager-button, a.pager-button:before, a.pager-button:after {
cursor: pointer;
}
div.pager a.selected, div.pager a.selected:hover, div.pager a.selected:active {
color: #dfd;
background: #666;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#666', endColorstr='#333', GradientType=0 );
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #666), color-stop(90%, #333));
background-image: -<API key>(top, #666 20%, #333 90%);
background-image: -moz-linear-gradient(top, #666 20%, #333 90%);
background-image: -o-linear-gradient(top, #666 20%, #333 90%);
background-image: linear-gradient(#666 20%, #333 90%);
}
div.pager a.disabled, div.pager a.disabled:hover, div.pager a.disabled:active
{
color: #666;
text-decoration: none;
border-radius: 3px;
margin: 2px;
padding: 1px 3px;
background: #eee;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eee', endColorstr='#ddd', GradientType=0 );
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eee), color-stop(90%, #ddd));
background-image: -<API key>(top, #eee 20%, #ddd 90%);
background-image: -moz-linear-gradient(top, #eee 20%, #ddd 90%);
background-image: -o-linear-gradient(top, #eee 20%, #ddd 90%);
background-image: linear-gradient(#eee 20%, #ddd 90%);
}
div.pager a
{
color: black;
text-decoration: none;
border-radius: 3px;
margin: 2px;
padding: 1px 3px;
background: #eee;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eee', endColorstr='#ccc', GradientType=0 );
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eee), color-stop(90%, #ccc));
background-image: -<API key>(top, #eee 20%, #ccc 90%);
background-image: -moz-linear-gradient(top, #eee 20%, #ccc 90%);
background-image: -o-linear-gradient(top, #eee 20%, #ccc 90%);
background-image: linear-gradient(#eee 20%, #ccc 90%);
}
div.pager a:hover, div.pager a:active
{
background: #ccc;
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ccc', endColorstr='#eee', GradientType=0 );
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ccc), color-stop(90%, #eee));
background-image: -<API key>(top, #ccc 20%, #eee 90%);
background-image: -moz-linear-gradient(top, #ccc 20%, #eee 90%);
background-image: -o-linear-gradient(top, #ccc 20%, #eee 90%);
background-image: linear-gradient(#ccc 20%, #eee 90%);
} |
package example
import org.scalatest.FunSuite
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class ListsSuite extends FunSuite {
/**
* Tests are written using the `test` operator which takes two arguments:
*
* - A description of the test. This description has to be unique, no two
* tests can have the same description.
* - The test body, a piece of Scala code that implements the test
*
* The most common way to implement a test body is using the method `assert`
* which tests that its argument evaluates to `true`. So one of the simplest
* successful tests is the following:
*/
test("one plus one is two")(assert(1 + 1 == 2))
/**
* In Scala, it is allowed to pass an argument to a method using the block
* syntax, i.e. `{ argument }` instead of parentheses `(argument)`.
*
* This allows tests to be written in a more readable manner:
*/
test("one plus one is three?") {
assert(1 + 1 != 3) // This assertion fails! Go ahead and fix it.
}
test("details why one plus one is not three") {
assert(1 + 1 === 2) // Fix me, please!
}
/**
* In order to test the exceptional behavior of a methods, ScalaTest offers
* the `intercept` operation.
*
* In the following example, we test the fact that the method `intNotZero`
* throws an `<API key>` if its argument is `0`.
*/
test("intNotZero throws an exception if its argument is 0") {
intercept[<API key>] {
intNotZero(0)
}
}
def intNotZero(x: Int): Int = {
if (x == 0) throw new <API key>("zero is not allowed")
else x
}
/**
* Now we finally write some tests for the list functions that have to be
* implemented for this assignment. We fist import all members of the
* `List` object.
*/
import Lists._
/**
* We only provide two very basic tests for you. Write more tests to make
* sure your `sum` and `max` methods work as expected.
*
* In particular, write tests for corner cases: negative numbers, zeros,
* empty lists, lists with repeated elements, etc.
*
* It is allowed to have multiple `assert` statements inside one test,
* however it is recommended to write an individual `test` statement for
* every tested aspect of a method.
*/
test("sum of a few numbers") {
assert(sum(List(1,2,0)) === 3)
}
test("sum of an empty list") {
assert(sum(List()) === 0)
}
test("max of a few numbers") {
assert(max(List(3, 7, 2)) === 7)
}
test("max of a single number") {
assert(max(List(0)) === 0)
assert(max(List(9)) === 9)
assert(max(List(3)) === 3)
}
test("empty list in max") {
intercept[java.util.<API key>] {
max(List())
}
}
} |
require 'spiderfw/model/model_hash'
module Spider; module Model
# The request object specifies which data is to be loaded for a model. It is similar in purpose to
# the SELECT ... part of an SQL query.
class Request < ModelHash
# @return [bool] if true, the total number of rows returned by the query is requested.
attr_accessor :total_rows
# @return [bool] find also the given subclasses of the queried model.
attr_reader :polymorphs
# @return [bool] if true, the request will be expanded with lazy groups on load
attr_accessor :expandable
# @param [Array|Hash] value Value to initialize the Request with. May be a Hash, or an Array of elements.
# @param [Hash] params Params may have:
# * :total_rows Request the total rows corresponding to the Query from the storage
def initialize(val=nil, params={})
if (val.is_a?(Array))
super()
val.each{ |v| request(v) }
else
super(val)
end
@total_rows = params[:total_rows]
@polymorphs = {}
@expandable = true
end
# Initializes a Request that should not be expanded by the Mapper
# @param [Array|Hash] val
# @param [Hash] params
# @return [Request]
def self.strict(val=nil, params={})
r = self.new(val, params)
r.expandable = false
r
end
# @param [Element|String|Symbol] Element to request
# @return [void]
def request(element) # :nodoc:
if element.is_a?(Element)
self[element.name.to_s] = true
elsif element.is_a?(String)
element.split(',').each do |el|
self[el.strip] = true
end
else
self[element] = true
end
end
# Requests that the mapper looks for subclasses of the given type, loading
# additional subclass specific elements specified in the request
# @param [Class<BaseModel] type The subclass
# @param [Request] request Request for subclass specific elements
def with_polymorphs(type, request)
@polymorphs[type] = request
end
# @return [bool] True if there are requested polymorphs
def polymorphs?
@polymorphs.empty? ? false : true
end
# Requests that only the subclasses requested with {#with_polymorphs} are returned,
# not the mapper's base class
# @return [self]
def only_polymorphs
@only_polymorphs = true
return self
end
# @return [bool] True if only polymorphs should be returned
def only_polymorphs?
@only_polymorphs
end
# Requests that the mapper retrieves also objects belonging to the model's superclass
# @return [self]
def with_superclass
@with_superclass = true
return self
end
# @return [bool] true if the superclass was requested with {#with_superclass}
def with_superclass?
@with_superclass
end
# @return [bool] true if the Request can be expanded by the mapper (using lazy groups)
def expandable?
@expandable
end
end
end; end |
{% load i18n %}{% spaceless %}
<dl class="sub-nav">
<dt class="hide">Sections:</dt>
<dd{% if active_tab == 'edit' %} class="active"{% endif %}>
<a href="{% url 'sveedocuments:page-edit' page_instance.slug %}">{% trans "Edit" %}</a>
</dd>
<dd{% if active_tab == 'history' %} class="active"{% endif %}>
<a href="{% url 'sveedocuments:page-history' page_instance.slug %}">{% trans "History" %} <em>({% if revisions_count %}{{ revisions_count }}{% else %}0{% endif %})</em></a>
</dd>
<dd{% if active_tab == 'attachments' %} class="active"{% endif %}>
<a href="{% url 'sveedocuments:page-attachments' page_instance.slug %}">{% trans "Attachments" %} <em>({% if files_count %}{{ files_count }}{% else %}0{% endif %})</em></a>
</dd>
{% if page_instance.visible %}<dd>
<a target="_blank" href="{% url 'sveedocuments:page-details' page_instance.slug %}">{% trans "View on site" %}</a>
</dd>{% endif %}
</dl>
{% endspaceless %} |
#include "panebase.h"
PaneBase::PaneBase(QWidget *parent, Qt::WindowFlags flags)
:QWidget(parent, flags)
{
}
PaneBase::~PaneBase()
{
} |
package com.googlecode.jmxtrans.model.output.support.pool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import stormpot.Expiration;
import stormpot.SlotInfo;
import java.net.Socket;
public class SocketExpiration implements Expiration<SocketPoolable> {
private static final Logger log = LoggerFactory.getLogger(SocketExpiration.class);
@Override
public boolean hasExpired(SlotInfo<? extends SocketPoolable> info) throws Exception {
Socket socket = info.getPoolable().getSocket();
try {
return socket == null
|| !socket.isConnected()
|| !socket.isBound()
|| socket.isClosed()
|| socket.isInputShutdown()
|| socket.isOutputShutdown();
} catch (Exception e) {
log.warn("Socket {} is expired", socket, e);
return true;
}
}
} |
/* rotate tile in 3D*/
.outblock.rotate3d
{
border-width:0px;
}
.rotate3d {
-webkit-perspective: 800px;
-ms-perspective: 800px;
-o-perspective: 800px;
perspective: 800px;
overflow: visible
}
.faces {
-<API key>: preserve-3d;
-webkit-transition: -webkit-transform 1s;
-ms-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
-o-transition: -o-transform 1s;
transition: -webkit-transform 1s;
transition: -ms-transform 1s;
transition: -o-transform 1s;
transition: transform 1s
}
.faces > div {
width: 100%;
height: 100%;
-<API key>: hidden;
-<API key>: hidden;
-<API key>: hidden;
backface-visibility: hidden;
}
.faces .front
{
position:relative;
top:-100%;
}
.rotate3dY .back {
-webkit-transform: rotateY( 180deg );
-ms-transform: rotateY( 180deg );
-o-transform: rotateY( 180deg );
transform: rotateY( 180deg )
}
.rotate3dY .front {
-webkit-transform: rotateY( 360deg );
-ms-transform: rotateY( 360deg );
-o-transform: rotateY( 360deg );
transform: rotateY( 360deg )
}
.rotate3dX .back {
-webkit-transform: rotateX( 180deg );
-ms-transform: rotateX( 180deg );
-o-transform: rotateX( 180deg );
transform: rotateX( 180deg )
}
.rotate3dY:hover .faces,
.rotate3dY.now .faces
{
-webkit-transform: rotateY( 180deg );
-ms-transform: rotateY( 180deg );
-o-transform: rotateY( 180deg );
transform: rotateY( 180deg )
}
.rotate3dX:hover .faces:hover ,
.rotate3dY.now .faces
{
-webkit-transform: rotateX( 180deg );
-ms-transform: rotateX( 180deg );
-o-transform: rotateX( 180deg );
transform: rotateX( 180deg )
} |
/* global asciidoctor, Chartist, hljs */
// exports
asciidoctor.browser.renderer = (webExtension, document, Constants, Settings, Dom, Theme) => {
const module = {}
/**
* Initialize the HTML document
*/
module.prepare = () => {
Dom.setViewport()
}
/**
* Update the content of the HTML document
* @param <API key> The response sent by the background script
* @returns {Promise<boolean>}
*/
module.updateHTML = async (<API key>) => {
try {
Dom.removeElement('<API key>')
// Save the scripts that are present at the root of the <body> to be able to restore them after the update
// QUESTION: Should we remove this code ? Since using livereload and this extension is not recommended!
const scripts = document.body.querySelectorAll(':scope > script')
detectLiveReloadJs(scripts)
const settings = await Settings.<API key>()
const customJavaScript = settings.customScript
preprocessing(customJavaScript)
await updateBodyHTML(<API key>, scripts)
postprocessing(customJavaScript)
return true
} catch (error) {
module.showError(error)
return false
}
}
/**
* Update the content of the HTML to show the error
* @param error An error
*/
module.showError = (error) => {
const message = `${error.name} : ${error.message}`
const messageText = `<p>${message}</p>`
document.body.innerHTML = `<div id="content"><h4>Error</h4>${messageText}</div>`
// <API key> no-console
console.error(error.stack)
}
/**
* Append MathJax script
*/
const initializeMathJax = (eqnumsValue) => {
const content = `function adjustDisplay(math, doc) {
let node = math.start.node.parentNode
if (node && (node = node.parentNode) && node.classList.contains('stemblock')) {
math.root.attributes.set('display', 'block')
}
}
window.MathJax = {
tex: {
inlineMath: [['\\\\(', '\\\\)']],
displayMath: [['\\\\[', '\\\\]']],
processEscapes: false,
tags: "${eqnumsValue}"
},
options: {
ignoreHtmlClass: 'nostem|noasciimath',
renderActions: {
adjustDisplay: [25, (doc) => {for (math of doc.math) {adjustDisplay(math, doc)}}, adjustDisplay]
}
},
asciimath: {
delimiters: [['\\\\$', '\\\\$']]
},
loader: {load: ['input/asciimath', 'output/chtml', 'ui/menu']}
};`
Dom.appendOnce(document.head, Dom.createScriptElement({
id: '<API key>',
innerHTML: content
}))
Dom.appendOnce(document.head, Dom.createScriptElement({
id: '<API key>',
src: webExtension.extension.getURL('vendor/MathJax-3.0.1/tex-chtml-full.js'),
async: true
}))
Dom.removeElement('<API key>')
document.head.appendChild(Dom.createScriptElement({
id: '<API key>',
innerHTML: 'if (MathJax && typeof MathJax.typesetPromise === \'function\') { MathJax.typesetPromise() }',
async: true
}))
}
/**
* Append styles
* @param doc
*/
const appendStyles = (stylesheet) => {
// Theme
return Theme.getThemeName(stylesheet)
.then(appendThemeStyle)
.then(() => {
// Highlight
const highlightTheme = 'github'
Dom.appendOnce(document.head, Dom.<API key>({
id: `asciidoctor-browser-${highlightTheme}-highlight-style`,
href: webExtension.extension.getURL(`css/highlight/${highlightTheme}.css`)
}))
})
}
/**
* @param customJavaScript
*/
const preprocessing = (customJavaScript) => {
if (customJavaScript && customJavaScript.loadDirective === 'before') {
document.head.appendChild(Dom.createScriptElement({
id: '<API key>',
innerHTML: customJavaScript.content
}))
}
}
/**
* @param customJavaScript
*/
const postprocessing = (customJavaScript) => {
if (customJavaScript && customJavaScript.loadDirective === 'after') {
document.head.appendChild(Dom.createScriptElement({
id: '<API key>',
innerHTML: customJavaScript.content
}))
}
}
const appendThemeStyle = async (themeName) => {
const themeNames = Theme.<API key>()
// Check if the theme is packaged in the extension... if not it's a custom theme
if (themeNames.includes(themeName)) {
Dom.<API key>(document.head, {
id: '<API key>',
href: webExtension.extension.getURL(`css/themes/${themeName}.css`)
})
} else {
const customThemeContent = await Settings.getSetting(Constants.CUSTOM_THEME_PREFIX + themeName)
if (customThemeContent) {
Dom.replaceStyleElement(document.head, {
id: '<API key>',
innerHTML: customThemeContent
})
}
}
}
/**
* Update the <div id="content"> element.
* @param html The new HTML content
*/
const updateContent = (html) => {
const contentElement = document.getElementById('content')
if (contentElement) {
contentElement.innerHTML = html
} else {
const contentDiv = document.createElement('div')
contentDiv.id = 'content'
contentDiv.innerHTML = html
document.body.innerHTML = '' // clear <body>
document.body.appendChild(contentDiv)
}
}
/**
* Update the HTML document with the Asciidoctor document
* @param converterResponse The response sent by the converter
* @param scripts The scripts to restore
*/
const updateBodyHTML = async (converterResponse, scripts) => {
const attributes = converterResponse.attributes
if (attributes.isFontIcons) {
<API key>()
}
await appendStyles(attributes.stylesheet)
appendChartistStyle()
const title = converterResponse.title
const doctype = converterResponse.doctype
const maxWidth = attributes.maxWidth
document.title = Dom.decodeEntities(title)
if (maxWidth) {
document.body.style.maxWidth = maxWidth
}
updateContent(converterResponse.html)
let tocClassNames = ''
if (attributes.hasSections && (attributes.tocPosition === 'left' || attributes.tocPosition === 'right')) {
tocClassNames = ` toc2 toc-${attributes.tocPosition}`
const tocElement = document.getElementById('toc')
if (tocElement !== null) {
tocElement.className = 'toc2'
}
}
document.body.className = `${doctype}${tocClassNames}`
<API key>()
if (attributes.isStemEnabled) {
initializeMathJax(attributes.eqnumsValue)
} else {
Dom.removeElement('<API key>')
Dom.removeElement('<API key>')
}
appendScripts(scripts)
if (attributes.<API key>) {
syntaxHighlighting()
}
drawCharts()
}
/**
* Detect LiveReload.js script to avoid multiple refreshes
*/
const detectLiveReloadJs = (scripts) => {
let liveReloadDetected = false
for (const script of scripts) {
if (script.src.indexOf(Constants.<API key>) !== -1) {
// LiveReload.js detected!
liveReloadDetected = true
break
}
}
const value = {}
value[Constants.<API key>] = liveReloadDetected
webExtension.storage.local.set(value)
}
/**
* Append saved scripts
*/
const appendScripts = (scripts) => {
for (const script of scripts) {
if (!isMathTexScript(script)) {
document.body.appendChild(script)
}
}
}
const isMathTexScript = (script) => {
return /math\/tex/i.test(script.type)
}
/**
* Syntax highlighting with Highlight.js
*/
const syntaxHighlighting = () => {
document.body.querySelectorAll('pre.highlight > code').forEach((node) => {
const match = /language-(\S+)/.exec(node.className)
if (match !== null && hljs.getLanguage(match[1]) !== null) {
hljs.highlightBlock(node)
} else {
node.className += ' hljs'
}
})
}
/**
* Draw charts with Chartist
*/
const drawCharts = () => {
document.body.querySelectorAll('div.ct-chart').forEach((node) => {
const options = {
height: node.dataset.chartHeight,
width: node.dataset.chartWidth,
colors: node.dataset.chartColors.split(',')
}
const dataset = Object.assign({}, node.dataset)
const series = Object.values(Object.keys(dataset)
.filter(key => key.startsWith('chartSeries-'))
.reduce((obj, key) => {
obj[key] = dataset[key]
return obj
}, {})).map(value => value.split(','))
const data = {
labels: node.dataset.chartLabels.split(','),
series: series
}
Chartist[node.dataset.chartType](node, data, options)
})
}
const appendChartistStyle = () => {
Dom.appendOnce(document.head, Dom.<API key>({
id: '<API key>',
href: webExtension.extension.getURL('css/chartist.min.css')
}))
Dom.appendOnce(document.head, Dom.createStyleElement({
id: '<API key>',
innerHTML: '.ct-chart .ct-series.ct-series-a .ct-line {stroke:#8EB33B} .ct-chart .ct-series.ct-series-b .ct-line {stroke:#72B3CC} .ct-chart .ct-series.ct-series-a .ct-point {stroke:#8EB33B} .ct-chart .ct-series.ct-series-b .ct-point {stroke:#72B3CC}'
}))
}
const <API key> = () => {
Dom.appendOnce(document.head, Dom.<API key>({
id: '<API key>',
href: webExtension.extension.getURL('css/font-awesome.min.css')
}))
}
/**
* Force dynamic objects to load (iframe, script...)
*/
const <API key> = () => {
document.body.querySelectorAll('iframe').forEach((node) => {
node.setAttribute('src', node.getAttribute('src'))
})
}
return module
} |
<?php
namespace App\Repositories;
use App\League;
class TeamRepository
{
/**
* Get all of the Teams for a given League.
*
* @param League $league
* @return Collection
*/
public function forLeague(League $league)
{
return $league->teams()
->orderBy('name', 'asc')
->get();
}} |
<?php
namespace EC\PrincipalBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\<API key>;
use Symfony\Component\OptionsResolver\<API key>;
class ValoracionType extends AbstractType
{
public function buildForm(<API key> $builder, array $options)
{
$builder->add('mensaje', 'textarea',array('label'=>'Mensaje','max_length'=>500));
$builder->add('puntuacion', 'rating',array('label'=>'Puntuación'));
}
public function setDefaultOptions(<API key> $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'EC\PrincipalBundle\Entity\Valoracion',
'csrf_protection' => false,
));
}
public function getName()
{
return 'valoracion';
}
} |
#include "../src/qt/csvmodelwriter.h"
#if !defined(<API key>)
#error "The header file 'csvmodelwriter.h' doesn't include <QObject>."
#elif <API key> != 63
#error "This file was generated using the moc from 4.8.4. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
<API key>
static const uint <API key>[] = {
// content:
6, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char <API key>[] = {
"CSVModelWriter\0"
};
void CSVModelWriter::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
const <API key> CSVModelWriter::<API key> = {
0, qt_static_metacall
};
const QMetaObject CSVModelWriter::staticMetaObject = {
{ &QObject::staticMetaObject, <API key>,
<API key>, &<API key> }
};
#ifdef <API key>
const QMetaObject &CSVModelWriter::getStaticMetaObject() { return staticMetaObject; }
#endif //<API key>
const QMetaObject *CSVModelWriter::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *CSVModelWriter::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, <API key>))
return static_cast<void*>(const_cast< CSVModelWriter*>(this));
return QObject::qt_metacast(_clname);
}
int CSVModelWriter::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
<API key> |
var main=require('../main');
main.directive('loginForm', function () {
return {
restrict: 'AE',
template:"<div style='height: 500px;'><label for='username'>:</label><input type='text' name='username' placeholder=''><label for='password'>:</label><input type='password' name='password' placeholder=''></div>"
}
}); |
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { <API key> } from './config-setting.component';
describe('<API key>', () => {
let component: <API key>;
let fixture: ComponentFixture<<API key>>;
beforeEach(async(() => {
TestBed.<API key>({
declarations: [ <API key> ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(<API key>);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
}); |
layout: post
title: "Common Misconceptions Executives Have About AI"
posturl: https://thinkgrowth.org/<API key>
tags:
- Overview
{% include post_info_header.md %}
Would be fun to see which executives actually have these misconceptions. I wonder how many times somebody utters on brainstorming meetings "let's use AI to solve this" though. Probably we will see a few years of "AI strategy" as we still see "mobile strategy".
<!--more
{% include post_info_footer.md %} |
<<<< HEAD
<?php
require "includes\ViewManager.php";
use ArcherSys\Viewer\ViewManager;
ViewManager::addProductForum("main");
?>
====
<?php
require "includes\ViewManager.php";
use ArcherSys\Viewer\ViewManager;
ViewManager::addProductForum("main");
?>
>>>> <SHA1-like> |
{
"title" : "How do I Convert a Microsoft Excel Spreadsheet to a PDF? "
}
How do I Convert a Microsoft Excel Spreadsheet to a PDF?
==
It is very simple to convert a Microsoft Excel Spreadsheet to a PDF file on the command line using [Docto](https://github.com/tobya/docto). You can also do this easily in Microsoft Excel, but sometimes it helps to be able to do it from the command line.
The command line below shows how you can convert a Microsoft Excel Spreadsheet Document to a Adobe PDF Format file - PDF.
Command Line
-
`
docto -XL -f 'c:\path\Spreadsheet.xls' -o 'c:\path\Spreadsheet.PDF' -t xlpdf
`
or easier to read
`
docto -XL -f 'c:\path\Spreadsheet.xls'
-o 'c:\path\Spreadsheet.PDF'
-t xlpdf
`
Command Line Explained
-
- `-XL` This is a conversion using Microsoft Excel.
- `-f` The File or directory to be converted
- `-o` The Output File or Directory where you would like the converted file to be written to.
- `-T` The file format type that is being converted to
Some other interesting commands
-
You might find some of the following commands also interesting.
Other File Types Available for Conversion
-
The following values below can be used to convert a Microsoft Excel Spreadsheet to another file type.
`
xlAddIn=18
xlCSV=6
xlCSVMac=22
xlCSVMSDOS=24
xlCSVWindows=23
<API key>=-4158
xlDBF2=7
xlDBF3=8
xlDBF4=11
xlDIF=9
xlExcel12=50
xlExcel2=16
xlExcel2FarEast=27
xlExcel3=29
xlExcel4=33
xlExcel4Workbook=35
xlExcel5=39
xlExcel7=39
xlExcel8=56
xlExcel9795=43
xlHtml=44
xlIntlAddIn=26
xlIntlMacro=25
<API key>=60
xlOpenXMLAddIn=55
xlOpenXMLTemplate=54
<API key>=53
xlOpenXMLWorkbook=51
<API key>=52
xlSYLK=2
xlTemplate=17
xlTextMac=19
xlTextMSDOS=21
xlTextPrinter=36
xlTextWindows=20
xlUnicodeText=42
xlWebArchive=45
xlWJ2WD1=14
xlWJ3=40
xlWJ3FJ3=41
xlWK1=5
xlWK1ALL=31
xlWK1FMT=30
xlWK3=15
xlWK3FM3=32
xlWK4=38
xlWKS=4
xlWorkbookDefault=51
xlWorkbookNormal=-4143
xlWorks2FarEast=28
xlWQ1=34
xlXMLSpreadsheet=46
xlTypePDF=50000
xlpdf=50000
xlTypeXPS=50001
xlXPS=50001
` |
Template.managegroup.group = function() {
var g = GROUPS.findOne(Session.get("gid"));
if (!g) g = {_id:Session.get("gid"),nogroup:true};
return g;
}
/*Template.managegroup.groupusers = function() {
return Meteor.users.find();
}*/
Template.managegroup.userscount = function() {
return Meteor.users.find().count();
}
Template.managegroup.rolenames = function(uacc) {
var keys = [];
var group = Session.get("gid");
if (group === undefined) {
for ( var k in uacc.roles ) {
keys.push(k + ': ' + uacc.roles[k]);
}
} else if (uacc.roles[group]) {
keys = uacc.roles[group];
}
return keys;
};
Template.managegroup.founduser = function() {
if (Session.get('selecteduser')) {
return Meteor.users.findOne(Session.get('selecteduser'));
} else {
return false;
}
}
Template.registerHelper('usernames', function() {
return Meteor.users.find().fetch().map(function(it){
if (it.username) return it.username;
});
});
Template.managegroup.rendered = function() {
Meteor.typeahead.inject();
};
Template.managegroup.helpers({
usersearch: function() {
return Meteor.users.find().fetch().map(function(it){
var ret = '';
if (it.username) ret += it.username;
if (it.emails && it.emails.length > 0 ) {
if (ret.length > 0) ret += ' - ';
ret += it.emails[0].address;
}
if (ret.length === 0) ret = 'ID ' + it._id;
return ret;
});
},
userblocks: function(uacc) {
return OAB_Blocked.find({'user':uacc._id}).count();
},
userrequests: function(uacc) {
return OAB_Request.find({'user':uacc._id}).count();
}
});
Template.registerHelper('searchedemail', function() {
return Session.get("searchedemail");
});
Template.managegroup.events({
"click #finduser": function(event) {
Session.set('searchedemail',undefined);
Session.set('selecteduser',undefined);
var vs = $('#usersearch').val().split(' - ');
var v = vs.length === 1 ? vs[0] : vs[1];
var u = Meteor.users.findOne({'emails.address':v});
Session.set('searchedemail',v);
if (u === undefined) u = Meteor.users.findOne(v.replace('ID ',''));
if (u !== undefined) Session.set('selecteduser',u._id);
},
"click #adduser": function(event) {
Meteor.call('addusertogroup',$('#newuser').val(),Session.get("gid"));
},
"click #removeuser": function(event) {
Meteor.call('removeuserfromgroup',$('#newuser').val(),Session.get("gid"));
},
"click #inviteuser": function(event) {
Meteor.call('inviteusertogroup',$('#newuser').val(),Session.get("gid"));
},
"click #makeadmin": function(event) {
Meteor.call('addusertogroup',event.target.getAttribute('user'),Session.get("gid"),'admin');
},
"click #removeadmin": function(event) {
Meteor.call('removeuserfromgroup',event.target.getAttribute('user'),Session.get("gid"),'admin');
},
"click #makeoabtestacc": function(event) {
Meteor.call('makeoabtestacc',event.target.getAttribute('user'));
},
"click #unmakeoabtestacc": function(event) {
Meteor.call('unmakeoabtestacc',event.target.getAttribute('user'));
},
"click #makepremium": function(event) {
Meteor.call('addusertogroup',event.target.getAttribute('user'),Session.get("gid"),'premium');
},
"click #removepremium": function(event) {
Meteor.call('removeuserfromgroup',event.target.getAttribute('user'),Session.get("gid"),'premium');
},
"change .addrole": function(event) {
Meteor.call('addusertogroup',event.target.getAttribute('user'),Session.get("gid"),event.target.val());
},
"click #lanternaddquota": function(event) {
if ( $('#lanternaddamount').val() && $('#lanternadddays').val() ) {
Meteor.call('lanternaddquota',event.target.getAttribute('user'),parseInt($('#lanternaddamount').val()),parseInt($('#lanternadddays').val()));
$('#lanternaddamount').val("");
$('#lanternadddays').val("");
}
},
});
Template.joingroup.events({
"change #joingroup": function(event) {
var g = $('#joingroup').val();
if (g.length) Meteor.call('addusertogroup',$('#joingroup').attr('user'),g);
}
});
UI.registerHelper('usergroups', function(uacc,filter) {
if (uacc === undefined) uacc = Meteor.user();
var u = [];
for ( var g in uacc.roles) {
var gg = uacc.roles[g];
var r = {
group: g,
roles: gg,
manage: false
};
if ( true ) r.manage = true;
if (filter && filter === g || filter === undefined) u.push(r);
}
return u;
});
UI.registerHelper('isX', function(uacc,role,group) {
if (typeof group === 'object') group = Session.get("gid");
return group && role && uacc && uacc.roles && uacc.roles[group] && uacc.roles[group].indexOf(role) !== -1;
});
UI.registerHelper('isadmin', function(uacc,group) {
if (typeof group === 'object') group = Session.get("gid");
return ( (group && uacc && uacc.roles && uacc.roles[group] && uacc.roles[group].indexOf('admin') !== -1) || (uacc.roles && uacc.roles.__global_roles__ && uacc.roles.__global_roles__.indexOf('root') !== -1) );
});
UI.registerHelper('isroot', function(uacc) {
var group = '__global_roles__';
return (uacc.roles && uacc.roles[group] && uacc.roles[group].indexOf('root') !== -1);
});
UI.registerHelper('userhandle', function(uacc) {
if (uacc.username) {
return uacc.username;
} else if (uacc.emails && uacc.emails.length > 0 ) {
return uacc.emails[0].address;
} else {
return uacc._id;
}
});
UI.registerHelper('equals', function(x,y) {
return x === y;
});
Template.<API key>.onRendered(function() {
if ( _.isEmpty(Session.get('userstats')) ) {
Meteor.call('userstats', function(err, result) {
Session.set('userstats', result);
});
}
});
Template.<API key>.requestscount = function(status,type) {
var filter = {};
if (status) filter.status = status;
if (type) filter.type = type;
return OAB_Request.find(filter).count();
}
Template.<API key>.<API key> = function() {
return OAB_Request.find({success:true}).count();
}
Template.<API key>.blockedcount = function(type) {
var filter = {};
if (type) filter.type = type;
return OAB_Blocked.find(filter).count();
}
Template.<API key>.userstats = function() {
return Session.get('userstats');
}
Template.<API key>.userblocked = function(uid) {
return OAB_Blocked.find({user:uid}).count();
}
Template.<API key>.userrequested = function(uid) {
return OAB_Request.find({user:uid}).count();
}
Template.<API key>.defaultapikey = function() {
for ( var k in Meteor.user().api.keys ) {
var dk = Meteor.user().api.keys[k];
if ( dk.name === 'default' ) return dk.key;
}
};
Template.<API key>.events({
'click #emailusers': function() {
$('#usersemail').val("").toggle();
$('#sendemail').toggle();
},
'click #sendemail': function() {
// TODO something...
}
}); |
Copyright (c) 2015 Jeff Calaway
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. |
<?php
namespace Equip\Structure\Traits;
trait CanIterate /* implements Iterator */
{
public function current()
{
return current($this->values);
}
public function key()
{
return key($this->values);
}
public function next()
{
next($this->values);
}
public function rewind()
{
reset($this->values);
}
public function valid()
{
$key = $this->key();
return isset($this->values[$key]);
}
} |
import * as bt from '@babel/types'
import { visit } from 'recast'
import { Node, TemplateChildNode, <API key> } from '@vue/compiler-dom'
import Documentation, { ParamTag } from '../Documentation'
import { <API key> } from '../parse-template'
import <API key> from '../utils/<API key>'
import getDoclets from '../utils/getDoclets'
import <API key> from '../utils/<API key>'
import {
isBaseElementNode,
isDirectiveNode,
<API key>,
isInterpolationNode
} from '../utils/guards'
export default function propTemplateHandler(
documentation: Documentation,
templateAst: TemplateChildNode,
siblings: TemplateChildNode[],
options: <API key>
) {
if (options.functional) {
propsInAttributes(documentation, templateAst, siblings)
<API key>(documentation, templateAst, siblings)
}
}
function propsInAttributes(
documentation: Documentation,
templateAst: TemplateChildNode,
siblings: TemplateChildNode[]
) {
if (isBaseElementNode(templateAst)) {
templateAst.props.forEach(prop => {
if (isDirectiveNode(prop) && <API key>(prop.exp)) {
<API key>(documentation, templateAst, prop.exp, siblings)
}
})
}
}
function <API key>(
documentation: Documentation,
templateAst: TemplateChildNode,
siblings: TemplateChildNode[]
) {
if (isInterpolationNode(templateAst) && <API key>(templateAst.content)) {
<API key>(documentation, templateAst, templateAst.content, siblings)
}
}
function <API key>(
documentation: Documentation,
item: Node,
exp: <API key>,
siblings: TemplateChildNode[]
) {
const expression = exp.content
const ast = <API key>(expression)
const propsFound: string[] = []
visit(ast.program, {
<API key>(path) {
const obj = path.node ? path.node.object : undefined
const propName = path.node ? path.node.property : undefined
if (
obj &&
propName &&
bt.isIdentifier(obj) &&
obj.name === 'props' &&
bt.isIdentifier(propName)
) {
const pName = propName.name
const p = documentation.getPropDescriptor(pName)
propsFound.push(pName)
p.type = { name: 'undefined' }
}
return false
}
})
if (propsFound.length) {
const comments = <API key>(siblings, item)
comments.forEach(comment => {
const doclets = getDoclets(comment)
const propTags = doclets.tags && (doclets.tags.filter(d => d.title === 'prop') as ParamTag[])
if (propTags && propTags.length) {
propsFound.forEach(pName => {
const propTag = propTags.filter(pt => pt.name === pName)
if (propTag.length) {
const p = documentation.getPropDescriptor(pName)
p.type = propTag[0].type
if (typeof propTag[0].description === 'string') {
p.description = propTag[0].description
}
}
})
}
})
}
} |
let code = {}
code.basic = `\
<vb-form-item addons>
<vb-button color="info">Confirm</vb-button>
<vb-button color="warning">Reset</vb-button>
</vb-form-item>
<vb-form-item addons>
<vb-input placeholder="Find a repository"></vb-input>
<vb-button color="info">Search</vb-button>
</vb-form-item>
<vb-form-item addons>
<vb-input placeholder="Your email"></vb-input>
<vb-button color="info" state="static">@gmail.com</vb-button>
</vb-form-item>
`
code.expanded = `\
<vb-form-item addons>
<vb-select value="€">
<option>$</option>
<option>£</option>
<option>€</option>
</vb-select>
<vb-input placeholder="Amount of money"></vb-input>
<vb-button>Transfer</vb-button>
</vb-form-item>
<vb-form-item addons>
<vb-select value="€">
<option>$</option>
<option>£</option>
<option>€</option>
</vb-select>
<vb-input expanded placeholder="Amount of money"></vb-input>
<vb-button>Transfer</vb-button>
</vb-form-item>
<vb-form-item addons>
<vb-select name="country" value="Argentina" fullWidth>
<option value="Argentina">Argentina</option>
<option value="Bolivia">Bolivia</option>
<option value="Brazil">Brazil</option>
<option value="Chile">Chile</option>
<option value="Colombia">Colombia</option>
<option value="Ecuador">Ecuador</option>
<option value="Guyana">Guyana</option>
<option value="Paraguay">Paraguay</option>
<option value="Peru">Peru</option>
<option value="Suriname">Suriname</option>
<option value="Uruguay">Uruguay</option>
<option value="Venezuela">Venezuela</option>
</vb-select>
<vb-button>Choose</vb-button>
</vb-form-item>
`
code.alignment = `\
<vb-form-item addons>
<vb-select value="€">
<option>$</option>
<option>£</option>
<option>€</option>
</vb-select>
<vb-input placeholder="Amount of money"></vb-input>
<vb-button color="primary">Transfer</vb-button>
</vb-form-item>
<vb-form-item addons align="centered">
<vb-select value="€">
<option>$</option>
<option>£</option>
<option>€</option>
</vb-select>
<vb-input placeholder="Amount of money"></vb-input>
<vb-button color="primary">Transfer</vb-button>
</vb-form-item>
<vb-form-item addons align="right">
<vb-select value="€">
<option>$</option>
<option>£</option>
<option>€</option>
</vb-select>
<vb-input placeholder="Amount of money"></vb-input>
<vb-button color="primary">Transfer</vb-button>
</vb-form-item>
`
export default code |
<!doctype html>
<html>
<head>
<script src="lib/phaser-no-physics.min.js"></script>
<script src="labyrinthz.js"></script>
<link rel="stylesheet" href="style.css" type="text/css"/>
<title>Labyrinthz</title>
</head>
<body>
<div id="content">
<h1>Labyrinthz</h1>
<div id="wrapper"></div>
<div id="copy"></div>
<div id="footer">
<div class="left"><a href="http://github.com/darekkay/labyrinthz" target="_blank">Source Code</a></div>
<div class="right">Handmade with ♥ by <a href="https://darekkay.com" target="_blank">Darek Kay</a></div>
</div>
</div>
</body>
</html> |
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{zXQ9:function(t,e,n){"use strict";var u=n("TqRt");e.__esModule=!0,e.default=void 0;var a=u(n("VbXa")),o=u(n("q1tI")),r=function(t){function e(){return t.apply(this,arguments)||this}return(0,a.default)(e,t),e.prototype.render=function(){return o.default.createElement(o.default.Fragment,null)},e}(o.default.Component);e.default=r}}]);
//# sourceMappingURL=<API key>.js.map |
FindAVIFile
Locate AVIFILE library and include paths
AVIFILE (http://avifile.sourceforge.net/) is a set of libraries for
i386 machines to use various AVI codecs. Support is limited beyond
Linux. Windows provides native AVI support, and so doesn't need this
library. This module defines
::
AVIFILE_INCLUDE_DIR, where to find avifile.h , etc.
AVIFILE_LIBRARIES, the libraries to link against
AVIFILE_DEFINITIONS, definitions to use when compiling
AVIFILE_FOUND, If false, don't try to use AVIFILE
if (UNIX)
find_path(AVIFILE_INCLUDE_DIR avifile.h PATH_SUFFIXES avifile/include include/avifile include/avifile-0.7)
find_library(<API key> aviplay aviplay-0.7 PATH_SUFFIXES avifile/lib)
endif ()
include(${<API key>}/<API key>.cmake)
<API key>(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR <API key>)
if (AVIFILE_FOUND)
set(AVIFILE_LIBRARIES ${<API key>})
set(AVIFILE_DEFINITIONS "")
endif()
mark_as_advanced(AVIFILE_INCLUDE_DIR <API key>) |
Riak for Go
=============
[.
[.
## Status
Core functionality (fetch, store, secondary indexes, links) is complete, but many advanced features (MapReduce, Yokozuna search) are still on the way. There is no short-term guarantee that the API will remain stable. (We are shooting for a beta release in Nov. '14, followed by a "stable" 1.0 in December.) That being said, this code is already being actively tested in some production applications.
## Features
- Efficient connection pooling and re-dialing.
- Asynchronous batch fetches (see `FetchAsync` and `MultiFetchAsync`).
- Easy RAM-backed caching (see `MakeCache`).
- Transparent sibling conflict resolution.
- Compare-and-swap (see: `PushChangeset`).
- Low per-operation heap allocation overhead.
## Usage
Satisfy the `Object` interface and you're off to the races. The included 'Blob' object is the simplest possible Object implementation.
go
import (
"github.com/philhofer/rkive"
)
// Open up one connection
riak, err := rkive.DialOne("127.0.0.1:8087", "test-Client-ID")
// handle err...
blobs := riak.Bucket("blob_bucket")
// let's make an object
myBlob := &rkive.Blob{ Data: []byte("Hello World!") }
// now let's put it in the database
err = blobs.New(myBlob, nil)
// handle err...
// since we didn't specify a key, riak assigned
// an available key
fmt.Printf("Our blob key is %s\n", myBlob.Info().Key())
// Let's make a change to the object...
myBlob.Data = []byte("MOAR DATA")
// ... and store it!
err = blobs.Push(myBlob)
// riak.Push will return an error (riakpb.ErrModified) if
// the object has been modified since the last
// time you called New(), Push(), Store(), Fetch(), etc.
// You can retreive the latest copy of the object with:
updated, err := blobs.Update(myBlob)
// handle err
if updated { /* the object has been changed! */ }
// you can also fetch a new copy
// of the object like so:
newBlob := &rkive.Blob{}
err = blobs.Fetch(newBlob, myBlob.Info().Key())
// handle err...
For more worked examples, check out the `/_examples` folder.
For automatic code generation that implements `Marshal` and `Unmarshal`, [check this out.](http://github.com/philhofer/msgp)
If you want to run Riak with `allow_mult=true` (which you should *strongly* consider), take a look
at the `ObjectM` interface, which allows you to specify a `Merge()` operation to be used for
your object when multiple values are encountered on a read or write operation. If you have `allow_mult=true`
and your object does not satisfy the `ObjectM` interface, then read and write operations on a key/bucket
pair with siblings will return a `*<API key>`. (In the degenerate case where 10 consecutive merge
conflict resolution attempts fail, `*<API key>` will be returned for `ObjectM` operations. This is to
avoid "sibling explosion.")
As an example, here's what the `Blob` type would have to define (internally) if it were
to satisfy the `ObjectM` interface:
go
// NewEmpty should always return a <API key>
// zero value for the type in question. The client
// will marshal data into this object and pass it to
// Merge().
func (b *Blob) NewEmpty() Object {
return &Blob{}
}
// Merge should make a best-effort attempt to merge
// data from its argument into the method receiver.
// It should be prepared to handle nil/zero values
// for either object.
func (b *Blob) Merge(o Object) {
// you can always type-assert the argument
// to Merge() to be the same type returned
// by NewEmtpy(), which should also be the
// same type as the method receiver
nb := o.(*Blob)
// we don't really have a good way of handling
// this conflict, so we'll set the content
// to be the combination of both
b.Content = append(b.Content, nb.Content...)
}
## Performance
This client library was built with performance in mind.
To run benchmarks, start up Riak locally and run:
`go test -v -tags 'riak' -check.vv -bench .`
You will need to be running Riak 2.0+ using the configuration file found at `$GOPATH/github.com/philhofer/rkive/_conf/riak.conf`.
Here's what I get on my MacBook Pro, keeping in mind that time/op and iowait/op vary by +/- 10% on every benchmark run. (Client time per operation is more consistent between benchmark runs.) Memory allocations are perfectly consistent between benchmark runs.
| Operation | time/op | iowait/op | client time / op | allocs | heap/op |
|:
| Fetch | 418598ns| 413398ns | 5200ns | 6 | 550B |
| Store | 782187ns| 775353ns | 6834ns | 5 | 750B |
## Design & TODOs
This package is focused on using Riak the way it was intended: with `allow_mult` set to `true`. This library will *always* use vclocks when getting and setting values. Additionally, this library adheres strictly to Riak's read-before-write policy.
Internally, Return-Head is always set to `true`, so every `Push()` or `Store()` operation updates the local object's metadata. Consequently, you can carry out a series of transactions on an object in parallel and still avoid conflicts. (`PushChangeset()` is particularly useful in this regard.) You can retreive the latest version of an object by calling Update().
The core "verbs" of this library (New, Fetch, Store, Push, Update, Delete) are meant to have intuitive and sane default behavior. For instance, New always asks Riak to abort the transaction if an object already exists at the given key, and Update doesn't return the whole body of the object back from the database if it hasn't been modified.
Since garbage collection time bottlenecks many Go applications, a lot of effort was put into reducing memory allocations on database reads and writes. The implementation can only become more memory efficient when Go's escape analysis becomes less pessimistic about escaping pointers.
There is an open issue for cache buckets, which has the potential to dramatically improve performance in query-heavy (2i, map-reduce, Yokozuna) use cases. There are also some open issues related to implementing Riak 2.0 features.
This code is MIT licensed. You may use it however you see fit. However, I would very much appreciate it if you create PRs in this repo for patches and improvements! |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pystructure.pystructure import PYStructureVisitor
class <API key>(object):
def setup_class(self):
self.visitor = PYStructureVisitor()
def <API key>(self):
func_name = "foo"
args_list = []
default_list = []
kwarg = None
vararg = None
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = "foo()"
assert result == expected
func_name = "foo"
args_list = ["a", "b"]
default_list = []
kwarg = None
vararg = None
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = "foo(a, b)"
assert result == expected
func_name = "foo"
args_list = ["a", "b"]
default_list = [3]
kwarg = None
vararg = None
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = "foo(a, b=3)"
assert result == expected
func_name = "foo"
args_list = ["a", "b"]
default_list = [3]
kwarg = "kw"
vararg = None
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = "foo(a, b=3, **kw)"
assert result == expected
func_name = "foo"
args_list = ["a", "b"]
default_list = [3, True]
kwarg = "kw"
vararg = "v"
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = "foo(a=3, b=True, *v, **kw)"
assert result == expected
func_name = "foo"
args_list = ["a", "b", "c"]
default_list = [3, True]
kwarg = None
vararg = "v"
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = "foo(a, b=3, c=True, *v)"
assert result == expected
func_name = "foo"
args_list = ["a", "b", "c"]
default_list = [3, "foo"]
kwarg = None
vararg = "v"
result = self.visitor.<API key>(
func_name,
args_list,
default_list,
kwarg,
vararg
)
expected = 'foo(a, b=3, c="foo", *v)'
assert result == expected |
// ==UserScript==
// @author James Edward Lewis II
// @description This loads Twitter emoji where possible, using the open-source Twemoji API.
// @name Twemojify
// @namespace greasyfork.org
// @version 1.0.0
// @include *
// @grant none
// @run-at document-start
// ==/UserScript==
// greatly inspired by the Twemojify extension by Monica Dinculescu
(function twemojify(window, undefined) {
'use strict';
function twemojifier() {
var observer = {}, observerConfig, r, <API key>;
// @win window reference
// @fn function reference
function contentLoaded(win, fn, cap) {
var done = false, top = true, doc = win.document, root = doc.documentElement,
w3c = !!doc.addEventListener, add = w3c ? 'addEventListener' : 'attachEvent',
rem = w3c ? 'removeEventListener' : 'detachEvent', pre = w3c ? '' : 'on',
init = function init(e) {
if (e.type === 'readystatechange' && doc.readyState !== 'complete') return;
(e.type === 'load' ? win : doc)[rem](pre + e.type, init, cap);
if (!done && (done = true)) fn.call(win, e.type || e);
},
poll = function poll() {
try { root.doScroll('left'); } catch(e) { setTimeout(poll, 50); return; }
init('poll');
};
cap = w3c && cap;
if (doc.readyState === 'complete') fn.call(win, 'lazy');
else {
if (doc.createEventObject && root.doScroll) {
try { top = !win.frameElement; } catch(e) { }
if (top) poll();
}
doc[add](pre + 'DOMContentLoaded', init, cap);
doc[add](pre + 'readystatechange', init, cap);
win[add](pre + 'load', init, cap);
}
}
function cb_addEventListener(obj, evt, fnc, cap) {
cap = !window.addEventListener || cap;
if (evt === 'DOMContentLoaded') return contentLoaded(window, fnc, cap);
// W3C model
if (obj.addEventListener) {
obj.addEventListener(evt, fnc, cap);
return true;
}
// Microsoft model
else if (obj.attachEvent) {
var binder = function binder() {return fnc.call(obj, evt);};
obj.attachEvent('on' + evt, binder);
return binder;
} else { // Browser doesn't support W3C or MSFT model, go on with traditional
evt = 'on' + evt;
if (typeof obj[evt] === 'function') {
// Object already has a function on traditional
// Let's wrap it with our own function inside another function
fnc = (function wrapper(f1, f2) {
return function wrapped() {
f1.apply(this, arguments);
f2.apply(this, arguments);
};
}(obj[evt], fnc));
}
obj[evt] = fnc;
return true;
}
}
function twemojiNode(e) {
e = e || window.event;
return twemoji.parse(e.target);
}
function twemojiBody() {
twemojiNode({target: document.body});
}
function init(e) {
var t;
e = e || event;
t = e.type;
if (e && (t === 'load' || t === 'DOMContentLoaded')) {
if (document.removeEventListener) document.removeEventListener(t, init, false);
else if (document.detachEvent) document.detachEvent(t, init);
else document[t] = null;
}
twemojiBody();
observer.start();
}
if (typeof MutationObserver !== 'function')
window.MutationObserver = window.<API key> || window.MozMutationObserver;
<API key> = (function testMutations() {
var e, l, f = false, root = document.documentElement;
l = root.id;
e = function e() {
if (root.removeEventListener) root.removeEventListener('DOMAttrModified', e, false);
else if (root.detachEvent) root.detachEvent('DOMAttrModified', e);
else root.onDomAttrModified = null;
<API key> = true;
root.id = l;
};
cb_addEventListener(root, 'DOMAttrModified', e, false);
// now modify a property
root.id = 'nw';
f = (root.id !== 'nw');
root.id = l;
return f;
}());
function onMutation(mutations) {
observer.stop();
twemojiBody();
observer.start();
}
if (MutationObserver) {
observer = new MutationObserver(onMutation);
observerConfig = {
attributes: false,
characterData: false,
childList: true,
subtree: true
};
observer.start = function start() {
observer.observe(document.body, observerConfig);
};
observer.stop = function stop() {
observer.disconnect();
};
} else if (<API key>) {
observer.start = function start() {
//cb_addEventListener(document.body, 'DOMAttrModified', onMutation, false);
//cb_addEventListener(document.body, '<API key>', onMutation, false);
cb_addEventListener(document.body, 'DOMNodeInserted', onMutation, false);
cb_addEventListener(document.body, 'DOMSubtreeModified', onMutation, false);
};
observer.stop = function stop() {
if (document.removeEventListener) {
//document.body.removeEventListener('DOMAttrModified', onMutation, false);
//document.body.removeEventListener('<API key>', onMutation, false);
document.body.removeEventListener('DOMNodeInserted', onMutation, false);
document.body.removeEventListener('DOMSubtreeModified', onMutation, false);
} else if (document.detachEvent) {
//document.body.detachEvent('DOMAttrModified', onMutation);
//document.body.detachEvent('<API key>', onMutation);
document.body.detachEvent('DOMNodeInserted', onMutation);
document.body.detachEvent('DOMSubtreeModified', onMutation);
} else {
//document.body.onDOMAttrModified = null;
//document.body.<API key> = null;
document.body.onDOMNodeInserted = null;
document.body.<API key> = null;
}
};
} else {
observer.start = function start() {
cb_addEventListener(document.body, 'propertychange', onMutation, false);
};
observer.stop = function stop() {
if (document.removeEventListener)
document.body.removeEventListener('propertychange', onMutation, false);
else if (document.detachEvent)
document.body.detachEvent('propertychange', onMutation);
else document.body.onpropertychange = null;
};
}
r = document.readyState;
if (r === 'complete' || r === 'loaded' || r === 'interactive') init({type: 'load'});
else cb_addEventListener(document, 'DOMContentLoaded', init, false);
}
function loadScript(url, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
if (script.readyState)
script.onreadystatechange = function callReady() {
if (script.readyState === 'loaded' ||
script.readyState === 'complete') {
script.onreadystatechange = null;
callback();
}
};
else script.onload = callback;
script.src = url;
(document.head || document.<API key>('head')[0]).appendChild(script);
}
if (typeof twemoji === 'undefined') loadScript('//rawgit.com/lewisje/twemojify/master/extension/twemoji.min.js', twemojifier);
else twemojifier();
}(window)); |
from ._testutil import GibsonTest, run_until_complete
from aiogibson import errors
class CommandsTest(GibsonTest):
@run_until_complete
def test_set(self):
key, value = b'test:set', b'bar'
response = yield from self.gibson.set(key, value, expire=3)
self.assertEqual(response, value)
with self.assertRaises(TypeError):
yield from self.gibson.set(key, value, expire='one')
@run_until_complete
def test_get(self):
key, value = b'test:get', b'bar'
resp = yield from self.gibson.set(key, value, expire=3)
self.assertEqual(resp, value)
resp = yield from self.gibson.get(key)
self.assertEqual(resp, value)
@run_until_complete
def test_delete(self):
key, value = b'test:delete', b'zap'
resp = yield from self.gibson.set(key, value, expire=3)
self.assertEqual(resp, value)
resp = yield from self.gibson.delete(key)
self.assertEqual(resp, True)
resp = yield from self.gibson.delete(key)
self.assertEqual(resp, False)
resp = yield from self.gibson.get(key)
self.assertEqual(resp, None)
@run_until_complete
def test_ttl(self):
key, value = b'test:ttl', b'zap'
resp = yield from self.gibson.set(key, value, 3)
self.assertEqual(resp, value)
resp = yield from self.gibson.ttl(key, 10)
self.assertEqual(resp, True)
with self.assertRaises(TypeError):
yield from self.gibson.ttl(key, expire='one')
@run_until_complete
def test_inc(self):
key, value = b'test:inc', 78
resp = yield from self.gibson.set(key, value, expire=3)
resp = yield from self.gibson.get(key)
self.assertEqual(resp, b'78')
resp = yield from self.gibson.inc(key)
self.assertEqual(resp, 79)
resp = yield from self.gibson.get(key)
self.assertEqual(resp, 79)
@run_until_complete
def test_dec(self):
key, value = b'test:dec', 78
resp = yield from self.gibson.set(key, value, expire=3)
resp = yield from self.gibson.get(key)
self.assertEqual(resp, b'78')
resp = yield from self.gibson.dec(key)
self.assertEqual(resp, 77)
resp = yield from self.gibson.get(key)
self.assertEqual(resp, 77)
@run_until_complete
def test_lock(self):
key, value = b'test:lock', b'zap'
resp = yield from self.gibson.set(key, value, 3)
self.assertEqual(resp, value)
resp = yield from self.gibson.lock(key, 10)
self.assertEqual(resp, True)
with self.assertRaises(errors.KeyLockedError):
yield from self.gibson.set(key, value, 3)
yield from self.gibson.unlock(key)
with self.assertRaises(TypeError):
yield from self.gibson.lock(key, expire='one')
def test_unlock(self):
key, value = b'test:unlock', b'zap'
resp = yield from self.gibson.set(key, value, 3)
self.assertEqual(resp, value)
resp = yield from self.gibson.lock(key, 10)
self.assertEqual(resp, True)
with self.assertRaises(errors.KeyLockedError):
yield from self.gibson.set(key, value, 3)
resp = yield from self.gibson.unlock(key)
self.assertEqual(resp, True)
resp = yield from self.gibson.set(key, 'foo', 3)
self.assertEqual(resp, b'foo')
@run_until_complete
def test_stats(self):
key, value = b'test:stats', b'zap'
resp = yield from self.gibson.set(key, value, 3)
self.assertEqual(resp, value)
resp = yield from self.gibson.stats()
test_keys = set([k for i, k in enumerate(resp) if not i % 2])
expected_keys = set([b'server_version', b'<API key>',
b'server_allocator', b'server_arch',
b'server_started', b'server_time',
b'first_item_seen', b'last_item_seen',
b'total_items', b'<API key>',
b'total_clients', b'total_cron_done',
b'total_connections', b'total_requests',
b'memory_available', b'memory_usable',
b'memory_used', b'memory_peak',
b'<API key>',
b'item_size_avg', b'compr_rate_avg',
b'reqs_per_client_avg'])
self.assertTrue(expected_keys.issubset(test_keys))
@run_until_complete
def test_keys(self):
key1, value1 = b'test:keys_1', b'keys:bar'
key2, value2 = b'test:keys_2', b'keys:zap'
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
resp = yield from self.gibson.keys(b'test:keys')
self.assertEqual(resp, [key1, key2])
@run_until_complete
def test_ping(self):
result = yield from self.gibson.ping()
self.assertTrue(result)
@run_until_complete
def test_meta(self):
key, value = b'test:meta_size', b'bar'
response = yield from self.gibson.set(key, value, expire=10)
self.assertEqual(response, value)
res = yield from self.gibson.meta_size(key)
self.assertEqual(res, 3)
res = yield from self.gibson.meta_encoding(key)
self.assertEqual(res, 0)
res = yield from self.gibson.meta_access(key)
self.assertTrue(1405555555 < res)
res = yield from self.gibson.meta_created(key)
self.assertTrue(1405555555 < res)
res = yield from self.gibson.meta_ttl(key)
self.assertEqual(res, 10)
res = yield from self.gibson.meta_left(key)
self.assertTrue(10 >= res)
res = yield from self.gibson.meta_lock(key)
self.assertEqual(res, 0)
@run_until_complete
def test_end(self):
self.assertTrue(self.gibson.__repr__().startswith("<Gibson"))
yield from self.gibson.end()
self.assertTrue(self.gibson.closed)
@run_until_complete
def test_mset_mget(self):
key1, value1 = b'test:mset:1', 10
key2, value2 = b'test:mset:2', 20
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 130)
res = yield from self.gibson.mset(b'test:mset', 42)
self.assertEqual(res, 2)
res = yield from self.gibson.mget(b'test:mset')
self.assertEqual(res, [key1, b'42', key2, b'42'])
@run_until_complete
def test_mget_limit(self):
key1, value1 = b'test:mget_limit:1', b'10'
key2, value2 = b'test:mget_limit:2', b'20'
key3, value3 = b'test:mget_limit:3', b'30'
yield from self.gibson.set(key1, value1, 100)
yield from self.gibson.set(key2, value2, 100)
yield from self.gibson.set(key3, value3, 100)
res = yield from self.gibson.mget(b'test:mget_limit', 2)
self.assertEqual(len(res), 2*2)
self.assertEquals(res, [key1, value1, key2, value2])
with self.assertRaises(TypeError):
yield from self.gibson.mget(key1, limit='one')
@run_until_complete
def test_mttl(self):
key1, value1 = b'test:mttl:1', b'mttl:bar'
key2, value2 = b'test:mttl:2', b'mttl:zap'
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
resp = yield from self.gibson.mttl(b'test:mttl', 10)
self.assertEqual(resp, 2)
with self.assertRaises(TypeError):
yield from self.gibson.mttl(key1, expire='one')
@run_until_complete
def test_minc(self):
key1, value1 = b'test:minc:1', 10
key2, value2 = b'test:minc:2', 20
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
res = yield from self.gibson.minc(b'test:minc')
self.assertEqual(res, 2)
res = yield from self.gibson.mget(b'test:minc')
self.assertEqual(res, [key1, 11, key2, 21])
@run_until_complete
def test_mdec(self):
key1, value1 = b'test:mdec:1', 10
key2, value2 = b'test:mdec:2', 20
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
res = yield from self.gibson.mdec(b'test:mdec')
self.assertEqual(res, 2)
res = yield from self.gibson.mget(b'test:mdec')
self.assertEqual(res, [key1, 9, key2, 19])
@run_until_complete
def test_mdelete(self):
key1, value1 = b'test:mdelete:1', 10
key2, value2 = b'test:mdelete:2', 20
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
res = yield from self.gibson.mdelete(b'test:mdelete')
self.assertEqual(res, 2)
res = yield from self.gibson.mget(b'test:mdelete')
self.assertEqual(res, None)
@run_until_complete
def test_mlock_munlock(self):
key1, value1 = b'test:mlock:1', 10
key2, value2 = b'test:mlock:2', 20
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
yield from self.gibson.mlock(b'test:mlock', expire=3)
with self.assertRaises(errors.KeyLockedError):
yield from self.gibson.delete(key1)
yield from self.gibson.munlock(b'test:mlock')
res = yield from self.gibson.mdelete(b'test:mlock')
self.assertEqual(res, 2)
with self.assertRaises(TypeError):
yield from self.gibson.mlock(key1, expire='one')
@run_until_complete
def test_count(self):
key1, value1 = b'test:count:1', 10
key2, value2 = b'test:count:2', 20
yield from self.gibson.set(key1, value1, 3)
yield from self.gibson.set(key2, value2, 3)
res = yield from self.gibson.count(b'test:count')
self.assertEqual(res, 2) |
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
namespace Colors.Properties {
[global::System.Runtime.CompilerServices.<API key>()]
[global::System.CodeDom.Compiler.<API key>("Microsoft.VisualStudio.Editors.SettingsDesigner.<API key>", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.<API key> {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.<API key>.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
} |
import React from 'react';
import XYChartReadme from '!!raw-loader!../../../../visx-xychart/README.md';
import * as XYChartPackage from '../../../../visx-xychart/src';
import DocPage from '../../components/DocPage';
import XYChartTile from '../../components/Gallery/XYChartTile';
const components = Object.values(XYChartPackage);
const examples = [XYChartTile];
const XYChartDocs = () => (
<DocPage
components={components}
examples={examples}
readme={XYChartReadme}
visxPackage="xychart"
/>
);
export default XYChartDocs; |
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\<API key>\<API key>(),
new FOS\UserBundle\FOSUserBundle(),
new Acme\UserBundle\AcmeUserBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\<API key>();
$bundles[] = new Sensio\Bundle\GeneratorBundle\<API key>();
}
return $bundles;
}
public function <API key>(LoaderInterface $loader)
{
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
}
} |
/* jshint node: true */
'use strict';
module.exports = {
normalizeEntityName: function(entityName) {
return entityName;
},
afterInstall: function() {
return this.<API key>('auth0-lock', '~6.6.2');
}
}; |
#ifndef <API key>
#define <API key>
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdexcept>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <Eigen/Dense>
#include "v4r/common/impl/SmartPtr.hpp"
#include <v4r/keypoints/<API key>.h>
#include <v4r/common/impl/DataMatrix2D.hpp>
#include <v4r/keypoints/impl/Object.hpp>
namespace v4r
{
/**
* LKPoseTrackerRT
*/
class LKPoseTrackerRT
{
public:
class Parameter
{
public:
bool compute_global_pose;
cv::Size win_size;
int max_level;
cv::TermCriteria termcrit;
float max_error; //100
<API key>::Parameter rt_param; // 0.01 (slam: 0.03)
Parameter(bool <API key>=true, const cv::Size &_win_size=cv::Size(21,21), int _max_level=2,
const cv::TermCriteria &_termcrit=cv::TermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03),
float _max_error=100,
const <API key>::Parameter &_rt_param=<API key>::Parameter(0.01))
: compute_global_pose(<API key>), win_size(_win_size), max_level(_max_level),
termcrit(_termcrit),
max_error(_max_error),
rt_param(_rt_param) {}
};
private:
Parameter param;
cv::Mat_<unsigned char> im_gray, im_last;
std::vector< cv::Point2f > im_points0, im_points1;
std::vector< int > inliers;
Eigen::Matrix4f last_pose;
bool have_im_last;
std::vector<unsigned char> status;
std::vector<float> error;
cv::Mat_<double> dist_coeffs;
cv::Mat_<double> intrinsic;
ObjectView::Ptr model;
<API key>::Ptr rt;
public:
cv::Mat dbg;
LKPoseTrackerRT(const Parameter &p=Parameter());
~LKPoseTrackerRT();
double detectIncremental(const cv::Mat &im, const DataMatrix2D<Eigen::Vector3f> &cloud, Eigen::Matrix4f &pose);
void setLastFrame(const cv::Mat &image, const Eigen::Matrix4f &pose);
void setModel(const ObjectView::Ptr &_model);
void setCameraParameter(const cv::Mat &_intrinsic, const cv::Mat &_dist_coeffs);
void getProjections(std::vector< std::pair<int,cv::Point2f> > &im_pts);
typedef SmartPtr< ::v4r::LKPoseTrackerRT> Ptr;
typedef SmartPtr< ::v4r::LKPoseTrackerRT const> ConstPtr;
};
} //--END--
#endif |
// OOP244 Milestone 2: error class, dynamic memory
// File: Error.cpp
#include <cstring>
#include "Error.h"
using namespace std;
namespace ict
{
Error::Error()
{
//clog << "[INFO] - Error()" << endl;
// Sets the message_ member variable to nullptr
message_ = nullptr;
}
Error::Error(const char * Error)
{
//clog << "[INFO] - Error(const char * Error)" << endl;
// Sets the message_ member variable to nullptr
message_ = nullptr;
// and then uses the message() setter member function to set the error message to the Error argument
message(Error);
}
Error::~Error()
{
//clog << "[INFO] - ~Error()" << endl;
// de-allocates the memory pointed by message_
clear();
}
void Error::clear()
{
//clog << "[INFO] - Error::clear()" << endl;
// de-allocates the memory pointed by message_
delete[] message_;
// and then sets message_ to nullptr
message_ = nullptr;
}
bool Error::isClear() const
{
//clog << "[INFO] - Error::isClear()" << endl;
// returns true if message_ is nullptr
return (nullptr == message_);
}
void Error::message(const char * value)
{
//clog << "[INFO] - Error::message(const char * value)" << endl;
// de-allocating the memory pointed by message_
clear();
// allocating memory to the same length of value + 1 keeping the address in message_ data member
message_ = new char[strlen(value) + 1];
// copying value c-string into message_
strcpy(message_, value);
}
const char * Error::message() const
{
//clog << "[INFO] - Error::message()" << endl;
// returns the address kept in message_
return message_;
}
Error & Error::operator = (const char * errorMessage)
{
//clog << "[INFO] - Error::operator = (const char * errorMessage)" << endl;
// de-allocating the memory pointed by message_
// & allocating memory to the same length of Error + 1 and keeping the address in message_ data member
// & copying Error c-string into message_
message(errorMessage);
return *this;
}
std::ostream & operator<<(std::ostream & ostr, const Error & error)
{
//clog << "[INFO] - operator << (std::ostream & ostr, const Error & error)" << endl;
// If Error isClear,
if (error.isClear())
{
// Nothing should be printed
}
// otherwise,
else
{
// the c-string pointed by message_ is printed
ostr << error.message();
}
return ostr;
}
} |
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace InceptionCache.Core
{
public interface ICacheProvider
{
Task<T> GetAsync<T>(string key) where T : class;
T Get<T>(string key) where T : class;
Task<T[]> GetAsync<T>(string[] keys) where T : class;
T[] Get<T>(string[] keys) where T : class;
Task AddAsync<T>(string key,
T value,
TimeSpan expiry) where T : class;
void Add<T>(string key,
T value,
TimeSpan expiry) where T : class;
Task AddAsync<T>(Dictionary<string, T> values,
TimeSpan expiry) where T : class;
void Add<T>(Dictionary<string, T> values,
TimeSpan expiry) where T : class;
Task DeleteAsync(string key);
Task DeleteAsync(string[] keys);
void Delete(string key);
void Delete(string[] keys);
string Name { get; }
}
} |
=
* [Home](page:0)
* [The Hillhead Trail](tour:hillhead-trail) |
# Week 1
It's about thinking, not learning new math techniques
Learn to stop looking for formulas or procedures to follow
You have to look at what the problem says
It's about understanding, not doing
## Background Reading: What is Mathematics?
1. More than arithmetic.
- Most math used in modern science and engineering is no more than 400 years
old
- The typical high school math curriculum is at least 300 years old, or even
two-thousand years old
- Math began with the invention of numbers around 10,000 years ago (for use
with money)
- Math was very utilitarian up until the Greeks in 500BCE, who made it an area
of study
- Euclid's Elements is the most widely circulated book after the Bible
- Since Algebra, there have only been two further advances, calculus and
probability theory
- Arithmetic and Number Theory study the patterns of numbers and counting
- Geometry studies the patterns of shape
- Calculus allows us to handle the patterns of motion
- Logic studies the patterns of reasoning
- Probability Theory studies the patterns of chance
- Topology studies the patterns of closeness and position
- Fractal Geometry studies the self-similarity found in the natural world
2. Mathematical Notation
- The mathematical reliance on abstract notation is a reflection of the
abstract nature of the patterns they study.
- Different aspects of reality require different forms of description
- The commutative law of addition could be written in English as: When two
numbers are added, their order is not important.
- The same law can be expressed in symbolic form as: m + n = n + m
- Symbolic notation in it's modern form is credited to Francois Viete in the
16th century.
3. Modern College-level Mathematics
- High school level math is primarily about calculation, whereas higher level
math is about understanding through mathematics itself
- Dirichlet created the conception of a function as a rule that produces new
numbers from old, rather than producing a new number y from any given number x
- A function can be any rule that takes objects of one kind and produces new
objects from them
- Mathematics began to study abstract functions, those not specified by a
formula but by their behavior
- The higher level of Math was attempted to be taught in high school in the
1960s, as 'New Math', but failed
4. Why are you having to learn this stuff?
- Education is not solely about the acquisition of specific tools to be used
in a subsequent career. Education is preparation for life, and only part of
that is the mastery of specific work skills.
- The world needs more people who can take a new problem and describe key
features of the problem mathematically, and use that mathematical
description to analyze the problem in precise fashion.
## Lecture 1 - Intro Material
Math is the Science of Patterns
Banach-Tarski Paradox: In theory, a sphere can be cut up in such a way that you
can reassemble it form two identical spheres, each the same size as the original
one.
The secret to this course is reflection and engagement, not completion
Real math takes time
Getting Precise About How We Use Language
- One American dies of melanoma almost every hour
vs
- Almost every hour, an American dies of melanoma
The first sentence, when read literally, makes an absurd claim.
When mathematicians use language, the rely on the literal meaning
The primary means to determine the truth of a claim in mathematics are Proofs
Prime Numbers: N = (p1 x p2 x p3 x ... pn) + 1
Mathematical language requires the elimination of as much linguistic ambiguity
as possible
Four Linguistic Forms of Mathematics
- Object a has property P
- Every object of type T has property P
- There is an object of type T having property P
- If statement A, then statement B
Key terms of Mathematical language
- and
- or
- not
- implies
- for all
- there exists
## Lecture 2 - Logical Combinators
The only way to acquire a new way of thinking, is to try multiple different ways
AND
And is a conjunction of two conjuncts.
If both conjuncts are true, then the conjunction is true.
If any are false, the conjunction is false
In math, conjunction is communicative.
In everyday English, the word AND is not always communicative
OR
OR is ambiguous, it can either be exclusive or inclusive
Inclusive OR is called a disjunction
If one of the disjuncts is true, then the disjunction is true
NOT
Not is the negation of a statement
Negating a word in a sentence is not the same as negating a sentence |
import React from "react";
import PropTypes from "prop-types";
import cx from "classnames";
import { Portal } from "./../Portal";
import { Overlay } from "./../Overlay";
import CSSModules from "react-css-modules";
import styles from "./Modal.css";
export class Modal extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
isHaveScrollbar: false
};
}
/**
* This function cancels the click handler when clicking on the active modal and prevents bubbling up
* so that it avoids evoking the event handler of the outside <div>
* */
cancelClickHandler = event => {
event.stopPropagation();
};
render() {
const {
active,
className,
onOverlayClick,
onEscKeyDown,
title,
overlay,
lockScroll,
style
} = this.props;
return (
active && (
<Portal>
{overlay && (
<Overlay
active={active}
onClick={onOverlayClick}
onEscKeyDown={onEscKeyDown}
lockScroll={lockScroll}
/>
)}
<div
styleName={cx("dialogWrapper")}
onClick={onOverlayClick}
style={style}
>
<div styleName={cx("dialog")}>
<div
style={style}
styleName={cx("modal", { active: active })}
className={cx(className)}
onClick={this.cancelClickHandler}
>
{title && <h3 styleName={cx("title")}>{title}</h3>}
<div>{this.props.children}</div>
</div>
</div>
</div>
</Portal>
)
);
}
}
Modal.propTypes = {
/**
* When true, will display Modal.
*/
active: PropTypes.bool,
/**
* Text, any HTML element, or React Component.
*/
children: PropTypes.node.isRequired,
/** An object, array, or string of CSS classes to apply to Modal.*/
className: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object,
PropTypes.array
]),
/**
* When true, will hide page scroll.
*/
lockScroll: PropTypes.bool,
/**
* Event handler for esc key down, can be used to close modal if needed.
*/
onEscKeyDown: PropTypes.func,
/**
* Event handler for clicking on overlay, can be used to close modal if needed.
*/
onOverlayClick: PropTypes.func,
/**
* When true, will display Modal with overlay.
*/
overlay: PropTypes.bool,
/**
* Pass inline styling here.
*/
style: PropTypes.object,
/**
* Text that will be displayed as title content in the Modal.
*/
title: PropTypes.string
};
Modal.defaultProps = {
active: false,
className: "",
overlay: false,
lockScroll: true
};
export default CSSModules(Modal, styles, { allowMultiple: true }); |
import * as React from 'react';
import {
View,
Image,
Text,
TextInput,
ScrollView,
StyleSheet,
} from 'react-native';
const MESSAGES = [
'okay',
'sudo make me a sandwich',
'what? make it yourself',
'make me a sandwich',
];
export default class Chat extends React.Component {
render() {
return (
<View style={styles.container}>
<ScrollView
style={styles.inverted}
<API key>={styles.content}
>
{MESSAGES.map((text, i) => {
const odd = i % 2;
return (
<View
// <API key> react/no-array-index-key
key={i}
style={[odd ? styles.odd : styles.even, styles.inverted]}
>
<Image
style={styles.avatar}
source={
odd
? require('../../assets/avatar-2.png')
: require('../../assets/avatar-1.png')
}
/>
<View
style={[styles.bubble, odd ? styles.received : styles.sent]}
>
<Text style={odd ? styles.receivedText : styles.sentText}>
{text}
</Text>
</View>
</View>
);
})}
</ScrollView>
<TextInput
style={styles.input}
placeholder="Write a message"
<API key>="transparent"
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#eceff1',
},
inverted: {
transform: [{ scaleY: -1 }],
},
content: {
padding: 16,
},
even: {
flexDirection: 'row',
},
odd: {
flexDirection: 'row-reverse',
},
avatar: {
marginVertical: 8,
marginHorizontal: 6,
height: 40,
width: 40,
borderRadius: 20,
borderColor: 'rgba(0, 0, 0, .16)',
borderWidth: StyleSheet.hairlineWidth,
},
bubble: {
marginVertical: 8,
marginHorizontal: 6,
paddingVertical: 12,
paddingHorizontal: 16,
borderRadius: 20,
},
sent: {
backgroundColor: '#cfd8dc',
},
received: {
backgroundColor: '#2196F3',
},
sentText: {
color: 'black',
},
receivedText: {
color: 'white',
},
input: {
height: 48,
paddingVertical: 12,
paddingHorizontal: 24,
backgroundColor: 'white',
},
}); |
/*jshint node:true, es3:false*/
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var yosay = require('yosay');
var chalk = require('chalk');
var _ = require('lodash');
var nameHelper = require('../../lib/name-helper.js');
var XdCodeGenerator = yeoman.generators.Base.extend({
init: function () {
this.pkg = require('../../package.json');
this.on('end', function () {
if (!this.options['skip-install']) {
this.installDependencies();
}
});
},
askFor: function () {
var done = this.async();
this.log(yosay('Welcome to the marvelous XdCode generator!'));
var prompts = [
{
name: 'projectName',
message: 'Project Name?',
default: path.basename(process.cwd())
},
{
name: 'vendorPrefix',
message: 'What vendor prefix would you like to use for your directives?',
validate: function (input){
if (_.isString(input)) {
if (input.length >= 2 && input !== 'ng' && input.match(/^[a-zA-Z]*$/)) return true;
}
return "Please enter 2 or more lower case letters, but not 'ng'.";
}
},
{
name: 'repoUrl',
message: 'What is your repository url?',
default: ''
},
{
name: 'webserver',
type: 'list',
message: 'Which dev server would you like?',
choices: ['gulp-webserver', 'express']
}
];
this.prompt(prompts, function (props) {
_.assign(this, props);
this.config.set(props);
done();
}.bind(this));
},
copyProjectFiles: function () {
this.copy('editorconfig', '.editorconfig');
this.copy('jshintrc', '.jshintrc');
this.copy('gitignore', '.gitignore');
this.copy('karma.conf.js', 'karma.conf.js');
this.copy('karma-common-conf.js', 'karma-common-conf.js');
},
<API key>: function () {
this.mkdir('app');
this.mkdir('lib');
this.mkdir('lib/tasks');
if (this.webserver === 'express') {
this.mkdir('srv');
this.mkdir('srv/lib');
this.mkdir('srv/lib/config');
}
this.mkdir('test');
this.mkdir('app/components');
this.mkdir('app/filters');
this.mkdir('app/partials');
this.mkdir('app/services');
this.mkdir('app/views');
},
executeTemplates: function () {
this.projectSlug = nameHelper.hyphenate(this.projectName);
this.appName = nameHelper.classify(this.projectName);
this.appTitle = nameHelper.titleize(this.projectName);
this.controllerName = this.appName.concat('Ctrl');
this.controllerInstance = nameHelper.camelize(this.controllerName)
this.template('_bower.json', 'bower.json');
this.template('_package.json', 'package.json');
this.template('_README.md', 'README.md');
this.template('_gulpfile.js', 'gulpfile.js');
this.template('app/_app.js', 'app/app.js');
this.template('app/_app.scss', 'app/app.scss');
this.template('app/partials/_layout.jade', 'app/partials/layout.jade');
this.template('app/partials/_scripts.jade', 'app/partials/scripts.jade');
this.template('app/_index.jade', 'app/index.jade');
this.template('app/views/test1/_test1.js', 'app/views/test1/test1.js');
this.template('app/views/test1/_test1.jade', 'app/views/test1/test1.jade');
this.template('app/views/test2/_test2.js', 'app/views/test2/test2.js');
this.template('app/views/test2/_test2.jade', 'app/views/test2/test2.jade');
this.template('lib/_config.js', 'lib/config.js');
this.template('lib/tasks/_copy.js', 'lib/tasks/copy.js');
this.template('lib/tasks/_create-styles.js', 'lib/tasks/create-styles.js');
this.template('lib/tasks/_create-templates.js', 'lib/tasks/create-templates.js');
this.template('lib/tasks/_lint.js', 'lib/tasks/lint.js');
this.template('lib/tasks/_serve.js', 'lib/tasks/serve.js');
this.template('lib/tasks/_docs.js', 'lib/tasks/docs.js');
this.template('lib/tasks/_unit-test.js', 'lib/tasks/unit-test.js');
if (this.webserver === 'express') {
this.template('srv/_server.js', 'srv/server.js');
this.template('srv/lib/config/_express.js', 'srv/lib/config/express.js');
this.template('srv/lib/config/_routes.js', 'srv/lib/config/routes.js');
this.template('srv/lib/config/_config.js', 'srv/lib/config/config.js');
}
}
});
module.exports = XdCodeGenerator; |
:host {
display: inline-block;
}
:host([disabled]) {
pointer-events: none;
}
:host > .io-editor {
white-space: nowrap;
display: inline-block;
}
:host > .io-editor:focus {
outline: 0;
}
:host > .io-editor.invalid:focus {
color: red;
}
:host > .io-value-label {
vertical-align: top;
} |
# coding: us-ascii
require_relative 'helper'
class FooBar
include Hash::Keyable
attr_accessor :var
end
foo = FooBar.new
bar = FooBar.new
The foo do
EQL bar
foo.var = 'foo'
bar.var = 'bar'
NG EQL?(bar)
bar.var = 'foo'
EQL bar
end
class FooBar
def my_specific1
:specific1
end
protected
def <API key>(*specifics)
super my_specific1, my_specific2, *specifics
end
private
def my_specific2
:specific2
end
end
foo = FooBar.new
bar = FooBar.new
The foo do
EQL bar
foo.var = 'foo'
bar.var = 'bar'
NG EQL?(bar)
bar.var = 'foo'
EQL bar
end |
<HTML><HEAD>
<TITLE>Review for Sunshine (1999)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0145503">Sunshine (1999)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?David+Bezanson">David Bezanson</A></H3><HR WIDTH="40%" SIZE="4">
<P>filmcritic.com presents a review from staff member David Bezanson.
You can find the review with full credits at
<A HREF="http:
<PRE> SUNSHINE
A film review by David Bezanson
Copyright 2000 filmcritic.com
filmcritic.com</PRE>
<P>Now that the 20th century is finally over, I guess it's time to start
re-interpreting it. Hopefully, summarizers of the century will follow
the example of Hungarian director Istvan Svabo and honestly face the
truth, no matter how painful. (Unfortunately, many intellectuals don't
always seem interested in the truth --- especially about subjects like
communism, which many continue to embrace.)</P>
<P>In Sunshine, Svabo looks back through the last 100 years of his
country's history for meaning, and finds some --- enough to fill a
three-hour, soapy epic about the century's chaos. The film mostly
works, and is a worthy addition to Svabo's art.</P>
<P>Sunshine begins at the end of the 19th century, focusing on three young
people who take Hungarian surnames and abandon the traditions espoused
by their father, a Jewish entrepeneur named Emmanuel Sonnenschein
("Sunshine" in English). The ambitious son Ignatz (Fiennes, who also
plays Ignatz' son and grandson) rises to power in the Hungarian
government, then goes down with the monarchy. His silly, free-spirited
cousin Valerie (Jennifer Ehle) deserts him over his conformity and
allegiance to the regime; his brother (James Frain) turns communist.</P>
<P>After WWI, the focus shifts from this triangle to Ignatz's son Adam
(Fiennes again), who becomes an Olympic champion and public hero after
renouncing Judaism, only to find his father's admonishment not to trust
in political power proved true. When the Nazis ("philistines" as one
character describes them) overrun Hungary, Adam fails to save his family
from being killed or scattered. Valerie is almost the only survivor.
She is played in later life by Rosemary Harris (Ehle's real-life
mother), whose luminous performance is easily the film's best.</P>
<P>Adam's son Ivan (Fiennes once again) is scarred by watching his father's
murder at Auschwitz and, after the war, becomes an official in the
equally brutal and philistine Communist Party. The Communists are also
anti-Semites (because they hate the wealthy classes) and Ivan finds
himself again imprisoned and dehumanized. At the end of the film, Ivan
and Valerie remember their family and faith, and Ivan changes his name
back to Sonnenschein, though the name is all he has left. His house has
been confiscated; the furniture, keepsakes, and cultural artifacts that
decorate the movie are thrown onto a garbage truck.</P>
<P>Sunshine clearly cost some bucks to make, and the result is the most
meticulous recreation of a historical period that I've seen on film.
The screenplay is not as flawless: some characters are sketchy and
others are unappealing (especially Adam's girlfriend, played by Rachel
Wiesz) --- though to be fair, only Valerie and Ivan live long enough to
reach maturity. There are some superficial moments; some of the sex
scenes are unpleasant and unrealistic. But ultimately, the film is
redeemed by its religious core and its powerful use of images and
themes, both good (love, freedom, civilization, family) and evil
(politics, power, ambition, envy). The film starts off slow but gets
better and better as it goes, building to a powerful, thoughtful
conclusion.</P>
<P>In the film, Svabo clearly draws distinctions between good beliefs and
bad beliefs. Aware that he has lost his faith and followed the false
gods of political ideals, Ivan asks, "If there never was a God, then why
do we miss Him so much?" Among the film's many characters, it is
perhaps great-grandfather Emmanuel (played by David de Keyser) who comes
off best, because he remains true to sensible beliefs.</P>
<P>On New Year's Day of 1900, Ignatz predicts that the new century will be
a time of "love, justice, and tolerance." Lots of people probably still
think the 20th century was a time of greater love, justice and tolerance
(along with modern improvements, walking on the moon, etc.) so it's
probably a good thing that the movie brutally underscores the irony of
Ignatz's prediction. The 20th century was the most murderous and
"philistine" century in history, in which Europe actually became less
civilized. It was not a century of improvements but of "breaking all
our inheritance" (as one character says) and throwing it onto garbage
trucks.</P>
<P>At the end of the film and the century, Hungary knows freedom for the
first time in almost a century. But in a world that is becoming ever
more "philistine" (judging from say, Eminem's new CD), less religious,
and less diverse, will the next century be much better?</P>
<PRE>RATING: ****</PRE>
<PRE>|
\ ***** Perfection \
\ **** Good, memorable film \
\ *** Average, hits and misses \
\ ** Sub-par on many levels \
\ * Unquestionably awful \
|
<P>Director: Istvan Svabo
Producers: Robt Lantos, Andras Hamori
Screenwriters: Istvan Svabo, Israel Horovitz
Stars: Ralph Fiennes, Rosemary Harris, Jennifer Ehle, Rachel Weisz,
Molly Parker, Miriam Margolyes, Deborah Kara Unger, James Frain, William
Hurt, John Neville</P>
<PRE>MPAA Rating: R</PRE>
<P><A HREF="http:
<P><A HREF="http:
Movie Fiends: Check out Amazon.com's Top 100 Hot DVDs!</P>
<HR><P CLASS=flush><SMALL>The review above was posted to the
<A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR>
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.<BR>
Please direct comments/criticisms of the review to relevant newsgroups.<BR>
Broken URLs inthe reviews are the responsibility of the author.<BR>
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
</SMALL></P>
<P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P>
</P></BODY></HTML> |
package gg.uhc.fancyfreeze.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerUnfreezeEvent extends Event {
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
protected final Player player;
public PlayerUnfreezeEvent(Player player) {
this.player = player;
}
public Player getPlayer() {
return player;
}
} |
"use strict";
var fx = require("framework");
var Class = fx.import("framework.Class");
var App = fx.import("framework.app.App");
var ImageView = fx.import("framework.ui.view.ImageView");
var CompositeView = fx.import("framework.ui.view.CompositeView");
var FrameAnimation = fx.import("framework.ui.animation.FrameAnimation");
Class.define("MyApp", App, {
onStart: function() {
var imageView = new ImageView();
imageView.src = global.app.rootPath + "/coin.png";
imageView.scaleType = "matrix";
imageView.width = 1000;
imageView.height = 100;
var containerView = new CompositeView();
containerView.width = 100;
containerView.height = 100;
containerView.top = 160;
containerView.left = 110;
containerView.addChild(imageView);
var animation = new FrameAnimation(imageView);
animation.frames = {
"0%": {left: 0},
"10%": {left: -100},
"20%": {left: -200},
"30%": {left: -300},
"40%": {left: -400},
"50%": {left: -500},
"60%": {left: -600},
"70%": {left: -700},
"80%": {left: -800},
"90%": {left: -900},
"100%": {left: 0}
};
animation.duration = 1000;
animation.repeat = "infinite";
animation.easing = "cubic-bezier(0.42, 0, 0.58, 1.0)";
animation.start();
this.window.addChild(containerView);
}
}, module); |
export default function BookListController(BookFactory) {
BookFactory.getBooks().then(function(response){
this.books = response.data;
}.bind(this));
// BookFactory.getBooks().then((response) =>{
// this.books = response.data;
} |
// ReSharper disable once CheckNamespace
namespace Data.DbClient
{
internal interface IDbFileHandler
{
<API key> <API key>(string fileName);
}
} |
import React from 'react';
import { Link } from 'react-router';
export class AboutView extends React.Component {
render() {
return (
<div className='container text-center'>
<h1>SUCH WOW SUCH DOGEE</h1>
<hr />
<Link to='/'>Back To Home View</Link>
</div>
);
}
}
export default AboutView; |
package ch.ethz.syslab.telesto.console;
import javax.swing.SwingUtilities;
import ch.ethz.syslab.telesto.console.gui.ConsoleWindow;
public class Main implements Runnable {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Main());
}
@Override
public void run() {
ConsoleWindow window = new ConsoleWindow();
window.setVisible(true);
}
} |
import Location from '../../geo/location';
import Tile from '../../geo/tile';
import City from '../../geo/city';
import Path from '../../geo/path';
import { catane } from './dices';
import { RandomResources } from './resources';
import * as geo from '../../geo/geo';
export class RoundGenerator {
constructor(nbRings) {
if (nbRings < 1) {
throw new Error(`Nb of rings must be higher than 1. ${nbRings} provided`);
}
this._tiles = new Map();
this._cities = new Map();
this._paths = new Map();
this._diceValues = catane();
this._resources = (new RandomResources(3 * nbRings * (nbRings - 1) + 1))[Symbol.iterator]();
this.generate(nbRings);
}
forEachTile(cbk) {
for (let tile of this._tiles.values()) {
cbk(tile);
}
}
forEachCity(cbk) {
for (let city of this._cities.values()) {
cbk(city);
}
}
forEachPath(cbk) {
for (let path of this._paths.values()) {
cbk(path);
}
}
/**
* Generates all the content once for all.
*/
generate(nbRings) {
var previousRing = [ this.createTile(0, 0) ];
for (let ring = 2; ring <= nbRings; ring += 1) {
let newRing = [];
for (let tile of previousRing) {
newRing = newRing.concat(this.<API key>(tile));
}
previousRing = newRing;
}
}
/**
* Creates tiles surrounding a certain tile.
* @param {Tile} center center tile
*/
<API key>(center) {
var newTiles = [];
geo.SURROUNDING_TILES.forEach(function(location) {
var [x, y] = location;
var tile = this.createTile(center.location.x + x, center.location.y + y);
if (tile !== null) {
newTiles.push(tile);
}
}, this);
return newTiles;
}
createTile(x, y) {
var tile = new Tile(x, y);
var tileHash = tile.location.hashCode();
if (!this._tiles.has(tileHash)) {
// Give the tile its resource and dice value
tile.resource = this._resources.next().value;
if (tile.resource !== 'desert') {
tile.diceValue = this._diceValues.next().value;
}
let firstCity = null;
let lastCity = null;
for (let [cityX, cityY] of geo.SURROUNDING_CITIES) {
let city = this.createCity(x + cityX, y + cityY);
tile.addCity(city);
if (firstCity === null) {
firstCity = city;
lastCity = city;
} else {
this.createPath(lastCity, city);
lastCity = city;
}
}
// Build path from the last to the first city
this.createPath(lastCity, firstCity);
this._tiles.set(tileHash, tile);
return tile;
} else {
return null;
}
}
createCity(x, y) {
var cityHash = new Location(x, y).hashCode();
var city;
if (this._cities.has(cityHash)) {
city = this._cities.get(cityHash);
} else {
city = new City(x, y);
this._cities.set(cityHash, city);
}
return city;
}
createPath(from, to) {
var path = new Path(from.location, to.location);
this._paths.set(path.hashCode(), path);
return path;
}
} |
package com.liulu.think;
public class Train extends Thread{
public InputNeuron[] InputNeurons;
public HiddenNeuron[] HiddenNeurons;
public OutputNeuron[] OutputNeurons;
public Train(){}
public void run(){}//run,,
public void optimize(){}
} |
const gulp = require('gulp');
const uglify = require('gulp-uglify');
const pump = require('pump');
const coffee = require('gulp-coffee');
const mocha = require('gulp-mocha');
gulp.task('coffee', () => |
// Use of this source code is governed by a MIT-style
package user
import (
"net/http"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/routers/api/v1/utils"
)
// getWatchedRepos returns the repos that the user with the specified userID is watching
func getWatchedRepos(user *user_model.User, private bool, listOptions db.ListOptions) ([]*api.Repository, int64, error) {
watchedRepos, total, err := models.GetWatchedRepos(user.ID, private, listOptions)
if err != nil {
return nil, 0, err
}
repos := make([]*api.Repository, len(watchedRepos))
for i, watched := range watchedRepos {
access, err := models.AccessLevel(user, watched)
if err != nil {
return nil, 0, err
}
repos[i] = convert.ToRepo(watched, access)
}
return repos, total, nil
}
// GetWatchedRepos returns the repos that the user specified in ctx is watching
func GetWatchedRepos(ctx *context.APIContext) {
// swagger:operation GET /users/{username}/subscriptions user <API key>
// summary: List the repositories watched by a user
// produces:
// - application/json
// parameters:
// - name: username
// type: string
// in: path
// description: username of the user
// required: true
// - name: page
// in: query
// description: page number of results to return (1-based)
// type: integer
// - name: limit
// in: query
// description: page size of results
// type: integer
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
user := GetUserByParams(ctx)
private := user.ID == ctx.User.ID
repos, total, err := getWatchedRepos(user, private, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.<API key>, "getWatchedRepos", err)
}
ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, &repos)
}
// GetMyWatchedRepos returns the repos that the authenticated user is watching
func GetMyWatchedRepos(ctx *context.APIContext) {
// swagger:operation GET /user/subscriptions user <API key>
// summary: List repositories watched by the authenticated user
// produces:
// - application/json
// parameters:
// - name: page
// in: query
// description: page number of results to return (1-based)
// type: integer
// - name: limit
// in: query
// description: page size of results
// type: integer
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
repos, total, err := getWatchedRepos(ctx.User, true, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.<API key>, "getWatchedRepos", err)
}
ctx.SetTotalCountHeader(total)
ctx.JSON(http.StatusOK, &repos)
}
// IsWatching returns whether the authenticated user is watching the repo
// specified in ctx
func IsWatching(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo}/subscription repository <API key>
// summary: Check if the current user is watching a repo
// parameters:
// - name: owner
// in: path
// description: owner of the repo
// type: string
// required: true
// - name: repo
// in: path
// description: name of the repo
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/WatchInfo"
// "404":
// description: User is not watching this repo or repo do not exist
if repo_model.IsWatching(ctx.User.ID, ctx.Repo.Repository.ID) {
ctx.JSON(http.StatusOK, api.WatchInfo{
Subscribed: true,
Ignored: false,
Reason: nil,
CreatedAt: ctx.Repo.Repository.CreatedUnix.AsTime(),
URL: subscriptionURL(ctx.Repo.Repository),
RepositoryURL: ctx.Repo.Repository.APIURL(),
})
} else {
ctx.NotFound()
}
}
// Watch the repo specified in ctx, as the authenticated user
func Watch(ctx *context.APIContext) {
// swagger:operation PUT /repos/{owner}/{repo}/subscription repository <API key>
// summary: Watch a repo
// parameters:
// - name: owner
// in: path
// description: owner of the repo
// type: string
// required: true
// - name: repo
// in: path
// description: name of the repo
// type: string
// required: true
// responses:
// "200":
// "$ref": "#/responses/WatchInfo"
err := repo_model.WatchRepo(ctx.User.ID, ctx.Repo.Repository.ID, true)
if err != nil {
ctx.Error(http.<API key>, "WatchRepo", err)
return
}
ctx.JSON(http.StatusOK, api.WatchInfo{
Subscribed: true,
Ignored: false,
Reason: nil,
CreatedAt: ctx.Repo.Repository.CreatedUnix.AsTime(),
URL: subscriptionURL(ctx.Repo.Repository),
RepositoryURL: ctx.Repo.Repository.APIURL(),
})
}
// Unwatch the repo specified in ctx, as the authenticated user
func Unwatch(ctx *context.APIContext) {
// swagger:operation DELETE /repos/{owner}/{repo}/subscription repository <API key>
// summary: Unwatch a repo
// parameters:
// - name: owner
// in: path
// description: owner of the repo
// type: string
// required: true
// - name: repo
// in: path
// description: name of the repo
// type: string
// required: true
// responses:
// "204":
// "$ref": "#/responses/empty"
err := repo_model.WatchRepo(ctx.User.ID, ctx.Repo.Repository.ID, false)
if err != nil {
ctx.Error(http.<API key>, "UnwatchRepo", err)
return
}
ctx.Status(http.StatusNoContent)
}
// subscriptionURL returns the URL of the subscription API endpoint of a repo
func subscriptionURL(repo *repo_model.Repository) string {
return repo.APIURL() + "/subscription"
} |
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.Types.ObjectId;
var UserSchema = new Schema({
// basic
name: { type: String },
loginname: { type: String },
std_id: { type: ObjectId },
psw: { type: String },
url: { type: String },
profile_image_url: { type: String },
location: { type: String },
signature: { type: String },
is_block: { type: String },
// social intercourse account
weibo: { type: String },
renren: { type: String },
wechat: { type: String },
qq: { type: Number },
email: { type: String },
github: {type: String },
// account info
score: { type: Number, default: 98 },
level: { type: String },
title: { type: String },
created_at: { type: Date, default: Date.now },
updated_at: { type: Date, default: Date.now },
access_token: { type: String }
});
UserSchema.virtual().get(function() {
});
UserSchema.index();
mongoose.model('User', UserSchema); |
module TheCityAdmin
# This adapter is the standard for all loading objects.
class ApiReader
attr_reader :headers
# Constructor
# def initialize
# end
# Loads the list
# @return the data loaded in a JSON object.
def load_feed
# if !@cacher.nil? and !@cacher.is_cache_expired?( @class_key )
# data = @cacher.get_data( @class_key )
# else
@url_data_params ||= {}
response = TheCityAdmin::admin_request(:get, @url_data_path, @url_data_params)
data = JSON.parse(response.body)
@headers = response.headers
@cacher.save_data(@class_key, data) unless @cacher.nil?
#end
return data
end
# Returns either the value of the <API key> header or
# <API key> header, whichever is lower.
def rate_limit
if @headers
[@headers['<API key>'].to_i, @headers['<API key>'].to_i].min
end
end
# Returns either the value of the <API key> header or
# <API key> header, whichever is lower.
def <API key>
if @headers
[@headers['<API key>'].to_i, @headers['<API key>'].to_i].min
end
end
end
end |
<?php namespace Jacopo\Authentication\Tests\Unit;
use App, Config, Event;
use Illuminate\Database\QueryException;
use Illuminate\Support\MessageBag;
use Jacopo\Authentication\Exceptions\UserExistsException;
use Jacopo\Authentication\Models\User;
use Jacopo\Authentication\Services\UserRegisterService;
use Jacopo\Library\Exceptions\<API key>;
use Jacopo\Library\Exceptions\NotFoundException;
use Mockery as m;
/**
* Test <API key>
*
* @author jacopo beschi jacopo@jacopobeschi.com
*/
class <API key> extends DbTestCase
{
public function setUp()
{
parent::setUp();
$this->u_r = App::make('user_repository');
}
public function tearDown()
{
m::close();
}
/**
* @test
**/
public function <API key>()
{
$input = $this-><API key>();
$mock_validator = $this->getValidatorSuccess();
$service = new <API key>($mock_validator);
$user = $service->register($input);
$this->assertTrue($user->exists);
$this->assertNotEmpty($this->getFirstUserProfile());
}
/**
* @test
**/
public function <API key>()
{
$input = $this-><API key>();
$mock_validator = $this->getValidatorSuccess();
$service = new <API key>($mock_validator);
$has_registering = false;
Event::listen('service.registering', function() use(&$has_registering){
$has_registering = true;
});
$has_registered = false;
Event::listen('service.registered', function() use(&$has_registered){
$has_registered = true;
});
$service->register($input);
$this->assertTrue($has_registering, 'service.registering event has not been fired.');
$this->assertTrue($has_registered, 'service.registered event has not been fired.');
}
/**
* @return array
*/
private function <API key>()
{
$input = [
"email" => "test@test.com", "password" => "password@test.com", "activated" => 0,
"first_name" => "first_name"
];
return $input;
}
/**
* @return m\MockInterface
*/
protected function getValidatorSuccess()
{
$mock_validator = m::mock('Jacopo\Authentication\Validators\UserSignupValidator')->shouldReceive('validate')->andReturn(true)->getMock();
return $mock_validator;
}
/**
* @return mixed
*/
protected function getFirstUserProfile()
{
$user = $this->u_r->find(1);
$profile = App::make('profile_repository')->getFromUserId($user->id);
return $profile;
}
/**
* @test
**/
public function <API key>()
{
$service = new UserRegisterService;
$user = new \StdClass;
$user->email = "user@user.com";
StateKeeper::set('expected_to', $user->email);
StateKeeper::set('expected_subject', 'Your user is activated on: '. Config::get('<API key>::app_name'));
StateKeeper::set('expected_body', 'Your email has been confirmed succesfully.');
Event::listen('mailer.sending', 'Jacopo\Authentication\Tests\Unit\AuthControllerTest@<API key>');
$service-><API key>($user);
}
/**
* @return m\MockInterface
*/
protected function getValidatorFails()
{
return m::mock('Jacopo\Authentication\Validators\UserSignupValidator')
->shouldReceive('validate')
->once()
->andReturn(false)
->getMock();
}
/**
* @test
**/
public function <API key>()
{
$mock_validator = $this->getValidatorFails();
$errors = new MessageBag(["model" => "error"]);
$mock_validator->shouldReceive('getErrors')->andReturn($errors);
$service = new UserRegisterService($mock_validator);
$throws_exception = false;
try
{
$service->register([]);
} catch(<API key> $e)
{
$throws_exception = true;
}
$this->assertTrue($throws_exception);
$this->assertEmptyUsers();
$this->assertHasErrors($service);
}
protected function assertEmptyUsers()
{
$this->assertNull(User::first());
}
/**
* @test
* @expectedException \Jacopo\Authentication\Exceptions\UserExistsException
**/
public function <API key>()
{
$mock_validator = $this->getValidatorSuccess();
$mock_repo = m::mock('StdClass')->shouldReceive('create')->andThrow(new UserExistsException)->getMock();
App::instance('user_repository', $mock_repo);
$service = new <API key>($mock_validator);
$service->register([]);
}
/**
* @test
**/
public function <API key>()
{
$this-><API key>();
$user_email = "email@email.com";
StateKeeper::set('expected_to', $user_email);
StateKeeper::set('expected_subject', "Registration request to: " . Config::get('<API key>::app_name'));
StateKeeper::set('expected_body', 'You account has been created. However, before you can use it you need to confirm your email address first by clicking the');
Event::listen('mailer.sending', 'Jacopo\Authentication\Tests\Unit\AuthControllerTest@<API key>');
$mock_validator = $this->getValidatorSuccess();
$<API key> = $this-><API key>();
App::instance('user_repository', $<API key>);
$<API key> = $this-><API key>();
App::instance('profile_repository', $<API key>);
$mock_auth = $this->mockAuthActiveToken();
App::instance('authenticator', $mock_auth);
$service = new UserRegisterService($mock_validator);
$service->register([
"email" => $user_email,
"password" => "password",
"activated" => 1,
"first_name" => "first_name"
]);
}
/**
* @return m\MockInterface
*/
protected function <API key>()
{
$user_stub = new User();
$user_stub->id = 1;
$user_stub->email = "";
$mock_u_r = m::mock('StdClass')->shouldReceive('create')->once()->andReturn($user_stub)->getMock();
return $mock_u_r;
}
/**
* @return m\MockInterface
*/
protected function <API key>()
{
$mock_p_r = m::mock('StdClass')->shouldReceive('create')->once()->andReturn(true)->getMock();
return $mock_p_r;
}
private function <API key>()
{
Config::set('<API key>::email_confirmation', true);
}
/**
* @test
**/
public function <API key>()
{
$this-><API key>();
$user_email = "email@email.com";
StateKeeper::set('expected_to', $user_email);
StateKeeper::set('expected_subject', "Registration request to: " . Config::get('<API key>::app_name'));
StateKeeper::set('expected_body', 'You can now login to the website using the');
Event::listen('mailer.sending', 'Jacopo\Authentication\Tests\Unit\AuthControllerTest@<API key>');
$mock_validator = $this->getValidatorSuccess();
$<API key> = $this-><API key>();
App::instance('user_repository', $<API key>);
$<API key> = $this-><API key>();
App::instance('profile_repository', $<API key>);
$mock_auth = $this->mockAuthActiveToken();
App::instance('authenticator', $mock_auth);
$service = new UserRegisterService($mock_validator);
$service->register([
"email" => $user_email,
"password" => "p",
"activated" => 1,
"first_name" => "first_name"
]);
}
/**
* @return m\MockInterface
*/
protected function mockAuthActiveToken()
{
return m::mock('Jacopo\Authentication\Interfaces\<API key>)
->shouldReceive('getActivationToken')
->andReturn(true)
->shouldReceive('getLoggedUser')
->getMock();
}
private function <API key>()
{
Config::set('<API key>::email_confirmation', false);
}
/**
* @test
**/
public function <API key>()
{
$this-><API key>();
Config::set('<API key>::email_confirmation',false);
$service = m::mock('Jacopo\Authentication\Services\UserRegisterService');
$this->assertTrue($service-><API key>([]));
Config::set('<API key>::email_confirmation',true);
$this->assertFalse($service-><API key>([]));
}
/**
* @test
**/
public function <API key>()
{
$user_stub = new \StdClass;
$user_stub->activation_code = "12345_";
$user_stub->email = "";
$mock_repo = m::mock('StdClass')
->shouldReceive('findByLogin')
->andReturn($user_stub)
->shouldReceive('activate')
->once()
->andReturn(true)
->getMock();
App::instance('user_repository', $mock_repo);
$email = "mail@mail.com";
$token = $user_stub->activation_code;
$this-><API key>();
$service = new <API key>;
$service-><API key>($email, $token);
}
protected function <API key>()
{
Event::listen('service.activated', function ()
{
return false;
});
}
/**
* @test
**/
public function <API key>()
{
$service = new UserRegisterService;
$email = "mail@mail.com";
$token = "12345_";
$gotcha = false;
try
{
$service-><API key>($email, $token);
} catch(\Jacopo\Authentication\Exceptions\<API key> $e)
{
$gotcha = true;
}
$this->assertTrue($gotcha);
$this->assertNotEmpty($service->getErrors());
}
/**
* @test
**/
public function <API key><API key>()
{
$user_stub =
m::mock('Jacopo\Authentication\Modles\User')->makePartial()->shouldReceive('<API key>')->andReturn(false)->getMock();
$user_stub->activation_code = "";
$mock_repo = m::mock('StdClass')->shouldReceive('findByLogin')->andReturn($user_stub)->getMock();
App::instance('user_repository', $mock_repo);
$email = "mail@mail.com";
$token = "12345_";
$service = new UserRegisterService;
$gotcha = false;
try
{
$service-><API key>($email, $token);
} catch(\Jacopo\Authentication\Exceptions\<API key> $e)
{
$gotcha = true;
}
$this->assertTrue($gotcha);
$this->assertNotEmpty($service->getErrors());
}
/**
* @test
**/
public function <API key>()
{
$user_stub = m::mock('Jacopo\Authentication\Modles\User');
$user_stub->activation_code = "12345_";
$mock_repo = m::mock('StdClass')->shouldReceive('findByLogin')->andReturn($user_stub)->shouldReceive('activate')->once()->andReturn(true)
->getMock();
App::instance('user_repository', $mock_repo);
$email = "mail@mail.com";
$token = "12345_";
$service = new UserRegisterService;
$event_fired = false;
Event::listen('service.activated', function () use (&$event_fired)
{
$event_fired = true;
return false;
}, 1000);
$service-><API key>($email, $token);
$this->assertTrue($event_fired);
}
}
class <API key> extends UserRegisterService
{
public function <API key>($input)
{
// do nothing...
}
} |
'use strict';
var Polls = require('../models/polls.js');
function PollHandler () {
this.addPoll = function(req, res) {
var poll = req.body;
poll.userId = req.user.github.id;
poll.username = req.user.github.username;
Polls
.create(poll, function (err) {
if (err) {
throw err;
}
});
}
this.getPolls = function(req, res) {
Polls
.find({ userId : req.user.github.id })
.exec(function(err, result) {
if (err) {
throw err;
}
res.json(result);
});
}
this.getPoll = function(req, res) {
Polls
.findOne({ _id : req.params.pollid })
.exec(function(err, result) {
if (err) {
throw err;
}
res.json(result);
});
}
this.vote = function(req, res) {
Polls
.findOne({ _id : req.params.pollid })
.exec(function(err, result) {
result.options[req.body.optionIndex].votes.push( req.body.userId );
Polls
.update({ _id : req.params.pollid }, result)
.exec(function(err) {
if (err) { console.log("err") };
res.send();
});
})
}
this.deletePoll = function(req, res) {
Polls
.findByIdAndRemove(req.params.pollid)
.exec(function(err, result) {
if (err) {
console.log(err);
}
})
}
}
module.exports = PollHandler; |
#pragma once
#include "cinder/Surface.h"
#include "cinder/gl/Texture.h"
#include "cinder/Timeline.h"
using namespace ci;
struct Sprite
{
enum State
{
NORMAL,
CLICK,
};
enum PosState
{
CORRECT,
HALF,
WRONG
};
void addDegree(float deg);
void setPosFromCursor(const Vec2f& pos);
void setPivotFromCursor(const Vec2f& pos);
void drawBox();
void drawBox(const Color8u& clr, int spacing = 0);
bool isOK();
bool _deg_ok;
State _state;
gl::Texture _tex;
float _scale;
Anim<float> _degree;
Anim<Vec2f> _center;
Vec2f _pivot;
Vec2f _orig_center;
Vec2i _idx;
Vec2i _size;
int _z;
bool isPointInside(const Vec2f& pt);
void draw();
static Sprite* createTile( const Surface8u& img, int x, int y, int tile_w, int tile_h );
static Sprite* createFromImage( const Surface8u& img, int x, int y, int target_w, int target_h);
private:
PosState _pos_state;
}; |
'use strict';
const AWS = require('aws-sdk');
const { promisify } = require('./promises');
const dbSettings = {
region: 'docker-compose',
endpoint: 'http://dynamodb:8000',
accessKeyId: '<API key>',
secretAccessKey: '<API key>',
};
const dynamoDb = new AWS.DynamoDB(dbSettings);
const docClient = new AWS.DynamoDB.DocumentClient({ service: dynamoDb });
const docGet = promisify(docClient.get, docClient);
const docUpdate = promisify(docClient.update, docClient);
const docPut = promisify(docClient.put, docClient);
module.exports.docGet = docGet;
module.exports.docUpdate = docUpdate;
module.exports.docPut = docPut; |
// ViewController.h
// BkAppDelegate
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end |
Copyright (c) 2015 Niilo Ursin
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. |
#!/bin/bash
UNREAL_PROXY_PATH=/DroneLab/demos/bluerov/unreal_proxy
DEMO_PATH=/DroneLab/demos/bluerov
SITL_POSITION_PORT=9989
ENTRY_POINT=unreal_proxy
ENTRY_PATH=$UNREAL_PROXY_PATH/
DRONESIMLAB_PATH=../../
#game defenitions
#GAME_PATH=/DroneLab/baked_games/Ocean1_packed/LinuxNoEditor/
GAME_PATH=/project_files/Ocean1_packed/LinuxNoEditor/
PACKED_NAME=Oceantest1
kill-session -t dronelab
source ../../scripts/common.sh
kill_images python_dev
kill_images sitl_image
if [ `docker ps | grep -v unreal_engine |wc -l` -gt 1 ]; then
echo "ERROR: Make sure no other docker images other then unreal_engine are running (counting on sequencial IP addresses)";
echo "use docker rm and docker ps to remove other docker containers"
exit 0
fi
function init_rov {
tmux send-keys "cd ../../dockers/python3_dev && ./run_image.sh" ENTER
#tmux send-keys "export UNREAL_PROXY_PATH=$UNREAL_PROXY_PATH" ENTER
tmux send-keys "export DEMO_PATH=$DEMO_PATH" ENTER
tmux send-keys "export SITL_POSITION_PORT=$1" ENTER
tmux send-keys "cd /DroneLab/ardupilot/ArduSub && ../Tools/autotest/sim_vehicle.py --out=udp:0.0.0.0:14550 -L OSRF0" ENTER
}
function pub_fdm {
tmux send-keys "cd ../../dockers/python3_dev && ./run_image.sh" ENTER
tmux send-keys "export DEMO_PATH=$DEMO_PATH" ENTER
tmux send-keys "export SITL_POSITION_PORT=$1" ENTER
tmux send-keys "export PATH=/miniconda/bin/:\$PATH" ENTER
tmux send-keys "cd $DEMO_PATH && python fdm_pub_underwater.py --config unreal_proxy/" ENTER
}
function image_bridge {
tmux send-keys "cd ../../dockers/python3_dev && ./run_image.sh" ENTER
tmux send-keys "export DEMO_PATH=$DEMO_PATH" ENTER
tmux send-keys "export SITL_POSITION_PORT=$1" ENTER
tmux send-keys "export PATH=/miniconda/bin/:\$PATH" ENTER
tmux send-keys "cd $DEMO_PATH && python ue4_image_bridge.py" ENTER
}
function run_game {
tmux send-keys "cd $DRONESIMLAB_PATH/dockers/python3_dev && PROJECT_FILES_DIR=$PROJECT_FILES_DIR ./run_image.sh" ENTER
tmux send-keys "export PATH=/miniconda/bin:\$PATH" ENTER
tmux send-keys "cd ${DEMO_PATH}" ENTER
tmux send-keys "python /DroneLab/UE4PyhtonBridge/set_path.py --entry_point $ENTRY_POINT --entry_path $ENTRY_PATH --packed_game_name $PACKED_NAME --packed_game_path $GAME_PATH" ENTER
tmux send-keys "cd ${GAME_PATH}" ENTER
tmux send-keys "INITIAL_DRONE_POS=$INITIAL_DRONE_POS CAMERA_RIG_PITCH=$CAMERA_RIG_PITCH DISPLAY=:0.0 ./run.sh" ENTER
}
#cleanning prev run
tmux new-session -d -s dronelab
#tmux send-keys "python drone_main.py" ENTER
#tmux send-keys "cd ../../dockers/unreal_engine_4 && ./attach.sh" ENTER
run_game
tmux new-window
tmux split-window -h
tmux select-pane -t 0
tmux split-window -v
tmux select-pane -t 2
tmux split-window -v
tmux select-pane -t 0
pub_fdm $SITL_POSITION_PORT
tmux select-pane -t 1
init_rov $SITL_POSITION_PORT
tmux select-pane -t 2
image_bridge
#tmux send-keys "./run.sh" ENTER
#tmux select-window -t 0
#tmux set -g mouse on
tmux att |
module VCloud
module ParsesXml
def self.included(base)
base.send(:include, HappyMapper)
base.extend(ClassMethods)
end
module ClassMethods
def has_links
self.class_eval do
has_many :links, 'VCloud::Link', :xpath => '.'
end
end
def <API key>
self.class_eval do
attribute :id, 'String'
attribute :type, 'String'
attribute :name, 'String'
attribute :href, 'String'
end
end
def from_xml(xml)
parse(xml)
end
end
def parse_xml(xml)
parse(xml)
end
end
end |
<div ng-controller="UserController" ng-init="findAll()">
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<div class="title-container">
<h3 class="modal-title">Confirmación para borrar usuario</h3>
</div>
</div>
<div class="modal-body">
<p>Está seguro que desea borrar el usuario?</p>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="button" ng-click="ok()">Borrar</button>
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancelar</button>
</div>
</script>
<div class="container" ng-show="show">
<h2> Lista de Usuarios</h2>
<input type="text" placeholder="Buscar por nombre" ng-model="filtro.nombre" />
<input type="text" placeholder="Buscar por Apellido" ng-model="filtro.apellido1" />
<input type="text" placeholder="Buscar por email" ng-model="filtro.email" />
<select name="genero" ng-model="filtro.genero">
<option value="" selected disabled>Género</option>
<option value="">Todos</option>
<option>Masculino</option>
<option>Femenino</option>
<option>Otro</option>
</select>
<select name="rol" ng-model="filtro.rol">
<option value="" selected disabled>Rol</option>
<option value="">Todos</option>
<option>Estudiante</option>
<option>Profesor</option>
</select>
<table class="table-responsive table-bordered table-striped table-hover" style="overflow-x:auto;">
<tr>
<th>Id</th>
<th>Rol</th>
<th>Nombre</th>
<th>Apellido1</th>
<th>Apellido2</th>
<th>Carnet</th>
<th>Genero</th>
<th>Email</th>
<th>Editar</th>
<th>Eliminar</th>
</tr>
<tr ng-repeat="user in users | filter:filtro | filter:search:strict ">
<td>{{user.idrecurso}}</td>
<td>{{user.rol}}</td>
<td>{{user.nombre}}</td>
<td>{{user.apellido1}}</td>
<td>{{user.apellido2}}</td>
<td>{{user.carnet}}</td>
<td>{{user.genero}}</td>
<td>{{user.email}}</td>
<td class="opcionList"><a href="users/edit/{{user.id}}"><i class="fa fa-pencil" aria-hidden="true"></i></a></td>
<td class="opcionList"><a href="javascript:void(0)" ng-click="open(user.id)"><i class="fa fa-trash error" aria-hidden="true"></i></a></td>
</tr>
</table>
<p class="success">{{message}}</p>
</div>
<h1 class="error" ng-show="!show">{{error}}</h1>
</div> |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::ServiceFabric::V6_2_0_9
module Models
# Defines an hour and minute of the day specified in 24 hour time.
class TimeOfDay
include MsRestAzure
# @return [Integer] Represents the hour of the day. Value must be between
# 0 and 23 inclusive.
attr_accessor :hour
# @return [Integer] Represents the minute of the hour. Value must be
# between 0 to 59 inclusive.
attr_accessor :minute
# Mapper for TimeOfDay class as Ruby Hash.
# This will be used for serialization/deserialization.
def self.mapper()
{
<API key>: true,
required: false,
serialized_name: 'TimeOfDay',
type: {
name: 'Composite',
class_name: 'TimeOfDay',
model_properties: {
hour: {
<API key>: true,
required: false,
serialized_name: 'Hour',
constraints: {
InclusiveMaximum: 23,
InclusiveMinimum: 0
},
type: {
name: 'Number'
}
},
minute: {
<API key>: true,
required: false,
serialized_name: 'Minute',
constraints: {
InclusiveMaximum: 59,
InclusiveMinimum: 0
},
type: {
name: 'Number'
}
}
}
}
}
end
end
end
end |
// for more details.
// modifications are permitted.
using Neo.IO.Json;
using Neo.VM;
using Neo.VM.Types;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text.Json;
using Array = Neo.VM.Types.Array;
using Boolean = Neo.VM.Types.Boolean;
using Buffer = Neo.VM.Types.Buffer;
namespace Neo.SmartContract
{
<summary>
A JSON serializer for <see cref="StackItem"/>.
</summary>
public static class JsonSerializer
{
<summary>
Serializes a <see cref="StackItem"/> to a <see cref="JObject"/>.
</summary>
<param name="item">The <see cref="StackItem"/> to serialize.</param>
<returns>The serialized object.</returns>
public static JObject Serialize(StackItem item)
{
switch (item)
{
case Array array:
{
return array.Select(p => Serialize(p)).ToArray();
}
case ByteString _:
case Buffer _:
{
return item.GetString();
}
case Integer num:
{
var integer = num.GetInteger();
if (integer > JNumber.MAX_SAFE_INTEGER || integer < JNumber.MIN_SAFE_INTEGER)
throw new <API key>();
return (double)integer;
}
case Boolean boolean:
{
return boolean.GetBoolean();
}
case Map map:
{
var ret = new JObject();
foreach (var entry in map)
{
if (!(entry.Key is ByteString)) throw new FormatException();
var key = entry.Key.GetString();
var value = Serialize(entry.Value);
ret[key] = value;
}
return ret;
}
case Null _:
{
return JObject.Null;
}
default: throw new FormatException();
}
}
<summary>
Serializes a <see cref="StackItem"/> to JSON.
</summary>
<param name="item">The <see cref="StackItem"/> to convert.</param>
<param name="maxSize">The maximum size of the JSON output.</param>
<returns>A byte array containing the JSON output.</returns>
public static byte[] <API key>(StackItem item, uint maxSize)
{
using MemoryStream ms = new();
using Utf8JsonWriter writer = new(ms, new JsonWriterOptions
{
Indented = false,
SkipValidation = false
});
Stack stack = new();
stack.Push(item);
while (stack.Count > 0)
{
switch (stack.Pop())
{
case Array array:
writer.WriteStartArray();
stack.Push(JsonTokenType.EndArray);
for (int i = array.Count - 1; i >= 0; i
stack.Push(array[i]);
break;
case JsonTokenType.EndArray:
writer.WriteEndArray();
break;
case StackItem buffer when buffer is ByteString || buffer is Buffer:
writer.WriteStringValue(buffer.GetString());
break;
case Integer num:
{
var integer = num.GetInteger();
if (integer > JNumber.MAX_SAFE_INTEGER || integer < JNumber.MIN_SAFE_INTEGER)
throw new <API key>();
writer.WriteNumberValue((double)integer);
break;
}
case Boolean boolean:
writer.WriteBooleanValue(boolean.GetBoolean());
break;
case Map map:
writer.WriteStartObject();
stack.Push(JsonTokenType.EndObject);
foreach (var pair in map.Reverse())
{
if (!(pair.Key is ByteString)) throw new FormatException();
stack.Push(pair.Value);
stack.Push(pair.Key);
stack.Push(JsonTokenType.PropertyName);
}
break;
case JsonTokenType.EndObject:
writer.WriteEndObject();
break;
case JsonTokenType.PropertyName:
writer.WritePropertyName(((StackItem)stack.Pop()).GetString());
break;
case Null _:
writer.WriteNullValue();
break;
default:
throw new <API key>();
}
if (ms.Position + writer.BytesPending > maxSize) throw new <API key>();
}
writer.Flush();
if (ms.Position > maxSize) throw new <API key>();
return ms.ToArray();
}
<summary>
Deserializes a <see cref="StackItem"/> from <see cref="JObject"/>.
</summary>
<param name="json">The <see cref="JObject"/> to deserialize.</param>
<param name="limits">The limits for the deserialization.</param>
<param name="referenceCounter">The <see cref="ReferenceCounter"/> used by the <see cref="StackItem"/>.</param>
<returns>The deserialized <see cref="StackItem"/>.</returns>
public static StackItem Deserialize(JObject json, <API key> limits, ReferenceCounter referenceCounter = null)
{
uint maxStackSize = limits.MaxStackSize;
return Deserialize(json, ref maxStackSize, referenceCounter);
}
private static StackItem Deserialize(JObject json, ref uint maxStackSize, ReferenceCounter referenceCounter)
{
if (maxStackSize-- == 0) throw new FormatException();
switch (json)
{
case null:
{
return StackItem.Null;
}
case JArray array:
{
List<StackItem> list = new(array.Count);
foreach (JObject obj in array)
list.Add(Deserialize(obj, ref maxStackSize, referenceCounter));
return new Array(referenceCounter, list);
}
case JString str:
{
return str.Value;
}
case JNumber num:
{
if ((num.Value % 1) != 0) throw new FormatException("Decimal value is not allowed");
return (BigInteger)num.Value;
}
case JBoolean boolean:
{
return new Boolean(boolean.Value);
}
case JObject obj:
{
var item = new Map(referenceCounter);
foreach (var entry in obj.Properties)
{
if (maxStackSize-- == 0) throw new FormatException();
var key = entry.Key;
var value = Deserialize(entry.Value, ref maxStackSize, referenceCounter);
item[key] = value;
}
return item;
}
default: throw new FormatException();
}
}
}
} |
import expect from 'expect'
import React from 'react'
import { createMemoryHistory } from 'history'
import { createRoutes } from '../RouteUtils'
import matchRoutes from '../matchRoutes'
import Route from '../Route'
import IndexRoute from '../IndexRoute'
import shouldWarn from './shouldWarn'
describe('matchRoutes', function () {
let routes
let
RootRoute, UsersRoute, UsersIndexRoute, UserRoute, PostRoute, FilesRoute,
AboutRoute, TeamRoute, ProfileRoute, GreedyRoute, OptionalRoute,
OptionalRouteChild, CatchAllRoute
let createLocation = createMemoryHistory().createLocation
beforeEach(function () {
/*
<Route>
<Route path="users">
<IndexRoute />
<Route path=":userID">
<Route path="/profile" />
</Route>
<Route path="/team" />
</Route>
</Route>
<Route path="/about" />
<Route path="/(optional)">
<Route path="child" />
</Route>
<Route path="*" />
*/
routes = [
RootRoute = {
childRoutes: [
UsersRoute = {
path: 'users',
indexRoute: (UsersIndexRoute = {}),
childRoutes: [
UserRoute = {
path: ':userID',
childRoutes: [
ProfileRoute = {
path: '/profile'
},
PostRoute = {
path: ':postID'
}
]
},
TeamRoute = {
path: '/team'
}
]
}
]
},
FilesRoute = {
path: '/files/*/*.jpg'
},
AboutRoute = {
path: '/about'
},
GreedyRoute = {
path: 'f'
},
OptionalRoute = {
path: '/(optional)',
childRoutes: [
OptionalRouteChild = {
path: 'child'
}
]
},
CatchAllRoute = {
path: '*'
}
]
})
function describeRoutes() {
describe('when the location matches an index route', function () {
it('matches the correct routes', function (done) {
matchRoutes(routes, createLocation('/users'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, UsersIndexRoute ])
done()
})
})
})
describe('when the location matches a nested route with params', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/users/5'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute ])
expect(match.params).toEqual({ userID: '5' })
done()
})
})
})
describe('when the location matches a deeply nested route with params', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/users/5/abc'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, PostRoute ])
expect(match.params).toEqual({ userID: '5', postID: 'abc' })
done()
})
})
})
describe('when the location matches a nested route with multiple splat params', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/files/a/b/c.jpg'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ FilesRoute ])
expect(match.params).toEqual({ splat: [ 'a', 'b/c' ] })
done()
})
})
})
describe('when the location matches a nested route with a greedy splat param', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/foo/bar/f'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ GreedyRoute ])
expect(match.params).toEqual({ splat: 'foo/bar' })
done()
})
})
})
describe('when the location matches a route with hash', function () {
it('matches the correct routes', function (done) {
matchRoutes(routes, createLocation('/users#about'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, UsersIndexRoute ])
done()
})
})
})
describe('when the location matches a deeply nested route with params and hash', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/users/5/abc#about'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, PostRoute ])
expect(match.params).toEqual({ userID: '5', postID: 'abc' })
done()
})
})
})
describe('when the location matches an absolute route', function () {
it('matches the correct routes', function (done) {
matchRoutes(routes, createLocation('/about'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ AboutRoute ])
done()
})
})
})
describe('when the location matches an optional route', function () {
it('matches when the optional pattern is missing', function (done) {
matchRoutes(routes, createLocation('/'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ OptionalRoute ])
done()
})
})
it('matches when the optional pattern is present', function (done) {
matchRoutes(routes, createLocation('/optional'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ OptionalRoute ])
done()
})
})
})
describe('when the location matches the child of an optional route', function () {
it('matches when the optional pattern is missing', function (done) {
matchRoutes(routes, createLocation('/child'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ OptionalRoute, OptionalRouteChild ])
done()
})
})
it('matches when the optional pattern is present', function (done) {
matchRoutes(routes, createLocation('/optional/child'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ OptionalRoute, OptionalRouteChild ])
done()
})
})
})
describe('when the location does not match any routes', function () {
it('matches the "catch-all" route', function (done) {
matchRoutes(routes, createLocation('/not-found'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ CatchAllRoute ])
done()
})
})
it('matches the "catch-all" route on a deep miss', function (done) {
matchRoutes(routes, createLocation('/not-found/foo'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ CatchAllRoute ])
done()
})
})
it('matches the "catch-all" route on missing path separators', function (done) {
matchRoutes(routes, createLocation('/optionalchild'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ CatchAllRoute ])
done()
})
})
})
}
describe('a synchronous route config', function () {
describeRoutes()
describe('when the location matches a nested absolute route', function () {
it('matches the correct routes', function (done) {
matchRoutes(routes, createLocation('/team'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, TeamRoute ])
done()
})
})
})
describe('when the location matches an absolute route nested under a route with params', function () {
it('matches the correct routes and params', function (done) {
matchRoutes(routes, createLocation('/profile'), function (error, match) {
expect(match).toExist()
expect(match.routes).toEqual([ RootRoute, UsersRoute, UserRoute, ProfileRoute ])
expect(match.params).toEqual({}) // no userID param
done()
})
})
})
})
describe('an asynchronous route config', function () {
function <API key>(routes) {
routes.forEach(function (route) {
const { childRoutes, indexRoute } = route
if (childRoutes) {
delete route.childRoutes
route.getChildRoutes = function (location, callback) {
setTimeout(function () {
callback(null, childRoutes)
})
}
<API key>(childRoutes)
}
if (indexRoute) {
delete route.indexRoute
route.getIndexRoute = function (location, callback) {
setTimeout(function () {
callback(null, indexRoute)
})
}
}
})
}
beforeEach(function () {
<API key>(routes)
})
describeRoutes()
})
describe('an asynchronous JSX route config', function () {
let getChildRoutes, getIndexRoute, jsxRoutes
beforeEach(function () {
getChildRoutes = function (location, callback) {
setTimeout(function () {
callback(null, <Route path=":userID" />)
})
}
getIndexRoute = function (location, callback) {
setTimeout(function () {
callback(null, <Route name="jsx" />)
})
}
jsxRoutes = createRoutes([
<Route name="users"
path="users"
getChildRoutes={getChildRoutes}
getIndexRoute={getIndexRoute} />
])
})
it('when getChildRoutes callback returns reactElements', function (done) {
matchRoutes(jsxRoutes, createLocation('/users/5'), function (error, match) {
expect(match).toExist()
expect(match.routes.map(r => r.path)).toEqual([ 'users', ':userID' ])
expect(match.params).toEqual({ userID: '5' })
done()
})
})
it('when getIndexRoute callback returns reactElements', function (done) {
matchRoutes(jsxRoutes, createLocation('/users'), function (error, match) {
expect(match).toExist()
expect(match.routes.map(r => r.name)).toEqual([ 'users', 'jsx' ])
done()
})
})
})
it('complains about invalid index route with path', function (done) {
shouldWarn('path')
const invalidRoutes = createRoutes(
<Route path="/">
<IndexRoute path="foo" />
</Route>
)
matchRoutes(invalidRoutes, createLocation('/'), function (error, match) {
expect(match).toExist()
done()
})
})
it('supports splat under pathless route at root', function (done) {
const routes = createRoutes(
<Route>
<Route path="*" />
</Route>
)
matchRoutes(routes, createLocation('/'), function (error, match) {
expect(match).toExist()
done()
})
})
}) |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Messages
{
<summary>
Interaction logic for Archivos.xaml
</summary>
public class shared
{
public Model.Contact user { get; set; }
public List<Model.archivo> sharedFiles { get; set; }
public Rest.Connection rest;
public shared(Model.Contact c) {
rest = new Rest.Connection();
user = c;
sharedFiles = new List<Model.archivo>();
actualizar();
}
public async void actualizar()
{
string result = await rest.Get_Rest("shared_files/" + user.userId.ToString() + "/" + rest.User);
var json = new <API key>();
sharedFiles = (List<Model.archivo>)json.Deserialize<List<Model.archivo>>(result);
}
}
public partial class Archivos : Window
{
public Model.Contact user { get; set; }
public shared viewModel { get; set; }
public Archivos(Model.Contact i)
{
user = i;
Title = "Archivos compartidos con " + user.userName;
viewModel = new shared(i);
InitializeComponent();
listFiles.ItemsSource = viewModel.sharedFiles;
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
viewModel.actualizar();
listFiles.ItemsSource = viewModel.sharedFiles;
}
private void Back(object sender, RoutedEventArgs e)
{
Chat c = new Chat(user);
c.Show();
this.Close();
}
private void <API key>(object sender, <API key> e)
{
int index = listFiles.SelectedIndex;
viewModel.rest.Download_File(viewModel.sharedFiles[index].id.ToString(), viewModel.sharedFiles[index].name);
}
}
} |
(function() {
if (window.isAlreadyPrepared) return;
window.isAlreadyPrepared = true;
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
if (!!request.format) {
copy(request.format);
}
});
function copy(format) {
return execCopy(<API key>(format));
}
function execCopy(text) {
var textArea = document.createElement('textarea');
textArea.style.cssText = 'position:absolute;left:-100%;';
document.body.appendChild(textArea);
textArea.value = text;
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
}
function <API key>(format) {
var h1 = 'h1.gh-header-title';
var title = document.querySelectorAll(`${h1} .js-issue-title`)[0].innerText.trim();
var num = document.querySelectorAll(`${h1} .f1-light`)[0].innerText;
var url = window.location.href;
var type = isPullRequestUrl(url) ? ' (Pull request)' : '';
switch (format) {
case 'markdown':
return `[${num}${title}${type}](${url})`;
break;
case 'html':
return `<a href="${url}">${num}${title}${type}</a>`;
break;
case 'plain':
return `${num}${title}${type}\n${url}`;
break;
}
return '';
}
function isPullRequestUrl(url) {
return /^https:\/\/github.com\/(.+)\/(.+)\/pull\/(\d+)/.test(url)
}
})(); |
using Floreview.Models;
using Microsoft.AspNet.Identity;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Floreview.DataAccess.Interfaces
{
public interface IIdentityManager
{
bool AddUserToRole(string userId, string roleName);
void ClearUserRoles(string userId);
IdentityResult Create(ApplicationUser user, string password);
Task<ClaimsIdentity> CreateIdentityAsync(ApplicationUser user, string auth);
bool CreateRole(string name, string description = "");
ApplicationUser FindAsync(string userName, string password);
bool RoleExists(string name);
ApplicationUser GetUser(string userName);
}
} |
<?php
declare(strict_types=1);
namespace MsgPhp\Domain\Event;
/**
* @author Roland Franssen <franssen.roland@gmail.com>
*/
interface DomainEvent
{
} |
#pragma once
#include "Vector2.h"
//reloaded
class Matrix2 {
public:
Matrix2();
Matrix2(float a_m1, float a_m2, float a_m3, float a_m4);
Matrix2(Matrix2 & other);
Matrix2(float * a_array);
//Matrix2(float *a_array);
//todo:concatenation, subscript operator, cast operator, setrotate
Matrix2 operator* (const Matrix2& other) const;
Vector2 operator* (Vector2& other);
Matrix2& operator= (Matrix2& other);
Matrix2& operator*=(const Matrix2 &a_rhs);
Matrix2& operator*=(Matrix2 &a_rhs);
Vector2& operator[] (unsigned int index);
explicit operator float*() { return &m1; };
void setRotate(float a_rot);
void set(float a_m1, float a_m2, float a_m3, float a_m4);
//float m1, m2, m3, m4;
union{
struct { float m1, m2, m3, m4; };
struct { float m[4]; };
struct { float mm[2][2]; };
struct { Vector2 mv[2]; };
};
}; |
<?php
class PostMessage
{
const CONVO_LOCATION = '../conversation/conversation.txt';
public function WriteToConversation($message, $who)
{
$file = __DIR__.'/'.self::CONVO_LOCATION;
$messages = unserialize(file_get_contents($file));
$messages[] = array(
'from' => $who,
'message' => $message,
'time' => date('h:i:s a')
);
$status = file_put_contents($file, serialize($messages));
header('Content-Type: application/json');
echo json_encode(array(
'status' => $status
));
}
}
$m = new PostMessage();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$m->WriteToConversation($request->msg, $request->from); |
package redis.clients.jedis;
import redis.clients.jedis.commands.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
public abstract class <API key> extends PipelineBase implements
<API key>, <API key>, ClusterPipeline,
<API key>, <API key>, BasicRedisPipeline {
protected Client client = null;
@Override
public Response<List<String>> brpop(String... args) {
client.brpop(args);
return getResponse(BuilderFactory.STRING_LIST);
}
public Response<List<String>> brpop(int timeout, String... keys) {
client.brpop(timeout, keys);
return getResponse(BuilderFactory.STRING_LIST);
}
@Override
public Response<List<String>> blpop(String... args) {
client.blpop(args);
return getResponse(BuilderFactory.STRING_LIST);
}
public Response<List<String>> blpop(int timeout, String... keys) {
client.blpop(timeout, keys);
return getResponse(BuilderFactory.STRING_LIST);
}
public Response<Map<String, String>> blpopMap(int timeout, String... keys) {
client.blpop(timeout, keys);
return getResponse(BuilderFactory.STRING_MAP);
}
@Override
public Response<List<byte[]>> brpop(byte[]... args) {
client.brpop(args);
return getResponse(BuilderFactory.BYTE_ARRAY_LIST);
}
public Response<List<String>> brpop(int timeout, byte[]... keys) {
client.brpop(timeout, keys);
return getResponse(BuilderFactory.STRING_LIST);
}
public Response<Map<String, String>> brpopMap(int timeout, String... keys) {
client.blpop(timeout, keys);
return getResponse(BuilderFactory.STRING_MAP);
}
@Override
public Response<List<byte[]>> blpop(byte[]... args) {
client.blpop(args);
return getResponse(BuilderFactory.BYTE_ARRAY_LIST);
}
public Response<List<String>> blpop(int timeout, byte[]... keys) {
client.blpop(timeout, keys);
return getResponse(BuilderFactory.STRING_LIST);
}
@Override
public Response<Long> del(String... keys) {
client.del(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> del(byte[]... keys) {
client.del(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> unlink(String... keys) {
client.unlink(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> unlink(byte[]... keys) {
client.unlink(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> exists(String... keys) {
client.exists(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> exists(byte[]... keys) {
client.exists(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Set<String>> keys(String pattern) {
getClient(pattern).keys(pattern);
return getResponse(BuilderFactory.STRING_SET);
}
@Override
public Response<Set<byte[]>> keys(byte[] pattern) {
getClient(pattern).keys(pattern);
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
}
@Override
public Response<List<String>> mget(String... keys) {
client.mget(keys);
return getResponse(BuilderFactory.STRING_LIST);
}
@Override
public Response<List<byte[]>> mget(byte[]... keys) {
client.mget(keys);
return getResponse(BuilderFactory.BYTE_ARRAY_LIST);
}
@Override
public Response<String> mset(String... keysvalues) {
client.mset(keysvalues);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> mset(byte[]... keysvalues) {
client.mset(keysvalues);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> msetnx(String... keysvalues) {
client.msetnx(keysvalues);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> msetnx(byte[]... keysvalues) {
client.msetnx(keysvalues);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> rename(String oldkey, String newkey) {
client.rename(oldkey, newkey);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> rename(byte[] oldkey, byte[] newkey) {
client.rename(oldkey, newkey);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> renamenx(String oldkey, String newkey) {
client.renamenx(oldkey, newkey);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> renamenx(byte[] oldkey, byte[] newkey) {
client.renamenx(oldkey, newkey);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> rpoplpush(String srckey, String dstkey) {
client.rpoplpush(srckey, dstkey);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<byte[]> rpoplpush(byte[] srckey, byte[] dstkey) {
client.rpoplpush(srckey, dstkey);
return getResponse(BuilderFactory.BYTE_ARRAY);
}
@Override
public Response<Set<String>> sdiff(String... keys) {
client.sdiff(keys);
return getResponse(BuilderFactory.STRING_SET);
}
@Override
public Response<Set<byte[]>> sdiff(byte[]... keys) {
client.sdiff(keys);
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
}
@Override
public Response<Long> sdiffstore(String dstkey, String... keys) {
client.sdiffstore(dstkey, keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sdiffstore(byte[] dstkey, byte[]... keys) {
client.sdiffstore(dstkey, keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Set<String>> sinter(String... keys) {
client.sinter(keys);
return getResponse(BuilderFactory.STRING_SET);
}
@Override
public Response<Set<byte[]>> sinter(byte[]... keys) {
client.sinter(keys);
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
}
@Override
public Response<Long> sinterstore(String dstkey, String... keys) {
client.sinterstore(dstkey, keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sinterstore(byte[] dstkey, byte[]... keys) {
client.sinterstore(dstkey, keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> smove(String srckey, String dstkey, String member) {
client.smove(srckey, dstkey, member);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> smove(byte[] srckey, byte[] dstkey, byte[] member) {
client.smove(srckey, dstkey, member);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sort(String key, SortingParams sortingParameters, String dstkey) {
client.sort(key, sortingParameters, dstkey);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sort(byte[] key, SortingParams sortingParameters, byte[] dstkey) {
client.sort(key, sortingParameters, dstkey);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sort(String key, String dstkey) {
client.sort(key, dstkey);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sort(byte[] key, byte[] dstkey) {
client.sort(key, dstkey);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Set<String>> sunion(String... keys) {
client.sunion(keys);
return getResponse(BuilderFactory.STRING_SET);
}
@Override
public Response<Set<byte[]>> sunion(byte[]... keys) {
client.sunion(keys);
return getResponse(BuilderFactory.BYTE_ARRAY_ZSET);
}
@Override
public Response<Long> sunionstore(String dstkey, String... keys) {
client.sunionstore(dstkey, keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> sunionstore(byte[] dstkey, byte[]... keys) {
client.sunionstore(dstkey, keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> watch(String... keys) {
client.watch(keys);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> watch(byte[]... keys) {
client.watch(keys);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> zinterstore(String dstkey, String... sets) {
client.zinterstore(dstkey, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zinterstore(byte[] dstkey, byte[]... sets) {
client.zinterstore(dstkey, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zinterstore(String dstkey, ZParams params, String... sets) {
client.zinterstore(dstkey, params, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zinterstore(byte[] dstkey, ZParams params, byte[]... sets) {
client.zinterstore(dstkey, params, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zunionstore(String dstkey, String... sets) {
client.zunionstore(dstkey, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zunionstore(byte[] dstkey, byte[]... sets) {
client.zunionstore(dstkey, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zunionstore(String dstkey, ZParams params, String... sets) {
client.zunionstore(dstkey, params, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> zunionstore(byte[] dstkey, ZParams params, byte[]... sets) {
client.zunionstore(dstkey, params, sets);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> bgrewriteaof() {
client.bgrewriteaof();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> bgsave() {
client.bgsave();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<List<String>> configGet(String pattern) {
client.configGet(pattern);
return getResponse(BuilderFactory.STRING_LIST);
}
@Override
public Response<String> configSet(String parameter, String value) {
client.configSet(parameter, value);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> brpoplpush(String source, String destination, int timeout) {
client.brpoplpush(source, destination, timeout);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<byte[]> brpoplpush(byte[] source, byte[] destination, int timeout) {
client.brpoplpush(source, destination, timeout);
return getResponse(BuilderFactory.BYTE_ARRAY);
}
@Override
public Response<String> configResetStat() {
client.configResetStat();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> save() {
client.save();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> lastsave() {
client.lastsave();
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> publish(String channel, String message) {
client.publish(channel, message);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> publish(byte[] channel, byte[] message) {
client.publish(channel, message);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> randomKey() {
client.randomKey();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<byte[]> randomKeyBinary() {
client.randomKey();
return getResponse(BuilderFactory.BYTE_ARRAY);
}
@Override
public Response<String> flushDB() {
client.flushDB();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> flushAll() {
client.flushAll();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> info() {
client.info();
return getResponse(BuilderFactory.STRING);
}
public Response<String> info(final String section) {
client.info(section);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> dbSize() {
client.dbSize();
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> shutdown() {
client.shutdown();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> ping() {
client.ping();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> select(int index) {
client.select(index);
Response<String> response = getResponse(BuilderFactory.STRING);
client.setDb(index);
return response;
}
@Override
public Response<String> swapDB(int index1, int index2) {
client.swapDB(index1, index2);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Long> bitop(BitOP op, byte[] destKey, byte[]... srcKeys) {
client.bitop(op, destKey, srcKeys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> bitop(BitOP op, String destKey, String... srcKeys) {
client.bitop(op, destKey, srcKeys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> clusterNodes() {
client.clusterNodes();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> clusterMeet(final String ip, final int port) {
client.clusterMeet(ip, port);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> clusterAddSlots(final int... slots) {
client.clusterAddSlots(slots);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> clusterDelSlots(final int... slots) {
client.clusterDelSlots(slots);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> clusterInfo() {
client.clusterInfo();
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<List<String>> <API key>(final int slot, final int count) {
client.<API key>(slot, count);
return getResponse(BuilderFactory.STRING_LIST);
}
@Override
public Response<String> clusterSetSlotNode(final int slot, final String nodeId) {
client.clusterSetSlotNode(slot, nodeId);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> <API key>(final int slot, final String nodeId) {
client.<API key>(slot, nodeId);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> <API key>(final int slot, final String nodeId) {
client.<API key>(slot, nodeId);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<Object> eval(String script) {
return this.eval(script, 0, new String[0]);
}
@Override
public Response<Object> eval(String script, List<String> keys, List<String> args) {
String[] argv = Jedis.getParams(keys, args);
return this.eval(script, keys.size(), argv);
}
@Override
public Response<Object> eval(String script, int keyCount, String... params) {
getClient(script).eval(script, keyCount, params);
return getResponse(BuilderFactory.EVAL_RESULT);
}
@Override
public Response<Object> evalsha(String sha1) {
return this.evalsha(sha1, 0, new String[0]);
}
@Override
public Response<Object> evalsha(String sha1, List<String> keys, List<String> args) {
String[] argv = Jedis.getParams(keys, args);
return this.evalsha(sha1, keys.size(), argv);
}
@Override
public Response<Object> evalsha(String sha1, int keyCount, String... params) {
getClient(sha1).evalsha(sha1, keyCount, params);
return getResponse(BuilderFactory.EVAL_RESULT);
}
@Override
public Response<Object> eval(byte[] script) {
return this.eval(script, 0);
}
@Override
public Response<Object> eval(byte[] script, byte[] keyCount, byte[]... params) {
getClient(script).eval(script, keyCount, params);
return getResponse(BuilderFactory.EVAL_BINARY_RESULT);
}
@Override
public Response<Object> eval(byte[] script, List<byte[]> keys, List<byte[]> args) {
byte[][] argv = BinaryJedis.getParamsWithBinary(keys, args);
return this.eval(script, keys.size(), argv);
}
@Override
public Response<Object> eval(byte[] script, int keyCount, byte[]... params) {
getClient(script).eval(script, keyCount, params);
return getResponse(BuilderFactory.EVAL_BINARY_RESULT);
}
@Override
public Response<Object> evalsha(byte[] sha1) {
return this.evalsha(sha1, 0);
}
@Override
public Response<Object> evalsha(byte[] sha1, List<byte[]> keys, List<byte[]> args) {
byte[][] argv = BinaryJedis.getParamsWithBinary(keys, args);
return this.evalsha(sha1, keys.size(), argv);
}
@Override
public Response<Object> evalsha(byte[] sha1, int keyCount, byte[]... params) {
getClient(sha1).evalsha(sha1, keyCount, params);
return getResponse(BuilderFactory.EVAL_BINARY_RESULT);
}
@Override
public Response<Long> pfcount(String... keys) {
client.pfcount(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> pfcount(final byte[]... keys) {
client.pfcount(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> pfmerge(byte[] destkey, byte[]... sourcekeys) {
client.pfmerge(destkey, sourcekeys);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<String> pfmerge(String destkey, String... sourcekeys) {
client.pfmerge(destkey, sourcekeys);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<List<String>> time() {
client.time();
return getResponse(BuilderFactory.STRING_LIST);
}
@Override
public Response<Long> touch(String... keys) {
client.touch(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<Long> touch(byte[]... keys) {
client.touch(keys);
return getResponse(BuilderFactory.LONG);
}
@Override
public Response<String> moduleUnload(String name) {
client.moduleUnload(name);
return getResponse(BuilderFactory.STRING);
}
@Override
public Response<List<Module>> moduleList() {
client.moduleList();
return getResponse(BuilderFactory.MODULE_LIST);
}
@Override
public Response<String> moduleLoad(String path) {
client.moduleLoad(path);
return getResponse(BuilderFactory.STRING);
}
} |
title: Swift-Alamofire
date: 2021-10-25
tags:
- 19
- iOS
author: HeKai
iOS
## 1URL
[http:

calendar.jsdatedayYYYY/MM

Alamofirerequestjson
func getCalendar(_ completion: @escaping (Error?, JSON?) -> ()) {
let url = "http://jycy.fzu.edu.cn/CmsInterface/<API key>"
let nowTime = NSDate()
let format = DateFormatter()
format.dateFormat = "YYYY/MM"
let dateday = format.string(from: nowTime as Date) as String
let parameters = ["dateday":dateday]
AF.request(url,method: .get,parameters: parameters)
.responseJSON { responds in
switch responds.result {
case .success(let value):
print("success")
let json = JSON(value)
print(json)
completion(nil, json)
case .failure(let error):
print("error")
completion(error, nil)
}
}
} |
<!DOCTYPE html>
<html>
<head>
<title>Lesson10-1</title>
</head>
<body>
<img src="images/Lesson10-1.jpg" />
</body>
</html> |
'use strict';
class MainCtrl {
constructor ($scope) {
$scope.hello = "world";
}
}
MainCtrl.$inject = ['$scope'];
export default MainCtrl; |
package Graficos;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;
import javax.swing.*;
public class Botao extends javax.swing.JButton { //Herda todas caracteristicas de JButton
private static final long serialVersionUID = 1L;
// Declara COmponentes
private JLabel label ;
private ArrayList<ImageIcon> imagem;
private ArrayList<ImageIcon> aux;
private ArrayList<ImageIcon> imagemVertical1;
private ArrayList<ImageIcon> imagemVertical2;
private ArrayList<ImageIcon> imagemVertical3;
private ArrayList<ImageIcon> imagemVertical4;
private ArrayList<ImageIcon> imagemVertical5;
private ArrayList<ImageIcon> imagemHorizontal1;
private ArrayList<ImageIcon> imagemHorizontal2;
private ArrayList<ImageIcon> imagemHorizontal3;
private ArrayList<ImageIcon> imagemHorizontal4;
private ArrayList<ImageIcon> imagemHorizontal5;
// Declara Variaveis auxiliares
private int i=0;
// Construtor de Botao com nome
public Botao(String text){
this();
label.setText(text);
}
// Construtor de Botao sem nome
public Botao(){
label = new JLabel();
this.add(label);
imagem = new ArrayList<ImageIcon>();
imagem.add(new ImageIcon("img/tabuleiro/mar1.jpg"));
imagem.add(new ImageIcon("img/tabuleiro/mar2.jpg"));
imagem.add(new ImageIcon("img/tabuleiro/mar3.jpg"));
aux = imagem;
criaImagens();
}
// Set nome (String) no botao
public void setText(String nome){
label.setText(nome);
}
// REESCREVE METODO DA CLASSE JBUTTON
// Aplica a imagem (image[0]) como fundo do botao (Obs: A imagem determina o tamanho do botao)
public void paintComponent(Graphics g) {
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
final Image backgroundImage = imagem.get(i).getImage();
// Pega tamanho da imagem (Obs: A imagem determina o tamanho do botao)
double scaleX = getWidth() / (double) backgroundImage.getWidth(null);
double scaleY = getHeight() / (double) backgroundImage.getHeight(null);
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
// Desenha Imagem
((Graphics2D) g).drawImage(backgroundImage, xform, this);
}
public void criaImagens(){
// Criando ArrayList de Imagens
this.imagemVertical1 = new ArrayList<ImageIcon>();
this.imagemVertical2 = new ArrayList<ImageIcon>();
this.imagemVertical3 = new ArrayList<ImageIcon>();
this.imagemVertical4 = new ArrayList<ImageIcon>();
this.imagemVertical5 = new ArrayList<ImageIcon>();
this.imagemHorizontal1 = new ArrayList<ImageIcon>();
this.imagemHorizontal2 = new ArrayList<ImageIcon>();
this.imagemHorizontal3 = new ArrayList<ImageIcon>();
this.imagemHorizontal4 = new ArrayList<ImageIcon>();
this.imagemHorizontal5 = new ArrayList<ImageIcon>();
// Adiciona Imagem do Barco 1 ao Array
this.imagemVertical1.add(new ImageIcon("img/navios/vertical/1a.jpg"));
this.imagemVertical1.add(new ImageIcon("img/navios/vertical/1b.jpg"));
// Adiciona Imagem do Barco 2 ao Array
this.imagemVertical2.add(new ImageIcon("img/navios/vertical/2a.jpg"));
this.imagemVertical2.add(new ImageIcon("img/navios/vertical/2b.jpg"));
// Adiciona Imagem do Barco 3 ao Array
this.imagemVertical3.add(new ImageIcon("img/navios/vertical/3a.jpg"));
this.imagemVertical3.add(new ImageIcon("img/navios/vertical/3b.jpg"));
this.imagemVertical3.add(new ImageIcon("img/navios/vertical/3c.jpg"));
// Adiciona Imagem do Barco 4 ao Array
this.imagemVertical4.add(new ImageIcon("img/navios/vertical/4a.jpg"));
this.imagemVertical4.add(new ImageIcon("img/navios/vertical/4b.jpg"));
this.imagemVertical4.add(new ImageIcon("img/navios/vertical/4c.jpg"));
this.imagemVertical4.add(new ImageIcon("img/navios/vertical/4d.jpg"));
// Adiciona Imagem do Barco 5 ao Array
this.imagemVertical5.add(new ImageIcon("img/navios/vertical/5a.jpg"));
this.imagemVertical5.add(new ImageIcon("img/navios/vertical/5b.jpg"));
this.imagemVertical5.add(new ImageIcon("img/navios/vertical/5c.jpg"));
this.imagemVertical5.add(new ImageIcon("img/navios/vertical/5d.jpg"));
// Adiciona Imagem do Barco 1 ao Array
this.imagemHorizontal1.add(new ImageIcon("img/navios/horizontal/1b.jpg"));
this.imagemHorizontal1.add(new ImageIcon("img/navios/horizontal/1a.jpg"));
// Adiciona Imagem do Barco 2 ao Array
this.imagemHorizontal2.add(new ImageIcon("img/navios/horizontal/2b.jpg"));
this.imagemHorizontal2.add(new ImageIcon("img/navios/horizontal/2a.jpg"));
// Adiciona Imagem do Barco 3 ao Array
this.imagemHorizontal3.add(new ImageIcon("img/navios/horizontal/3c.jpg"));
this.imagemHorizontal3.add(new ImageIcon("img/navios/horizontal/3b.jpg"));
this.imagemHorizontal3.add(new ImageIcon("img/navios/horizontal/3a.jpg"));
// Adiciona Imagem do Barco 4 ao Array
this.imagemHorizontal4.add(new ImageIcon("img/navios/horizontal/4d.jpg"));
this.imagemHorizontal4.add(new ImageIcon("img/navios/horizontal/4c.jpg"));
this.imagemHorizontal4.add(new ImageIcon("img/navios/horizontal/4b.jpg"));
this.imagemHorizontal4.add(new ImageIcon("img/navios/horizontal/4a.jpg"));
// Adiciona Imagem do Barco 5 ao Array
this.imagemHorizontal5.add(new ImageIcon("img/navios/horizontal/5d.jpg"));
this.imagemHorizontal5.add(new ImageIcon("img/navios/horizontal/5c.jpg"));
this.imagemHorizontal5.add(new ImageIcon("img/navios/horizontal/5b.jpg"));
this.imagemHorizontal5.add(new ImageIcon("img/navios/horizontal/5a.jpg"));
}
// Muda a imagem (image[int i]) do fundo do botao
public void setFundo(int tipo){
this.i = tipo;
}
// Reset no fundo (Volta ao padrao do tabuleiro)
public void setFundo(){
this.imagem = aux;
this.i =0;
}
// Muda imagem do fundo, conforme posicao do navio
public void setFundo(boolean posicao, int tipo){
// Conforme Tipo e Posicao a variavel da imagem (fundo do botao) muda
if (tipo == 0){
if (!posicao)
this.imagem = this.imagemVertical1;
else
this.imagem = this.imagemHorizontal1;
}
if (tipo == 1){
if (!posicao)
this.imagem = this.imagemVertical2;
else
this.imagem = this.imagemHorizontal2;
}
if (tipo == 2){
if (!posicao)
this.imagem = this.imagemVertical3;
else
this.imagem = this.imagemHorizontal3;
}
if (tipo == 3){
if (!posicao)
this.imagem = this.imagemVertical4;
else
this.imagem = this.imagemHorizontal4;
}
if (tipo == 4){
if (!posicao)
this.imagem = this.imagemVertical5;
else
this.imagem = this.imagemHorizontal5;
}
}
} |
<?php
namespace Jmbermudo\LsiUserBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class <API key> extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
} |
#ifndef TOOLLISTENER_H_
#define TOOLLISTENER_H_
#include "Paintable.h"
class ToolListener {
public:
virtual void <API key>(Paintable* p) = 0;
virtual void <API key>(Paintable* p) = 0;
};
#endif /*TOOLLISTENER_H_*/ |
MIT License
Copyright (c) 2017 Jordan Adams
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. |
module Corral
class Feature
attr_reader :condition, :disabled
def initialize(feature, condition, disabled)
@feature = feature
@condition = condition
@disabled = disabled
end
class << self
def features
@features ||= {}
end
def push(name, condition, disabled = true)
features[name] = new(name, condition, disabled)
end
def enable(name, condition)
push(name, condition, false)
end
def disable(name, condition)
push(name, condition, true)
end
def get(name)
features[name]
end
def all
features
end
end
end
end |
<?php
namespace App\VitrineBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* LoisirRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class LoisirRepository extends EntityRepository
{
} |
console.log('two2'); |
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Enum TypeKind
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Enum TypeKind
">
<meta name="generator" content="docfx 2.30.0.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Swigged.LLVM.TypeKind">
<h1 id="<API key>" data-uid="Swigged.LLVM.TypeKind" class="text-break">Enum TypeKind
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>
<h6><strong>Namespace</strong>: <a class="xref" href="Swigged.LLVM.html">Swigged.LLVM</a></h6>
<h6><strong>Assembly</strong>: swigged.llvm.dll</h6>
<h5 id="<API key>">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public enum TypeKind : int</code></pre>
</div>
<h3 id="fields">Fields
</h3>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<thead>
<tbody>
<tr>
<td id="<API key>">ArrayTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">DoubleTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">FloatTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">FP128TypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">FunctionTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">HalfTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">IntegerTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">LabelTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">MetadataTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">PointerTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">PPC_FP128TypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">StructTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">TokenTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">VectorTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">VoidTypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">X86_FP80TypeKind</td>
<td></td>
</tr>
<tr>
<td id="<API key>">X86_MMXTypeKind</td>
<td></td>
</tr>
</tbody>
</thead></thead></table>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Copyright © 2015-2017 Microsoft<br>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html> |
require 'rails_helper'
RSpec.describe Maker::Concept, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end |
namespace Shopify.Tests {
using Shopify.Unity.SDK;
using System.Collections.Generic;
public class MockLoaderErrors : IMockLoader {
public bool <API key>(string query) {
return Is404Query(query) || IsGraphQLErrorQuery(query);
}
public void HandleResponse(string query, <API key> callback) {
if (Is404Query(query)) {
callback(null, "404 from mock loader");
} else if (IsGraphQLErrorQuery(query)) {
callback(@"{""errors"": [{""message"": ""GraphQL error from mock loader""}]}", null);
}
}
public List<string> GetQueries() {
return new List<string>();
}
private bool Is404Query(string query) {
return query.Contains(@"after:""404""");
}
private bool IsGraphQLErrorQuery(string query) {
return query.Contains(@"after:""666""");
}
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.